File:  [UNIX Amiga Emulator] / uae / src / md-i386-dos / memory.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:39:33 2018 UTC (8 years, 3 months ago) by root
Branches: MAIN, BSchmidt
CVS tags: uae068, HEAD
uae-0.6.8

 /* 
  * UAE - The Un*x Amiga Emulator
  * 
  * Memory access functions
  *
  * Copyright 1996 Bernd Schmidt
  */


static __inline__ ULONG do_get_mem_long(ULONG *a)
{
    ULONG retval;

    __asm__ ("bswapl %0" : "=r" (retval) : "0" (*a) : "cc");
    return retval;
}

static __inline__ ULONG do_get_mem_word(UWORD *a)
{
    ULONG retval;

    __asm__ ("movzwl %1,%k0\n\trolw $8,%w0" : "=r" (retval) : "m" (*a) : "cc");
    return retval;
}

static __inline__ UBYTE do_get_mem_byte(UBYTE *a)
{
    return *a;
}

static __inline__ void do_put_mem_long(ULONG *a, ULONG v)
{
    __asm__ ("bswapl %0" : "=r" (v) : "0" (v) : "cc");
    *a = v;
}

static __inline__ void do_put_mem_word(UWORD *a, UWORD v)
{
    __asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc");
    *a = v;
}

static __inline__ void do_put_mem_byte(UBYTE *a, UBYTE v)
{
    *a = v;
}

#if 0
static __inline__ ULONG call_mem_get_func(mem_get_func func, CPTR addr)
{
    ULONG result;
    __asm__("call *%1"
	    : "=a" (result) : "r" (func) : "cc", "edx", "ecx");
    return result;
}

static __inline__ void call_mem_put_func(mem_put_func func, CPTR addr, ULONG v)
{
    __asm__("call *%1"
	    : : "a" (addr), "d" (v), "r" (func) : "cc", "eax", "edx", "ecx", "memory");
}
#else

#define call_mem_get_func(func,addr) ((*func)(addr))
#define call_mem_put_func(func,addr,v) ((*func)(addr,v))

#endif

#undef USE_MAPPED_MEMORY
#undef CAN_MAP_MEMORY
#undef NO_INLINE_MEMORY_ACCESS

unix.superglobalmegacorp.com

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