1*45699Sbostic /* align.h 1.2 90/12/04 */ 229581Ssam 329581Ssam #ifndef LOCORE 429581Ssam /* 529581Ssam * Some special registers definitions. 629581Ssam */ 729581Ssam 829581Ssam #ifndef SLR 929581Ssam #define SLR 1 1029581Ssam #define P0LR 3 1129581Ssam #define P1LR 5 1229581Ssam #define P2LR 7 1329581Ssam #endif 1429581Ssam 15*45699Sbostic #include "defs.h" 1629581Ssam /* 1729581Ssam * Definitions about the stack frame as seen by the routine 1829581Ssam * 'alignment' in the kernel. If you ever wondered what's the 1929581Ssam * meaning of 'machine dependent code', look here :-) 2029581Ssam * This structure is partly set up by locore.s, for 'alignment', 2129581Ssam * and partly by the allocation of local variables in 'alignment.c' 2229581Ssam * itself. 2329581Ssam * All these things are passed between procedures on the 2429581Ssam * (current process' kernel) stack. The alternative (static 2529581Ssam * variables) is a little bit more elegant but it works fine 2629581Ssam * for one process only. Will not work for multiple processes 2729581Ssam * with alignment processing or for MP models of HW. 2829581Ssam * 2929581Ssam * WARNING : due to the intimate relationships involved, don't 3029581Ssam * change the process_info structure unless you also 3129581Ssam * change the alignment trap code in locore.s AND the 3229581Ssam * allocation of local variables in 'alignment.c' !! 3329581Ssam */ 3429581Ssam typedef struct { 3529581Ssam long Saved_sp; /* For exceptions */ 3629581Ssam long Saved_pc; 3729581Ssam long Last_operand; /* Last operand # processed */ 3829581Ssam long Opcode; /* 'offending' opcode */ 3929581Ssam struct oprnd Decoded[4]; 4029581Ssam long REG0; 4129581Ssam long REG1; 4229581Ssam long REG2; 4329581Ssam long REG3; 4429581Ssam long REG4; 4529581Ssam long REG5; 4629581Ssam long REG6; 4729581Ssam long REG7; 4829581Ssam long REG8; 4929581Ssam long REG9; 5029581Ssam long REG10; 5129581Ssam long REG11; 5229581Ssam long REG12; 5329581Ssam long return_pc; /* Points into locore.s */ 5429581Ssam long mask_restored; 5529581Ssam long REG13; /* Original, from the process */ 5629581Ssam long Sp; /* Alias R14 */ 5729581Ssam long ret_code; 5829581Ssam long ret_addr; 5929581Ssam long ret_exception; /* To tell locore.s about problems */ 6029581Ssam long Ach; 6129581Ssam long Acl; 6229581Ssam unsigned unused:30; 6329581Ssam unsigned pcb_acc_pnt:1; 6429581Ssam unsigned acc_dbl:1; 6529581Ssam long Pc; /* Alias R15 */ 6629581Ssam long Psl; 6729581Ssam } process_info; 6829581Ssam 6929581Ssam #define saved_pc (infop->Saved_pc) 7029581Ssam #define saved_sp (infop->Saved_sp) 7129581Ssam #define last_operand (infop->Last_operand) 7229581Ssam #define opCODE (infop->Opcode) 7329581Ssam #define decoded (infop->Decoded) 7429581Ssam #define r0 (infop->REG0) 7529581Ssam #define r1 (infop->REG1) 7629581Ssam #define r2 (infop->REG2) 7729581Ssam #define r3 (infop->REG3) 7829581Ssam #define r4 (infop->REG4) 7929581Ssam #define r5 (infop->REG5) 8029581Ssam #define r6 (infop->REG6) 8129581Ssam #define r7 (infop->REG7) 8229581Ssam #define r8 (infop->REG8) 8329581Ssam #define r9 (infop->REG9) 8429581Ssam #define r10 (infop->REG10) 8529581Ssam #define r11 (infop->REG11) 8629581Ssam #define r12 (infop->REG12) 8729581Ssam #define r13 (infop->REG13) 8829581Ssam #define fp (infop->REG13) 8929581Ssam #define sp (infop->Sp) 9029581Ssam #define acc_high (infop->Ach) 9129581Ssam #define acc_low (infop->Acl) 9229581Ssam #define pc (infop->Pc) 9329581Ssam #define psl (infop->Psl) 9429581Ssam 9529581Ssam #define PCOUNTER 15 9629581Ssam #define SPOINTER 14 9729581Ssam 9829581Ssam 9929581Ssam /* 10029581Ssam * Setting new condition codes for the process. 10129581Ssam #define Set_psl(z) asm(" movl z,r6"); \ 10229581Ssam asm(" andl2 $15,r6"); \ 10329581Ssam asm(" mnegl $1,r7"); \ 10429581Ssam asm(" xorl2 r6,r7"); \ 10529581Ssam asm(" andl2 $15,r7"); \ 10629581Ssam asm(" bicpsw r7"); \ 10729581Ssam asm(" bispsw r6") 10829581Ssam */ 10929581Ssam #define Set_psl(z) asm(" andl2 $15,z"); \ 11029581Ssam asm(" mnegl $1,r6"); \ 11129581Ssam asm(" xorl2 z,r6"); \ 11229581Ssam asm(" andl2 $15,r6"); \ 11329581Ssam asm(" bicpsw r6"); \ 11429581Ssam asm(" bispsw z") 11529581Ssam #define New_cc(x) (x) &= PSL_ALLCC; psl = psl & ~PSL_ALLCC | (x) 11629581Ssam 11729581Ssam #endif 11829581Ssam 11929581Ssam /* 12029581Ssam * Definitions for ret_code. NOTE : DON"T USE 0 !! locore.s knows that 12129581Ssam * 0 means OK, no problems ! 12229581Ssam */ 12329581Ssam 12429581Ssam #define ILL_ADDRMOD 1 12529581Ssam #define ILL_ACCESS 2 12629581Ssam #define ILL_OPRND 3 12729581Ssam #define ARITHMETIC 4 12829581Ssam #define ALIGNMENT 5 12929581Ssam 13029581Ssam /* 13129581Ssam * For use in u.u_eosys as a flag. 13229581Ssam */ 13329581Ssam #define EMULATEALIGN 0x80 134