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