x86_64 call & ret

This commit is contained in:
2026-06-06 23:26:17 -04:00
parent 69cd249671
commit 66710370bf
5 changed files with 26 additions and 1 deletions
+13
View File
@@ -8,6 +8,18 @@ pub fn run() {
let mut program = Program::<X86_64>::default();
let text = b"Hello world!\n";
let text_sym = program.ro_data(text);
let text2 = "世界、こんにちは!\n";
let text_sym2 = program.ro_data(text2);
let hello2 = program.func([BInstr::Asm(Asm {
instrs: vec![
mov(ax, 1),
mov(di, 1),
lea(rsi, text_sym2),
mov(dx, text2.len() as u64),
Instr::Syscall,
Instr::Ret,
],
})]);
let entry = program.func([BInstr::Asm(Asm {
instrs: vec![
mov(ax, 1),
@@ -15,6 +27,7 @@ pub fn run() {
lea(rsi, text_sym),
mov(dx, text.len() as u64),
Instr::Syscall,
Instr::Call(hello2),
mov(ax, 0x3c),
mov(di, 39),
Instr::Syscall,