reg.h revision 4
14Srgrimes/*-
24Srgrimes * Copyright (c) 1990 The Regents of the University of California.
34Srgrimes * All rights reserved.
44Srgrimes *
54Srgrimes * This code is derived from software contributed to Berkeley by
64Srgrimes * William Jolitz.
74Srgrimes *
84Srgrimes * Redistribution and use in source and binary forms, with or without
94Srgrimes * modification, are permitted provided that the following conditions
104Srgrimes * are met:
114Srgrimes * 1. Redistributions of source code must retain the above copyright
124Srgrimes *    notice, this list of conditions and the following disclaimer.
134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
144Srgrimes *    notice, this list of conditions and the following disclaimer in the
154Srgrimes *    documentation and/or other materials provided with the distribution.
164Srgrimes * 3. All advertising materials mentioning features or use of this software
174Srgrimes *    must display the following acknowledgement:
184Srgrimes *	This product includes software developed by the University of
194Srgrimes *	California, Berkeley and its contributors.
204Srgrimes * 4. Neither the name of the University nor the names of its contributors
214Srgrimes *    may be used to endorse or promote products derived from this software
224Srgrimes *    without specific prior written permission.
234Srgrimes *
244Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
254Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
264Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
274Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
284Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
294Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
304Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
314Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
324Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
334Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
344Srgrimes * SUCH DAMAGE.
354Srgrimes *
364Srgrimes *	@(#)reg.h	5.5 (Berkeley) 1/18/91
374Srgrimes */
384Srgrimes
394Srgrimes/*
404Srgrimes * Location of the users' stored
414Srgrimes * registers within appropriate frame of 'trap' and 'syscall', relative to
424Srgrimes * base of stack frame.
434Srgrimes * Normal usage is u.u_ar0[XX] in kernel.
444Srgrimes */
454Srgrimes
464Srgrimes/* When referenced during a trap/exception, registers are at these offsets */
474Srgrimes
484Srgrimes#define	tES	(0)
494Srgrimes#define	tDS	(1)
504Srgrimes#define	tEDI	(2)
514Srgrimes#define	tESI	(3)
524Srgrimes#define	tEBP	(4)
534Srgrimes
544Srgrimes#define	tEBX	(6)
554Srgrimes#define	tEDX	(7)
564Srgrimes#define	tECX	(8)
574Srgrimes#define	tEAX	(9)
584Srgrimes
594Srgrimes#define	tEIP	(12)
604Srgrimes#define	tCS	(13)
614Srgrimes#define	tEFLAGS	(14)
624Srgrimes#define	tESP	(15)
634Srgrimes#define	tSS	(16)
644Srgrimes
654Srgrimes/* During a system call, registers are at these offsets instead of above. */
664Srgrimes
674Srgrimes#define	sEDI	(0)
684Srgrimes#define	sESI	(1)
694Srgrimes#define	sEBP	(2)
704Srgrimes
714Srgrimes#define	sEBX	(4)
724Srgrimes#define	sEDX	(5)
734Srgrimes#define	sECX	(6)
744Srgrimes#define	sEAX	(7)
754Srgrimes#define	sEFLAGS	(8)
764Srgrimes#define	sEIP	(9)
774Srgrimes#define	sCS	(10)
784Srgrimes#define	sESP	(11)
794Srgrimes#define	sSS	(12)
804Srgrimes
814Srgrimes#define	PC	sEIP
824Srgrimes#define	SP	sESP
834Srgrimes#define	PS	sEFLAGS
844Srgrimes#define	R0	sEDX
854Srgrimes#define	R1	sECX
864Srgrimes/*
874Srgrimes * Registers accessible to ptrace(2) syscall for debugger
884Srgrimes */
894Srgrimes#ifdef IPCREG
904Srgrimes#define	NIPCREG 14
914Srgrimesint ipcreg[NIPCREG] =
924Srgrimes  { tES,tDS,tEDI,tESI,tEBP,tEBX,tEDX,tECX,tEAX,tEIP,tCS,tEFLAGS,tESP,tSS };
934Srgrimes#endif
94