1f9bac91bSBenno Rice /*- 251369649SPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 351369649SPedro F. Giffuni * 4f9bac91bSBenno Rice * Copyright (C) 1995, 1996 Wolfgang Solfrank. 5f9bac91bSBenno Rice * Copyright (C) 1995, 1996 TooLs GmbH. 6f9bac91bSBenno Rice * All rights reserved. 7f9bac91bSBenno Rice * 8f9bac91bSBenno Rice * Redistribution and use in source and binary forms, with or without 9f9bac91bSBenno Rice * modification, are permitted provided that the following conditions 10f9bac91bSBenno Rice * are met: 11f9bac91bSBenno Rice * 1. Redistributions of source code must retain the above copyright 12f9bac91bSBenno Rice * notice, this list of conditions and the following disclaimer. 13f9bac91bSBenno Rice * 2. Redistributions in binary form must reproduce the above copyright 14f9bac91bSBenno Rice * notice, this list of conditions and the following disclaimer in the 15f9bac91bSBenno Rice * documentation and/or other materials provided with the distribution. 16f9bac91bSBenno Rice * 3. All advertising materials mentioning features or use of this software 17f9bac91bSBenno Rice * must display the following acknowledgement: 18f9bac91bSBenno Rice * This product includes software developed by TooLs GmbH. 19f9bac91bSBenno Rice * 4. The name of TooLs GmbH may not be used to endorse or promote products 20f9bac91bSBenno Rice * derived from this software without specific prior written permission. 21f9bac91bSBenno Rice * 22f9bac91bSBenno Rice * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 23f9bac91bSBenno Rice * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24f9bac91bSBenno Rice * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25f9bac91bSBenno Rice * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26f9bac91bSBenno Rice * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27f9bac91bSBenno Rice * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 28f9bac91bSBenno Rice * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29f9bac91bSBenno Rice * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 30f9bac91bSBenno Rice * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 31f9bac91bSBenno Rice * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32f9bac91bSBenno Rice * 33f9bac91bSBenno Rice * $NetBSD: pcb.h,v 1.4 2000/06/04 11:57:17 tsubai Exp $ 34f9bac91bSBenno Rice * $FreeBSD$ 35f9bac91bSBenno Rice */ 36f9bac91bSBenno Rice 37f9bac91bSBenno Rice #ifndef _MACHINE_PCB_H_ 38f9bac91bSBenno Rice #define _MACHINE_PCB_H_ 39f9bac91bSBenno Rice 40a18c313eSNathan Whitehorn #include <machine/setjmp.h> 41f9bac91bSBenno Rice 42*ef1fcaf0SWarner Losh #ifndef _STANDALONE 43f9bac91bSBenno Rice struct pcb { 448b8aa9c1SBenno Rice register_t pcb_context[20]; /* non-volatile r14-r31 */ 454eed0cf1SBenno Rice register_t pcb_cr; /* Condition register */ 464eed0cf1SBenno Rice register_t pcb_sp; /* stack pointer */ 47c3e289e1SNathan Whitehorn register_t pcb_toc; /* toc pointer */ 484eed0cf1SBenno Rice register_t pcb_lr; /* link register */ 49f9bac91bSBenno Rice struct pmap *pcb_pm; /* pmap of our vmspace */ 50a18c313eSNathan Whitehorn jmp_buf *pcb_onfault; /* For use during 514eed0cf1SBenno Rice copyin/copyout */ 52f9bac91bSBenno Rice int pcb_flags; 53debe4455SNathan Whitehorn #define PCB_FPU 1 /* Process uses FPU */ 54debe4455SNathan Whitehorn #define PCB_FPREGS 2 /* Process had FPU registers initialized */ 55debe4455SNathan Whitehorn #define PCB_VEC 4 /* Process had Altivec initialized */ 5635f612b8SNathan Whitehorn #define PCB_VSX 8 /* Process had VSX initialized */ 57f9bac91bSBenno Rice struct fpu { 5835f612b8SNathan Whitehorn union { 5935f612b8SNathan Whitehorn double fpr; 6035f612b8SNathan Whitehorn uint32_t vsr[4]; 6135f612b8SNathan Whitehorn } fpr[32]; 62f9bac91bSBenno Rice double fpscr; /* FPSCR stored as double for easier access */ 63f9bac91bSBenno Rice } pcb_fpu; /* Floating point processor */ 64eeaa8979SBenno Rice unsigned int pcb_fpcpu; /* which CPU had our FPU 65eeaa8979SBenno Rice stuff. */ 661ac37bcbSNathan Whitehorn struct vec { 671ac37bcbSNathan Whitehorn uint32_t vr[32][4]; 68971e8cb1SJustin Hibbits uint32_t spare[2]; 69971e8cb1SJustin Hibbits uint32_t vrsave; 70971e8cb1SJustin Hibbits uint32_t vscr; /* aligned at vector element 3 */ 71c3e289e1SNathan Whitehorn } pcb_vec __aligned(16); /* Vector processor */ 721ac37bcbSNathan Whitehorn unsigned int pcb_veccpu; /* which CPU had our vector 731ac37bcbSNathan Whitehorn stuff. */ 74786e4a1bSRafal Jaworowski 75786e4a1bSRafal Jaworowski union { 76786e4a1bSRafal Jaworowski struct { 7795fa3335SNathan Whitehorn vm_offset_t usr_segm; /* Base address */ 78c3e289e1SNathan Whitehorn register_t usr_vsid; /* USER_SR segment */ 79786e4a1bSRafal Jaworowski } aim; 80786e4a1bSRafal Jaworowski struct { 810a35b40fSRafal Jaworowski register_t dbcr0; 82786e4a1bSRafal Jaworowski } booke; 83786e4a1bSRafal Jaworowski } pcb_cpu; 84f9bac91bSBenno Rice }; 85*ef1fcaf0SWarner Losh #endif 86f9bac91bSBenno Rice 87f9bac91bSBenno Rice #ifdef _KERNEL 88f9bac91bSBenno Rice 89f54721f6SMarcel Moolenaar struct trapframe; 90f54721f6SMarcel Moolenaar 91f9bac91bSBenno Rice #ifndef curpcb 92f9bac91bSBenno Rice extern struct pcb *curpcb; 93f9bac91bSBenno Rice #endif 94f9bac91bSBenno Rice 95f9bac91bSBenno Rice extern struct pmap *curpm; 96f9bac91bSBenno Rice extern struct proc *fpuproc; 97f9bac91bSBenno Rice 98abdc8ff1SPeter Grehan void makectx(struct trapframe *, struct pcb *); 992383d92aSNathan Whitehorn void savectx(struct pcb *) __returns_twice; 100abdc8ff1SPeter Grehan 101f9bac91bSBenno Rice #endif 102f9bac91bSBenno Rice #endif /* _MACHINE_PCB_H_ */ 103