xref: /openbsd-src/sys/arch/arm/include/pcb.h (revision c7b5578a715ca65ee46f2c1c48fca8629620c8ce)
1*c7b5578aSkettenis /*	$OpenBSD: pcb.h,v 1.8 2018/01/26 16:22:20 kettenis Exp $	*/
2e1e4f5b1Sdrahn /*	$NetBSD: pcb.h,v 1.10 2003/10/13 21:46:39 scw Exp $	*/
3e1e4f5b1Sdrahn 
4e1e4f5b1Sdrahn /*
5e1e4f5b1Sdrahn  * Copyright (c) 2001 Matt Thomas <matt@3am-software.com>.
6e1e4f5b1Sdrahn  * Copyright (c) 1994 Mark Brinicombe.
7e1e4f5b1Sdrahn  * All rights reserved.
8e1e4f5b1Sdrahn  *
9e1e4f5b1Sdrahn  * Redistribution and use in source and binary forms, with or without
10e1e4f5b1Sdrahn  * modification, are permitted provided that the following conditions
11e1e4f5b1Sdrahn  * are met:
12e1e4f5b1Sdrahn  * 1. Redistributions of source code must retain the above copyright
13e1e4f5b1Sdrahn  *    notice, this list of conditions and the following disclaimer.
14e1e4f5b1Sdrahn  * 2. Redistributions in binary form must reproduce the above copyright
15e1e4f5b1Sdrahn  *    notice, this list of conditions and the following disclaimer in the
16e1e4f5b1Sdrahn  *    documentation and/or other materials provided with the distribution.
17e1e4f5b1Sdrahn  * 3. All advertising materials mentioning features or use of this software
18e1e4f5b1Sdrahn  *    must display the following acknowledgement:
19e1e4f5b1Sdrahn  *	This product includes software developed by the RiscBSD team.
20e1e4f5b1Sdrahn  * 4. The name "RiscBSD" nor the name of the author may be used to
21e1e4f5b1Sdrahn  *    endorse or promote products derived from this software without specific
22e1e4f5b1Sdrahn  *    prior written permission.
23e1e4f5b1Sdrahn  *
24e1e4f5b1Sdrahn  * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
25e1e4f5b1Sdrahn  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26e1e4f5b1Sdrahn  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27e1e4f5b1Sdrahn  * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28e1e4f5b1Sdrahn  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29e1e4f5b1Sdrahn  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30e1e4f5b1Sdrahn  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31e1e4f5b1Sdrahn  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32e1e4f5b1Sdrahn  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33e1e4f5b1Sdrahn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34e1e4f5b1Sdrahn  * SUCH DAMAGE.
35e1e4f5b1Sdrahn  */
36e1e4f5b1Sdrahn 
37e1e4f5b1Sdrahn #ifndef	_ARM_PCB_H_
38e1e4f5b1Sdrahn #define	_ARM_PCB_H_
39e1e4f5b1Sdrahn 
40e1e4f5b1Sdrahn #include <machine/frame.h>
41e1e4f5b1Sdrahn 
42e1e4f5b1Sdrahn #include <arm/pte.h>
43*c7b5578aSkettenis #include <arm/reg.h>
44e1e4f5b1Sdrahn 
45e1e4f5b1Sdrahn struct trapframe;
46e1e4f5b1Sdrahn 
47e1e4f5b1Sdrahn struct pcb_arm32 {
48e1e4f5b1Sdrahn 	paddr_t	pcb32_pagedir;			/* PT hooks */
49e1e4f5b1Sdrahn 	pd_entry_t *pcb32_pl1vec;		/* PTR to vector_base L1 entry*/
50e1e4f5b1Sdrahn 	pd_entry_t pcb32_l1vec;			/* Value to stuff on ctx sw */
51e1e4f5b1Sdrahn 	u_int	pcb32_dacr;			/* Domain Access Control Reg */
52e1e4f5b1Sdrahn 	void	*pcb32_cstate;			/* &pmap->pm_cstate */
53e1e4f5b1Sdrahn 	/*
54e1e4f5b1Sdrahn 	 * WARNING!
55e1e4f5b1Sdrahn 	 * cpuswitch.S relies on pcb32_r8 being quad-aligned in struct pcb
56e1e4f5b1Sdrahn 	 * (due to the use of "strd" when compiled for XSCALE)
57e1e4f5b1Sdrahn 	 */
58e1e4f5b1Sdrahn 	u_int	pcb32_r8;			/* used */
59e1e4f5b1Sdrahn 	u_int	pcb32_r9;			/* used */
60e1e4f5b1Sdrahn 	u_int	pcb32_r10;			/* used */
61e1e4f5b1Sdrahn 	u_int	pcb32_r11;			/* used */
62e1e4f5b1Sdrahn 	u_int	pcb32_r12;			/* used */
63e1e4f5b1Sdrahn 	u_int	pcb32_sp;			/* used */
64e1e4f5b1Sdrahn 	u_int	pcb32_lr;
65e1e4f5b1Sdrahn 	u_int	pcb32_pc;
66e1e4f5b1Sdrahn 	u_int	pcb32_und_sp;
67e1e4f5b1Sdrahn };
68e1e4f5b1Sdrahn #define	pcb_pagedir	pcb_un.un_32.pcb32_pagedir
69e1e4f5b1Sdrahn #define	pcb_pl1vec	pcb_un.un_32.pcb32_pl1vec
70e1e4f5b1Sdrahn #define	pcb_l1vec	pcb_un.un_32.pcb32_l1vec
71e1e4f5b1Sdrahn #define	pcb_dacr	pcb_un.un_32.pcb32_dacr
72e1e4f5b1Sdrahn #define	pcb_cstate	pcb_un.un_32.pcb32_cstate
73e1e4f5b1Sdrahn 
74e1e4f5b1Sdrahn /*
75e1e4f5b1Sdrahn  * WARNING!
76e1e4f5b1Sdrahn  * See warning for struct pcb_arm32, above, before changing struct pcb!
77e1e4f5b1Sdrahn  */
78e1e4f5b1Sdrahn struct pcb {
79e1e4f5b1Sdrahn 	u_int	pcb_flags;
80*c7b5578aSkettenis #define	PCB_FPU		0x00000001	/* Process had FPU initialized */
81e1e4f5b1Sdrahn 	struct	trapframe *pcb_tf;
82e1e4f5b1Sdrahn 	caddr_t	pcb_onfault;			/* On fault handler */
83e1e4f5b1Sdrahn 	union	{
84e1e4f5b1Sdrahn 		struct	pcb_arm32 un_32;
85e1e4f5b1Sdrahn 	} pcb_un;
86*c7b5578aSkettenis 	struct fpreg pcb_fpstate;	/* Floating Point state */
87*c7b5578aSkettenis 	struct cpu_info	*pcb_fpcpu;
88be8a2326Spatrick 	void	*pcb_tcb;
89e1e4f5b1Sdrahn };
90e1e4f5b1Sdrahn 
91e1e4f5b1Sdrahn #endif	/* _ARM_PCB_H_ */
92