Created
April 27, 2018 03:04
-
-
Save rust-play/54a5b6c95c1352139b9896b7aade1f2e to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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
#![feature(asm)] | |
fn main() { | |
unsafe { sched_part_2_thunk(0) }; | |
} | |
unsafe fn sched_part_2_thunk(rsp: usize) -> ! { | |
asm!{ | |
" | |
movq $0, %rsp | |
movq $0, %rbp | |
jmp $1 | |
" | |
: /* no outputs */ | |
: "r"(rsp), "i"(main) | |
: "rbp", "rsp", "memory" | |
: "volatile" | |
}; | |
unreachable!(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment