Skip to content

Instantly share code, notes, and snippets.

@agrif
Created March 5, 2022 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agrif/e237565bd1c84afcb6c2c9d7b5c9c75c to your computer and use it in GitHub Desktop.
Save agrif/e237565bd1c84afcb6c2c9d7b5c9c75c to your computer and use it in GitHub Desktop.
// find the segmented address of STAGE3_ENTRY
// be careful: rust *really* wants to optimize STAGE3_ENTRY into a u16
// in the resulting binary
let mut buf_address: u32;
unsafe {
core::arch::asm!(
"mov {1}, {0}",
in(reg) STAGE3_ENTRY,
out(reg) buf_address,
);
}
buf_address -= (BOOT_SEGMENT as u32) << 4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment