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