Annotation of MiNT/src/inline.h, revision 1.1.1.3

1.1       root        1: /*
                      2: 
1.1.1.2   root        3: Copyright 1992 Eric R. Smith.
                      4: 
1.1.1.3 ! root        5: Copyright 1993 Atari Corporation.
        !             6: 
1.1.1.2   root        7: All rights reserved.
1.1       root        8: 
                      9:  */
                     10: 
                     11: 
                     12: 
                     13: /*
                     14: 
                     15:  * inlining of various utility functions, for speed
                     16: 
                     17:  * NOTE: ALL functions in this file must also have
                     18: 
                     19:  * "normal" equivalents in the .c or .s files;
                     20: 
                     21:  * don't put a function just into here!
                     22: 
                     23:  */
                     24: 
                     25: 
                     26: 
                     27: #ifdef __GNUC__
                     28: 
                     29: 
                     30: 
                     31: #define spl7()                 \
                     32: 
                     33: ({  register short retvalue;   \
                     34: 
                     35:     __asm__ volatile("         \
                     36: 
                     37:        movew sr,%0;            \
                     38: 
                     39:        oriw  #0x0700,sr "      \
                     40: 
1.1.1.2   root       41:     : "=d"(retvalue)           \
1.1       root       42: 
                     43:     ); retvalue; })
                     44: 
                     45: 
                     46: 
                     47: #define spl(N)                 \
                     48: 
                     49: ({                             \
                     50: 
                     51:     __asm__ volatile("         \
                     52: 
                     53:        movew %0,sr "           \
                     54: 
                     55:     :                          \
                     56: 
1.1.1.2   root       57:     : "d"(N) ); })
1.1       root       58: 
                     59: 
                     60: 
                     61: 
                     62: 
                     63: /*
                     64: 
                     65:  * note that we must save some registers ourselves,
                     66: 
                     67:  * or else gcc will run out of reggies to use
                     68: 
                     69:  * and complain
                     70: 
                     71:  */
                     72: 
                     73: 
                     74: 
                     75: #define callout1(func, a)                      \
                     76: 
                     77: ({                                             \
                     78: 
                     79:        register long retvalue __asm__("d0");   \
                     80: 
                     81:        long _f = func;                         \
                     82: 
                     83:        short _a = (short)(a);                  \
                     84: 
                     85:                                                \
                     86: 
                     87:        __asm__ volatile                        \
                     88: 
                     89:        ("  moveml d5-d7/a4-a6,sp@-;            \
                     90: 
                     91:            movew %2,sp@-;                      \
                     92: 
                     93:            jsr %1@;                            \
                     94: 
                     95:            addqw #2,sp;                        \
                     96: 
                     97:            moveml sp@+,d5-d7/a4-a6 "           \
                     98: 
                     99:        : "=r"(retvalue)        /* outputs */   \
                    100: 
                    101:        : "a"(_f), "r"(_a)      /* inputs */    \
                    102: 
                    103:        : "d0", "d1", "d2", "d3", "d4",         \
                    104: 
                    105:          "a0", "a1", "a2", "a3" /* clobbered regs */ \
                    106: 
                    107:        );                                      \
                    108: 
                    109:        retvalue;                               \
                    110: 
                    111: })
                    112: 
                    113: 
                    114: 
                    115: #define callout2(func, a, b)                   \
                    116: 
                    117: ({                                             \
                    118: 
                    119:        register long retvalue __asm__("d0");   \
                    120: 
                    121:        long _f = func;                         \
                    122: 
                    123:        short _a = (short)(a);                  \
                    124: 
                    125:        short _b = (short)(b);                  \
                    126: 
                    127:                                                \
                    128: 
                    129:        __asm__ volatile                        \
                    130: 
                    131:        ("  moveml d5-d7/a4-a6,sp@-;            \
                    132: 
                    133:            movew %3,sp@-;                      \
                    134: 
                    135:            movew %2,sp@-;                      \
                    136: 
                    137:            jsr %1@;                            \
                    138: 
                    139:            addqw #4,sp;                        \
                    140: 
                    141:            moveml sp@+,d5-d7/a4-a6 "           \
                    142: 
                    143:        : "=r"(retvalue)        /* outputs */   \
                    144: 
                    145:        : "a"(_f), "r"(_a), "r"(_b) /* inputs */ \
                    146: 
                    147:        : "d0", "d1", "d2", "d3", "d4",         \
                    148: 
                    149:          "a0", "a1", "a2", "a3" /* clobbered regs */ \
                    150: 
                    151:        );                                      \
                    152: 
                    153:        retvalue;                               \
                    154: 
                    155: })
                    156: 
                    157: 
                    158: 
1.1.1.3 ! root      159: #define flush_pmmu() __asm__ volatile("pflusha");
        !           160: 
1.1       root      161: #endif
                    162: 
                    163: 
                    164: 
                    165: #ifdef LATTICE
                    166: 
                    167: #pragma inline d0=spl7()       {"40c0007c0700";}
                    168: 
                    169: #pragma inline d0=spl(d0)      {"46c0";}
                    170: 
                    171: #endif
                    172: 

unix.superglobalmegacorp.com

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