Annotation of Net2/arch/i386/boot/asm.h, revision 1.1.1.2

1.1       root        1: /* 
                      2:  * Ported to Boot 386BSD by Julian Elsicher ([email protected]) Sept. 1992
                      3:  *
                      4:  * Mach Operating System
                      5:  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
                      6:  * All Rights Reserved.
                      7:  * 
                      8:  * Permission to use, copy, modify and distribute this software and its
                      9:  * documentation is hereby granted, provided that both the copyright
                     10:  * notice and this permission notice appear in all copies of the
                     11:  * software, derivative works or modified versions, and any portions
                     12:  * thereof, and that both notices appear in supporting documentation.
                     13:  * 
                     14:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     15:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                     16:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     17:  * 
                     18:  * Carnegie Mellon requests users of this software to return to
                     19:  * 
                     20:  *  Software Distribution Coordinator  or  [email protected]
                     21:  *  School of Computer Science
                     22:  *  Carnegie Mellon University
                     23:  *  Pittsburgh PA 15213-3890
                     24:  * 
                     25:  * any improvements or extensions that they make and grant Carnegie Mellon
                     26:  * the rights to redistribute these changes.
                     27:  */
                     28: /* 
                     29:  * HISTORY
1.1.1.2 ! root       30:  * asm.h,v
        !            31:  * Revision 1.2  1993/07/11  12:02:19  andrew
        !            32:  * Fixes from bde, including support for loading @ any MB boundary (e.g. a
        !            33:  * kernel linked for 0xfe100000 will load at the 1MB mark) and read-ahead
        !            34:  * buffering to speed booting from floppies.  Also works with aha174x
        !            35:  * controllers in enhanced mode.
        !            36:  *
        !            37:  *
        !            38:  * 93/06/28  bde
        !            39:  *     Deleted addr16 and data16.  These produce the same prefix bytes as
        !            40:  *     addr32 and data32 but have confusing names.  There is no way to make
        !            41:  *     gas produce 16-bit addresses or operand sizes.  Instead, we let it
        !            42:  *     produce 32-bit addresses and operand sizes and explicitly code the
        !            43:  *     correct prefix(es) to make the address modes and operand sizes what
        !            44:  *     gas thinks they are.  It would be safer to use prefixes before
        !            45:  *     _every_ instruction (there are alleady a lot of unnecessary data32's
        !            46:  *     before short jumps in case the jumps are actually long).  We must
        !            47:  *     avoid "word" instructions becuase gas would produce the wrong prefix
        !            48:  *     and there is no way to cancel a prefix.  We sometimes avoid adding
        !            49:  *     a prefix using kludges like
        !            50:  *             "xorl %eax, %eax        # actually xorw %ax, %ax".
        !            51:  *
        !            52:  * 93/06/28  bde
        !            53:  *     Added addr32.
        !            54:  *
        !            55:  * Revision 1.1  1993/03/21  18:08:18  cgd
1.1       root       56:  * after 0.2.2 "stable" patches applied
                     57:  *
                     58:  * Revision 2.7  92/02/29  15:33:41  rpd
                     59:  *     Added ENTRY2.
                     60:  *     [92/02/28            rpd]
                     61:  * 
                     62:  * Revision 2.6  92/02/19  15:07:52  elf
                     63:  *     Changed #if __STDC__ to #ifdef __STDC__
                     64:  *     [92/01/16            jvh]
                     65:  * 
                     66:  * Revision 2.5  91/05/14  16:02:45  mrt
                     67:  *     Correcting copyright
                     68:  * 
                     69:  * Revision 2.4  91/02/05  17:10:42  mrt
                     70:  *     Changed to new Mach copyright
                     71:  *     [91/02/01  17:30:29  mrt]
                     72:  * 
                     73:  * Revision 2.3  90/12/20  16:35:27  jeffreyh
                     74:  *     changes for __STDC__
                     75:  *     [90/12/06            jeffreyh]
                     76:  * 
                     77:  * Revision 2.2  90/05/03  15:24:12  dbg
                     78:  *     First checkin.
                     79:  * 
                     80:  *
                     81:  *     Typo on ENTRY if gprof
                     82:  *     [90/03/29            rvb]
                     83:  * 
                     84:  *     fix SVC for "ifdef wheeze" [kupfer]
                     85:  *     Fix the GPROF definitions.
                     86:  *     ENTRY(x) gets profiled iffdef GPROF.
                     87:  *     Entry(x) (and DATA(x)) is NEVER profiled.
                     88:  *     MCOUNT can be used by asm that intends to build a frame,
                     89:  *     after the frame is built.
                     90:  *     [90/02/26            rvb]
                     91:  *
                     92:  *     Add #define addr16 .byte 0x67
                     93:  *     [90/02/09            rvb]
                     94:  *     Added LBi, SVC and ENTRY
                     95:  *     [89/11/10  09:51:33  rvb]
                     96:  * 
                     97:  *     New a.out and coff compatible .s files.
                     98:  *     [89/10/16            rvb]
                     99:  */
                    100: 
                    101: 
                    102: #define S_ARG0  4(%esp)
                    103: #define S_ARG1  8(%esp)
                    104: #define S_ARG2 12(%esp)
                    105: #define S_ARG3 16(%esp)
                    106: 
                    107: #define FRAME  pushl %ebp; movl %esp, %ebp
                    108: #define EMARF  leave
                    109: 
                    110: #define B_ARG0  8(%ebp)
                    111: #define B_ARG1 12(%ebp)
                    112: #define B_ARG2 16(%ebp)
                    113: #define B_ARG3 20(%ebp)
                    114: 
                    115: #ifdef wheeze
                    116: 
                    117: #define ALIGN 4
                    118: #define EXT(x) x
                    119: #define LEXT(x) x:
                    120: #define LCL(x) ./**/x
                    121: 
                    122: #define LB(x,n) ./**/x
                    123: #define LBb(x,n) ./**/x
                    124: #define LBf(x,n) ./**/x
                    125: 
                    126: #define        SVC lcall $7,$0
                    127: 
                    128: #define String .string
                    129: #define Value  .value
                    130: #define Times(a,b) [a\*b]
                    131: #define Divide(a,b) [a\\b]
                    132: 
                    133: #define INB    inb     (%dx)
                    134: #define OUTB   outb    (%dx)
                    135: #define INL    inl     (%dx)
                    136: #define OUTL   outl    (%dx)
                    137: 
                    138: #else  wheeze
                    139: #define ALIGN 
                    140: #define        LCL(x)  x
                    141: 
                    142: #define LB(x,n) n
                    143: #ifdef __STDC__
                    144: #define EXT(x) _ ## x
                    145: #define LEXT(x) _ ## x ## :
                    146: 
                    147: #define LBb(x,n) n ## b
                    148: #define LBf(x,n) n ## f
                    149: #else __STDC__
                    150: #define EXT(x) _/**/x
                    151: #define LEXT(x) _/**/x/**/:
                    152: #define LBb(x,n) n/**/b
                    153: #define LBf(x,n) n/**/f
                    154: #endif __STDC__
                    155: #define SVC .byte 0x9a; .long 0; .word 0x7
                    156: 
                    157: #define String .ascii
                    158: #define Value  .word
                    159: #define Times(a,b) (a*b)
                    160: #define Divide(a,b) (a/b)
                    161: 
                    162: #define INB    inb     %dx, %al
                    163: #define OUTB   outb    %al, %dx
                    164: #define INL    inl     %dx, %eax
                    165: #define OUTL   outl    %eax, %dx
                    166: 
                    167: #endif wheeze
                    168: 
