1 /* $NetBSD: frame.h,v 1.2 2004/07/18 23:21:35 chs Exp $ */ 2 3 /* $OpenBSD: frame.h,v 1.11 1999/11/25 18:28:06 mickey Exp $ */ 4 5 /* 6 * Copyright (c) 1999 Michael Shalayeff 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by Michael Shalayeff. 20 * 4. The name of the author may not be used to endorse or promote products 21 * derived from this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT, 27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 33 * THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36 37 #ifndef _HPPA_FRAME_H_ 38 #define _HPPA_FRAME_H_ 39 40 #include <machine/reg.h> 41 42 /* 43 * Call frame definitions 44 */ 45 #define HPPA_FRAME_NARGS (12) 46 #define HPPA_FRAME_MAXARGS (HPPA_FRAME_NARGS * 4) 47 #define HPPA_FRAME_ARG(n) (-(32 + 4*((n) + 1))) 48 #define HPPA_FRAME_CARG(n,sp) ((register_t *)((sp) + HPPA_FRAME_ARG(n))) 49 #define HPPA_FRAME_SIZE (64) 50 #define HPPA_FRAME_PSP (-4) 51 #define HPPA_FRAME_EP (-8) 52 #define HPPA_FRAME_CLUP (-12) 53 #define HPPA_FRAME_SL (-16) 54 #define HPPA_FRAME_CRP (-20) 55 #define HPPA_FRAME_ERP (-24) 56 #define HPPA_FRAME_ESR4 (-28) 57 #define HPPA_FRAME_EDP (-32) 58 #define HPPA_FRAME_ROUND(x) \ 59 (((x) + HPPA_FRAME_SIZE - 1) & ~(HPPA_FRAME_SIZE - 1)) 60 61 /* 62 * Macros to decode processor status word. 63 */ 64 #define HPPA_PC_PRIV_MASK 3 65 #define HPPA_PC_PRIV_KERN 0 66 #define HPPA_PC_PRIV_USER 3 67 #define USERMODE(pc) ((((register_t)pc) & HPPA_PC_PRIV_MASK) != HPPA_PC_PRIV_KERN) 68 #define KERNMODE(pc) (((register_t)pc) & ~HPPA_PC_PRIV_MASK) 69 70 #ifndef __ASSEMBLER__ 71 /* 72 * the trapframe is divided into two parts: 73 * one is saved while we are in the physical mode (beginning of the trap), 74 * and should be kept as small as possible, since all the interrupts will 75 * be lost during this phase, also it must be 64-bytes aligned, per 76 * pa-risc stack conventions, and it's dependancies in the code (; 77 * the other part is filled out when we are already in the virtual mode, 78 * are able to catch interrupts (they are kept pending) and perform 79 * other trap activities (like tlb misses). 80 */ 81 struct trapframe { 82 /* the `physical' part of the trapframe */ 83 u_int tf_t1; /* r22 */ 84 u_int tf_t2; /* r21 */ 85 u_int tf_sp; /* r30 */ 86 u_int tf_t3; /* r20 */ 87 u_int tf_iisq_head; /* cr17 */ 88 u_int tf_iisq_tail; 89 u_int tf_iioq_head; /* cr18 */ 90 u_int tf_iioq_tail; 91 u_int tf_eiem; /* cr15 */ 92 u_int tf_ipsw; /* cr22 */ 93 u_int tf_sr3; 94 u_int tf_pidr1; /* cr8 */ 95 u_int tf_isr; /* cr20 */ 96 u_int tf_ior; /* cr21 */ 97 u_int tf_iir; /* cr19 */ 98 u_int tf_flags; 99 100 /* here starts the `virtual' part */ 101 u_int tf_sar; /* cr11 */ 102 u_int tf_r1; 103 u_int tf_rp; /* r2 */ 104 u_int tf_r3; /* frame pointer when -g */ 105 u_int tf_r4; 106 u_int tf_r5; 107 u_int tf_r6; 108 u_int tf_r7; 109 u_int tf_r8; 110 u_int tf_r9; 111 u_int tf_r10; 112 u_int tf_r11; 113 u_int tf_r12; 114 u_int tf_r13; 115 u_int tf_r14; 116 u_int tf_r15; 117 u_int tf_r16; 118 u_int tf_r17; 119 u_int tf_r18; 120 u_int tf_t4; /* r19 */ 121 u_int tf_arg3; /* r23 */ 122 u_int tf_arg2; /* r24 */ 123 u_int tf_arg1; /* r25 */ 124 u_int tf_arg0; /* r26 */ 125 u_int tf_dp; /* r27 */ 126 u_int tf_ret0; /* r28 */ 127 u_int tf_ret1; /* r29 */ 128 u_int tf_r31; 129 u_int tf_sr0; 130 u_int tf_sr1; 131 u_int tf_sr2; 132 u_int tf_sr4; 133 u_int tf_sr5; 134 u_int tf_sr6; 135 u_int tf_sr7; 136 u_int tf_pidr2; /* cr9 */ 137 u_int tf_pidr3; /* cr12 */ 138 u_int tf_pidr4; /* cr13 */ 139 u_int tf_rctr; /* cr0 */ 140 u_int tf_ccr; /* cr10 */ 141 u_int tf_eirr; /* cr23 - DDB */ 142 u_int tf_hptm; /* cr24 - DDB */ 143 u_int tf_vtop; /* cr25 - DDB */ 144 u_int tf_cr28; /* - DDB */ 145 u_int tf_cr30; /* uaddr */ 146 147 u_int tf_pad[3]; /* pad to 256 bytes */ 148 }; 149 150 #endif /* !__ASSEMBLER__ */ 151 152 #endif /* !_HPPA_FRAME_H_ */ 153