1*29581Ssam /* align.h 1.1 86/07/20 */ 2*29581Ssam 3*29581Ssam #ifndef LOCORE 4*29581Ssam /* 5*29581Ssam * Some special registers definitions. 6*29581Ssam */ 7*29581Ssam 8*29581Ssam #ifndef SLR 9*29581Ssam #define SLR 1 10*29581Ssam #define P0LR 3 11*29581Ssam #define P1LR 5 12*29581Ssam #define P2LR 7 13*29581Ssam #endif 14*29581Ssam 15*29581Ssam #include "../tahoealign/defs.h" 16*29581Ssam /* 17*29581Ssam * Definitions about the stack frame as seen by the routine 18*29581Ssam * 'alignment' in the kernel. If you ever wondered what's the 19*29581Ssam * meaning of 'machine dependent code', look here :-) 20*29581Ssam * This structure is partly set up by locore.s, for 'alignment', 21*29581Ssam * and partly by the allocation of local variables in 'alignment.c' 22*29581Ssam * itself. 23*29581Ssam * All these things are passed between procedures on the 24*29581Ssam * (current process' kernel) stack. The alternative (static 25*29581Ssam * variables) is a little bit more elegant but it works fine 26*29581Ssam * for one process only. Will not work for multiple processes 27*29581Ssam * with alignment processing or for MP models of HW. 28*29581Ssam * 29*29581Ssam * WARNING : due to the intimate relationships involved, don't 30*29581Ssam * change the process_info structure unless you also 31*29581Ssam * change the alignment trap code in locore.s AND the 32*29581Ssam * allocation of local variables in 'alignment.c' !! 33*29581Ssam */ 34*29581Ssam typedef struct { 35*29581Ssam long Saved_sp; /* For exceptions */ 36*29581Ssam long Saved_pc; 37*29581Ssam long Last_operand; /* Last operand # processed */ 38*29581Ssam long Opcode; /* 'offending' opcode */ 39*29581Ssam struct oprnd Decoded[4]; 40*29581Ssam long REG0; 41*29581Ssam long REG1; 42*29581Ssam long REG2; 43*29581Ssam long REG3; 44*29581Ssam long REG4; 45*29581Ssam long REG5; 46*29581Ssam long REG6; 47*29581Ssam long REG7; 48*29581Ssam long REG8; 49*29581Ssam long REG9; 50*29581Ssam long REG10; 51*29581Ssam long REG11; 52*29581Ssam long REG12; 53*29581Ssam long return_pc; /* Points into locore.s */ 54*29581Ssam long mask_restored; 55*29581Ssam long REG13; /* Original, from the process */ 56*29581Ssam long Sp; /* Alias R14 */ 57*29581Ssam long ret_code; 58*29581Ssam long ret_addr; 59*29581Ssam long ret_exception; /* To tell locore.s about problems */ 60*29581Ssam long Ach; 61*29581Ssam long Acl; 62*29581Ssam unsigned unused:30; 63*29581Ssam unsigned pcb_acc_pnt:1; 64*29581Ssam unsigned acc_dbl:1; 65*29581Ssam long Pc; /* Alias R15 */ 66*29581Ssam long Psl; 67*29581Ssam } process_info; 68*29581Ssam 69*29581Ssam #define saved_pc (infop->Saved_pc) 70*29581Ssam #define saved_sp (infop->Saved_sp) 71*29581Ssam #define last_operand (infop->Last_operand) 72*29581Ssam #define opCODE (infop->Opcode) 73*29581Ssam #define decoded (infop->Decoded) 74*29581Ssam #define r0 (infop->REG0) 75*29581Ssam #define r1 (infop->REG1) 76*29581Ssam #define r2 (infop->REG2) 77*29581Ssam #define r3 (infop->REG3) 78*29581Ssam #define r4 (infop->REG4) 79*29581Ssam #define r5 (infop->REG5) 80*29581Ssam #define r6 (infop->REG6) 81*29581Ssam #define r7 (infop->REG7) 82*29581Ssam #define r8 (infop->REG8) 83*29581Ssam #define r9 (infop->REG9) 84*29581Ssam #define r10 (infop->REG10) 85*29581Ssam #define r11 (infop->REG11) 86*29581Ssam #define r12 (infop->REG12) 87*29581Ssam #define r13 (infop->REG13) 88*29581Ssam #define fp (infop->REG13) 89*29581Ssam #define sp (infop->Sp) 90*29581Ssam #define acc_high (infop->Ach) 91*29581Ssam #define acc_low (infop->Acl) 92*29581Ssam #define pc (infop->Pc) 93*29581Ssam #define psl (infop->Psl) 94*29581Ssam 95*29581Ssam #define PCOUNTER 15 96*29581Ssam #define SPOINTER 14 97*29581Ssam 98*29581Ssam 99*29581Ssam /* 100*29581Ssam * Setting new condition codes for the process. 101*29581Ssam #define Set_psl(z) asm(" movl z,r6"); \ 102*29581Ssam asm(" andl2 $15,r6"); \ 103*29581Ssam asm(" mnegl $1,r7"); \ 104*29581Ssam asm(" xorl2 r6,r7"); \ 105*29581Ssam asm(" andl2 $15,r7"); \ 106*29581Ssam asm(" bicpsw r7"); \ 107*29581Ssam asm(" bispsw r6") 108*29581Ssam */ 109*29581Ssam #define Set_psl(z) asm(" andl2 $15,z"); \ 110*29581Ssam asm(" mnegl $1,r6"); \ 111*29581Ssam asm(" xorl2 z,r6"); \ 112*29581Ssam asm(" andl2 $15,r6"); \ 113*29581Ssam asm(" bicpsw r6"); \ 114*29581Ssam asm(" bispsw z") 115*29581Ssam #define New_cc(x) (x) &= PSL_ALLCC; psl = psl & ~PSL_ALLCC | (x) 116*29581Ssam 117*29581Ssam #endif 118*29581Ssam 119*29581Ssam /* 120*29581Ssam * Definitions for ret_code. NOTE : DON"T USE 0 !! locore.s knows that 121*29581Ssam * 0 means OK, no problems ! 122*29581Ssam */ 123*29581Ssam 124*29581Ssam #define ILL_ADDRMOD 1 125*29581Ssam #define ILL_ACCESS 2 126*29581Ssam #define ILL_OPRND 3 127*29581Ssam #define ARITHMETIC 4 128*29581Ssam #define ALIGNMENT 5 129*29581Ssam 130*29581Ssam /* 131*29581Ssam * For use in u.u_eosys as a flag. 132*29581Ssam */ 133*29581Ssam #define EMULATEALIGN 0x80 134