x86_64 call & ret
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user