Annotation of researchv9/sys/sun3/reg.h, revision 1.1.1.1

1.1       root        1: /*     @(#)reg.h 1.1 86/02/03 SMI      */
                      2: 
                      3: /*
                      4:  * Copyright (c) 1985 by Sun Microsystems, Inc.
                      5:  */
                      6: 
                      7: #ifndef _REG_
                      8: #define _REG_
                      9: 
                     10: /*
                     11:  * Location of the users' stored
                     12:  * registers relative to R0.
                     13:  * Usage is u.u_ar0[XX].
                     14:  */
                     15: #define        R0      (0)
                     16: #define        R1      (1)
                     17: #define        R2      (2)
                     18: #define        R3      (3)
                     19: #define        R4      (4)
                     20: #define        R5      (5)
                     21: #define        R6      (6)
                     22: #define        R7      (7)
                     23: #define        AR0     (8)
                     24: #define        AR1     (9)
                     25: #define        AR2     (10)
                     26: #define        AR3     (11)
                     27: #define        AR4     (12)
                     28: #define        AR5     (13)
                     29: #define        AR6     (14)
                     30: #define        AR7     (15)
                     31: #define        SP      (15)
                     32: #define        PS      (16)
                     33: #define        PC      (17)
                     34: 
                     35: /*
                     36:  * And now for something completely the same...
                     37:  */
                     38: #ifndef LOCORE
                     39: struct regs {  
                     40:        int     r_dreg[8];      /* data registers */
                     41: #define r_r0   r_dreg[0]       /* r0 for portability */
                     42:        int     r_areg[8];      /* address registers */
                     43: #define r_sp   r_areg[7]       /* user stack pointer */
                     44:        int     r_sr;           /* status register (actually a short) */
                     45: #define        r_ps    r_sr
                     46:        int     r_pc;           /* program counter */
                     47: };
                     48: 
                     49: struct stkfmt {
                     50:        int     f_stkfmt : 4;   /* stack format */
                     51:        int              : 2;
                     52:        int     f_vector : 10;  /* vector offset */
                     53:        short   f_beibase;      /* start of bus error info (if any) */
                     54: };
                     55: 
                     56: 
                     57: /*
                     58:  * Struct for floating point registers and general state
                     59:  * for the MC68881 (the sky fpp has no user visible state).
                     60:  * If fps_flags == FPS_UNUSED, the other 68881 fields have no meaning.
                     61:  * fps_code and fps_flags are software implemented fields.
                     62:  * fps_flags is not used when set by user level programs,
                     63:  * but changing fps_code has the side effect of changing u.u_code.
                     64:  */
                     65: 
                     66: typedef        struct ext_fp {
                     67:        int     fp[3];
                     68: } ext_fp;              /* extended 96-bit 68881 fp registers */
                     69: 
                     70: struct fp_status {
                     71:        ext_fp  fps_regs[8];            /* 68881 floating point regs */
                     72:        int     fps_control;            /* 68881 control reg */
                     73:        int     fps_status;             /* 68881 status reg */
                     74:        int     fps_iaddr;              /* 68881 instruction address reg */
                     75:        int     fps_code;               /* additional word for signals */
                     76:        int     fps_flags;              /* r/o - unused, idle or busy */
                     77: };
                     78: #endif !LOCORE
                     79: 
                     80: /*
                     81:  * Values defined for `fps_flags'.
                     82:  */
                     83: #define        FPS_UNUSED      0               /* 68881 never used yet */
                     84: #define        FPS_IDLE        1               /* 68881 instruction completed */
                     85: #define        FPS_BUSY        2               /* 68881 instruction interrupted */
                     86: 
                     87: #ifndef LOCORE
                     88: /*
                     89:  * Struct for the internal state of the MC68881
                     90:  * Although the MC68881 can have a smaller maximum for
                     91:  * internal state, we allow for more to allow for expansion.
                     92:  * A fpis_vers and fpis_bufsize of zero means NULL state.
                     93:  */
                     94: #define        FPIS_BUFSIZ     192
                     95: 
                     96: struct fp_istate {
                     97:        unsigned char   fpis_vers;              /* version number */
                     98:        unsigned char   fpis_bufsiz;            /* size of info in fpis_buf */
                     99:        unsigned short  fpis_reserved;          /* reserved word */
                    100:        unsigned char   fpis_buf[FPIS_BUFSIZ];  /* fpp internal state buffer */
                    101: };
                    102: 
                    103: /*
                    104:  * Known values for fpis_bufsiz when null/idle, otherwize we have
                    105:  * to assume it's busy.  The EXT_FPS_FLAGS() macro is used to
                    106:  * convert a pointer to an fp_istate into a value to be used
                    107:  * for the user visible state found in fps_flags.  As a speed
                    108:  * optimization, this convertion is only done is required (e.g.
                    109:  * the PTRACE_GETFPREGS ptrace call or when dumping core) instead
                    110:  * of on each context switch.
                    111:  */
                    112: #define        FPIS_NULLSZ     0
                    113: #define        FPIS_IDLESZ     24
                    114: 
                    115: #define EXT_FPS_FLAGS(istatep) \
                    116:        ((istatep)->fpis_bufsiz == FPIS_NULLSZ ? FPS_UNUSED : \
                    117:            (istatep)->fpis_bufsiz == FPIS_IDLESZ ? FPS_IDLE : FPS_BUSY)
                    118: 
                    119: /* 
                    120:  * Structures for the status and data registers are defined here.
                    121:  * If fpais_context == FPA_NO_CONTEXT, the other FPA fields have
                    122:  * no meaning.  Struct fpa_istate and fpa_status are included in the
                    123:  * u area.  Struct fpa_regs is included in struct core.
                    124:  */
                    125: 
                    126: struct fpa_istate {
                    127:        unsigned int    fpais_context;  /* 0-31, 32 means FPA not used   */
                    128:        unsigned int    fpais_state;    /* FPA STATE register */
                    129: };
                    130: 
                    131: #define FPA_NO_CONTEXT 32
                    132: 
                    133: struct fpa_status {
                    134:        unsigned int    fpas_status[3]; /* IMASK, LOAD_PTR, IERR */
                    135:        unsigned short  fpas_opcode[4]; /* pipe instruction halves */
                    136:        unsigned int    fpas_operand[4];/* pipe data halves */
                    137:        unsigned int    fpas_mode;      /* FPA MODE3_0 register */
                    138: };
                    139: 
                    140: /* 
                    141:  * Since there are 64 8-byte data registers, save/restore them during
                    142:  * context switch both consumes time and occupies 512 bytes in the u area.
                    143:  * Also, there are 32 contexts supported by the fpa hardware.
                    144:  * Therefore, when we do context switch on the fpa, we don't save/restore
                    145:  * the data registers between the fpa and  the u area.  To protect
                    146:  * data registers from being overwritten, if there are already 32
                    147:  * processes using the fpa concurrently, we give an error message to
                    148:  * the 33rd process trying to use the fpa.  (Hopefully there will not
                    149:  * be this many processes using fpa concurrently.)
                    150:  */
                    151: 
                    152: /* 
                    153:  * There are 64 64-bit data registers. Since the data path between cpu
                    154:  * and fpa is 32 bit wide, we view FPA data registers as 128 unsigned int's.
                    155:  */
                    156: #define FPA_NLONG_WORDS                128
                    157: 
                    158: struct fpa_data {
                    159:        unsigned int    fpad_data[FPA_NLONG_WORDS]; /* FPA data registers */
                    160:        unsigned int    fpad_wstatus;   /* FPA WSTATUS register */
                    161: };
                    162: 
                    163: struct fpa_regs {
                    164:        struct  fpa_istate      fpar_istate;
                    165:         struct  fpa_status      fpar_status;
                    166:         struct  fpa_data        fpar_data;
                    167: };
                    168: 
                    169: #endif !LOCORE
                    170: 
                    171: #endif !_REG_

unix.superglobalmegacorp.com

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