diff options
Diffstat (limited to 'sys/arch/alpha/include')
48 files changed, 1269 insertions, 492 deletions
diff --git a/sys/arch/alpha/include/alpha_cpu.h b/sys/arch/alpha/include/alpha_cpu.h new file mode 100644 index 00000000000..0c695e1612f --- /dev/null +++ b/sys/arch/alpha/include/alpha_cpu.h @@ -0,0 +1,281 @@ +/* $OpenBSD: alpha_cpu.h,v 1.1 1996/10/30 22:38:49 niklas Exp $ */ +/* $NetBSD: alpha_cpu.h,v 1.6 1996/08/20 23:02:17 cgd Exp $ */ + +/* + * Copyright (c) 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#ifndef __ALPHA_ALPHA_CPU_H__ +#define __ALPHA_ALPHA_CPU_H__ + +/* + * Alpha CPU + OSF/1 PALcode definitions for use by the kernel. + * + * Definitions for: + * + * Process Control Block + * Interrupt/Exception/Syscall Stack Frame + * Processor Status Register + * Machine Check Error Summary Register + * Machine Check Logout Area + * Virtual Memory Management + * Kernel Entry Vectors + * MMCSR Fault Type Codes + * Translation Buffer Invalidation + * + * and miscellaneous PALcode operations. + */ + + +/* + * Process Control Block definitions [OSF/1 PALcode Specific] + */ + +struct alpha_pcb { + unsigned long apcb_ksp; /* kernel stack ptr */ + unsigned long apcb_usp; /* user stack ptr */ + unsigned long apcb_ptbr; /* page table base reg */ + unsigned int apcb_cpc; /* charged process cycles */ + unsigned int apcb_asn; /* address space number */ + unsigned long apcb_unique; /* process unique value */ + unsigned long apcb_flags; /* flags; see below */ + unsigned long apcb_decrsv0; /* DEC reserved */ + unsigned long apcb_decrsv1; /* DEC reserved */ +}; + +#define ALPHA_PCB_FLAGS_FEN 0x0000000000000001 +#define ALPHA_PCB_FLAGS_PME 0x4000000000000000 + +/* + * Interrupt/Exception/Syscall "Hardware" (really PALcode) + * Stack Frame definitions + * + * These are quadword offsets from the sp on kernel entry, i.e. + * to get to the value in question you access (sp + (offset * 8)). + * + * On syscall entry, A0-A2 aren't written to memory but space + * _is_ reserved for them. + */ + +#define ALPHA_HWFRAME_PS 0 /* processor status register */ +#define ALPHA_HWFRAME_PC 1 /* program counter */ +#define ALPHA_HWFRAME_GP 2 /* global pointer */ +#define ALPHA_HWFRAME_A0 3 /* a0 */ +#define ALPHA_HWFRAME_A1 4 /* a1 */ +#define ALPHA_HWFRAME_A2 5 /* a2 */ + +#define ALPHA_HWFRAME_SIZE 6 /* 6 8-byte words */ + +/* + * Processor Status Register [OSF/1 PALcode Specific] + * + * Includes user/kernel mode bit, interrupt priority levels, etc. + */ + +#define ALPHA_PSL_USERMODE 0x0008 /* set -> user mode */ +#define ALPHA_PSL_IPL_MASK 0x0007 /* interrupt level mask */ + +#define ALPHA_PSL_IPL_0 0x0000 /* all interrupts enabled */ +#define ALPHA_PSL_IPL_SOFT 0x0001 /* software ints disabled */ +#define ALPHA_PSL_IPL_IO 0x0004 /* I/O dev ints disabled */ +#define ALPHA_PSL_IPL_CLOCK 0x0005 /* clock ints disabled */ +#define ALPHA_PSL_IPL_HIGH 0x0006 /* all but mchecks disabled */ + +#define ALPHA_PSL_MUST_BE_ZERO 0xfffffffffffffff0 + +/* Convenience constants: what must be set/clear in user mode */ +#define ALPHA_PSL_USERSET ALPHA_PSL_USERMODE +#define ALPHA_PSL_USERCLR (ALPHA_PSL_MUST_BE_ZERO | ALPHA_PSL_IPL_MASK) + +/* + * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific] + * + * The following bits are values as read. On write, _PCE, _SCE, and + * _MIP are "write 1 to clear." + */ + +#define ALPHA_MCES_IMP \ + 0xffffffff00000000 /* impl. dependent */ +#define ALPHA_MCES_RSVD \ + 0x00000000ffffffe0 /* reserved */ +#define ALPHA_MCES_DSC \ + 0x0000000000000010 /* disable system correctable error reporting */ +#define ALPHA_MCES_DPC \ + 0x0000000000000008 /* disable processor correctable error reporting */ +#define ALPHA_MCES_PCE \ + 0x0000000000000004 /* processor correctable error in progress */ +#define ALPHA_MCES_SCE \ + 0x0000000000000002 /* system correctable error in progress */ +#define ALPHA_MCES_MIP \ + 0x0000000000000001 /* machine check in progress */ + +/* + * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific] + */ + +struct alpha_logout_area { + unsigned int la_frame_size; /* frame size */ + unsigned int la_flags; /* flags; see below */ + unsigned int la_cpu_offset; /* offset to cpu area */ + unsigned int la_system_offset; /* offset to system area */ +}; + +#define ALPHA_LOGOUT_FLAGS_RETRY 0x80000000 /* OK to continue */ +#define ALPHA_LOGOUT_FLAGS_SE 0x40000000 /* second error */ +#define ALPHA_LOGOUT_FLAGS_SBZ 0x3fffffff /* should be zero */ + +#define ALPHA_LOGOUT_NOT_BUILT \ + (struct alpha_logout_area *)0xffffffffffffffff) + +#define ALPHA_LOGOUT_PAL_AREA(lap) \ + (unsigned long *)((unsigned char *)(lap) + 16) +#define ALPHA_LOGOUT_PAL_SIZE(lap) \ + ((lap)->la_cpu_offset - 16) +#define ALPHA_LOGOUT_CPU_AREA(lap) \ + (unsigned long *)((unsigned char *)(lap) + (lap)->la_cpu_offset) +#define ALPHA_LOGOUT_CPU_SIZE(lap) \ + ((lap)->la_system_offset - (lap)->la_cpu_offset) +#define ALPHA_LOGOUT_SYSTEM_AREA(lap) \ + (unsigned long *)((unsigned char *)(lap) + (lap)->la_system_offset) +#define ALPHA_LOGOUT_SYSTEM_SIZE(lap) \ + ((lap)->la_frame_size - (lap)->la_system_offset) + +/* + * Virtual Memory Management definitions [OSF/1 PALcode Specific] + * + * Includes user and kernel space addresses and information, + * page table entry definitions, etc. + * + * NOTE THAT THESE DEFINITIONS MAY CHANGE IN FUTURE ALPHA CPUS! + */ + +#define ALPHA_PGSHIFT 13 +#define ALPHA_PGBYTES (1 << ALPHA_PGSHIFT) + +#define ALPHA_USEG_BASE 0 /* virtual */ +#define ALPHA_USEG_END 0x000003ffffffffff + +#define ALPHA_K0SEG_BASE 0xfffffc0000000000 /* direct-mapped */ +#define ALPHA_K0SEG_END 0xfffffdffffffffff +#define ALPHA_K1SEG_BASE 0xfffffe0000000000 /* virtual */ +#define ALPHA_K1SEG_END 0xffffffffffffffff + +#define ALPHA_K0SEG_TO_PHYS(x) ((x) & 0x00000003ffffffff) +#define ALPHA_PHYS_TO_K0SEG(x) ((x) | ALPHA_K0SEG_BASE) + +#define ALPHA_PTE_VALID 0x0001 + +#define ALPHA_PTE_FAULT_ON_READ 0x0002 +#define ALPHA_PTE_FAULT_ON_WRITE 0x0004 +#define ALPHA_PTE_FAULT_ON_EXECUTE 0x0008 + +#define ALPHA_PTE_ASM 0x0010 /* addr. space match */ +#define ALPHA_PTE_GRANULARITY 0x0060 /* granularity hint */ + +#define ALPHA_PTE_PROT 0xff00 +#define ALPHA_PTE_KR 0x0100 +#define ALPHA_PTE_UR 0x0200 +#define ALPHA_PTE_KW 0x1000 +#define ALPHA_PTE_UW 0x2000 + +#define ALPHA_PTE_WRITE (ALPHA_PTE_KW | ALPHA_PTE_KW) + +#define ALPHA_PTE_SOFTWARE 0xffff0000 + +#define ALPHA_PTE_PFN 0xffffffff00000000 + +#define ALPHA_PTE_TO_PFN(pte) ((pte) >> 32) +#define ALPHA_PTE_FROM_PFN(pfn) ((pfn) << 32) + +typedef unsigned long alpha_pt_entry_t; + +/* + * Kernel Entry Vectors. [OSF/1 PALcode Specific] + */ + +#define ALPHA_KENTRY_INT 0 +#define ALPHA_KENTRY_ARITH 1 +#define ALPHA_KENTRY_MM 2 +#define ALPHA_KENTRY_IF 3 +#define ALPHA_KENTRY_UNA 4 +#define ALPHA_KENTRY_SYS 5 + +/* + * MMCSR Fault Type Codes. [OSF/1 PALcode Specific] + */ + +#define ALPHA_MMCSR_INVALTRANS 0 +#define ALPHA_MMCSR_ACCESS 1 +#define ALPHA_MMCSR_FOR 2 +#define ALPHA_MMCSR_FOE 3 +#define ALPHA_MMCSR_FOW 4 + +/* + * Instruction Fault Type Codes. [OSF/1 PALcode Specific] + */ + +#define ALPHA_IF_CODE_BPT 0 +#define ALPHA_IF_CODE_BUGCHK 1 +#define ALPHA_IF_CODE_GENTRAP 2 +#define ALPHA_IF_CODE_FEN 3 +#define ALPHA_IF_CODE_OPDEC 4 + +/* + * Translation Buffer Invalidation definitions [OSF/1 PALcode Specific] + */ + +#define ALPHA_TBIA() alpha_pal_tbi(-2, 0) /* all TB entries */ +#define ALPHA_TBIAP() alpha_pal_tbi(-1, 0) /* all per-process */ +#define ALPHA_TBISI(va) alpha_pal_tbi(1, (va)) /* ITB entry for va */ +#define ALPHA_TBISD(va) alpha_pal_tbi(2, (va)) /* DTB entry for va */ +#define ALPHA_TBIS(va) alpha_pal_tbi(3, (va)) /* all for va */ + +/* + * Stubs for Alpha instructions normally inaccessible from C. + */ +unsigned long alpha_rpcc __P((void)); +void alpha_mb __P((void)); +void alpha_wmb __P((void)); + +/* + * Stubs for OSF/1 PALcode operations. + */ +void alpha_pal_imb __P((void)); +void alpha_pal_draina __P((void)); +void alpha_pal_halt __P((void)) __attribute__((__noreturn__)); +unsigned long alpha_pal_rdmces __P((void)); +unsigned long alpha_pal_rdusp __P((void)); +unsigned long alpha_pal_swpipl __P((unsigned long)); +unsigned long _alpha_pal_swpipl __P((unsigned long)); /* for profiling */ +void alpha_pal_tbi __P((unsigned long, vm_offset_t)); +unsigned long alpha_pal_whami __P((void)); +void alpha_pal_wrent __P((void *, unsigned long)); +void alpha_pal_wrfen __P((unsigned long)); +void alpha_pal_wrusp __P((unsigned long)); +void alpha_pal_wrvptptr __P((unsigned long)); +void alpha_pal_wrmces __P((unsigned long)); + +#endif __ALPHA_ALPHA_CPU_H__ diff --git a/sys/arch/alpha/include/ansi.h b/sys/arch/alpha/include/ansi.h index 6e005d9b3b6..7e529f40e07 100644 --- a/sys/arch/alpha/include/ansi.h +++ b/sys/arch/alpha/include/ansi.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ansi.h,v 1.4 1996/07/29 22:58:23 niklas Exp $ */ -/* $NetBSD: ansi.h,v 1.4 1996/03/16 01:31:45 jtc Exp $ */ +/* $OpenBSD: ansi.h,v 1.5 1996/10/30 22:38:50 niklas Exp $ */ +/* $NetBSD: ansi.h,v 1.5 1996/10/09 21:13:04 cgd Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -55,7 +55,8 @@ #define _BSD_TIME_T_ int /* time() */ typedef struct { char *base; - long offset; + int offset; + int pad; } __va_list; #define _BSD_VA_LIST_ __va_list /* va_list */ diff --git a/sys/arch/alpha/include/trap.h b/sys/arch/alpha/include/aout_machdep.h index 78a6ef53ec6..badaa8c07d8 100644 --- a/sys/arch/alpha/include/trap.h +++ b/sys/arch/alpha/include/aout_machdep.h @@ -1,5 +1,4 @@ -/* $OpenBSD: trap.h,v 1.2 1996/07/29 22:59:25 niklas Exp $ */ -/* $NetBSD: trap.h,v 1.1 1995/02/13 23:07:58 cgd Exp $ */ +/* $NetBSD: aout_machdep.h,v 1.1 1995/02/13 23:07:37 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -28,22 +27,12 @@ * rights to redistribute these changes. */ -#define T_ASTFLT 0x00 -#define T_UNAFLT 0x01 -#define T_ARITHFLT 0x02 +#ifndef _ALPHA_EXEC_H_ +#define _ALPHA_EXEC_H_ -#define T_IFLT 0x10 -#define T_BPT (T_IFLT|0x00) -#define T_BUGCHK (T_IFLT|0x01) -#define T_GENTRAP (T_IFLT|0x02) -#define T_FPDISABLED (T_IFLT|0x03) -#define T_OPDEC (T_IFLT|0x04) +#define cpu_exec_aout_makecmds(p, epp) ENOEXEC -#define T_MMFLT 0x20 -#define T_INVALTRANS (T_MMFLT|0x00) -#define T_ACCESS (T_MMFLT|0x01) -#define T_FOR (T_MMFLT|0x02) -#define T_FOE (T_MMFLT|0x03) -#define T_FOW (T_MMFLT|0x04) +/* Size of a page in an object file. */ +#define __LDPGSZ 8192 -#define T_USER 0x80 /* user-mode flag or'ed with type */ +#endif /* !_ALPHA_EXEC_H_ */ diff --git a/sys/arch/alpha/include/asm.h b/sys/arch/alpha/include/asm.h index 2c96e4c625c..0dbea2e046f 100644 --- a/sys/arch/alpha/include/asm.h +++ b/sys/arch/alpha/include/asm.h @@ -1,5 +1,5 @@ -/* $OpenBSD: asm.h,v 1.4 1996/07/29 22:58:25 niklas Exp $ */ -/* $NetBSD: asm.h,v 1.4 1996/04/12 01:36:51 cgd Exp $ */ +/* $OpenBSD: asm.h,v 1.5 1996/10/30 22:38:52 niklas Exp $ */ +/* $NetBSD: asm.h,v 1.10 1996/10/17 18:33:53 cgd Exp $ */ /* * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University @@ -130,6 +130,22 @@ #define ai $25 /* (T) argument information */ #define pv $27 /* (T) procedure value */ + +/* + * Useful stuff. + */ +#ifdef __STDC__ +#define __CONCAT(a,b) a ## b +#else +#define __CONCAT(a,b) a/**/b +#endif +#define ___CONCAT(a,b) __CONCAT(a,b) + +/* + * Macro to make a local label name. + */ +#define LLABEL(name,num) ___CONCAT(___CONCAT(L,name),num) + /* * * Debuggers need symbol table information to be able to properly @@ -203,18 +219,9 @@ #define MCOUNT /* nothing */ #else #define MCOUNT \ - lda sp, -16(sp); \ - stq pv, 0(sp); \ - \ - br pv, 1f; \ -1: ldgp gp, 0(pv); \ - lda pv, _mcount; \ - jsr at_reg, (pv); \ - br pv, 2f; \ -2: ldgp gp, 0(pv); \ - \ - ldq pv, 0(sp); \ - lda sp, 16(sp) + .set noat; \ + jsr at_reg,_mcount; \ + .set at #endif /* @@ -434,26 +441,26 @@ _name_:; \ * Allocate space for a message (a read-only ascii string) */ #define ASCIZ .asciz -#define MSG(msg,reg) \ - lda reg, 9f; \ +#define MSG(msg,reg,label) \ + lda reg, label; \ .data; \ -9: ASCIZ msg; \ +label: ASCIZ msg; \ .text; /* * PRINTF * Print a message */ -#define PRINTF(msg) \ - MSG(msg,a0); \ +#define PRINTF(msg,label) \ + MSG(msg,a0,label); \ CALL(printf) /* * PANIC * Fatal error (KERNEL) */ -#define PANIC(msg) \ - MSG(msg,a0); \ +#define PANIC(msg,label) \ + MSG(msg,a0,label); \ CALL(panic) /* @@ -541,9 +548,10 @@ _name_:; \ * are unprivileged. */ -/* Common PAL codes. */ +/* Common PAL function codes. */ #define PAL_halt 0x0000 /* P */ #define PAL_draina 0x0002 /* P */ +#define PAL_cserve 0x0009 /* P */ #define PAL_swppal 0x000a /* P */ #define PAL_bpt 0x0080 /* U */ #define PAL_bugchk 0x0081 /* U */ @@ -552,7 +560,7 @@ _name_:; \ #define PAL_wrunique 0x009f /* U */ #define PAL_gentrap 0x00aa /* U */ -/* VMS PAL codes. */ +/* VMS PAL function codes. */ #define PAL_VMS_ldqp 0x0003 /* P */ #define PAL_VMS_stqp 0x0004 /* P */ #define PAL_VMS_mtpr_fen 0x000c /* P */ @@ -575,7 +583,9 @@ _name_:; \ #define PAL_VMS_mfpr_whami 0x003f /* P */ #define PAL_VMS_rei 0x0092 /* U */ -/* OSF/1 PAL codes. */ +/* OSF/1 PAL function codes. */ +#define PAL_OSF1_rdmces 0x0010 /* P */ +#define PAL_OSF1_wrmces 0x0011 /* P */ #define PAL_OSF1_wrfen 0x002b /* P */ #define PAL_OSF1_wrvptptr 0x002d /* P */ #define PAL_OSF1_swpctx 0x0030 /* P */ @@ -594,13 +604,28 @@ _name_:; \ #define PAL_OSF1_callsys 0x0083 /* U */ #define PAL_OSF1_imb 0x0086 /* U */ + /* - * Defintions to make things portable between gcc and OSF/1 cc. + * System call glue. */ -#define SETGP(pv) ldgp gp,0(pv) +#define SYSCALLNUM(name) \ + ___CONCAT(SYS_,name) -#define MF_FPCR(x) mf_fpcr x -#define MT_FPCR(x) mt_fpcr x -#define JMP(loc) jmp zero,loc -#define CONST(c,reg) ldiq reg, c +#define CALLSYS_NOERROR(name) \ + ldiq v0, SYSCALLNUM(name); \ + call_pal PAL_OSF1_callsys + +/* + * Load the global pointer. + */ +#define LDGP(reg) \ + ldgp gp, 0(reg) +/* + * WEAK_ALIAS: create a weak alias (ELF only). + */ +#ifdef __ELF__ +#define WEAK_ALIAS(alias,sym) \ + .weak alias; \ + alias = sym +#endif diff --git a/sys/arch/alpha/include/autoconf.h b/sys/arch/alpha/include/autoconf.h index 5531aa9d3f6..517d0f2fc5f 100644 --- a/sys/arch/alpha/include/autoconf.h +++ b/sys/arch/alpha/include/autoconf.h @@ -1,5 +1,5 @@ -/* $OpenBSD: autoconf.h,v 1.5 1996/10/18 14:47:07 niklas Exp $ */ -/* $NetBSD: autoconf.h,v 1.2.4.2 1996/06/13 18:35:23 cgd Exp $ */ +/* $OpenBSD: autoconf.h,v 1.6 1996/10/30 22:38:54 niklas Exp $ */ +/* $NetBSD: autoconf.h,v 1.5 1996/07/14 04:12:59 cgd Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -81,10 +81,12 @@ struct bootdev_data { char *ctrl_dev_type; }; -void device_register __P((struct device *, void *)); -void set_clockintr __P((void)); -void set_iointr __P((void (*)(void *, int))); -int badaddr __P((void *, u_int64_t)); +void set_clockintr __P((void)); +void set_iointr __P((void (*)(void *, unsigned long))); +int badaddr __P((void *, size_t)); +void configure __P((void)); +void device_register __P((struct device *, void *)); +void dumpconf __P((void)); #ifdef EVCNT_COUNTERS extern struct evcnt clock_intr_evcnt; diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index 61cd8cbcbe5..75e7d3fe992 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -1,5 +1,5 @@ -/* $OpenBSD: bus.h,v 1.2 1996/07/29 22:58:29 niklas Exp $ */ -/* $NetBSD: bus.h,v 1.2.4.2 1996/06/13 17:44:45 cgd Exp $ */ +/* $OpenBSD: bus.h,v 1.3 1996/10/30 22:38:55 niklas Exp $ */ +/* $NetBSD: bus.h,v 1.4 1996/06/11 21:16:21 cgd Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. diff --git a/sys/arch/alpha/include/cdefs.h b/sys/arch/alpha/include/cdefs.h index c39c2620736..05b289d79c4 100644 --- a/sys/arch/alpha/include/cdefs.h +++ b/sys/arch/alpha/include/cdefs.h @@ -1,8 +1,8 @@ -/* $OpenBSD: cdefs.h,v 1.4 1996/07/29 22:58:30 niklas Exp $ */ -/* $NetBSD: cdefs.h,v 1.2 1995/05/03 00:13:55 cgd Exp $ */ +/* $OpenBSD: cdefs.h,v 1.5 1996/10/30 22:38:56 niklas Exp $ */ +/* $NetBSD: cdefs.h,v 1.5 1996/10/12 18:08:12 cgd Exp $ */ /* - * Copyright (c) 1995 Carnegie-Mellon University. + * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. * * Author: Chris G. Demetriou @@ -33,7 +33,35 @@ #define _C_LABEL(x) _STRING(x) -#define __indr_references(sym,msg) /* nothing */ +#ifdef __ELF__ + +#define __indr_reference(sym,alias) /* nada, since we do weak refs */ + +#ifdef __STDC__ + +#define __weak_alias(alias,sym) \ + __asm__(".weak " #alias " ; " #alias " = " #sym) +#define __warn_references(sym,msg) \ + __asm__(".section .gnu.warning." #sym " ; .ascii \"" msg "\" ; .text") + +#else /* !__STDC__ */ + +#define __weak_alias(alias,sym) \ + __asm__(".weak alias ; alias = sym") +#define __warn_references(sym,msg) \ + __asm__(".section .gnu.warning.sym ; .ascii msg ; .text") + +#endif /* !__STDC__ */ + +#else /* !__ELF__ */ + +/* + * Very little to do if not ELF: we support neither indirect or + * weak references, and don't do anything with warnings. + */ + #define __warn_references(sym,msg) /* nothing */ +#endif /* !__ELF__ */ + #endif /* !_MACHINE_CDEFS_H_ */ diff --git a/sys/arch/alpha/include/cfbreg.h b/sys/arch/alpha/include/cfbreg.h index 4707077c82b..d5e7222a6ad 100644 --- a/sys/arch/alpha/include/cfbreg.h +++ b/sys/arch/alpha/include/cfbreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cfbreg.h,v 1.2 1996/07/29 22:58:32 niklas Exp $ */ +/* $OpenBSD: cfbreg.h,v 1.3 1996/10/30 22:38:57 niklas Exp $ */ /* $NetBSD: cfbreg.h,v 1.1 1996/05/01 23:25:00 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h index 9dbabd53d4a..cb08112157d 100644 --- a/sys/arch/alpha/include/cpu.h +++ b/sys/arch/alpha/include/cpu.h @@ -1,5 +1,5 @@ -/* $OpenBSD: cpu.h,v 1.4 1996/07/29 22:58:33 niklas Exp $ */ -/* $NetBSD: cpu.h,v 1.7.4.1 1996/06/14 20:42:44 cgd Exp $ */ +/* $OpenBSD: cpu.h,v 1.5 1996/10/30 22:38:58 niklas Exp $ */ +/* $NetBSD: cpu.h,v 1.12 1996/07/14 04:15:10 cgd Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -66,9 +66,11 @@ struct clockframe { struct trapframe cf_tf; }; -#define CLKF_USERMODE(framep) (((framep)->cf_tf.tf_ps & PSL_U) != 0) -#define CLKF_BASEPRI(framep) (((framep)->cf_tf.tf_ps & PSL_IPL) == 0) -#define CLKF_PC(framep) ((framep)->cf_tf.tf_pc) +#define CLKF_USERMODE(framep) \ + (((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0) +#define CLKF_BASEPRI(framep) \ + (((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_IPL_MASK) == 0) +#define CLKF_PC(framep) ((framep)->cf_tf.tf_regs[FRAME_PC]) /* * XXX No way to accurately tell if we were in interrupt mode before taking * clock interrupt. @@ -101,28 +103,22 @@ u_int64_t want_resched; /* resched() was called */ /* - * simulated software interrupt register - */ -extern u_int64_t ssir; - -#define SIR_NET 0x1 -#define SIR_CLOCK 0x2 - -#define siroff(x) ssir &= ~(x) -#define setsoftnet() ssir |= SIR_NET -#define setsoftclock() ssir |= SIR_CLOCK - -/* * CTL_MACHDEP definitions. */ #define CPU_CONSDEV 1 /* dev_t: console terminal device */ #define CPU_ROOT_DEVICE 2 /* string: root device name */ -#define CPU_MAXID 3 /* number of valid machdep ids */ +#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */ +#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */ +#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */ +#define CPU_MAXID 6 /* 5 valid machdep IDs */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ { "console_device", CTLTYPE_STRUCT }, \ { "root_device", CTLTYPE_STRING }, \ + { "unaligned_print", CTLTYPE_INT }, \ + { "unaligned_fix", CTLTYPE_INT }, \ + { "unaligned_sigbus", CTLTYPE_INT }, \ } #endif /* _ALPHA_CPU_H_ */ diff --git a/sys/arch/alpha/include/db_machdep.h b/sys/arch/alpha/include/db_machdep.h index d7f713a78ba..7a5aadc64b6 100644 --- a/sys/arch/alpha/include/db_machdep.h +++ b/sys/arch/alpha/include/db_machdep.h @@ -1,5 +1,5 @@ -/* $OpenBSD: db_machdep.h,v 1.2 1996/07/29 22:58:35 niklas Exp $ */ -/* $NetBSD: db_machdep.h,v 1.1 1995/11/23 02:35:54 cgd Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.3 1996/10/30 22:38:58 niklas Exp $ */ +/* $NetBSD: db_machdep.h,v 1.2 1996/07/11 05:31:31 cgd Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. @@ -46,12 +46,12 @@ typedef struct trapframe db_regs_t; db_regs_t ddb_regs; /* register state */ #define DDB_REGS (&ddb_regs) -#define PC_REGS(regs) ((db_addr_t)(regs)->tf_pc) +#define PC_REGS(regs) ((db_addr_t)(regs)->tf_regs[FRAME_PC]) #define BKPT_INST 0x00000080 /* breakpoint instruction */ #define BKPT_SIZE (4) /* size of breakpoint inst */ #define BKPT_SET(inst) (BKPT_INST) -#define FIXUP_PC_AFTER_BREAK ddb_regs.tf_pc -= BKPT_SIZE; +#define FIXUP_PC_AFTER_BREAK ddb_regs.tf_regs[FRAME_PC] -= BKPT_SIZE; #endif /* _ALPHA_DB_MACHDEP_H_ */ diff --git a/sys/arch/alpha/include/disklabel.h b/sys/arch/alpha/include/disklabel.h index fe4987cfead..0bdfb430483 100644 --- a/sys/arch/alpha/include/disklabel.h +++ b/sys/arch/alpha/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.2 1996/07/29 22:58:37 niklas Exp $ */ +/* $OpenBSD: disklabel.h,v 1.3 1996/10/30 22:38:59 niklas Exp $ */ /* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/ecoff.h b/sys/arch/alpha/include/ecoff.h index a6d8b13363f..b605b5421f2 100644 --- a/sys/arch/alpha/include/ecoff.h +++ b/sys/arch/alpha/include/ecoff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ecoff.h,v 1.5 1996/07/29 22:58:39 niklas Exp $ */ +/* $OpenBSD: ecoff.h,v 1.6 1996/10/30 22:39:00 niklas Exp $ */ /* $NetBSD: ecoff.h,v 1.3 1996/05/09 23:47:25 cgd Exp $ */ /* @@ -43,10 +43,10 @@ u_long gp_value #define ECOFF_MAGIC_ALPHA 0603 -#define ECOFF_MAGIC_NETBSD_ALPHA 0605 +#define ECOFF_MAGIC_NATIVE_ALPHA 0605 #define ECOFF_BADMAG(ep) \ ((ep)->f.f_magic != ECOFF_MAGIC_ALPHA && \ - (ep)->f.f_magic != ECOFF_MAGIC_NETBSD_ALPHA) + (ep)->f.f_magic != ECOFF_MAGIC_NATIVE_ALPHA) #define ECOFF_FLAG_EXEC 0002 #define ECOFF_SEGMENT_ALIGNMENT(ep) \ @@ -93,3 +93,8 @@ struct ecoff_extsym { unsigned :29; int es_indexfld; }; + +#ifdef _KERNEL +void cpu_exec_ecoff_setregs + __P((struct proc *, struct exec_package *, u_long, register_t *)); +#endif diff --git a/sys/arch/alpha/include/ecoff_machdep.h b/sys/arch/alpha/include/ecoff_machdep.h new file mode 100644 index 00000000000..9f2d2447113 --- /dev/null +++ b/sys/arch/alpha/include/ecoff_machdep.h @@ -0,0 +1,95 @@ +/* $OpenBSD: ecoff_machdep.h,v 1.1 1996/10/30 22:39:01 niklas Exp $ */ +/* $NetBSD: ecoff_machdep.h,v 1.3 1996/05/09 23:47:25 cgd Exp $ */ + +/* + * Copyright (c) 1994 Adam Glass + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Adam Glass. + * 4. The name of the Author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL Adam Glass BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define ECOFF_LDPGSZ 4096 + +#define ECOFF_PAD \ + u_short bldrev; /* XXX */ + +#define ECOFF_MACHDEP \ + u_int gprmask; \ + u_int fprmask; \ + u_long gp_value + +#define ECOFF_MAGIC_ALPHA 0603 +#define ECOFF_MAGIC_NATIVE_ALPHA 0605 +#define ECOFF_BADMAG(ep) \ + ((ep)->f.f_magic != ECOFF_MAGIC_ALPHA && \ + (ep)->f.f_magic != ECOFF_MAGIC_NATIVE_ALPHA) + +#define ECOFF_FLAG_EXEC 0002 +#define ECOFF_SEGMENT_ALIGNMENT(ep) \ + (((ep)->f.f_flags & ECOFF_FLAG_EXEC) == 0 ? 8 : 16) + +struct ecoff_symhdr { + int16_t magic; + int16_t vstamp; + int32_t lineMax; + int32_t densenumMax; + int32_t procMax; + int32_t lsymMax; + int32_t optsymMax; + int32_t auxsymMax; + int32_t lstrMax; + int32_t estrMax; + int32_t fdMax; + int32_t rfdMax; + int32_t esymMax; + long linesize; + long cbLineOffset; + long cbDnOffset; + long cbPdOffset; + long cbSymOffset; + long cbOptOffset; + long cbAuxOffset; + long cbSsOffset; + long cbSsExtOffset; + long cbFdOffset; + long cbRfdOffset; + long cbExtOffset; +}; + +struct ecoff_extsym { + long es_value; + int es_strindex; + unsigned es_type:6; + unsigned es_class:5; + unsigned :1; + unsigned es_symauxindex:20; + unsigned es_jmptbl:1; + unsigned es_cmain:1; + unsigned es_weakext:1; + unsigned :29; + int es_indexfld; +}; diff --git a/sys/arch/alpha/include/elf_machdep.h b/sys/arch/alpha/include/elf_machdep.h new file mode 100644 index 00000000000..5f6c6b545f7 --- /dev/null +++ b/sys/arch/alpha/include/elf_machdep.h @@ -0,0 +1,9 @@ +/* $OpenBSD: elf_machdep.h,v 1.1 1996/10/30 22:39:02 niklas Exp $ */ +/* $NetBSD: elf_machdep.h,v 1.1 1996/09/26 21:50:57 cgd Exp $ */ + +#define ELF32_MACHDEP_ID_CASES \ + /* no 32-bit ELF machine types supported */ + +#define ELF64_MACHDEP_ID_CASES \ + case Elf_em_alpha: \ + break; diff --git a/sys/arch/alpha/include/endian.h b/sys/arch/alpha/include/endian.h index 4cbdb950046..ec524c5f64e 100644 --- a/sys/arch/alpha/include/endian.h +++ b/sys/arch/alpha/include/endian.h @@ -1,5 +1,5 @@ -/* $OpenBSD: endian.h,v 1.2 1996/07/29 22:58:40 niklas Exp $ */ -/* $NetBSD: endian.h,v 1.1 1995/02/13 23:07:36 cgd Exp $ */ +/* $OpenBSD: endian.h,v 1.3 1996/10/30 22:39:03 niklas Exp $ */ +/* $NetBSD: endian.h,v 1.3 1996/10/13 19:57:59 cgd Exp $ */ /* * Copyright (c) 1987, 1991, 1993 @@ -58,11 +58,14 @@ #include <sys/cdefs.h> +typedef u_int32_t in_addr_t; +typedef u_int16_t in_port_t; + __BEGIN_DECLS -unsigned long htonl __P((unsigned long)); -unsigned short htons __P((unsigned short)); -unsigned long ntohl __P((unsigned long)); -unsigned short ntohs __P((unsigned short)); +in_addr_t htonl __P((in_addr_t)); +in_port_t htons __P((in_port_t)); +in_addr_t ntohl __P((in_addr_t)); +in_port_t ntohs __P((in_port_t)); __END_DECLS /* @@ -81,10 +84,10 @@ __END_DECLS #else -#define NTOHL(x) (x) = ntohl((u_long)x) -#define NTOHS(x) (x) = ntohs((u_short)x) -#define HTONL(x) (x) = htonl((u_long)x) -#define HTONS(x) (x) = htons((u_short)x) +#define NTOHL(x) (x) = ntohl((in_addr_t)x) +#define NTOHS(x) (x) = ntohs((in_port_t)x) +#define HTONL(x) (x) = htonl((in_addr_t)x) +#define HTONS(x) (x) = htons((in_port_t)x) #endif #endif /* !_POSIX_SOURCE */ #endif /* !_ENDIAN_H_ */ diff --git a/sys/arch/alpha/include/fbio.h b/sys/arch/alpha/include/fbio.h index a9a4c40eae2..bce6db8ba24 100644 --- a/sys/arch/alpha/include/fbio.h +++ b/sys/arch/alpha/include/fbio.h @@ -1,5 +1,5 @@ -/* $OpenBSD: fbio.h,v 1.2 1996/07/29 22:58:43 niklas Exp $ */ -/* $NetBSD: fbio.h,v 1.2 1996/05/01 19:44:21 cgd Exp $ */ +/* $OpenBSD: fbio.h,v 1.3 1996/10/30 22:39:04 niklas Exp $ */ +/* $NetBSD: fbio.h,v 1.3 1996/08/23 00:50:25 cgd Exp $ */ /* * Copyright (c) 1992 Regents of the University of California. @@ -57,8 +57,9 @@ #define FBTYPE_PCIVGA 7 /* PCI VGA */ #define FBTYPE_TGA 8 /* TGA (PCI) */ #define FBTYPE_SFBP 9 /* SFB+ (TurboChannel) */ +#define FBTYPE_TGA2 10 /* TGA2 (PCI) */ -#define FBTYPE_LASTPLUSONE 10 +#define FBTYPE_LASTPLUSONE 11 /* * Frame buffer descriptor as returned by FBIOGTYPE. diff --git a/sys/arch/alpha/include/float.h b/sys/arch/alpha/include/float.h index 24358b119bc..fa51cc4a5ea 100644 --- a/sys/arch/alpha/include/float.h +++ b/sys/arch/alpha/include/float.h @@ -1,4 +1,4 @@ -/* $OpenBSD: float.h,v 1.2 1996/07/29 22:58:45 niklas Exp $ */ +/* $OpenBSD: float.h,v 1.3 1996/10/30 22:39:05 niklas Exp $ */ /* $NetBSD: float.h,v 1.4 1995/06/20 20:45:22 jtc Exp $ */ /* diff --git a/sys/arch/alpha/include/frame.h b/sys/arch/alpha/include/frame.h index 981d26dd4ef..a05fc112370 100644 --- a/sys/arch/alpha/include/frame.h +++ b/sys/arch/alpha/include/frame.h @@ -1,5 +1,5 @@ -/* $OpenBSD: frame.h,v 1.2 1996/07/29 22:58:47 niklas Exp $ */ -/* $NetBSD: frame.h,v 1.1 1995/02/13 23:07:39 cgd Exp $ */ +/* $OpenBSD: frame.h,v 1.3 1996/10/30 22:39:06 niklas Exp $ */ +/* $NetBSD: frame.h,v 1.3 1996/07/11 05:31:32 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -31,23 +31,22 @@ #ifndef _ALPHA_FRAME_H_ #define _ALPHA_FRAME_H_ -/* - * XXX where did this info come from? - */ +#include <machine/alpha_cpu.h> /* - * Trap and syscall frame. + * Software trap, exception, and syscall frame. * - * Hardware puts fields marked "[HW]" on stack. We have to add - * all of the general-purpose registers except for zero, for sp, - * which is automatically saved in usp for traps, and implicitly - * saved for syscalls, and for a0-a2, which are saved by hardware. + * Includes "hardware" (PALcode) frame. + * + * PALcode puts ALPHA_HWFRAME_* fields on stack. We have to add + * all of the general-purpose registers except for zero, for sp + * (which is automatically saved in the PCB's USP field for entries + * from user mode, and which is implicitly saved and restored by the + * calling conventions for entries from kernel mode), and (on traps + * and exceptions) for a0, a1, and a2 (which are saved by PALcode). */ -/* Number of registers saved, including padding. */ -#define FRAME_NSAVEREGS 28 - -/* The offsets of the registers to be saved, into the array. */ +/* Quadword offsets of the registers to be saved. */ #define FRAME_V0 0 #define FRAME_T0 1 #define FRAME_T1 2 @@ -75,16 +74,22 @@ #define FRAME_T12 24 #define FRAME_AT 25 #define FRAME_SP 26 -#define FRAME_SPARE 27 /* spare; padding */ + +#define FRAME_SW_SIZE (FRAME_SP + 1) +#define FRAME_HW_OFFSET FRAME_SW_SIZE + +#define FRAME_PS (FRAME_HW_OFFSET + ALPHA_HWFRAME_PS) +#define FRAME_PC (FRAME_HW_OFFSET + ALPHA_HWFRAME_PC) +#define FRAME_GP (FRAME_HW_OFFSET + ALPHA_HWFRAME_GP) +#define FRAME_A0 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A0) +#define FRAME_A1 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A1) +#define FRAME_A2 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A2) + +#define FRAME_HW_SIZE ALPHA_HWFRAME_SIZE +#define FRAME_SIZE (FRAME_HW_OFFSET + FRAME_HW_SIZE) struct trapframe { - u_int64_t tf_regs[FRAME_NSAVEREGS]; /* GPRs (listed above) */ - u_int64_t tf_ps; /* processor status [HW] */ - u_int64_t tf_pc; /* program counter [HW] */ - u_int64_t tf_gp; /* global pointer [HW] */ - u_int64_t tf_a0; /* saved a0 [HW] */ - u_int64_t tf_a1; /* saved a1 [HW] */ - u_int64_t tf_a2; /* saved a2 [HW] */ + unsigned long tf_regs[FRAME_SIZE]; /* See above */ }; #endif /* _ALPHA_FRAME_H_ */ diff --git a/sys/arch/alpha/include/ieee.h b/sys/arch/alpha/include/ieee.h index eed83d82d9e..943ac5052e8 100644 --- a/sys/arch/alpha/include/ieee.h +++ b/sys/arch/alpha/include/ieee.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee.h,v 1.2 1996/07/29 22:58:48 niklas Exp $ */ +/* $OpenBSD: ieee.h,v 1.3 1996/10/30 22:39:07 niklas Exp $ */ /* $NetBSD: ieee.h,v 1.1 1995/02/13 23:07:40 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/ieeefp.h b/sys/arch/alpha/include/ieeefp.h index 731366c1ae3..4ebb20b0aa5 100644 --- a/sys/arch/alpha/include/ieeefp.h +++ b/sys/arch/alpha/include/ieeefp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieeefp.h,v 1.2 1996/07/29 22:58:50 niklas Exp $ */ +/* $OpenBSD: ieeefp.h,v 1.3 1996/10/30 22:39:08 niklas Exp $ */ /* $NetBSD: ieeefp.h,v 1.1 1995/04/29 01:09:17 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/intr.h b/sys/arch/alpha/include/intr.h index 1e1edaae517..e638077e95d 100644 --- a/sys/arch/alpha/include/intr.h +++ b/sys/arch/alpha/include/intr.h @@ -1,5 +1,5 @@ -/* $OpenBSD: intr.h,v 1.2 1996/07/29 22:58:52 niklas Exp $ */ -/* $NetBSD: intr.h,v 1.1 1996/04/12 01:42:17 cgd Exp $ */ +/* $OpenBSD: intr.h,v 1.3 1996/10/30 22:39:09 niklas Exp $ */ +/* $NetBSD: intr.h,v 1.2 1996/07/09 00:33:25 cgd Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -28,6 +28,9 @@ * rights to redistribute these changes. */ +#ifndef _ALPHA_INTR_H_ +#define _ALPHA_INTR_H_ + #define IPL_NONE 0 /* disable only this interrupt */ #define IPL_BIO 1 /* disable block I/O interrupts */ #define IPL_NET 2 /* disable network interrupts */ @@ -39,3 +42,30 @@ #define IST_PULSE 1 /* pulsed */ #define IST_EDGE 2 /* edge-triggered */ #define IST_LEVEL 3 /* level-triggered */ + +#define splx(s) \ + (s == ALPHA_PSL_IPL_0 ? spl0() : alpha_pal_swpipl(s)) +#define splsoft() alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT) +#define splsoftclock() splsoft() +#define splsoftnet() splsoft() +#define splnet() alpha_pal_swpipl(ALPHA_PSL_IPL_IO) +#define splbio() alpha_pal_swpipl(ALPHA_PSL_IPL_IO) +#define splimp() alpha_pal_swpipl(ALPHA_PSL_IPL_IO) +#define spltty() alpha_pal_swpipl(ALPHA_PSL_IPL_IO) +#define splclock() alpha_pal_swpipl(ALPHA_PSL_IPL_CLOCK) +#define splstatclock() alpha_pal_swpipl(ALPHA_PSL_IPL_CLOCK) +#define splhigh() alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH) + +/* + * simulated software interrupt register + */ +extern u_int64_t ssir; + +#define SIR_NET 0x1 +#define SIR_CLOCK 0x2 + +#define siroff(x) ssir &= ~(x) +#define setsoftnet() ssir |= SIR_NET +#define setsoftclock() ssir |= SIR_CLOCK + +#endif diff --git a/sys/arch/alpha/include/intrcnt.h b/sys/arch/alpha/include/intrcnt.h index fbc8d214a43..50a451798ff 100644 --- a/sys/arch/alpha/include/intrcnt.h +++ b/sys/arch/alpha/include/intrcnt.h @@ -1,5 +1,5 @@ -/* $OpenBSD: intrcnt.h,v 1.3 1996/07/29 22:58:53 niklas Exp $ */ -/* $NetBSD: intrcnt.h,v 1.4.4.2 1996/06/05 03:42:24 cgd Exp $ */ +/* $OpenBSD: intrcnt.h,v 1.4 1996/10/30 22:39:10 niklas Exp $ */ +/* $NetBSD: intrcnt.h,v 1.6 1996/06/05 03:38:02 cgd Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. diff --git a/sys/arch/alpha/include/kbio.h b/sys/arch/alpha/include/kbio.h index 1923e84da77..30dc944ba83 100644 --- a/sys/arch/alpha/include/kbio.h +++ b/sys/arch/alpha/include/kbio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: kbio.h,v 1.2 1996/07/29 22:58:55 niklas Exp $ */ +/* $OpenBSD: kbio.h,v 1.3 1996/10/30 22:39:11 niklas Exp $ */ /* $NetBSD: kbio.h,v 1.1 1996/04/12 01:45:45 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/kcore.h b/sys/arch/alpha/include/kcore.h new file mode 100644 index 00000000000..87da4d36d0c --- /dev/null +++ b/sys/arch/alpha/include/kcore.h @@ -0,0 +1,40 @@ +/* $OpenBSD: kcore.h,v 1.1 1996/10/30 22:39:11 niklas Exp $ */ +/* $NetBSD: kcore.h,v 1.1 1996/10/01 18:38:05 cgd Exp $ */ + +/* + * Copyright (c) 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#ifndef _ALPHA_KCORE_H_ +#define _ALPHA_KCORE_H_ + +typedef struct cpu_kcore_hdr { + u_int64_t lev1map_pa; /* PA of Lev1map */ + u_int64_t page_size; /* Page size */ + phys_ram_seg_t core_seg; /* Core addrs; only one seg */ +} cpu_kcore_hdr_t; + +#endif /* _ALPHA_KCORE_H_ */ diff --git a/sys/arch/alpha/include/limits.h b/sys/arch/alpha/include/limits.h index 2ff6b3fcf78..1d2799a3f06 100644 --- a/sys/arch/alpha/include/limits.h +++ b/sys/arch/alpha/include/limits.h @@ -1,4 +1,4 @@ -/* $OpenBSD: limits.h,v 1.3 1996/07/29 22:58:56 niklas Exp $ */ +/* $OpenBSD: limits.h,v 1.4 1996/10/30 22:39:12 niklas Exp $ */ /* $NetBSD: limits.h,v 1.2 1996/04/12 01:38:25 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h index e7d8ed09324..40878d41a71 100644 --- a/sys/arch/alpha/include/param.h +++ b/sys/arch/alpha/include/param.h @@ -1,5 +1,5 @@ -/* $OpenBSD: param.h,v 1.5 1996/07/29 22:58:58 niklas Exp $ */ -/* $NetBSD: param.h,v 1.12 1996/03/04 05:04:10 cgd Exp $ */ +/* $OpenBSD: param.h,v 1.6 1996/10/30 22:39:13 niklas Exp $ */ +/* $NetBSD: param.h,v 1.13 1996/07/09 00:33:23 cgd Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -52,9 +52,7 @@ #define MACHINE_ARCH "alpha" #define MID_MACHINE MID_ALPHA -#ifdef _KERNEL /* XXX */ -#include <machine/cpu.h> /* XXX */ -#endif /* XXX */ +#include <machine/alpha_cpu.h> /* * Round p (pointer or byte index) up to a correctly-aligned value for all @@ -64,9 +62,9 @@ #define ALIGNBYTES 7 #define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) -#define NBPG 8192 /* bytes/page */ +#define NBPG (1 << ALPHA_PGSHIFT) /* bytes/page */ #define PGOFSET (NBPG-1) /* byte off. into pg */ -#define PGSHIFT 13 /* LOG2(NBPG) */ +#define PGSHIFT ALPHA_PGSHIFT /* LOG2(NBPG) */ #define NPTEPG (1 << (PGSHIFT-PTESHIFT)) /* pte's/page */ #define SEGSHIFT (PGSHIFT + (PGSHIFT-PTESHIFT)) /* LOG2(NBSEG) */ @@ -145,34 +143,17 @@ #define alpha_btop(x) ((unsigned long)(x) >> PGSHIFT) #define alpha_ptob(x) ((unsigned long)(x) << PGSHIFT) -#include <machine/psl.h> - -#define splx(s) (s == PSL_IPL_0 ? spl0() : pal_swpipl(s)) -#define splsoft() pal_swpipl(PSL_IPL_SOFT) -#define splsoftclock() splsoft() -#define splsoftnet() splsoft() -#define splnet() pal_swpipl(PSL_IPL_IO) -#define splbio() pal_swpipl(PSL_IPL_IO) -#define splimp() pal_swpipl(PSL_IPL_IO) -#define spltty() pal_swpipl(PSL_IPL_IO) -#define splclock() pal_swpipl(PSL_IPL_CLOCK) -#define splstatclock() pal_swpipl(PSL_IPL_CLOCK) -#define splhigh() pal_swpipl(PSL_IPL_HIGH) +#include <machine/intr.h> #ifdef _KERNEL #ifndef _LOCORE -/* This was calibrated empirically */ -extern u_int64_t cycles_per_usec; -int delay __P((int)); +void delay __P((unsigned long)); #define DELAY(n) delay(n) +/* XXX ALL OF THE FOLLOWING BELONG IN INTR.H */ int spl0 __P((void)); /* drop ipl to zero */ +/* XXX END INTR.H */ #endif #endif /* !_KERNEL */ - -int prtloc; -extern int ticks; -#define LOC() do { if (prtloc) printf("(%ld:%ld) %s: %d\n", curproc ? curproc->p_pid : -1, (long)ticks, __FILE__, __LINE__); } while (0) -#define PLOC(str) panic("XXX: (%ld:%ld) %s at %s: %d\n", curproc ? curproc->p_pid : -1, (long)ticks, str, __FILE__, __LINE__); diff --git a/sys/arch/alpha/include/pcb.h b/sys/arch/alpha/include/pcb.h index e24132f82db..bd7530fb65a 100644 --- a/sys/arch/alpha/include/pcb.h +++ b/sys/arch/alpha/include/pcb.h @@ -1,5 +1,5 @@ -/* $OpenBSD: pcb.h,v 1.2 1996/07/29 22:58:59 niklas Exp $ */ -/* $NetBSD: pcb.h,v 1.1 1995/02/13 23:07:43 cgd Exp $ */ +/* $OpenBSD: pcb.h,v 1.3 1996/10/30 22:39:14 niklas Exp $ */ +/* $NetBSD: pcb.h,v 1.4 1996/10/07 23:57:21 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -31,9 +31,7 @@ #include <machine/frame.h> #include <machine/reg.h> -/* - * XXX where did this info come from? - */ +#include <machine/alpha_cpu.h> /* * PCB: process control block @@ -49,17 +47,11 @@ * So we cache the physical address of the pcb in the md_proc struct. */ struct pcb { - u_int64_t pcb_ksp; /* kernel stack ptr [HW] */ - u_int64_t pcb_usp; /* user stack ptr [HW] */ - u_int64_t pcb_ptbr; /* page table base reg [HW] */ - u_int32_t pcb_pcc; /* process cycle cntr [HW] */ - u_int32_t pcb_asn; /* address space number [HW] */ - u_int64_t pcb_unique; /* process unique value [HW] */ - u_int64_t pcb_fen; /* FP enable (in bit 0) [HW] */ - u_int64_t pcb_decrsv[2]; /* DEC reserved [HW] */ - u_int64_t pcb_context[9]; /* s[0-6], ra, ps [SW] */ + struct alpha_pcb pcb_hw; /* PALcode defined */ + unsigned long pcb_context[9]; /* s[0-6], ra, ps [SW] */ struct fpreg pcb_fp; /* FP registers [SW] */ - caddr_t pcb_onfault; /* for copy faults [SW] */ + unsigned long pcb_onfault; /* for copy faults [SW] */ + unsigned long pcb_accessaddr; /* for [fs]uswintr [SW] */ }; /* @@ -69,4 +61,9 @@ struct pcb { */ struct md_coredump { struct trapframe md_tf; + struct fpreg md_fpstate; }; + +#ifdef _KERNEL +void savectx __P((struct pcb *)); +#endif diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h index ed63680b21d..9b2120cd6ce 100644 --- a/sys/arch/alpha/include/pmap.h +++ b/sys/arch/alpha/include/pmap.h @@ -1,127 +1,10 @@ -/* $OpenBSD: pmap.h,v 1.3 1996/07/29 22:59:01 niklas Exp $ */ -/* $NetBSD: pmap.h,v 1.4 1995/11/23 02:36:25 cgd Exp $ */ +/* $OpenBSD: pmap.h,v 1.4 1996/10/30 22:39:16 niklas Exp $ */ +/* $NetBSD: pmap.h,v 1.9 1996/08/20 23:02:30 cgd Exp $ */ -/* - * Copyright (c) 1987 Carnegie-Mellon University - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pmap.h 8.1 (Berkeley) 6/10/93 - */ +#ifndef NEW_PMAP +#include <machine/pmap.old.h> +#else +#include <machine/pmap.new.h> +#endif -#ifndef _PMAP_MACHINE_ -#define _PMAP_MACHINE_ - -#include <machine/pte.h> - -#define ALPHA_PAGE_SIZE NBPG -#define ALPHA_SEG_SIZE NBSEG - -#define alpha_trunc_seg(x) (((u_long)(x)) & ~(ALPHA_SEG_SIZE-1)) -#define alpha_round_seg(x) alpha_trunc_seg((u_long)(x) + ALPHA_SEG_SIZE-1) - -/* - * Pmap stuff - */ -struct pmap { - pt_entry_t *pm_ptab; /* KVA of page table */ - pt_entry_t *pm_stab; /* KVA of segment table */ - int pm_stchanged; /* ST changed */ - pt_entry_t pm_stpte; /* PTE mapping STE */ - short pm_sref; /* segment table ref count */ - short pm_count; /* pmap reference count */ - simple_lock_data_t pm_lock; /* lock on pmap */ - struct pmap_statistics pm_stats; /* pmap statistics */ - long pm_ptpages; /* more stats: PT pages */ -}; - -typedef struct pmap *pmap_t; - -extern struct pmap kernel_pmap_store; - -#define pmap_kernel() (&kernel_pmap_store) -#define active_pmap(pm) \ - ((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap) - -/* - * Macros for speed - */ -#define PMAP_ACTIVATE(pmapp, iscurproc) \ - if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \ - if (iscurproc) \ - loadustp((pmapp)->pm_stpte); \ - (pmapp)->pm_stchanged = FALSE; \ - } -#define PMAP_DEACTIVATE(pmapp, pcbp) - -/* - * For each vm_page_t, there is a list of all currently valid virtual - * mappings of that page. An entry is a pv_entry_t, the list is pv_table. - */ -typedef struct pv_entry { - struct pv_entry *pv_next; /* next pv_entry */ - struct pmap *pv_pmap; /* pmap where mapping lies */ - vm_offset_t pv_va; /* virtual address for mapping */ - pt_entry_t *pv_ptpte; /* non-zero if VA maps a PT page */ - struct pmap *pv_ptpmap; /* if pv_ptpte, pmap for PT page */ - int pv_flags; /* flags */ -} *pv_entry_t; - -#define PV_PTPAGE 0x01 /* header: entry maps a page table page */ - -/* - * bits of pmap_attributes[] - */ -#define PMAP_ATTR_MOD 0x01 /* modified */ -#define PMAP_ATTR_REF 0x02 /* referenced */ - -#ifdef _KERNEL -pv_entry_t pv_table; /* array of entries, one per page */ - -#define pa_index(pa) atop(pa - vm_first_phys) -#define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) - -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) -#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) - -extern pt_entry_t *Sysmap; -extern char *vmmap; /* map for mem, dumps, etc. */ - -/* Machine-specific functions. */ -void pmap_emulate_reference __P((struct proc *p, vm_offset_t v, - int user, int write)); -#endif /* _KERNEL */ - -#endif /* _PMAP_MACHINE_ */ +void pmap_unmap_prom __P((void)); diff --git a/sys/arch/alpha/include/pmap.new.h b/sys/arch/alpha/include/pmap.new.h new file mode 100644 index 00000000000..d70ee7302c9 --- /dev/null +++ b/sys/arch/alpha/include/pmap.new.h @@ -0,0 +1,363 @@ +/* $OpenBSD: pmap.new.h,v 1.1 1996/10/30 22:39:17 niklas Exp $ */ +/* $NetBSD: pmap.new.h,v 1.3 1996/08/20 23:02:59 cgd Exp $ */ + +/* + * Copyright (c) 1992, 1993, 1996 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie Mellon + * the rights to redistribute these changes. + */ + +/* + * File: pmap.h + * + * Author: David Golub (mods for Alpha by Alessandro Forin) + Mods for use in {Net,Open}BSD/Alpha by Chris Demetriou. + * Date: 1988 ca. + * + * Machine-dependent structures for the physical map module. + */ + +#ifndef _PMAP_MACHINE_ +#define _PMAP_MACHINE_ + +#include <machine/alpha_cpu.h> + +/* XXX */ +typedef struct pcb *pcb_t; + +/* + * Alpha Page Table Entry + */ + +typedef alpha_pt_entry_t pt_entry_t; +#define PT_ENTRY_NULL ((pt_entry_t *) 0) + +#define ALPHA_OFFMASK (ALPHA_PGBYTES-1) /* offset within page */ + +#define SEG_MASK ((ALPHA_PGBYTES / 8)-1) /* masks for segments */ +#define SEG3_SHIFT (ALPHA_PGSHIFT) /* shifts for segments */ +#define SEG2_SHIFT (SEG3_SHIFT+(ALPHA_PGSHIFT-3)) +#define SEG1_SHIFT (SEG2_SHIFT+(ALPHA_PGSHIFT-3)) + +/* + * Convert address offset to page descriptor index + */ +#define pdenum(a) (((a) >> SEG1_SHIFT) & SEG_MASK) + +/* + * Convert page descriptor index to user virtual address + */ +#define pdetova(a) ((vm_offset_t)(a) << SEG1_SHIFT) +#define pde2tova(a) ((vm_offset_t)(a) << SEG2_SHIFT) +#define pde3tova(a) ((vm_offset_t)(a) << SEG3_SHIFT) + +/* + * Convert address offset to second level page table index + */ +#define pte2num(a) (((a) >> SEG2_SHIFT) & SEG_MASK) + +/* + * Convert address offset to third level page table index + */ +#define pte3num(a) (((a) >> SEG3_SHIFT) & SEG_MASK) + +#define NPTES (alpha_ptob(1)/sizeof(pt_entry_t)) +#define NPDES (alpha_ptob(1)/sizeof(pt_entry_t)) + +/* + * Hardware/PALcode pte bit definitions (to be used directly + * on the ptes without using the bit fields) are defined in + * <machine/alpha_cpu.h>. Software-defined bits are defined + * here. + */ + +#define ALPHA_PTE_WIRED 0x00010000 +#define ALPHA_PTE_REF 0x00020000 +#define ALPHA_PTE_MOD 0x00040000 + + +#define pa_to_pte(a) ALPHA_PTE_FROM_PFN(alpha_btop(a)) +#define pte_to_pa(p) alpha_ptob(ALPHA_PTE_TO_PFN(p)) +#define pte_increment_pa(p) ((p) += pa_to_pte(ALPHA_PGBYTES)) + +/* + * Convert page table entry to kernel virtual address + */ +#define ptetokv(a) (phystokv(pte_to_pa(a))) + +typedef volatile long cpu_set; /* set of CPUs - must be <= 64 */ + /* changed by other processors */ + +#define decl_simple_lock_data(x,y) simple_lock_data_t y; + +struct pmap { + pt_entry_t *dirbase; /* page directory pointer register */ + unsigned long dirpfn; /* cached dirbase physical PFN */ + int pid; /* TLBPID when in use */ + int ref_count; /* reference count */ + decl_simple_lock_data(,lock) + /* lock on map */ + struct pmap_statistics stats; /* map statistics */ + cpu_set cpus_using; /* bitmap of cpus using pmap */ + int (*hacking)(); /* horrible things needed */ +}; + +typedef struct pmap *pmap_t; + +#define PMAP_NULL ((pmap_t) 0) + +#define vtophys(x) kvtophys(x) +extern vm_offset_t kvtophys __P((vm_offset_t)); +extern void set_ptbr(pmap_t map, pcb_t pcb, boolean_t); + +#if NCPUS > 1 +/* + * List of cpus that are actively using mapped memory. Any + * pmap update operation must wait for all cpus in this list. + * Update operations must still be queued to cpus not in this + * list. + */ +extern cpu_set cpus_active; + +/* + * List of cpus that are idle, but still operating, and will want + * to see any kernel pmap updates when they become active. + */ +extern cpu_set cpus_idle; + +/* + * Quick test for pmap update requests. + */ +extern volatile +boolean_t cpu_update_needed[NCPUS]; + +/* + * External declarations for PMAP_ACTIVATE. + */ + +void pmap_activate __P((pmap_t, struct alpha_pcb *, int)); +void pmap_deactivate __P((pmap_t, struct alpha_pcb *, int)); +void pmap_bootstrap __P((vm_offset_t, vm_offset_t, int)); +void process_pmap_updates __P((pmap_t)); +void pmap_update_interrupt __P((void)); +extern pmap_t kernel_pmap; + +#endif /* NCPUS > 1 */ + +/* + * Machine dependent routines that are used only for Alpha. + */ + +pt_entry_t *pmap_pte(pmap_t, vm_offset_t); + +/* + * Macros for speed. + */ + +#if NCPUS > 1 + +/* + * For multiple CPUS, PMAP_ACTIVATE and PMAP_DEACTIVATE must manage + * fields to control TLB invalidation on other CPUS. + */ + +#define PMAP_ACTIVATE_KERNEL(my_cpu) { \ + \ + /* \ + * Let pmap updates proceed while we wait for this pmap. \ + */ \ + i_bit_clear((my_cpu), &cpus_active); \ + \ + /* \ + * Lock the pmap to put this cpu in its active set. \ + * Wait for updates here. \ + */ \ + simple_lock(&kernel_pmap->lock); \ + \ + /* \ + * Process invalidate requests for the kernel pmap. \ + */ \ + if (cpu_update_needed[(my_cpu)]) \ + process_pmap_updates(kernel_pmap); \ + \ + /* \ + * Mark that this cpu is using the pmap. \ + */ \ + i_bit_set((my_cpu), &kernel_pmap->cpus_using); \ + \ + /* \ + * Mark this cpu active - IPL will be lowered by \ + * load_context(). \ + */ \ + i_bit_set((my_cpu), &cpus_active); \ + \ + simple_unlock(&kernel_pmap->lock); \ +} + +#define PMAP_DEACTIVATE_KERNEL(my_cpu) { \ + /* \ + * Mark pmap no longer in use by this cpu even if \ + * pmap is locked against updates. \ + */ \ + i_bit_clear((my_cpu), &kernel_pmap->cpus_using); \ +} + +#define PMAP_ACTIVATE_USER(pmap, th, my_cpu) { \ + register pmap_t tpmap = (pmap); \ + register pcb_t pcb = (th)->pcb; \ + \ + if (tpmap == kernel_pmap) { \ + /* \ + * If this is the kernel pmap, switch to its page tables. \ + */ \ + set_ptbr(tpmap,pcb,TRUE); \ + } \ + else { \ + /* \ + * Let pmap updates proceed while we wait for this pmap. \ + */ \ + i_bit_clear((my_cpu), &cpus_active); \ + \ + /* \ + * Lock the pmap to put this cpu in its active set. \ + * Wait for updates here. \ + */ \ + simple_lock(&tpmap->lock); \ + \ + /* \ + * No need to invalidate the TLB - the entire user pmap \ + * will be invalidated by reloading dirbase. \ + */ \ + if (tpmap->pid < 0) pmap_assign_tlbpid(tpmap); \ + set_ptbr(tpmap, pcb, TRUE); \ + \ + /* \ + * Mark that this cpu is using the pmap. \ + */ \ + i_bit_set((my_cpu), &tpmap->cpus_using); \ + \ + /* \ + * Mark this cpu active - IPL will be lowered by \ + * load_context(). \ + */ \ + i_bit_set((my_cpu), &cpus_active); \ + \ + simple_unlock(&tpmap->lock); \ + } \ +} + +#define PMAP_DEACTIVATE_USER(pmap, thread, my_cpu) { \ + register pmap_t tpmap = (pmap); \ + \ + /* \ + * Do nothing if this is the kernel pmap. \ + */ \ + if (tpmap != kernel_pmap) { \ + /* \ + * Mark pmap no longer in use by this cpu even if \ + * pmap is locked against updates. \ + */ \ + i_bit_clear((my_cpu), &(pmap)->cpus_using); \ + } \ +} + +#define MARK_CPU_IDLE(my_cpu) { \ + /* \ + * Mark this cpu idle, and remove it from the active set, \ + * since it is not actively using any pmap. Signal_cpus \ + * will notice that it is idle, and avoid signaling it, \ + * but will queue the update request for when the cpu \ + * becomes active. \ + */ \ + spl_t s = splvm(); \ + i_bit_set((my_cpu), &cpus_idle); \ + i_bit_clear((my_cpu), &cpus_active); \ + splx(s); \ +} + +#define MARK_CPU_ACTIVE(my_cpu) { \ + \ + spl_t s = splvm(); \ + /* \ + * If a kernel_pmap update was requested while this cpu \ + * was idle, process it as if we got the interrupt. \ + * Before doing so, remove this cpu from the idle set. \ + * Since we do not grab any pmap locks while we flush \ + * our TLB, another cpu may start an update operation \ + * before we finish. Removing this cpu from the idle \ + * set assures that we will receive another update \ + * interrupt if this happens. \ + */ \ + i_bit_clear((my_cpu), &cpus_idle); \ + \ + if (cpu_update_needed[(my_cpu)]) \ + pmap_update_interrupt(); \ + \ + /* \ + * Mark that this cpu is now active. \ + */ \ + i_bit_set((my_cpu), &cpus_active); \ + splx(s); \ +} + +#else /* NCPUS > 1 */ + +/* + * With only one CPU, we just have to indicate whether the pmap is + * in use. + */ + +#define PMAP_ACTIVATE_KERNEL(my_cpu) { \ + kernel_pmap->cpus_using = TRUE; \ +} + +#define PMAP_DEACTIVATE_KERNEL(my_cpu) { \ + kernel_pmap->cpus_using = FALSE; \ +} + +#define PMAP_ACTIVATE_USER(pmap, th, my_cpu) { \ + register pmap_t tpmap = (pmap); \ + register pcb_t pcb = (th)->pcb; \ + \ + if (tpmap->pid < 0) pmap_assign_tlbpid(tpmap); \ + set_ptbr(tpmap,pcb,TRUE); \ + if (tpmap != kernel_pmap) { \ + tpmap->cpus_using = TRUE; \ + } \ +} + +#define PMAP_DEACTIVATE_USER(pmap, thread, cpu) { \ + if ((pmap) != kernel_pmap) \ + (pmap)->cpus_using = FALSE; \ +} + +#endif /* NCPUS > 1 */ + +#define pmap_kernel() (kernel_pmap) +#define pmap_resident_count(pmap) ((pmap)->stats.resident_count) + +/* + * Data structures this module exports + */ +extern pmap_t kernel_pmap; /* pointer to the kernel pmap */ + +#endif _PMAP_MACHINE_ diff --git a/sys/arch/alpha/include/pmap.old.h b/sys/arch/alpha/include/pmap.old.h new file mode 100644 index 00000000000..c60dfc9c485 --- /dev/null +++ b/sys/arch/alpha/include/pmap.old.h @@ -0,0 +1,131 @@ +/* $OpenBSD: pmap.old.h,v 1.1 1996/10/30 22:39:18 niklas Exp $ */ +/* $NetBSD: pmap.old.h,v 1.5 1996/07/09 00:39:24 cgd Exp $ */ + +/* + * Copyright (c) 1987 Carnegie-Mellon University + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pmap.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _PMAP_MACHINE_ +#define _PMAP_MACHINE_ + +#include <machine/pte.h> + +extern vm_offset_t vtophys(vm_offset_t); + +#define ALPHA_PAGE_SIZE NBPG +#define ALPHA_SEG_SIZE NBSEG + +#define alpha_trunc_seg(x) (((u_long)(x)) & ~(ALPHA_SEG_SIZE-1)) +#define alpha_round_seg(x) alpha_trunc_seg((u_long)(x) + ALPHA_SEG_SIZE-1) + +/* + * Pmap stuff + */ +struct pmap { + pt_entry_t *pm_ptab; /* KVA of page table */ + pt_entry_t *pm_stab; /* KVA of segment table */ + int pm_stchanged; /* ST changed */ + pt_entry_t pm_stpte; /* PTE mapping STE */ + short pm_sref; /* segment table ref count */ + short pm_count; /* pmap reference count */ + simple_lock_data_t pm_lock; /* lock on pmap */ + struct pmap_statistics pm_stats; /* pmap statistics */ + long pm_ptpages; /* more stats: PT pages */ +}; + +typedef struct pmap *pmap_t; + +extern struct pmap kernel_pmap_store; + +#define pmap_kernel() (&kernel_pmap_store) +#define active_pmap(pm) \ + ((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap) + +/* + * Macros for speed + */ +#define PMAP_ACTIVATE(pmapp, iscurproc) \ + if ((pmapp) != NULL && (pmapp)->pm_stchanged) { \ + if (iscurproc) \ + loadustp((pmapp)->pm_stpte); \ + (pmapp)->pm_stchanged = FALSE; \ + } +#define PMAP_DEACTIVATE(pmapp, pcbp) + +/* + * For each vm_page_t, there is a list of all currently valid virtual + * mappings of that page. An entry is a pv_entry_t, the list is pv_table. + */ +typedef struct pv_entry { + struct pv_entry *pv_next; /* next pv_entry */ + struct pmap *pv_pmap; /* pmap where mapping lies */ + vm_offset_t pv_va; /* virtual address for mapping */ + pt_entry_t *pv_ptpte; /* non-zero if VA maps a PT page */ + struct pmap *pv_ptpmap; /* if pv_ptpte, pmap for PT page */ + int pv_flags; /* flags */ +} *pv_entry_t; + +#define PV_PTPAGE 0x01 /* header: entry maps a page table page */ + +/* + * bits of pmap_attributes[] + */ +#define PMAP_ATTR_MOD 0x01 /* modified */ +#define PMAP_ATTR_REF 0x02 /* referenced */ + +#ifdef _KERNEL +pv_entry_t pv_table; /* array of entries, one per page */ + +#define pa_index(pa) atop(pa - vm_first_phys) +#define pa_to_pvh(pa) (&pv_table[pa_index(pa)]) + +#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) + +extern pt_entry_t *Sysmap; +extern char *vmmap; /* map for mem, dumps, etc. */ + +/* Machine-specific functions. */ +void pmap_activate __P((pmap_t)); +void pmap_emulate_reference __P((struct proc *p, vm_offset_t v, + int user, int write)); +void pmap_bootstrap __P((vm_offset_t, vm_offset_t)); +#endif /* _KERNEL */ + +#endif /* _PMAP_MACHINE_ */ diff --git a/sys/arch/alpha/include/proc.h b/sys/arch/alpha/include/proc.h index 4460c2e8c25..5794e0244de 100644 --- a/sys/arch/alpha/include/proc.h +++ b/sys/arch/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.2 1996/07/29 22:59:03 niklas Exp $ */ +/* $OpenBSD: proc.h,v 1.3 1996/10/30 22:39:19 niklas Exp $ */ /* $NetBSD: proc.h,v 1.2 1995/03/24 15:01:36 cgd Exp $ */ /* @@ -39,3 +39,8 @@ struct mdproc { }; #define MDP_FPUSED 0x0001 /* Process used the FPU */ + +#ifdef _KERNEL +void switch_exit __P((struct proc *)); +void switch_trampoline __P((void (*) __P((struct proc *)), void *)); +#endif diff --git a/sys/arch/alpha/include/profile.h b/sys/arch/alpha/include/profile.h index dd163bc13a6..34b748366d4 100644 --- a/sys/arch/alpha/include/profile.h +++ b/sys/arch/alpha/include/profile.h @@ -1,5 +1,5 @@ -/* $OpenBSD: profile.h,v 1.3 1996/07/29 22:59:05 niklas Exp $ */ -/* $NetBSD: profile.h,v 1.3 1995/11/23 02:36:28 cgd Exp $ */ +/* $OpenBSD: profile.h,v 1.4 1996/10/30 22:39:20 niklas Exp $ */ +/* $NetBSD: profile.h,v 1.6 1996/09/15 22:33:28 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -92,8 +92,8 @@ LEAF(_mcount,0) /* XXX */ stq t12, OFFSET_T12(sp) stq gp, OFFSET_GP(sp) - br pv, 1f -1: SETGP(pv) + br pv, LX99 +LX99: SETGP(pv) mov ra, a0 mov at_reg, a1 CALL(mcount) @@ -118,8 +118,9 @@ LEAF(_mcount,0) /* XXX */ ldq t9, OFFSET_T9(sp) ldq t10, OFFSET_T10(sp) ldq t11, OFFSET_T11(sp) - ldq gp, OFFSET_GP(sp) ldq ra, OFFSET_RA(sp) + stq t12, OFFSET_T12(sp) + ldq gp, OFFSET_GP(sp) ldq at_reg, OFFSET_AT(sp) @@ -164,8 +165,8 @@ _mcount:; \ stq $27, 176($30); \ stq $29, 184($30); \ \ - br $27, 1f; \ -1: ldgp $29,0($27); \ + br $27, LX98; \ +LX98: ldgp $29,0($27); \ mov $26, $16; \ mov $28, $17; \ jsr $26,mcount; \ @@ -191,10 +192,10 @@ _mcount:; \ ldq $23, 144($30); \ ldq $24, 152($30); \ ldq $25, 160($30); \ - ldq $29, 184($30); \ + ldq $25, 160($30); \ ldq $26, 168($30); \ - \ - ldq $28, 0($30); \ + ldq $27, 176($30); \ + ldq $29, 184($30); \ \ lda $30, 192($30); \ ret $31, ($28), 1; \ @@ -204,13 +205,13 @@ _mcount:; \ #ifdef _KERNEL /* * The following two macros do splhigh and splx respectively. - * profile_swpipl is a special version of pal_swpipl which + * _alpha_pal_swpipl is a special version of alpha_pal_swpipl which * doesn't include profiling support. * * XXX These macros should probably use inline assembly. */ #define MCOUNT_ENTER \ - s = profile_swpipl(PSL_IPL_HIGH) + s = _alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH) #define MCOUNT_EXIT \ - (void)profile_swpipl(s); + (void)_alpha_pal_swpipl(s); #endif diff --git a/sys/arch/alpha/include/prom.h b/sys/arch/alpha/include/prom.h index d27f11e7b46..827054942bb 100644 --- a/sys/arch/alpha/include/prom.h +++ b/sys/arch/alpha/include/prom.h @@ -1,5 +1,5 @@ -/* $OpenBSD: prom.h,v 1.3 1996/07/29 22:59:07 niklas Exp $ */ -/* $NetBSD: prom.h,v 1.2 1996/04/23 15:23:18 cgd Exp $ */ +/* $OpenBSD: prom.h,v 1.4 1996/10/30 22:39:21 niklas Exp $ */ +/* $NetBSD: prom.h,v 1.4 1996/10/15 23:52:49 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -30,7 +30,7 @@ #ifndef ASSEMBLER struct prom_vec { - int (*routine)(); + int (*routine) __P((struct crd *)); struct crd *routine_arg; }; @@ -55,6 +55,11 @@ void putchar __P((int)); void prom_halt __P((int)) __attribute__((__noreturn__)); int prom_getenv __P((int, char *, int)); + +void init_prom_interface __P((void)); +void hwrbp_restart_setup __P((void)); +int prom_dispatch __P((int, int, u_char *, int)); +int promcnlookc __P((dev_t, char *)); #endif /* Prom operation values. */ @@ -64,6 +69,7 @@ int prom_getenv __P((int, char *, int)); #define PROM_R_OPEN 0x10 #define PROM_R_PUTS 0x02 #define PROM_R_READ 0x13 +#define PROM_R_WRITE 0x14 /* Environment variable values. */ #define PROM_E_BOOTED_DEV 0x4 @@ -80,3 +86,5 @@ int prom_getenv __P((int, char *, int)); #define prom_close(chan) prom_dispatch(PROM_R_CLOSE, chan) #define prom_read(chan, len, buf, blkno) \ prom_dispatch(PROM_R_READ, chan, len, buf, blkno) +#define prom_write(chan, len, buf, blkno) \ + prom_dispatch(PROM_R_WRITE, chan, len, buf, blkno) diff --git a/sys/arch/alpha/include/psl.h b/sys/arch/alpha/include/psl.h index ef86bc4c563..e37308e86bf 100644 --- a/sys/arch/alpha/include/psl.h +++ b/sys/arch/alpha/include/psl.h @@ -1,97 +1,10 @@ -/* $OpenBSD: psl.h,v 1.5 1996/10/17 22:19:45 niklas Exp $ */ -/* $NetBSD: psl.h,v 1.5 1996/04/23 15:24:09 cgd Exp $ */ +/* $OpenBSD: psl.h,v 1.6 1996/10/30 22:39:22 niklas Exp $ */ +/* $NetBSD: psl.h,v 1.6 1996/07/09 00:37:51 cgd Exp $ */ /* - * Copyright (c) 1994, 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. + * Everything which would be defined here is defined in + * alpha_cpu.h, and this file is no longer necessary for the + * Alpha. However, some machine-independent code (e.g. + * /sys/compat/common/kern_exit_43.c) still wants a file with + * this name to be around. */ - -#ifndef __ALPHA_PSL_H__ -#define __ALPHA_PSL_H__ - -/* - * Processor Status register definitions. - */ -#define PSL_U 0x08 /* PS<3> == 1 -> User mode */ -#define PSL_IPL 0x07 /* PS<2:0> -> Interrupt mask */ - -/* - * The interrupt priority levels. - * Other IPL's are configured in software, and are listed below. - */ -#define PSL_IPL_0 0 /* all interrupts enabled */ -#define PSL_IPL_SOFT 1 /* block software interrupts */ -#define PSL_IPL_IO 4 /* block I/O device interrupts */ -#define PSL_IPL_CLOCK 5 /* block clock interrupts */ -#define PSL_IPL_HIGH 6 /* block everything except mchecks */ - -/* - * Miscellaneous PSL definitions - */ -#define PSL_MBZ (0xfffffffffffffff0) /* Must be always zero */ -#define PSL_USERSET (PSL_U) /* Must be set for user-mode */ -#define PSL_USERCLR (PSL_MBZ|PSL_IPL) /* Must be clr for user-mode */ -#define USERMODE(ps) ((ps & PSL_U) != 0) /* Is it user-mode? */ - -#ifdef _KERNEL -/* - * Translation buffer invalidation macro definitions. - */ -#define TBI_A -2 /* Flush all TB entries */ -#define TBI_AP -1 /* Flush all per-process TB entries */ -#define TBI_SI 1 /* Invalidate ITB entry for va */ -#define TBI_SD 2 /* Invalidate DTB entry for va */ -#define TBI_S 3 /* Invalidate all entries for va */ - -#define TBIA() pal_tbi(TBI_A, NULL) -#define TBIAP() pal_tbi(TBI_AP, NULL) -#define TBISI(va) pal_tbi(TBI_SI, va) -#define TBISD(va) pal_tbi(TBI_SD, va) -#define TBIS(va) pal_tbi(TBI_S, va) - -/* - * Cache invalidation/flush routines. - */ - -/* Flush all write buffers */ -static __inline void wbflush __P((void)); -static __inline void -wbflush() -{ - /* XXX? wmb */ - __asm __volatile("mb" : : : "memory"); -} - -#define IMB() pal_imb() /* Sync instruction cache w/data */ - -void alpha_mb __P((void)); /* Flush all write buffers */ -void pal_imb __P((void)); /* Sync instruction cache */ -u_int64_t pal_swpipl __P((u_int64_t)); /* write new IPL, return old */ -u_int64_t profile_swpipl __P((u_int64_t)); /* pal_swpipl w/o profiling */ -void pal_tbi __P((u_int64_t, void *)); /* Invalidate TLB entries */ -void pal_halt __P((void)) __attribute__((__noreturn__)); /* halt/reboot */ -#endif /* _KERNEL */ - -#endif /* !__ALPHA_PSL_H__ */ diff --git a/sys/arch/alpha/include/pte.h b/sys/arch/alpha/include/pte.h index f8a669a6206..6fcec6de1b9 100644 --- a/sys/arch/alpha/include/pte.h +++ b/sys/arch/alpha/include/pte.h @@ -1,5 +1,5 @@ -/* $OpenBSD: pte.h,v 1.4 1996/07/29 22:59:10 niklas Exp $ */ -/* $NetBSD: pte.h,v 1.4 1996/02/01 22:28:56 mycroft Exp $ */ +/* $OpenBSD: pte.h,v 1.5 1996/10/30 22:39:23 niklas Exp $ */ +/* $NetBSD: pte.h,v 1.7 1996/10/01 20:21:05 cgd Exp $ */ /* * Copyright (c) 1994, 1995 Carnegie-Mellon University. @@ -41,42 +41,53 @@ /* * Alpha Page Table Entry */ -typedef u_int64_t pt_entry_t; + +#include <machine/alpha_cpu.h> + +typedef alpha_pt_entry_t pt_entry_t; + #define PT_ENTRY_NULL ((pt_entry_t *) 0) #define PTESHIFT 3 /* pte size == 1 << PTESHIFT */ -#define PG_V 0x0000000000000001 /* PFN Valid */ -#define PG_NV 0x0000000000000000 /* PFN NOT Valid */ -#define PG_FOR 0x0000000000000002 /* Fault on read */ -#define PG_FOW 0x0000000000000004 /* Fault on write */ -#define PG_FOE 0x0000000000000008 /* Fault on execute */ -#define PG_ASM 0x0000000000000010 /* Address space match */ -#define PG_GH 0x0000000000000060 /* Granularity hint */ -#define PG_KRE 0x0000000000000100 /* Kernel read enable */ -#define PG_URE 0x0000000000000200 /* User read enable */ -#define PG_KWE 0x0000000000001000 /* Kernel write enable */ -#define PG_UWE 0x0000000000002000 /* User write enable */ -#define PG_PROT 0x000000000000ff00 +#define PG_V ALPHA_PTE_VALID +#define PG_NV 0 +#define PG_FOR ALPHA_PTE_FAULT_ON_READ +#define PG_FOW ALPHA_PTE_FAULT_ON_WRITE +#define PG_FOE ALPHA_PTE_FAULT_ON_EXECUTE +#define PG_ASM ALPHA_PTE_ASM +#define PG_GH ALPHA_PTE_GRANULARITY +#define PG_KRE ALPHA_PTE_KR +#define PG_URE ALPHA_PTE_UR +#define PG_KWE ALPHA_PTE_KW +#define PG_UWE ALPHA_PTE_UW +#define PG_PROT ALPHA_PTE_PROT #define PG_RSVD 0x000000000000cc80 /* Reserved fpr hardware */ #define PG_WIRED 0x0000000000010000 /* Wired. [SOFTWARE] */ -#define PG_FRAME 0xffffffff00000000 +#define PG_FRAME ALPHA_PTE_RAME #define PG_SHIFT 32 -#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT) +#define PG_PFNUM(x) ALPHA_PTE_TO_PFN(x) +#if 0 /* XXX NOT HERE */ #define K0SEG_BEGIN 0xfffffc0000000000 /* unmapped, cached */ #define K0SEG_END 0xfffffe0000000000 #define PHYS_UNCACHED 0x0000000040000000 +#endif #ifndef _LOCORE +#if 0 /* XXX NOT HERE */ #define k0segtophys(x) ((vm_offset_t)(x) & 0x00000003ffffffff) #define phystok0seg(x) ((vm_offset_t)(x) | K0SEG_BEGIN) #define phystouncached(x) ((vm_offset_t)(x) | PHYS_UNCACHED) #define uncachedtophys(x) ((vm_offset_t)(x) & ~PHYS_UNCACHED) +#endif #define PTEMASK (NPTEPG - 1) #define vatopte(va) (((va) >> PGSHIFT) & PTEMASK) #define vatoste(va) (((va) >> SEGSHIFT) & PTEMASK) +#define kvtol1pte(va) \ + (((vm_offset_t)(va) >> (PGSHIFT + 2*(PGSHIFT-PTESHIFT))) & PTEMASK) + #define vatopa(va) \ ((PG_PFNUM(*kvtopte(va)) << PGSHIFT) | ((vm_offset_t)(va) & PGOFSET)) @@ -92,15 +103,9 @@ typedef u_int64_t pt_entry_t; #define ptetokv(pte) \ ((((pt_entry_t *)(pte) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS) -/* - * Kernel virtual address to Lev1map entry index. - */ -#define kvtol1pte(va) \ - (((vm_offset_t)(va) >> (PGSHIFT + 2*(PGSHIFT-PTESHIFT))) & PTEMASK) - #define loadustp(stpte) { \ Lev1map[kvtol1pte(VM_MIN_ADDRESS)] = stpte; \ - TBIAP(); \ + ALPHA_TBIAP(); \ } extern pt_entry_t *Lev1map; /* Alpha Level One page table */ diff --git a/sys/arch/alpha/include/ptrace.h b/sys/arch/alpha/include/ptrace.h index c729976d16b..a38169df9d0 100644 --- a/sys/arch/alpha/include/ptrace.h +++ b/sys/arch/alpha/include/ptrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ptrace.h,v 1.2 1996/07/29 22:59:11 niklas Exp $ */ +/* $OpenBSD: ptrace.h,v 1.3 1996/10/30 22:39:24 niklas Exp $ */ /* $NetBSD: ptrace.h,v 1.1 1995/02/13 23:07:51 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/reg.h b/sys/arch/alpha/include/reg.h index 6dbb8d0ed41..f7f9dcde9ed 100644 --- a/sys/arch/alpha/include/reg.h +++ b/sys/arch/alpha/include/reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reg.h,v 1.2 1996/07/29 22:59:13 niklas Exp $ */ +/* $OpenBSD: reg.h,v 1.3 1996/10/30 22:39:25 niklas Exp $ */ /* $NetBSD: reg.h,v 1.2 1995/03/28 18:14:07 jtc Exp $ */ /* @@ -94,6 +94,8 @@ struct fpreg { #ifdef _KERNEL void restorefpstate __P((struct fpreg *)); void savefpstate __P((struct fpreg *)); +void frametoreg __P((struct trapframe *, struct reg *)); +void regtoframe __P((struct reg *, struct trapframe *)); #endif #endif /* _ALPHA_REG_H_ */ diff --git a/sys/arch/alpha/include/rpb.h b/sys/arch/alpha/include/rpb.h index ca1f09ab7e8..cbe4b76eccf 100644 --- a/sys/arch/alpha/include/rpb.h +++ b/sys/arch/alpha/include/rpb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rpb.h,v 1.4 1996/07/29 22:59:15 niklas Exp $ */ +/* $OpenBSD: rpb.h,v 1.5 1996/10/30 22:39:26 niklas Exp $ */ /* $NetBSD: rpb.h,v 1.7 1996/04/29 16:23:11 cgd Exp $ */ /* @@ -136,11 +136,15 @@ struct rpb { vm_offset_t rpb_memdat_off; /* C8: memory data offset */ vm_offset_t rpb_condat_off; /* D0: config data offset */ vm_offset_t rpb_fru_off; /* D8: FRU table offset */ - long (*rpb_save_term)(); /* E0: terminal save */ + /* XXX Are the protos below correct? */ + long (*rpb_save_term) __P((long)); + /* E0: terminal save */ long rpb_save_term_val; /* E8: */ - long (*rpb_rest_term)(); /* F0: terminal restore */ + long (*rpb_rest_term) __P((long)); + /* F0: terminal restore */ long rpb_rest_term_val; /* F8: */ - long (*rpb_restart)(); /* 100: restart */ + long (*rpb_restart) __P((long)); + /* 100: restart */ long rpb_restart_val; /* 108: */ u_int64_t rpb_reserve_os; /* 110: */ u_int64_t rpb_reserve_hw; /* 118: */ @@ -313,7 +317,7 @@ struct ctb { */ struct crd { int64_t descriptor; - int (*code)(); + int (*code) __P((struct crd *)); }; /* diff --git a/sys/arch/alpha/include/setjmp.h b/sys/arch/alpha/include/setjmp.h index 44cc80a4de4..7b032bb312e 100644 --- a/sys/arch/alpha/include/setjmp.h +++ b/sys/arch/alpha/include/setjmp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: setjmp.h,v 1.2 1996/07/29 22:59:16 niklas Exp $ */ +/* $OpenBSD: setjmp.h,v 1.3 1996/10/30 22:39:27 niklas Exp $ */ /* $NetBSD: setjmp.h,v 1.1 1995/02/13 23:07:55 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/sfbreg.h b/sys/arch/alpha/include/sfbreg.h index cdef5423be9..1adff8f3578 100644 --- a/sys/arch/alpha/include/sfbreg.h +++ b/sys/arch/alpha/include/sfbreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sfbreg.h,v 1.2 1996/07/29 22:59:18 niklas Exp $ */ +/* $OpenBSD: sfbreg.h,v 1.3 1996/10/30 22:39:28 niklas Exp $ */ /* $NetBSD: sfbreg.h,v 1.1 1996/05/01 21:15:46 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/signal.h b/sys/arch/alpha/include/signal.h index 33fd77a3a79..8df58e92099 100644 --- a/sys/arch/alpha/include/signal.h +++ b/sys/arch/alpha/include/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.2 1996/07/29 22:59:20 niklas Exp $ */ +/* $OpenBSD: signal.h,v 1.3 1996/10/30 22:39:29 niklas Exp $ */ /* $NetBSD: signal.h,v 1.2 1995/02/16 03:08:08 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/stdarg.h b/sys/arch/alpha/include/stdarg.h index 714090bcd28..6d3b043d87c 100644 --- a/sys/arch/alpha/include/stdarg.h +++ b/sys/arch/alpha/include/stdarg.h @@ -1,5 +1,5 @@ -/* $OpenBSD: stdarg.h,v 1.3 1996/07/29 22:59:21 niklas Exp $ */ -/* $NetBSD: stdarg.h,v 1.3 1995/12/26 00:15:47 mycroft Exp $ */ +/* $OpenBSD: stdarg.h,v 1.4 1996/10/30 22:39:30 niklas Exp $ */ +/* $NetBSD: stdarg.h,v 1.4 1996/10/09 21:13:05 cgd Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -47,7 +47,7 @@ typedef _BSD_VA_LIST_ va_list; (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) #define va_start(ap, last) \ - (__builtin_next_arg(last), (ap) = *(va_list *)__builtin_saveregs()) + (__builtin_next_arg(last), (ap) = *(va_list *)__builtin_saveregs(), (ap).pad = 0) #define __REAL_TYPE_CLASS 8 #define __va_arg_offset(ap, type) \ diff --git a/sys/arch/alpha/include/tgareg.h b/sys/arch/alpha/include/tgareg.h index 59a5f2cc740..f64d01b693c 100644 --- a/sys/arch/alpha/include/tgareg.h +++ b/sys/arch/alpha/include/tgareg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tgareg.h,v 1.2 1996/07/29 22:59:23 niklas Exp $ */ +/* $OpenBSD: tgareg.h,v 1.3 1996/10/30 22:39:31 niklas Exp $ */ /* $NetBSD: tgareg.h,v 1.1 1996/04/12 01:44:23 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/types.h b/sys/arch/alpha/include/types.h index 8f4367884a4..a068d7920fb 100644 --- a/sys/arch/alpha/include/types.h +++ b/sys/arch/alpha/include/types.h @@ -1,5 +1,5 @@ -/* $OpenBSD: types.h,v 1.2 1996/07/29 22:59:27 niklas Exp $ */ -/* $NetBSD: types.h,v 1.4 1995/07/06 03:39:32 cgd Exp $ */ +/* $OpenBSD: types.h,v 1.3 1996/10/30 22:39:32 niklas Exp $ */ +/* $NetBSD: types.h,v 1.5 1996/10/01 14:26:18 cgd Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -70,6 +70,4 @@ typedef unsigned long u_int64_t; typedef int64_t register_t; -#define __BDEVSW_DUMP_OLD_TYPE - #endif /* _MACHTYPES_H_ */ diff --git a/sys/arch/alpha/include/varargs.h b/sys/arch/alpha/include/varargs.h index e6a8c3346dd..38be90fdf3d 100644 --- a/sys/arch/alpha/include/varargs.h +++ b/sys/arch/alpha/include/varargs.h @@ -1,5 +1,5 @@ -/* $OpenBSD: varargs.h,v 1.3 1996/07/29 22:59:29 niklas Exp $ */ -/* $NetBSD: varargs.h,v 1.4 1995/12/26 01:16:24 mycroft Exp $ */ +/* $OpenBSD: varargs.h,v 1.4 1996/10/30 22:39:33 niklas Exp $ */ +/* $NetBSD: varargs.h,v 1.5 1996/10/09 21:13:05 cgd Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -57,6 +57,6 @@ #undef va_start #define va_start(ap) \ - ((ap) = *(va_list *)__builtin_saveregs()) + ((ap) = *(va_list *)__builtin_saveregs(), (ap).pad = 0) #endif /* !_ALPHA_VARARGS_H_ */ diff --git a/sys/arch/alpha/include/vmparam.h b/sys/arch/alpha/include/vmparam.h index 34f99d525cb..62eb118299c 100644 --- a/sys/arch/alpha/include/vmparam.h +++ b/sys/arch/alpha/include/vmparam.h @@ -1,5 +1,5 @@ -/* $OpenBSD: vmparam.h,v 1.3 1996/07/29 22:59:31 niklas Exp $ */ -/* $NetBSD: vmparam.h,v 1.2 1995/11/23 02:36:46 cgd Exp $ */ +/* $OpenBSD: vmparam.h,v 1.4 1996/10/30 22:39:34 niklas Exp $ */ +/* $NetBSD: vmparam.h,v 1.3 1996/07/09 00:28:25 cgd Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -84,15 +84,6 @@ #define DMMIN 32 /* smallest swap allocation */ #define DMMAX 4096 /* largest potential swap allocation */ -#ifdef THESE_ARE_WRONG -/* - * Sizes of the system and user portions of the system page table. - */ -/* SYSPTSIZE IS SILLY; (really number of buffers for I/O) */ -#define SYSPTSIZE 1228 -#define USRPTSIZE 1024 -#endif /* WRONG */ - /* * PTEs for mapping user space into the kernel for phyio operations. * 64 pte's are enough to cover 8 disks * MAXBSIZE. @@ -138,31 +129,21 @@ * swapped in you deserve some resources. We protect the last SAFERSS * pages against paging and will just swap you out rather than paging you. * Note that each process has at least UPAGES+CLSIZE pages which are not - * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this - * number just means a swapped in process is given around 25k bytes. - * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), - * so we loan each swapped in process memory worth 100$, or just admit - * that we don't consider it worthwhile and swap it out to disk which costs - * $30/mb or about $0.75. + * paged anyways, in addition to SAFERSS. */ -#define SAFERSS 4 /* nominal ``small'' resident set size +#define SAFERSS 10 /* nominal ``small'' resident set size protected against replacement */ -#ifdef THESE_ARE_WRONG -#define mapin(pte, v, pfnum, prot) \ - (*(int *)(pte) = ((pfnum) << PG_SHIFT) | (prot), MachTLBFlushAddr(v)) -#endif /* WRONG */ - /* * Mach derived constants */ /* user/kernel map constants */ -#define VM_MIN_ADDRESS ((vm_offset_t)0x0000000000000000) /* 0 */ -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x0000000200000000) /* 8G */ +#define VM_MIN_ADDRESS ((vm_offset_t)ALPHA_USEG_BASE) /* 0 */ +#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x0000000200000000) /* 8G XXX */ #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xfffffe0000000000) -#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xffffffffffffffff) +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)ALPHA_K1SEG_BASE) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)ALPHA_K1SEG_END) /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) @@ -171,8 +152,3 @@ /* some Alpha-specific constants */ #define VPTBASE ((vm_offset_t)0xfffffffc00000000) /* Virt. pg table */ - -#ifdef THESE_ARE_WRONG -/* pcb base */ -#define pcbb(p) ((u_int)(p)->p_addr) -#endif /* WRONG */ diff --git a/sys/arch/alpha/include/vuid_event.h b/sys/arch/alpha/include/vuid_event.h index a9ca5c9d112..833040b542e 100644 --- a/sys/arch/alpha/include/vuid_event.h +++ b/sys/arch/alpha/include/vuid_event.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vuid_event.h,v 1.2 1996/07/29 22:59:33 niklas Exp $ */ +/* $OpenBSD: vuid_event.h,v 1.3 1996/10/30 22:39:35 niklas Exp $ */ /* $NetBSD: vuid_event.h,v 1.1 1996/04/12 01:45:47 cgd Exp $ */ /* diff --git a/sys/arch/alpha/include/wsconsio.h b/sys/arch/alpha/include/wsconsio.h index 1f4bb1a418d..8dc493b5547 100644 --- a/sys/arch/alpha/include/wsconsio.h +++ b/sys/arch/alpha/include/wsconsio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsconsio.h,v 1.2 1996/07/29 22:59:35 niklas Exp $ */ +/* $OpenBSD: wsconsio.h,v 1.3 1996/10/30 22:39:35 niklas Exp $ */ /* $NetBSD: wsconsio.h,v 1.1 1996/04/12 01:43:06 cgd Exp $ */ /* |