1.1.1.2 ! root      169: #define addr32 .byte 0x67
1.1       root      170: #define data32 .byte 0x66
                    171: 
                    172: #ifdef GPROF
                    173: #ifdef __STDC__
                    174: 
                    175: #define MCOUNT         .data; LB(x, 9); .long 0; .text; lea LBb(x, 9),%edx; call mcount
                    176: #define        ENTRY(x)        .globl EXT(x); .align ALIGN; LEXT(x) ; \
                    177:                        pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
                    178: #define        ENTRY2(x,y)     .globl EXT(x); .globl EXT(y); \
                    179:                        .align ALIGN; LEXT(x) LEXT(y) ; \
                    180:                        pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
                    181: #define        ASENTRY(x)      .globl x; .align ALIGN; x ## : ; \
                    182:                        pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
                    183: 
                    184: #else   __STDC__
                    185: 
                    186: #define MCOUNT         .data; LB(x, 9): .long 0; .text; lea LBb(x, 9),%edx; call mcount
                    187: #define        ENTRY(x)        .globl EXT(x); .align ALIGN; LEXT(x) ; \
                    188:                        pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
                    189: #define        ENTRY2(x,y)     .globl EXT(x); .globl EXT(y); \
                    190:                        .align ALIGN; LEXT(x) LEXT(y)
                    191: #define        ASENTRY(x)      .globl x; .align ALIGN; x: ; \
                    192:                        pushl %ebp; movl %esp, %ebp; MCOUNT; popl %ebp;
                    193: 
                    194: #endif __STDC__
                    195: #else  GPROF
                    196: #ifdef __STDC__
                    197: 
                    198: #define MCOUNT
                    199: #define        ENTRY(x)        .globl EXT(x); .align ALIGN; LEXT(x)
                    200: #define        ENTRY2(x,y)     .globl EXT(x); .globl EXT(y); \
                    201:                        .align ALIGN; LEXT(x) LEXT(y)
                    202: #define        ASENTRY(x)      .globl x; .align ALIGN; x ## :
                    203: 
                    204: #else  __STDC__
                    205: 
                    206: #define MCOUNT
                    207: #define        ENTRY(x)        .globl EXT(x); .align ALIGN; LEXT(x)
                    208: #define        ENTRY2(x,y)     .globl EXT(x); .globl EXT(y); \
                    209:                        .align ALIGN; LEXT(x) LEXT(y)
                    210: #define        ASENTRY(x)      .globl x; .align ALIGN; x:
                    211: 
                    212: #endif __STDC__
                    213: #endif GPROF
                    214: 
                    215: #define        Entry(x)        .globl EXT(x); .align ALIGN; LEXT(x)
                    216: #define        DATA(x)         .globl EXT(x); .align ALIGN; LEXT(x)

unix.superglobalmegacorp.com

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