Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
kernel
Commits
45e1eb7b
Verified
Commit
45e1eb7b
authored
1 year ago
by
Jacob Lorentzon
Browse files
Options
Downloads
Patches
Plain Diff
Set IA32_TSC_AUX if present.
parent
303c9649
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!245
Set IA32_TSC_AUX and add a logical CPU ID newtype
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/arch/x86_64/misc.rs
+12
-2
12 additions, 2 deletions
src/arch/x86_64/misc.rs
src/arch/x86_64/start.rs
+2
-2
2 additions, 2 deletions
src/arch/x86_64/start.rs
with
14 additions
and
4 deletions
src/arch/x86_64/misc.rs
+
12
−
2
View file @
45e1eb7b
use
x86
::
controlregs
::
Cr4
;
use
x86
::
cpuid
::
ExtendedFeatures
;
pub
unsafe
fn
init
()
{
let
has_ext_feat
=
|
feat
:
fn
(
ExtendedFeatures
)
->
bool
|
crate
::
cpuid
::
cpuid_always
()
.get_extended_feature_info
()
.map_or
(
false
,
feat
);
use
crate
::
cpuid
::
cpuid_always
;
pub
unsafe
fn
init
(
cpu_id
:
usize
)
{
let
has_ext_feat
=
|
feat
:
fn
(
ExtendedFeatures
)
->
bool
|
{
cpuid_always
()
.get_extended_feature_info
()
.map_or
(
false
,
feat
)
};
if
has_ext_feat
(|
feat
|
feat
.has_umip
())
{
// UMIP (UserMode Instruction Prevention) forbids userspace from calling SGDT, SIDT, SLDT,
...
...
@@ -25,4 +31,8 @@ pub unsafe fn init() {
// Clear CLAC in (the probably unlikely) case the bootloader set it earlier.
x86
::
bits64
::
rflags
::
clac
();
}
if
let
Some
(
feats
)
=
cpuid_always
()
.get_extended_processor_and_feature_identifiers
()
&&
feats
.has_rdtscp
()
{
x86
::
msr
::
wrmsr
(
x86
::
msr
::
IA32_TSC_AUX
,
cpu_id
as
u64
);
}
}
This diff is collapsed.
Click to expand it.
src/arch/x86_64/start.rs
+
2
−
2
View file @
45e1eb7b
...
...
@@ -155,7 +155,7 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
log
::
init
();
// Initialize miscellaneous processor features
misc
::
init
();
misc
::
init
(
0
);
// Initialize devices
device
::
init
();
...
...
@@ -234,7 +234,7 @@ pub unsafe extern fn kstart_ap(args_ptr: *const KernelArgsAp) -> ! {
interrupt
::
syscall
::
init
();
// Initialize miscellaneous processor features
misc
::
init
();
misc
::
init
(
cpu_id
);
// Initialize devices (for AP)
device
::
init_ap
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment