Annotation of previous/src/cpu/mmu_common.h, revision 1.1

1.1     ! root        1: 
        !             2: #ifndef MMU_COMMON_H
        !             3: #define MMU_COMMON_H
        !             4: 
        !             5: #if 0
        !             6: struct m68k_exception {
        !             7:        int prb;
        !             8:        m68k_exception (int exc) : prb (exc) {}
        !             9:        operator int() { return prb; }
        !            10: };
        !            11: #define SAVE_EXCEPTION
        !            12: #define RESTORE_EXCEPTION
        !            13: #define TRY(var) try
        !            14: #define CATCH(var) catch(m68k_exception var)
        !            15: #define THROW(n) throw m68k_exception(n)
        !            16: #define THROW_AGAIN(var) throw
        !            17: 
        !            18: #else
        !            19: /* we are in plain C, just use a stack of long jumps */
        !            20: #include <setjmp.h>
        !            21: extern jmp_buf __exbuf;
        !            22: extern int     __exvalue;
        !            23: #define TRY(DUMMY)       __exvalue=setjmp(__exbuf);       \
        !            24:                   if (__exvalue==0) { __pushtry(&__exbuf);
        !            25: #define CATCH(x)  __poptry(); } else { fprintf(stderr,"Gotcha! %d %s in %d\n",__exvalue,__FILE__,__LINE__);
        !            26: #define ENDTRY    __poptry();}
        !            27: #define THROW(x) if (__is_catched()) {fprintf(stderr,"Longjumping %s in %d\n",__FILE__,__LINE__);longjmp(__exbuf,x);}
        !            28: #define THROW_AGAIN(var) if (__is_catched()) longjmp(*__poptry(),__exvalue)
        !            29: #define SAVE_EXCEPTION
        !            30: #define RESTORE_EXCEPTION
        !            31: jmp_buf* __poptry(void);
        !            32: void __pushtry(jmp_buf *j);
        !            33: int __is_catched(void);
        !            34: 
        !            35: typedef  int m68k_exception;
        !            36: 
        !            37: #endif
        !            38: 
        !            39: /* special status word (access error stack frame) */
        !            40: /* this is only valid for 68040 */
        !            41: /* TODO: correctly handle SSW on 68030 */
        !            42: #define MMU_SSW_TM             0x0007
        !            43: #define MMU_SSW_TT             0x0018
        !            44: #define MMU_SSW_SIZE   0x0060
        !            45: #define MMU_SSW_SIZE_B 0x0020
        !            46: #define MMU_SSW_SIZE_W 0x0040
        !            47: #define MMU_SSW_SIZE_L 0x0000
        !            48: #define MMU_SSW_RW             0x0100
        !            49: #define MMU_SSW_LK             0x0200
        !            50: #define MMU_SSW_ATC            0x0400
        !            51: #define MMU_SSW_MA             0x0800
        !            52: #define MMU_SSW_CM     0x1000
        !            53: #define MMU_SSW_CT     0x2000
        !            54: #define MMU_SSW_CU     0x4000
        !            55: #define MMU_SSW_CP     0x8000
        !            56: 
        !            57: #define MMU030_SSW_FC       0x8000
        !            58: #define MMU030_SSW_FB       0x4000
        !            59: #define MMU030_SSW_RC       0x2000
        !            60: #define MMU030_SSW_RB       0x1000
        !            61: #define MMU030_SSW_DF       0x0100
        !            62: #define MMU030_SSW_RM       0x0080
        !            63: #define MMU030_SSW_RW       0x0040
        !            64: #define MMU030_SSW_SIZE_MASK    0x0030
        !            65: #define MMU030_SSW_SIZE_B       0x0010 /* correct ? */
        !            66: #define MMU030_SSW_SIZE_W       0x0020 /* correct ? */
        !            67: #define MMU030_SSW_SIZE_L       0x0000 /* correct ? */
        !            68: #define MMU030_SSW_FC_MASK      0x0007
        !            69: 
        !            70: 
        !            71: #define ALWAYS_INLINE __inline
        !            72: 
        !            73: // take care of 2 kinds of alignement, bus size and page
        !            74: static inline bool is_unaligned(uaecptr addr, int size)
        !            75: {
        !            76:     return unlikely((addr & (size - 1)) && (addr ^ (addr + size - 1)) & 0x1000);
        !            77: }
        !            78: 
        !            79: static ALWAYS_INLINE void phys_put_long(uaecptr addr, uae_u32 l)
        !            80: {
        !            81:     longput(addr, l);
        !            82: }
        !            83: static ALWAYS_INLINE void phys_put_word(uaecptr addr, uae_u32 w)
        !            84: {
        !            85:     wordput(addr, w);
        !            86: }
        !            87: static ALWAYS_INLINE void phys_put_byte(uaecptr addr, uae_u32 b)
        !            88: {
        !            89:     byteput(addr, b);
        !            90: }
        !            91: static ALWAYS_INLINE uae_u32 phys_get_long(uaecptr addr)
        !            92: {
        !            93:     return longget (addr);
        !            94: }
        !            95: static ALWAYS_INLINE uae_u32 phys_get_word(uaecptr addr)
        !            96: {
        !            97:     return wordget (addr);
        !            98: }
        !            99: static ALWAYS_INLINE uae_u32 phys_get_byte(uaecptr addr)
        !           100: {
        !           101:     return byteget (addr);
        !           102: }
        !           103: 
        !           104: #endif

unix.superglobalmegacorp.com

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