pcpu.h revision 101898
180708Sjake/*-
281763Sobrien * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
380708Sjake * All rights reserved.
480708Sjake *
580708Sjake * Redistribution and use in source and binary forms, with or without
680708Sjake * modification, are permitted provided that the following conditions
780708Sjake * are met:
880708Sjake * 1. Redistributions of source code must retain the above copyright
980708Sjake *    notice, this list of conditions and the following disclaimer.
1080708Sjake * 2. Redistributions in binary form must reproduce the above copyright
1180708Sjake *    notice, this list of conditions and the following disclaimer in the
1280708Sjake *    documentation and/or other materials provided with the distribution.
1380708Sjake *
1481334Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1580708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1680708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1781334Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1880708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1980708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2080708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2180708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2280708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2380708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2480708Sjake * SUCH DAMAGE.
2580708Sjake *
2682905Sjake *	from: FreeBSD: src/sys/i386/include/globaldata.h,v 1.27 2001/04/27
2780708Sjake * $FreeBSD: head/sys/sparc64/include/pcpu.h 101898 2002-08-15 05:24:55Z jake $
2880708Sjake */
2980708Sjake
3087702Sjhb#ifndef	_MACHINE_PCPU_H_
3187702Sjhb#define	_MACHINE_PCPU_H_
3280708Sjake
3381763Sobrien#ifdef _KERNEL
3480708Sjake
3589035Sjake#include <machine/asmacros.h>
3685232Sjake#include <machine/frame.h>
3785232Sjake#include <machine/intr_machdep.h>
3885232Sjake
3982905Sjake#define	ALT_STACK_SIZE	128
4082905Sjake
4191617Sjakestruct vmspace;
4291617Sjake
4381763Sobrien/*
4481763Sobrien * Inside the kernel, the globally reserved register g7 is used to
4581763Sobrien * point at the globaldata structure.
4681763Sobrien */
4787702Sjhb#define	PCPU_MD_FIELDS							\
4897265Sjake	struct	intr_request pc_irpool[IR_FREE];			\
4997265Sjake	struct	intr_request *pc_irhead;				\
5097265Sjake	struct	intr_request **pc_irtail;				\
5197265Sjake	struct	intr_request *pc_irfree;				\
5291617Sjake	struct	vmspace *pc_vmspace;					\
5391617Sjake	vm_offset_t pc_addr;						\
5489035Sjake	u_int 	pc_mid;							\
55101898Sjake	u_int	pc_node;						\
5691613Sjake	u_int	pc_tlb_ctx;						\
5791613Sjake	u_int	pc_tlb_ctx_max;						\
5891613Sjake	u_int	pc_tlb_ctx_min;						\
5987702Sjhb	u_int	pc_wp_insn;			/* watch point support */ \
6087702Sjhb	u_long	pc_wp_pstate;						\
6187702Sjhb	u_long	pc_wp_va;						\
6287702Sjhb	int	pc_wp_mask
6385232Sjake
6489035Sjakestruct pcb;
6587702Sjhbstruct pcpu;
6685232Sjake
6789035Sjakeregister struct pcb *curpcb __asm__(__XSTRING(PCB_REG));
6889035Sjakeregister struct pcpu *pcpup __asm__(__XSTRING(PCPU_REG));
6980708Sjake
7087702Sjhb#define	PCPU_GET(member)	(pcpup->pc_ ## member)
7187702Sjhb#define	PCPU_PTR(member)	(&pcpup->pc_ ## member)
7287702Sjhb#define	PCPU_SET(member,value)	(pcpup->pc_ ## member = (value))
7387702Sjhb
7481763Sobrien#endif	/* _KERNEL */
7581763Sobrien
7687702Sjhb#endif	/* !_MACHINE_PCPU_H_ */
77