use crate::tests::helpers;
use crate::*;
#[test]
pub fn linux_call64() {
helpers::setup();
let mut emu = emu64();
let opcodes: Vec<u8> = vec![
0x55, 0x48, 0x89, 0xe5, 0x89, 0x7d, 0xfc, 0x89, 0x75, 0xf8, 0x89, 0x55, 0xf4, 0x89, 0x4d,
0xf0, 0x44, 0x89, 0x45, 0xec, 0x44, 0x89, 0x4d, 0xe8, 0x8b, 0x55, 0xfc, 0x8b, 0x45, 0xf8,
0x01, 0xc2, 0x8b, 0x45, 0xf4, 0x01, 0xc2, 0x8b, 0x45, 0xf0, 0x01, 0xc2, 0x8b, 0x45, 0xec,
0x01, 0xc2, 0x8b, 0x45, 0xe8, 0x01, 0xc2, 0x8b, 0x45, 0x10, 0x01, 0xd0, 0x5d, 0xc3,
];
emu.set_verbose(0);
emu.os = crate::arch::OperatingSystem::Linux;
emu.load_code_bytes(&opcodes);
emu.regs_mut().rax = 0;
let rax = emu
.linux_call64(emu.regs().rip, &[1, 2, 3, 4, 5, 6, 7])
.unwrap();
assert_eq!(rax, emu.regs().rax);
assert_eq!(emu.regs().rax, 1 + 2 + 3 + 4 + 5 + 6 + 7);
}