forked from project-oak/oak
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stage0: add a wrapper for unaligned 64bit address (project-oak#4580)
Entry addresses of XSDT are placed from offset 0x24, and an entry address has 8 bytes. If the XSDT table header is 4-byte aligned, there is only 50% chance that the entry addresses are 8-byte aligned. In debug mode, it is observed that Xsdt::entries() function causes the following panic: ``` stage0 ERROR: panicked at /path/to/.rustup/toolchains/ nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/ library/core/src/panicking.rs:155:5 : unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX` ``` This patch adds a pointer wrapper to handle the alignment issue. This wrapper itself is 8 bytes but only 1-byte aligned. Trait Deref is implemented for this wrapper. Signed-off-by: Changyuan Lyu <[email protected]>
- Loading branch information
Showing
2 changed files
with
39 additions
and
10 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 |
---|---|---|
@@ -1 +1 @@ | ||
25 | ||
26 |
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