16fc729afSOlivier Houchard /* $NetBSD: pcb.h,v 1.10 2003/10/13 21:46:39 scw Exp $ */ 26fc729afSOlivier Houchard 3d8315c79SWarner Losh /*- 46fc729afSOlivier Houchard * Copyright (c) 2001 Matt Thomas <matt@3am-software.com>. 56fc729afSOlivier Houchard * Copyright (c) 1994 Mark Brinicombe. 66fc729afSOlivier Houchard * All rights reserved. 76fc729afSOlivier Houchard * 86fc729afSOlivier Houchard * Redistribution and use in source and binary forms, with or without 96fc729afSOlivier Houchard * modification, are permitted provided that the following conditions 106fc729afSOlivier Houchard * are met: 116fc729afSOlivier Houchard * 1. Redistributions of source code must retain the above copyright 126fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer. 136fc729afSOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright 146fc729afSOlivier Houchard * notice, this list of conditions and the following disclaimer in the 156fc729afSOlivier Houchard * documentation and/or other materials provided with the distribution. 166fc729afSOlivier Houchard * 3. All advertising materials mentioning features or use of this software 176fc729afSOlivier Houchard * must display the following acknowledgement: 186fc729afSOlivier Houchard * This product includes software developed by the RiscBSD team. 196fc729afSOlivier Houchard * 4. The name "RiscBSD" nor the name of the author may be used to 206fc729afSOlivier Houchard * endorse or promote products derived from this software without specific 216fc729afSOlivier Houchard * prior written permission. 226fc729afSOlivier Houchard * 236fc729afSOlivier Houchard * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED 246fc729afSOlivier Houchard * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 256fc729afSOlivier Houchard * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 266fc729afSOlivier Houchard * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 276fc729afSOlivier Houchard * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 286fc729afSOlivier Houchard * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 296fc729afSOlivier Houchard * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 306fc729afSOlivier Houchard * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 316fc729afSOlivier Houchard * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 326fc729afSOlivier Houchard * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 336fc729afSOlivier Houchard * SUCH DAMAGE. 346fc729afSOlivier Houchard * 356fc729afSOlivier Houchard * $FreeBSD$ 366fc729afSOlivier Houchard */ 376fc729afSOlivier Houchard 386fc729afSOlivier Houchard #ifndef _MACHINE_PCB_H_ 396fc729afSOlivier Houchard #define _MACHINE_PCB_H_ 406fc729afSOlivier Houchard 416fc729afSOlivier Houchard #include <machine/fp.h> 426fc729afSOlivier Houchard 436fc729afSOlivier Houchard 446fc729afSOlivier Houchard struct trapframe; 456fc729afSOlivier Houchard 466fc729afSOlivier Houchard struct pcb_arm32 { 476fc729afSOlivier Houchard vm_offset_t pcb32_pagedir; /* PT hooks */ 486fc729afSOlivier Houchard uint32_t *pcb32_pl1vec; /* PTR to vector_base L1 entry*/ 496fc729afSOlivier Houchard uint32_t pcb32_l1vec; /* Value to stuff on ctx sw */ 506fc729afSOlivier Houchard u_int pcb32_dacr; /* Domain Access Control Reg */ 516fc729afSOlivier Houchard /* 526fc729afSOlivier Houchard * WARNING! 536fc729afSOlivier Houchard * cpuswitch.S relies on pcb32_r8 being quad-aligned in struct pcb 546fc729afSOlivier Houchard * (due to the use of "strd" when compiled for XSCALE) 556fc729afSOlivier Houchard */ 566fc729afSOlivier Houchard u_int pcb32_r8; /* used */ 576fc729afSOlivier Houchard u_int pcb32_r9; /* used */ 586fc729afSOlivier Houchard u_int pcb32_r10; /* used */ 596fc729afSOlivier Houchard u_int pcb32_r11; /* used */ 606fc729afSOlivier Houchard u_int pcb32_r12; /* used */ 616fc729afSOlivier Houchard u_int pcb32_sp; /* used */ 626fc729afSOlivier Houchard u_int pcb32_lr; 636fc729afSOlivier Houchard u_int pcb32_pc; 646fc729afSOlivier Houchard u_int pcb32_und_sp; 656fc729afSOlivier Houchard }; 666fc729afSOlivier Houchard #define pcb_pagedir un_32.pcb32_pagedir 676fc729afSOlivier Houchard #define pcb_pl1vec un_32.pcb32_pl1vec 686fc729afSOlivier Houchard #define pcb_l1vec un_32.pcb32_l1vec 696fc729afSOlivier Houchard #define pcb_dacr un_32.pcb32_dacr 706fc729afSOlivier Houchard #define pcb_cstate un_32.pcb32_cstate 716fc729afSOlivier Houchard 726fc729afSOlivier Houchard /* 736fc729afSOlivier Houchard * WARNING! 746fc729afSOlivier Houchard * See warning for struct pcb_arm32, above, before changing struct pcb! 756fc729afSOlivier Houchard */ 766fc729afSOlivier Houchard struct pcb { 776fc729afSOlivier Houchard u_int pcb_flags; 786fc729afSOlivier Houchard #define PCB_OWNFPU 0x00000001 796fc729afSOlivier Houchard #define PCB_NOALIGNFLT 0x00000002 806fc729afSOlivier Houchard caddr_t pcb_onfault; /* On fault handler */ 816fc729afSOlivier Houchard struct pcb_arm32 un_32; 82cf1a573fSOleksandr Tymoshenko struct vfp_state pcb_vfpstate; /* VP/NEON state */ 83cf1a573fSOleksandr Tymoshenko u_int pcb_vfpcpu; /* VP/NEON last cpu */ 84*3acd1dbcSOlivier Houchard } __aligned(8); /* 85*3acd1dbcSOlivier Houchard * We need the PCB to be aligned on 8 bytes, as we may 86*3acd1dbcSOlivier Houchard * access it using ldrd/strd, and some CPUs require it 87*3acd1dbcSOlivier Houchard * to by aligned on 8 bytes. 88*3acd1dbcSOlivier Houchard */ 896fc729afSOlivier Houchard 906fc729afSOlivier Houchard /* 916fc729afSOlivier Houchard * No additional data for core dumps. 926fc729afSOlivier Houchard */ 936fc729afSOlivier Houchard struct md_coredump { 946fc729afSOlivier Houchard int md_empty; 956fc729afSOlivier Houchard }; 966fc729afSOlivier Houchard 9733f588f1SOlivier Houchard void makectx(struct trapframe *tf, struct pcb *pcb); 9833f588f1SOlivier Houchard 996fc729afSOlivier Houchard #ifdef _KERNEL 100c5f7772fSOlivier Houchard 101460378bfSDimitry Andric void savectx(struct pcb *) __returns_twice; 1026fc729afSOlivier Houchard #endif /* _KERNEL */ 1036fc729afSOlivier Houchard 1046fc729afSOlivier Houchard #endif /* !_MACHINE_PCB_H_ */ 105