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

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

unix.superglobalmegacorp.com

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