diff options
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"); +} |