xref: /freebsd/sys/arm/include/pcb.h (revision 95ee2897)
16fc729afSOlivier Houchard /*	$NetBSD: pcb.h,v 1.10 2003/10/13 21:46:39 scw Exp $	*/
26fc729afSOlivier Houchard 
3d8315c79SWarner Losh /*-
4af3dc4a7SPedro F. Giffuni  * SPDX-License-Identifier: BSD-4-Clause
5af3dc4a7SPedro F. Giffuni  *
66fc729afSOlivier Houchard  * Copyright (c) 2001 Matt Thomas <matt@3am-software.com>.
76fc729afSOlivier Houchard  * Copyright (c) 1994 Mark Brinicombe.
86fc729afSOlivier Houchard  * All rights reserved.
96fc729afSOlivier Houchard  *
106fc729afSOlivier Houchard  * Redistribution and use in source and binary forms, with or without
116fc729afSOlivier Houchard  * modification, are permitted provided that the following conditions
126fc729afSOlivier Houchard  * are met:
136fc729afSOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
146fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
156fc729afSOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
166fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
176fc729afSOlivier Houchard  *    documentation and/or other materials provided with the distribution.
186fc729afSOlivier Houchard  * 3. All advertising materials mentioning features or use of this software
196fc729afSOlivier Houchard  *    must display the following acknowledgement:
206fc729afSOlivier Houchard  *	This product includes software developed by the RiscBSD team.
216fc729afSOlivier Houchard  * 4. The name "RiscBSD" nor the name of the author may be used to
226fc729afSOlivier Houchard  *    endorse or promote products derived from this software without specific
236fc729afSOlivier Houchard  *    prior written permission.
246fc729afSOlivier Houchard  *
256fc729afSOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
266fc729afSOlivier Houchard  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
276fc729afSOlivier Houchard  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
286fc729afSOlivier Houchard  * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
296fc729afSOlivier Houchard  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
306fc729afSOlivier Houchard  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
316fc729afSOlivier Houchard  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
326fc729afSOlivier Houchard  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
336fc729afSOlivier Houchard  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
346fc729afSOlivier Houchard  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
356fc729afSOlivier Houchard  * SUCH DAMAGE.
366fc729afSOlivier Houchard  */
376fc729afSOlivier Houchard 
386fc729afSOlivier Houchard #ifndef	_MACHINE_PCB_H_
396fc729afSOlivier Houchard #define	_MACHINE_PCB_H_
406fc729afSOlivier Houchard 
41c4c27bc9SIan Lepore #include <machine/frame.h>
42dfe5f22fSMichal Meloun #include <machine/vfp.h>
436fc729afSOlivier Houchard 
446fc729afSOlivier Houchard /*
456fc729afSOlivier Houchard  * WARNING!
46c4c27bc9SIan Lepore  * Keep pcb_regs first for faster access in switch.S
476fc729afSOlivier Houchard  */
486fc729afSOlivier Houchard struct pcb {
49c4c27bc9SIan Lepore 	struct switchframe pcb_regs;		/* CPU state */
506fc729afSOlivier Houchard 	u_int	pcb_flags;
516fc729afSOlivier Houchard #define	PCB_OWNFPU	0x00000001
526fc729afSOlivier Houchard #define PCB_NOALIGNFLT	0x00000002
536fc729afSOlivier Houchard 	caddr_t	pcb_onfault;			/* On fault handler */
54676420e8SZbigniew Bodek 	vm_offset_t	pcb_pagedir;		/* TTB0 value */
55676420e8SZbigniew Bodek 	/*
56676420e8SZbigniew Bodek 	 * XXX:
57676420e8SZbigniew Bodek 	 * Variables pcb_pl1vec, pcb_l1vec, pcb_dacr are used solely
58676420e8SZbigniew Bodek 	 * by old PMAP. Keep them here for PCB binary compatibility
59676420e8SZbigniew Bodek 	 * between old and new PMAP.
60676420e8SZbigniew Bodek 	 */
61c4c27bc9SIan Lepore 	uint32_t *pcb_pl1vec;			/* PTR to vector_base L1 entry*/
62c4c27bc9SIan Lepore 	uint32_t pcb_l1vec;			/* Value to stuff on ctx sw */
63c4c27bc9SIan Lepore 	u_int	pcb_dacr;			/* Domain Access Control Reg */
64676420e8SZbigniew Bodek 
65cf1a573fSOleksandr Tymoshenko 	struct vfp_state pcb_vfpstate;          /* VP/NEON state */
66cf1a573fSOleksandr Tymoshenko 	u_int pcb_vfpcpu;                       /* VP/NEON last cpu */
676926e269SKornel Dulęba #define	PCB_FP_STARTED	0x01
686926e269SKornel Dulęba #define	PCB_FP_KERN	0x02
696926e269SKornel Dulęba #define	PCB_FP_NOSAVE	0x04
706926e269SKornel Dulęba 	struct vfp_state *pcb_vfpsaved;          /* VP/NEON state */
716926e269SKornel Dulęba 	int		pcb_fpflags;
723acd1dbcSOlivier Houchard } __aligned(8); /*
733acd1dbcSOlivier Houchard 		 * We need the PCB to be aligned on 8 bytes, as we may
74c4c27bc9SIan Lepore 		 * access it using ldrd/strd, and ARM ABI require it
753acd1dbcSOlivier Houchard 		 * to by aligned on 8 bytes.
763acd1dbcSOlivier Houchard 		 */
776fc729afSOlivier Houchard 
786fc729afSOlivier Houchard /*
796fc729afSOlivier Houchard  * No additional data for core dumps.
806fc729afSOlivier Houchard  */
816fc729afSOlivier Houchard struct md_coredump {
826fc729afSOlivier Houchard 	int	md_empty;
836fc729afSOlivier Houchard };
846fc729afSOlivier Houchard 
8533f588f1SOlivier Houchard void	makectx(struct trapframe *tf, struct pcb *pcb);
8633f588f1SOlivier Houchard 
876fc729afSOlivier Houchard #ifdef _KERNEL
88c5f7772fSOlivier Houchard 
89460378bfSDimitry Andric void    savectx(struct pcb *) __returns_twice;
906fc729afSOlivier Houchard #endif	/* _KERNEL */
916fc729afSOlivier Houchard 
926fc729afSOlivier Houchard #endif	/* !_MACHINE_PCB_H_ */
93