generated from jasondyoungberg/limine-rust-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spin Mutex rewrite to reduce unsafe block count
- Loading branch information
1 parent
769af06
commit 12264e1
Showing
7 changed files
with
178 additions
and
92 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
use crate::println; | ||
use limine::response::HhdmResponse; | ||
use spin::Mutex; | ||
|
||
pub static mut offset: u64 = 0; | ||
pub static offset: Mutex<u64> = Mutex::new(0); | ||
|
||
pub fn init(res: &HhdmResponse) { | ||
unsafe { | ||
offset = res.offset(); | ||
// println!("{offset}"); | ||
} | ||
*offset.lock() = res.offset(); | ||
} | ||
|
||
pub fn phys_to_virt(addr: u64) -> u64 { | ||
unsafe { addr + offset } | ||
addr + *offset.lock() | ||
} |
Oops, something went wrong.