Home | History | Annotate | Line # | Download | only in include
pcb.h revision 1.10
      1 /* $NetBSD: pcb.h,v 1.10 2003/06/23 11:01:01 martin Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
      5  * All rights reserved.
      6  *
      7  * Author: Chris G. Demetriou
      8  *
      9  * Permission to use, copy, modify and distribute this software and
     10  * its documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie the
     27  * rights to redistribute these changes.
     28  */
     29 
     30 #ifndef _ALPHA_PCB_H_
     31 #define	_ALPHA_PCB_H_
     32 
     33 #include "opt_multiprocessor.h"
     34 
     35 #include <sys/lock.h>
     36 
     37 #include <machine/frame.h>
     38 #include <machine/reg.h>
     39 
     40 #include <machine/alpha_cpu.h>
     41 
     42 /*
     43  * PCB: process control block
     44  *
     45  * In this case, the hardware structure that is the defining element
     46  * for a process, and the additional state that must be saved by software
     47  * on a context switch.  Fields marked [HW] are mandated by hardware; fields
     48  * marked [SW] are for the software.
     49  *
     50  * It's said in the VMS PALcode section of the AARM that the pcb address
     51  * passed to the swpctx PALcode call has to be a physical address.  Not
     52  * knowing this (and trying a virtual) address proved this correct.
     53  * So we cache the physical address of the pcb in the md_proc struct.
     54  */
     55 struct pcb {
     56 	struct alpha_pcb pcb_hw;		/* PALcode defined */
     57 	unsigned long	pcb_context[9];		/* s[0-6], ra, ps	[SW] */
     58 	struct fpreg	pcb_fp;			/* FP registers		[SW] */
     59 	unsigned long	pcb_onfault;		/* for copy faults	[SW] */
     60 	unsigned long	pcb_accessaddr;		/* for [fs]uswintr	[SW] */
     61 	struct cpu_info * __volatile pcb_fpcpu;	/* CPU with our FP state[SW] */
     62 	struct simplelock pcb_fpcpu_slock;	/* simple lock on fpcpu [SW] */
     63 };
     64 
     65 #if defined(MULTIPROCESSOR)
     66 /*
     67  * Need to block IPIs while holding the fpcpu_slock.
     68  */
     69 #define	FPCPU_LOCK(pcb, s)						\
     70 do {									\
     71 	(s) = splhigh();						\
     72 	simple_lock(&(pcb)->pcb_fpcpu_slock);				\
     73 } while (/*CONSTCOND*/0)
     74 
     75 #define	FPCPU_UNLOCK(pcb, s)						\
     76 do {									\
     77 	simple_unlock(&(pcb)->pcb_fpcpu_slock);				\
     78 	splx((s));							\
     79 } while (/*CONSTCOND*/0)
     80 #else
     81 #define	FPCPU_LOCK(pcb, s)	simple_lock(&(pcb)->pcb_fpcpu_slock)
     82 #define	FPCPU_UNLOCK(pcb, s)	simple_unlock(&(pcb)->pcb_fpcpu_slock)
     83 #endif /* MULTIPROCESSOR */
     84 
     85 /*
     86  * The pcb is augmented with machine-dependent additional data for
     87  * core dumps. For the Alpha, that's a trap frame and the floating
     88  * point registers.
     89  */
     90 struct md_coredump {
     91 	struct	trapframe md_tf;
     92 	struct	fpreg md_fpstate;
     93 };
     94 #endif /* _ALPHA_PCB_H_ */
     95