177957Sbenno/*- 277957Sbenno * Copyright (C) 1995, 1996 Wolfgang Solfrank. 377957Sbenno * Copyright (C) 1995, 1996 TooLs GmbH. 477957Sbenno * All rights reserved. 577957Sbenno * 677957Sbenno * Redistribution and use in source and binary forms, with or without 777957Sbenno * modification, are permitted provided that the following conditions 877957Sbenno * are met: 977957Sbenno * 1. Redistributions of source code must retain the above copyright 1077957Sbenno * notice, this list of conditions and the following disclaimer. 1177957Sbenno * 2. Redistributions in binary form must reproduce the above copyright 1277957Sbenno * notice, this list of conditions and the following disclaimer in the 1377957Sbenno * documentation and/or other materials provided with the distribution. 1477957Sbenno * 3. All advertising materials mentioning features or use of this software 1577957Sbenno * must display the following acknowledgement: 1677957Sbenno * This product includes software developed by TooLs GmbH. 1777957Sbenno * 4. The name of TooLs GmbH may not be used to endorse or promote products 1877957Sbenno * derived from this software without specific prior written permission. 1977957Sbenno * 2077957Sbenno * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 2177957Sbenno * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2277957Sbenno * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2377957Sbenno * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2477957Sbenno * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2577957Sbenno * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2677957Sbenno * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2777957Sbenno * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2877957Sbenno * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 2977957Sbenno * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3077957Sbenno * 3177957Sbenno * $NetBSD: pcb.h,v 1.4 2000/06/04 11:57:17 tsubai Exp $ 3277957Sbenno * $FreeBSD: releng/11.0/sys/powerpc/include/pcb.h 293636 2016-01-10 16:42:14Z nwhitehorn $ 3377957Sbenno */ 3477957Sbenno 3577957Sbenno#ifndef _MACHINE_PCB_H_ 3677957Sbenno#define _MACHINE_PCB_H_ 3777957Sbenno 38293636Snwhitehorn#include <machine/setjmp.h> 3977957Sbenno 4077957Sbennostruct pcb { 4199036Sbenno register_t pcb_context[20]; /* non-volatile r14-r31 */ 4291467Sbenno register_t pcb_cr; /* Condition register */ 4391467Sbenno register_t pcb_sp; /* stack pointer */ 44209975Snwhitehorn register_t pcb_toc; /* toc pointer */ 4591467Sbenno register_t pcb_lr; /* link register */ 4691467Sbenno struct pmap *pcb_pm; /* pmap of our vmspace */ 47293636Snwhitehorn jmp_buf *pcb_onfault; /* For use during 4891467Sbenno copyin/copyout */ 4991467Sbenno int pcb_flags; 50258257Snwhitehorn#define PCB_FPU 1 /* Process uses FPU */ 51258257Snwhitehorn#define PCB_FPREGS 2 /* Process had FPU registers initialized */ 52258257Snwhitehorn#define PCB_VEC 4 /* Process had Altivec initialized */ 53279189Snwhitehorn#define PCB_VSX 8 /* Process had VSX initialized */ 5477957Sbenno struct fpu { 55279189Snwhitehorn union { 56279189Snwhitehorn double fpr; 57279189Snwhitehorn uint32_t vsr[4]; 58279189Snwhitehorn } fpr[32]; 5991467Sbenno double fpscr; /* FPSCR stored as double for easier access */ 6077957Sbenno } pcb_fpu; /* Floating point processor */ 6196499Sbenno unsigned int pcb_fpcpu; /* which CPU had our FPU 6296499Sbenno stuff. */ 63188860Snwhitehorn struct vec { 64188860Snwhitehorn uint32_t vr[32][4]; 65276635Sjhibbits uint32_t spare[2]; 66276635Sjhibbits uint32_t vrsave; 67276635Sjhibbits uint32_t vscr; /* aligned at vector element 3 */ 68209975Snwhitehorn } pcb_vec __aligned(16); /* Vector processor */ 69188860Snwhitehorn unsigned int pcb_veccpu; /* which CPU had our vector 70188860Snwhitehorn stuff. */ 71176742Sraj 72176742Sraj union { 73176742Sraj struct { 74212715Snwhitehorn vm_offset_t usr_segm; /* Base address */ 75209975Snwhitehorn register_t usr_vsid; /* USER_SR segment */ 76176742Sraj } aim; 77176742Sraj struct { 78189100Sraj register_t dbcr0; 79176742Sraj } booke; 80176742Sraj } pcb_cpu; 8177957Sbenno}; 8277957Sbenno 8377957Sbenno#ifdef _KERNEL 8477957Sbenno 85160712Smarcelstruct trapframe; 86160712Smarcel 8777957Sbenno#ifndef curpcb 8877957Sbennoextern struct pcb *curpcb; 8977957Sbenno#endif 9077957Sbenno 9177957Sbennoextern struct pmap *curpm; 9277957Sbennoextern struct proc *fpuproc; 9377957Sbenno 94132067Sgrehanvoid makectx(struct trapframe *, struct pcb *); 95240860Snwhitehornvoid savectx(struct pcb *) __returns_twice; 96132067Sgrehan 9777957Sbenno#endif 9877957Sbenno#endif /* _MACHINE_PCB_H_ */ 99