Annotation of hatari/src/uae-cpu/maccess.h_i86, revision 1.1

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: static __inline__ uae_u32 do_get_mem_long (uae_u32 *a)
        !            10: {
        !            11:     uae_u32 retval;
        !            12: 
        !            13:     __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc");
        !            14:     return retval;
        !            15: }
        !            16: 
        !            17: static __inline__ uae_u32 do_get_mem_word (uae_u16 *a)
        !            18: {
        !            19:     uae_u32 retval;
        !            20: 
        !            21: #ifdef X86_PPRO_OPT
        !            22:     __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswap %k0\n" : "=&r" (retval) : "m" (*a) : "cc");
        !            23: #else
        !            24:     __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc");
        !            25: #endif
        !            26:     return retval;
        !            27: }
        !            28: 
        !            29: #define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)a))
        !            30: 
        !            31: static __inline__ void do_put_mem_long (uae_u32 *a, uae_u32 v)
        !            32: {
        !            33:     __asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc");
        !            34:     *a = v;
        !            35: }
        !            36: 
        !            37: static __inline__ void do_put_mem_word (uae_u16 *a, uae_u32 v)
        !            38: {
        !            39: #ifdef X86_PPRO_OPT
        !            40:     __asm__ ("bswap %0" : "=&r" (v) : "0" (v << 16) : "cc");
        !            41: #else
        !            42:     __asm__ ("rolw $8,%w0" : "=r" (v) : "0" (v) : "cc");
        !            43: #endif
        !            44:     *a = v;
        !            45: }
        !            46: 
        !            47: #define do_put_mem_byte(a,v) (*(uae_u8 *)(a) = (v))
        !            48: 
        !            49: #if 0
        !            50: static __inline__ uae_u32 call_mem_get_func(mem_get_func func, uae_cptr addr)
        !            51: {
        !            52:     uae_u32 result;
        !            53:     __asm__("call %1"
        !            54:            : "=a" (result) : "r" (func), "a" (addr) : "cc", "edx", "ecx");
        !            55:     return result;
        !            56: }
        !            57: 
        !            58: static __inline__ void call_mem_put_func(mem_put_func func, uae_cptr addr, uae_u32 v)
        !            59: {
        !            60:     __asm__("call %2"
        !            61:            : : "a" (addr), "d" (v), "r" (func) : "cc", "eax", "edx", "ecx", "memory");
        !            62: }
        !            63: #else
        !            64: 
        !            65: #define call_mem_get_func(func,addr) ((*func)(addr))
        !            66: #define call_mem_put_func(func,addr,v) ((*func)(addr,v))
        !            67: 
        !            68: #endif
        !            69: 
        !            70: #undef NO_INLINE_MEMORY_ACCESS
        !            71: #undef MD_HAVE_MEM_1_FUNCS
        !            72: 
        !            73: #ifdef MD_HAVE_MEM_1_FUNCS
        !            74: static __inline__ uae_u32 longget_1 (uae_cptr addr)
        !            75: {
        !            76:     uae_u32 result;
        !            77: 
        !            78:     __asm__ ("andl $0x00FFFFFF,%1\n"
        !            79:             "\tcmpb $0,(%1,%3)\n"
        !            80:             "\tleal 1f,%%ecx\n"
        !            81:             "\tje longget_stub\n"
        !            82:             "\taddl address_space,%1\n"
        !            83:             "\tmovl (%1),%0\n"
        !            84:             "\tbswap %0\n"
        !            85:             "\t1:"
        !            86:             : "=c" (result), "=d" (addr) : "1" (addr), "r" (good_address_map) : "cc");
        !            87:     return result;
        !            88: }
        !            89: static __inline__ uae_u32 wordget_1 (uae_cptr addr)
        !            90: {
        !            91:     uae_u32 result;
        !            92: 
        !            93:     __asm__ ("andl $0x00FFFFFF,%1\n"
        !            94:             "\tcmpb $0,(%1,%3)\n"
        !            95:             "\tleal 1f,%%ecx\n"
        !            96:             "\tje wordget_stub\n"
        !            97:             "\taddl address_space,%1\n"
        !            98:             "\tmovzwl (%1),%0\n"
        !            99:             "\trolw $8,%w0\n"
        !           100:             "\t1:"
        !           101:             : "=c" (result), "=d" (addr) : "1" (addr), "r" (good_address_map) : "cc");
        !           102:     return result;
        !           103: }
        !           104: static __inline__ uae_u32 byteget_1 (uae_cptr addr) 
        !           105: {
        !           106:     uae_u32 result;
        !           107: 
        !           108:     __asm__ ("andl $0x00FFFFFF,%1\n"
        !           109:             "\tcmpb $0,(%1,%3)\n"
        !           110:             "\tleal 1f,%%ecx\n"
        !           111:             "\tje byteget_stub\n"
        !           112:             "\taddl address_space,%1\n"
        !           113:             "\tmovzbl (%1),%0\n"
        !           114:             "\t1:"
        !           115:             : "=c" (result), "=d" (addr) : "1" (addr), "r" (good_address_map) : "cc");
        !           116:     return result;
        !           117: }
        !           118: static __inline__ void longput_1 (uae_cptr addr, uae_u32 l)
        !           119: {
        !           120:     __asm__ __volatile__("andl $0x00FFFFFF,%0\n"
        !           121:             "\tcmpb $0,(%0,%3)\n"
        !           122:             "\tleal 1f,%%ecx\n"
        !           123:             "\tje longput_stub\n"
        !           124:             "\taddl address_space,%0\n"
        !           125:             "\tbswap %1\n"
        !           126:             "\tmovl %1,(%0)\n"
        !           127:             "\t1:"
        !           128:             : "=d" (addr), "=b" (l) : "0" (addr), "r" (good_address_map), "1" (l) : "cc", "memory", "ecx");
        !           129: }
        !           130: static __inline__ void wordput_1 (uae_cptr addr, uae_u32 w)
        !           131: {
        !           132:     __asm__ __volatile__("andl $0x00FFFFFF,%0\n"
        !           133:             "\tcmpb $0,(%0,%3)\n"
        !           134:             "\tleal 1f,%%ecx\n"
        !           135:             "\tje wordput_stub\n"
        !           136:             "\taddl address_space,%0\n"
        !           137:             "\trolw $8,%1\n"
        !           138:             "\tmovw %w1,(%0)\n"
        !           139:             "\t1:"
        !           140:             : "=d" (addr), "=b" (w) : "0" (addr), "r" (good_address_map), "1" (w) : "cc", "memory", "ecx");
        !           141: }
        !           142: static __inline__ void byteput_1 (uae_cptr addr, uae_u32 b)
        !           143: {
        !           144:     __asm__ __volatile__("andl $0x00FFFFFF,%0\n"
        !           145:             "\tcmpb $0,(%0,%3)\n"
        !           146:             "\tleal 1f,%%ecx\n"
        !           147:             "\tje byteput_stub\n"
        !           148:             "\taddl address_space,%0\n"
        !           149:             "\tmovb %b1,(%0)\n"
        !           150:             "\t1:"
        !           151:             : "=d" (addr), "=b" (b) : "0" (addr), "r" (good_address_map), "1" (b) : "cc", "memory", "ecx");
        !           152: }
        !           153: 
        !           154: #endif
        !           155: 
        !           156: #define ALIGN_POINTER_TO32(p) ((~(unsigned long)(p)) & 3)
        !           157: 
        !           158: /* Not the best place for this, but then there's no good place for a kludge
        !           159:  * like this... */
        !           160: #define HAVE_UAE_U24
        !           161: typedef struct {
        !           162:     unsigned char a, b, c;
        !           163: } __attribute__ ((packed)) uae_u24;
        !           164: 
        !           165: static __inline__ uae_u24 uae24_convert (uae_u32 v)
        !           166: {
        !           167:     return *(uae_u24 *)&v;
        !           168: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.