diff options
author | Marvin Borner | 2021-07-10 15:51:54 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-10 15:51:54 +0200 |
commit | ad56eb28f0614db4b7656ade390f1c79b446cbc9 (patch) | |
tree | 7d42ab3c9f36c188dbf54a25b1db1c3db5acb1bd /src/loader/cpu.c | |
parent | 176b6eb808f4d02d871c30f6ec19daa179f374d1 (diff) |
A20, E820h, Real Mode Emulation
Diffstat (limited to 'src/loader/cpu.c')
-rw-r--r-- | src/loader/cpu.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/loader/cpu.c b/src/loader/cpu.c index a0694ed..d5b56df 100644 --- a/src/loader/cpu.c +++ b/src/loader/cpu.c @@ -41,3 +41,20 @@ void outl(u16 port, u32 data) { __asm__ volatile("outl %0, %1" ::"a"(data), "Nd"(port)); } + +/** + * Move memory + */ + +#define WORD_PTR(PTR) (*((u16 *)(PTR))) +u16 mminw(u32 addr) +{ + u16 ret; + __asm__ volatile("movw %1, %0" : "=r"(ret) : "m"(WORD_PTR(addr)) : "memory"); + return ret; +} + +void mmoutw(u32 addr, u16 value) +{ + __asm__ volatile("movw %1, %0" : "=m"(WORD_PTR(addr)) : "ir"(value) : "memory"); +} |