WINDOWS HELLO WORLD (scuffed)

This commit is contained in:
2026-06-09 01:02:40 -04:00
parent e4acaf40aa
commit ea305909a0
6 changed files with 58 additions and 8 deletions
+13
View File
@@ -110,6 +110,18 @@ impl Encoder<'_> {
Ok(())
}
pub fn mem_mov(&mut self, reg: RegMode, offset: u64, val: u64) {
assert!(offset <= u8::MAX as u64);
assert!(val <= u32::MAX as u64);
self.data
.extend([0x48 | ((reg.gt8() as u8) << 2), 0xc7, 0x40 | reg.base()]);
if reg.reg == rsp.reg {
self.data.push(0x24)
}
self.data.push(offset as u8);
self.data.extend((val as u32).to_le_bytes());
}
pub fn lea(&mut self, dst: RegMode, sym: Symbol) {
self.data.extend([
0x48 | ((dst.gt8() as u8) << 2),
@@ -184,6 +196,7 @@ impl Encoder<'_> {
pub fn asm(&mut self, instr: Instr) -> Result<(), CompilerMsg> {
match instr {
Instr::Mov { dst, src } => self.mov(dst, src)?,
Instr::MemMov { reg, offset, val } => self.mem_mov(reg, offset, val),
Instr::Int(code) => self.int(code),
Instr::Syscall => self.syscall(),
Instr::Lea { dst, sym } => self.lea(dst, sym),