This file contains hidden or 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
use std::arch::asm; | |
fn sys_print(msg: &str) { | |
// mac only | |
unsafe { | |
asm!( | |
"mov rdx,{0}", // length of msg | |
"mov rsi,{1}", // msg | |
"mov rdi,1", // 1 = stdout | |
"mov rax,0x2000004", // 4 = sys_write ? you have to add 0x20000000 to the syscall number on mac ... why?? |