-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Move x86_64 specific code to arch mod
This commit introduces `arch` mod for architecture specific code, and moves x86_64 related code under arch/x86_64. This change is to support multiple architecture. Signed-off-by: Akira Moroo <[email protected]>
- Loading branch information
Showing
8 changed files
with
32 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2022 Akira Moroo | ||
|
||
#[cfg(target_arch = "x86_64")] | ||
pub mod x86_64; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2022 Akira Moroo | ||
|
||
#[cfg(not(test))] | ||
pub mod asm; | ||
pub mod gdt; | ||
pub mod paging; | ||
pub mod sse; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use x86_64::registers::control::{Cr0, Cr0Flags, Cr4, Cr4Flags}; | ||
|
||
// Enable SSE2 for XMM registers (needed for EFI calling) | ||
pub fn enable_sse() { | ||
let mut cr0 = Cr0::read(); | ||
cr0.remove(Cr0Flags::EMULATE_COPROCESSOR); | ||
cr0.insert(Cr0Flags::MONITOR_COPROCESSOR); | ||
unsafe { Cr0::write(cr0) }; | ||
let mut cr4 = Cr4::read(); | ||
cr4.insert(Cr4Flags::OSFXSR); | ||
cr4.insert(Cr4Flags::OSXMMEXCPT_ENABLE); | ||
unsafe { Cr4::write(cr4) }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters