|
|
1.1 ! root 1: /* ! 2: * UAE - The Un*x Amiga Emulator ! 3: * ! 4: * Memory access functions ! 5: * ! 6: * Copyright 1996 Bernd Schmidt ! 7: */ ! 8: ! 9: ! 10: static __inline__ ULONG do_get_mem_long(ULONG *a) ! 11: { ! 12: ULONG retval; ! 13: ! 14: __asm__ ("bswapl %0" : "=r" (retval) : "0" (*a) : "cc"); ! 15: return retval; ! 16: } ! 17: ! 18: static __inline__ ULONG do_get_mem_word(UWORD *a) ! 19: { ! 20: ULONG retval; ! 21: ! 22: __asm__ ("movzwl %1,%k0\n\trolw $8,%w0" : "=r" (retval) : "m" (*a) : "cc"); ! 23: return retval; ! 24: } ! 25: ! 26: static __inline__ UBYTE do_get_mem_byte(UBYTE *a) ! 27: { ! 28: return *a; ! 29: } ! 30: ! 31: static __inline__ void do_put_mem_long(ULONG *a, ULONG v) ! 32: { ! 33: __asm__ ("bswapl %0" : "=r" (v) : "0" (v) : "cc"); ! 34: *a = v; ! 35: } ! 36: ! 37: static __inline__ void do_put_mem_word(UWORD *a, UWORD v) ! 38: { ! 39: __asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); ! 40: *a = v; ! 41: } ! 42: ! 43: static __inline__ void do_put_mem_byte(UBYTE *a, UBYTE v) ! 44: { ! 45: *a = v; ! 46: } ! 47: ! 48: #if 0 ! 49: static __inline__ ULONG call_mem_get_func(mem_get_func func, CPTR addr) ! 50: { ! 51: ULONG result; ! 52: __asm__("call *%1" ! 53: : "=a" (result) : "r" (func) : "cc", "edx", "ecx"); ! 54: return result; ! 55: } ! 56: ! 57: static __inline__ void call_mem_put_func(mem_put_func func, CPTR addr, ULONG v) ! 58: { ! 59: __asm__("call *%1" ! 60: : : "a" (addr), "d" (v), "r" (func) : "cc", "eax", "edx", "ecx", "memory"); ! 61: } ! 62: #else ! 63: ! 64: #define call_mem_get_func(func,addr) ((*func)(addr)) ! 65: #define call_mem_put_func(func,addr,v) ((*func)(addr,v)) ! 66: ! 67: #endif ! 68: ! 69: #undef USE_MAPPED_MEMORY ! 70: #undef CAN_MAP_MEMORY ! 71: #undef NO_INLINE_MEMORY_ACCESS
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.