diff options
Diffstat (limited to 'sys/arch/alpha/include')
34 files changed, 3450 insertions, 0 deletions
diff --git a/sys/arch/alpha/include/ansi.h b/sys/arch/alpha/include/ansi.h new file mode 100644 index 00000000000..c3e6e2bfbf4 --- /dev/null +++ b/sys/arch/alpha/include/ansi.h @@ -0,0 +1,78 @@ +/* $NetBSD: ansi.h,v 1.2 1995/02/16 03:08:04 cgd Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. 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 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. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + */ + +#ifndef _ANSI_H_ +#define _ANSI_H_ + +/* + * Types which are fundamental to the implementation and may appear in + * more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ int /* clock() */ +#define _BSD_PTRDIFF_T_ long /* ptr1 - ptr2 */ +#define _BSD_SIZE_T_ unsigned long /* sizeof() */ +#define _BSD_SSIZE_T_ long /* byte count or error */ +#define _BSD_TIME_T_ int /* time() */ +struct __va_list { + char *base; + long offset; +}; +#define _BSD_VA_LIST_ struct __va_list /* va_list */ + +/* + * Runes (wchar_t) is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you + * lose a bit of ANSI conformance, but your programs will still work. + * + * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t + * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains + * defined for ctype.h. + */ +#define _BSD_WCHAR_T_ int /* wchar_t */ +#define _BSD_RUNE_T_ int /* rune_t */ + +#endif /* _ANSI_H_ */ diff --git a/sys/arch/alpha/include/asm.h b/sys/arch/alpha/include/asm.h new file mode 100644 index 00000000000..4283fbe52cc --- /dev/null +++ b/sys/arch/alpha/include/asm.h @@ -0,0 +1,569 @@ +/* $NetBSD: asm.h,v 1.1 1995/02/13 23:07:30 cgd Exp $ */ + +/* + * Copyright (c) 1991,1990,1989,1994,1995 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. + */ + +/* + * Assembly coding style + * + * This file contains macros and register defines to + * aid in writing more readable assembly code. + * Some rules to make assembly code understandable by + * a debugger are also noted. + * + * The document + * + * "ALPHA Calling Standard", DEC 27-Apr-90 + * + * defines (a superset of) the rules and conventions + * we use. While we make no promise of adhering to + * such standard and its evolution (esp where we + * can get faster code paths) it is certainly intended + * that we be interoperable with such standard. + * + * In this sense, this file is a proper part of the + * definition of the (software) Alpha architecture. + */ + +/* + * Symbolic register names and register saving rules + * + * Legend: + * T Saved by caller (Temporaries) + * S Saved by callee (call-Safe registers) + */ + +#define v0 $0 /* (T) return value */ +#define t0 $1 /* (T) temporary registers */ +#define t1 $2 +#define t2 $3 +#define t3 $4 +#define t4 $5 +#define t5 $6 +#define t6 $7 +#define t7 $8 + +#define s0 $9 /* (S) call-safe registers */ +#define s1 $10 +#define s2 $11 +#define s3 $12 +#define s4 $13 +#define s5 $14 +#define s6 $15 +#define a0 $16 /* (T) argument registers */ +#define a1 $17 +#define a2 $18 +#define a3 $19 +#define a4 $20 +#define a5 $21 +#define t8 $22 /* (T) temporary registers */ +#define t9 $23 +#define t10 $24 +#define t11 $25 +#define ra $26 /* (T) return address */ +#define t12 $27 /* (T) another temporary */ +#define at_reg $28 /* (T) assembler scratch */ +#define gp $29 /* (T) (local) data pointer */ +#define sp $30 /* (S) stack pointer */ +#define zero $31 /* wired zero */ + +/* Floating point registers (XXXX VERIFY THIS) */ +#define fv0 $f0 /* (T) return value (real) */ +#define fv1 $f1 /* (T) return value (imaginary)*/ +#define ft0 fv1 +#define fs0 $f2 /* (S) call-safe registers */ +#define fs1 $f3 +#define fs2 $f4 +#define fs3 $f5 +#define fs4 $f6 +#define fs5 $f7 +#define fs6 $f8 +#define fs7 $f9 +#define ft1 $f10 /* (T) temporary registers */ +#define ft2 $f11 +#define ft3 $f12 +#define ft4 $f13 +#define ft5 $f14 +#define ft6 $f15 +#define fa0 $f16 /* (T) argument registers */ +#define fa1 $f17 +#define fa2 $f18 +#define fa3 $f19 +#define fa4 $f20 +#define fa5 $f21 +#define ft7 $f22 /* (T) more temporaries */ +#define ft8 $f23 +#define ft9 $f24 +#define ft10 $f25 +#define ft11 $f26 +#define ft12 $f27 +#define ft13 $f28 +#define ft14 $f29 +#define ft15 $f30 +#define fzero $f31 /* wired zero */ + + +/* Other DEC standard names */ +#define ai $25 /* (T) argument information */ +#define pv $27 /* (T) procedure value */ + +/* + * + * Debuggers need symbol table information to be able to properly + * decode a stack trace. The minimum that should be provided is: + * + * name: + * .proc name,numargs + * + * where "name" is the function's name; + * "numargs" how many arguments it expects. For varargs + * procedures this should be a negative number, + * indicating the minimum required number of + * arguments (which is at least 1); + * + * NESTED functions (functions that call other functions) should define + * how they handle their stack frame in a .frame directive: + * + * .frame framesize, pc_reg, i_mask, f_mask + * + * where "framesize" is the size of the frame for this function, in bytes. + * That is: + * new_sp + framesize == old_sp + * Framesizes should be rounded to a cacheline size. + * Note that old_sp plays the role of a conventional + * "frame pointer"; + * "pc_reg" is either a register which preserves the caller's PC + * or 'std', if std the saved PC should be stored at + * old_sp-8 + * "i_mask" is a bitmask that indicates which of the integer + * registers are saved. See the M_xx defines at the + * end for the encoding of this 32bit value. + * "f_mask" is the same, for floating point registers. + * + * Note that registers should be saved starting at "old_sp-8", where the + * return address should be stored. Other registers follow at -16-24-32.. + * starting from register 0 (if saved) and up. Then float registers (ifany) + * are saved. + * + * If you need to alias a leaf function, or to provide multiple entry points + * use the LEAF() macro for the main entry point and XLEAF() for the other + * additional/alternate entry points. + * "XLEAF"s must be nested within a "LEAF" and a ".end". + * Similar rules for nested routines, e.g. use NESTED/XNESTED + * Symbols that should not be exported can be declared with the STATIC_xxx + * macros. + * + * All functions must be terminated by the END macro + * + * It is conceivable, although currently at the limits of compiler + * technology, that while performing inter-procedural optimizations + * the compiler/linker be able to avoid unnecessary register spills + * if told about the register usage of LEAF procedures (and by transitive + * closure of NESTED procedures as well). Assembly code can help + * this process using the .reguse directive: + * + * .reguse i_mask, f_mask + * + * where the register masks are built as above or-ing M_xx defines. + * + * + * All symbols are internal unless EXPORTed. Symbols that are IMPORTed + * must be appropriately described to the debugger. + * + */ + +/* + * LEAF + * Declare a global leaf function. + * A leaf function does not call other functions AND does not + * use any register that is callee-saved AND does not modify + * the stack pointer. + */ +#define LEAF(_name_,_n_args_) \ + .globl _name_; \ + .ent _name_ 0; \ +_name_:; \ + .frame sp,0,ra +/* should have been + .proc _name_,_n_args_; \ + .frame 0,ra,0,0 +*/ + +/* + * STATIC_LEAF + * Declare a local leaf function. + */ +#define STATIC_LEAF(_name_,_n_args_) \ + .ent _name_ 0; \ +_name_:; \ + .frame sp,0,ra +/* should have been + .proc _name_,_n_args_; \ + .frame 0,ra,0,0 +*/ +/* + * XLEAF + * Global alias for a leaf function, or alternate entry point + */ +#define XLEAF(_name_,_n_args_) \ + .globl _name_; \ + .aent _name_ 0; \ +_name_: +/* should have been + .aproc _name_,_n_args_; +*/ + +/* + * STATIC_XLEAF + * Local alias for a leaf function, or alternate entry point + */ +#define STATIC_XLEAF(_name_,_n_args_) \ + .aent _name_ 0; \ +_name_: +/* should have been + .aproc _name_,_n_args_; +*/ + +/* + * NESTED + * Declare a (global) nested function + * A nested function calls other functions and needs + * therefore stack space to save/restore registers. + */ +#define NESTED(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \ + .globl _name_; \ + .ent _name_ 0; \ +_name_:; \ + .frame sp,_framesize_,_pc_reg_; \ + .livereg _i_mask_,_f_mask_ +/* should have been + .proc _name_,_n_args_; \ + .frame _framesize_, _pc_reg_, _i_mask_, _f_mask_ +*/ + +/* + * STATIC_NESTED + * Declare a local nested function. + */ +#define STATIC_NESTED(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \ + .ent _name_ 0; \ +_name_:; \ + .frame sp,_framesize_,_pc_reg_; \ + .livereg _i_mask_,_f_mask_ +/* should have been + .proc _name_,_n_args_; \ + .frame _framesize_, _pc_reg_, _i_mask_, _f_mask_ +*/ + +/* + * XNESTED + * Same as XLEAF, for a nested function. + */ +#define XNESTED(_name_,_n_args_) \ + .globl _name_; \ + .aent _name_ 0; \ +_name_: +/* should have been + .aproc _name_,_n_args_; +*/ + + +/* + * STATIC_XNESTED + * Same as STATIC_XLEAF, for a nested function. + */ +#define STATIC_XNESTED(_name_,_n_args_) \ + .aent _name_ 0; \ +_name_: +/* should have been + .aproc _name_,_n_args_; +*/ + + +/* + * END + * Function delimiter + */ +#define END(_name_) \ + .end _name_ + + +/* + * CALL + * Function invocation + */ +#define CALL(_name_) \ + jsr ra,_name_; \ + ldgp gp,0(ra) +/* but this would cover longer jumps + br ra,.+4; \ + bsr ra,_name_ +*/ + + +/* + * RET + * Return from function + */ +#define RET \ + ret zero,(ra),1 + + +/* + * EXPORT + * Export a symbol + */ +#define EXPORT(_name_) \ + .globl _name_; \ +_name_: + + +/* + * IMPORT + * Make an external name visible, typecheck the size + */ +#define IMPORT(_name_, _size_) \ + .extern _name_,_size_ + + +/* + * ABS + * Define an absolute symbol + */ +#define ABS(_name_, _value_) \ + .globl _name_; \ +_name_ = _value_ + + +/* + * BSS + * Allocate un-initialized space for a global symbol + */ +#define BSS(_name_,_numbytes_) \ + .comm _name_,_numbytes_ + +/* + * VECTOR + * Make an exception entry point look like a called function, + * to make it digestible to the debugger (KERNEL only) + */ +#define VECTOR(_name_, _i_mask_) \ + .globl _name_; \ + .ent _name_ 0; \ +_name_:; \ + .mask _i_mask_|IM_EXC,0; \ + .frame sp,MSS_SIZE,ra; +/* .livereg _i_mask_|IM_EXC,0 +/* should have been + .proc _name_,1; \ + .frame MSS_SIZE,$31,_i_mask_,0; \ +*/ + +/* + * MSG + * Allocate space for a message (a read-only ascii string) + */ +#ifdef __ALPHA_AS__ +#define ASCIZ .asciiz +#else +#define ASCIZ .asciz +#endif +#define MSG(msg,reg) \ + lda reg, 9f; \ + .data; \ +9: ASCIZ msg; \ + .text; + +/* + * PRINTF + * Print a message + */ +#define PRINTF(msg) \ + MSG(msg,a0); \ + CALL(printf) + +/* + * PANIC + * Fatal error (KERNEL) + */ +#define PANIC(msg) \ + MSG(msg,a0); \ + CALL(panic) + +/* + * Register mask defines, used to define both save + * and use register sets. + * + * NOTE: The bit order should HAVE BEEN maintained when saving + * registers on the stack: sp goes at the highest + * address, gp lower on the stack, etc etc + * BUT NOONE CARES ABOUT DEBUGGERS AT MIPS + */ + +#define IM_EXC 0x80000000 +#define IM_SP 0x40000000 +#define IM_GP 0x20000000 +#define IM_AT 0x10000000 +#define IM_T12 0x08000000 +# define IM_PV IM_T4 +#define IM_RA 0x04000000 +#define IM_T11 0x02000000 +# define IM_AI IM_T3 +#define IM_T10 0x01000000 +#define IM_T9 0x00800000 +#define IM_T8 0x00400000 +#define IM_A5 0x00200000 +#define IM_A4 0x00100000 +#define IM_A3 0x00080000 +#define IM_A2 0x00040000 +#define IM_A1 0x00020000 +#define IM_A0 0x00010000 +#define IM_S6 0x00008000 +#define IM_S5 0x00004000 +#define IM_S4 0x00002000 +#define IM_S3 0x00001000 +#define IM_S2 0x00000800 +#define IM_S1 0x00000400 +#define IM_S0 0x00000200 +#define IM_T7 0x00000100 +#define IM_T6 0x00000080 +#define IM_T5 0x00000040 +#define IM_T4 0x00000020 +#define IM_T3 0x00000010 +#define IM_T2 0x00000008 +#define IM_T1 0x00000004 +#define IM_T0 0x00000002 +#define IM_V0 0x00000001 + +#define FM_T15 0x40000000 +#define FM_T14 0x20000000 +#define FM_T13 0x10000000 +#define FM_T12 0x08000000 +#define FM_T11 0x04000000 +#define FM_T10 0x02000000 +#define FM_T9 0x01000000 +#define FM_T8 0x00800000 +#define FM_T7 0x00400000 +#define FM_A5 0x00200000 +#define FM_A4 0x00100000 +#define FM_A3 0x00080000 +#define FM_A2 0x00040000 +#define FM_A1 0x00020000 +#define FM_A0 0x00010000 +#define FM_T6 0x00008000 +#define FM_T5 0x00004000 +#define FM_T4 0x00002000 +#define FM_T3 0x00001000 +#define FM_T2 0x00000800 +#define FM_T1 0x00000400 +#define FM_S7 0x00000200 +#define FM_S6 0x00000100 +#define FM_S5 0x00000080 +#define FM_S4 0x00000040 +#define FM_S3 0x00000020 +#define FM_S2 0x00000010 +#define FM_S1 0x00000008 +#define FM_S0 0x00000004 +#define FM_T0 0x00000002 +#define FM_V1 FM_T0 +#define FM_V0 0x00000001 + +/* + * PAL "function" codes (used as arguments to call_pal instructions). + * + * Those marked with "P" are privileged, and those marked with "U" + * are unprivileged. + */ + +/* Common PAL codes. */ +#define PAL_halt 0x0000 /* P */ +#define PAL_draina 0x0002 /* P */ +#define PAL_swppal 0x000a /* P */ +#define PAL_bpt 0x0080 /* U */ +#define PAL_bugchk 0x0081 /* U */ +#define PAL_imb 0x0086 /* U */ +#define PAL_rdunique 0x009e /* U */ +#define PAL_wrunique 0x009f /* U */ +#define PAL_gentrap 0x00aa /* U */ + +/* VMS PAL codes. */ +#define PAL_VMS_ldqp 0x0003 /* P */ +#define PAL_VMS_stqp 0x0004 /* P */ +#define PAL_VMS_mtpr_fen 0x000c /* P */ +#define PAL_VMS_mtpr_ipir 0x000d /* P */ +#define PAL_VMS_mfpr_ipl 0x000e /* P */ +#define PAL_VMS_mtpr_ipl 0x000f /* P */ +#define PAL_VMS_mfpr_mces 0x0010 /* P */ +#define PAL_VMS_mtpr_mces 0x0011 /* P */ +#define PAL_VMS_mfpr_prbr 0x0013 /* P */ +#define PAL_VMS_mtpr_prbr 0x0014 /* P */ +#define PAL_VMS_mfpr_ptbr 0x0015 /* P */ +#define PAL_VMS_mtpr_scbb 0x0017 /* P */ +#define PAL_VMS_mtpr_sirr 0x0018 /* P */ +#define PAL_VMS_mtpr_tbia 0x001b /* P */ +#define PAL_VMS_mtpr_tbiap 0x001c /* P */ +#define PAL_VMS_mtpr_tbis 0x001d /* P */ +#define PAL_VMS_mfpr_usp 0x0022 /* P */ +#define PAL_VMS_mtpr_usp 0x0023 /* P */ +#define PAL_VMS_mfpr_vptb 0x0029 /* P */ +#define PAL_VMS_mfpr_whami 0x003f /* P */ +#define PAL_VMS_rei 0x0092 /* U */ + +/* OSF/1 PAL codes. */ +#define PAL_OSF1_wrfen 0x002b /* P */ +#define PAL_OSF1_wrvptptr 0x002d /* P */ +#define PAL_OSF1_swpctx 0x0030 /* P */ +#define PAL_OSF1_wrval 0x0031 /* P */ +#define PAL_OSF1_rdval 0x0032 /* P */ +#define PAL_OSF1_tbi 0x0033 /* P */ +#define PAL_OSF1_wrent 0x0034 /* P */ +#define PAL_OSF1_swpipl 0x0035 /* P */ +#define PAL_OSF1_rdps 0x0036 /* P */ +#define PAL_OSF1_wrkgp 0x0037 /* P */ +#define PAL_OSF1_wrusp 0x0038 /* P */ +#define PAL_OSF1_rdusp 0x003a /* P */ +#define PAL_OSF1_whami 0x003c /* P */ +#define PAL_OSF1_retsys 0x003d /* P */ +#define PAL_OSF1_rti 0x003f /* P */ +#define PAL_OSF1_callsys 0x0083 /* U */ +#define PAL_OSF1_imb 0x0086 /* U */ + +/* + * Defintions to make things portable between gcc and OSF/1 cc. + */ +#define SETGP(pv) ldgp gp,0(pv) + +#ifdef __ALPHA_AS__ +#define MF_FPCR(x) mf_fpcr x,x,x +#define MT_FPCR(x) mt_fpcr x,x,x +#define JMP(loc) jmp loc +#define CONST(c,reg) mov c, reg +#else +#define MF_FPCR(x) mf_fpcr x +#define MT_FPCR(x) mt_fpcr x +#define JMP(loc) br zero,loc +#define CONST(c,reg) ldiq reg, c +#endif + diff --git a/sys/arch/alpha/include/autoconf.h b/sys/arch/alpha/include/autoconf.h new file mode 100644 index 00000000000..167a214e34b --- /dev/null +++ b/sys/arch/alpha/include/autoconf.h @@ -0,0 +1,74 @@ +/* $NetBSD: autoconf.h,v 1.1 1995/02/13 23:07:31 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. + */ + +/* + * Machine-dependent structures of autoconfiguration + */ + +struct confargs; + +typedef int (*intr_handler_t) __P((void *)); + +struct abus { + struct device *ab_dv; /* back-pointer to device */ + int ab_type; /* bus type (see below) */ + void (*ab_intr_establish) /* bus's set-handler function */ + __P((struct confargs *, intr_handler_t, void *)); + void (*ab_intr_disestablish) /* bus's unset-handler function */ + __P((struct confargs *)); + caddr_t (*ab_cvtaddr) /* convert slot/offset to address */ + __P((struct confargs *)); + int (*ab_matchname) /* see if name matches driver */ + __P((struct confargs *, char *)); +}; + +#define BUS_MAIN 1 /* mainbus */ +#define BUS_TC 2 /* TurboChannel */ +#define BUS_ASIC 3 /* IOCTL ASIC; under TurboChannel */ +#define BUS_TCDS 4 /* TCDS ASIC; under TurboChannel */ + +#define BUS_INTR_ESTABLISH(ca, handler, val) \ + (*(ca)->ca_bus->ab_intr_establish)((ca), (handler), (val)) +#define BUS_INTR_DISESTABLISH(ca) \ + (*(ca)->ca_bus->ab_intr_establish)(ca) +#define BUS_CVTADDR(ca) \ + (*(ca)->ca_bus->ab_cvtaddr)(ca) +#define BUS_MATCHNAME(ca, name) \ + (*(ca)->ca_bus->ab_matchname)((ca), (name)) + +struct confargs { + char *ca_name; /* Device name. */ + int ca_slot; /* Device slot. */ + int ca_offset; /* Offset into slot. */ + struct abus *ca_bus; /* bus device resides on. */ +}; + +void set_clockintr __P((void (*)(struct clockframe *))); +void set_iointr __P((void (*)(void *, int))); +int badaddr __P((void *, u_int64_t)); diff --git a/sys/arch/alpha/include/cdefs.h b/sys/arch/alpha/include/cdefs.h new file mode 100644 index 00000000000..cd705e0db7d --- /dev/null +++ b/sys/arch/alpha/include/cdefs.h @@ -0,0 +1,38 @@ +/* $NetBSD: cdefs.h,v 1.2 1995/05/03 00:13:55 cgd Exp $ */ + +/* + * Copyright (c) 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. + */ + +#ifndef _MACHINE_CDEFS_H_ +#define _MACHINE_CDEFS_H_ + +#define _C_LABEL(x) _STRING(x) + +#define __indr_references(sym,msg) /* nothing */ +#define __warn_references(sym,msg) /* nothing */ + +#endif /* !_MACHINE_CDEFS_H_ */ diff --git a/sys/arch/alpha/include/coff.h b/sys/arch/alpha/include/coff.h new file mode 100644 index 00000000000..7516cb7e72a --- /dev/null +++ b/sys/arch/alpha/include/coff.h @@ -0,0 +1,109 @@ +/* + * Mach Operating System + * Copyright (c) 1992,1993,1994,1995 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. + */ +/* + * HISTORY + * Revision 1.1 1994/06/30 16:29:52 bostic + * coff.h + * + * Revision 2.3 93/01/19 08:59:12 danner + * Fix TXTOFF to cope with assembler/linker incoherence viz + * rounding in OMAGIC files. + * [93/01/15 af] + * + * Revision 2.2 93/01/14 17:12:13 danner + * Adapted for Alpha. + * [92/05/31 af] + * + */ +/* + * File: coff.h + * Author: Alessandro Forin, Carnegie Mellon University + * Date: 10/89 + * + * Structure definitions for COFF headers + */ + +struct filehdr { + unsigned short f_magic; /* magic number */ + unsigned short f_nscns; /* number of sections */ + int f_timdat; /* time & date stamp */ + vm_offset_t f_symptr; /* file pointer to symtab */ + int f_nsyms; /* number of symtab entries */ + unsigned short f_opthdr; /* sizeof(optional hdr) */ + unsigned short f_flags; /* flags */ +}; + +#define F_EXEC 0000002 + +#define ALPHAMAGIC 0603 + +struct scnhdr { + char s_name[8]; /* section name */ + vm_offset_t s_paddr; /* physical address */ + vm_offset_t s_vaddr; /* virtual address */ + vm_offset_t s_size; /* section size */ + vm_offset_t s_scnptr; /* file ptr to raw data for section */ + vm_offset_t s_relptr; /* file ptr to relocation */ + vm_offset_t s_lnnoptr; /* file ptr to line numbers */ + unsigned short s_nreloc; /* number of relocation entries */ + unsigned short s_nlnno; /* number of line number entries */ + int s_flags; /* flags */ +}; + +struct aouthdr { + short magic; /* see magic.h */ + short vstamp; /* version stamp */ + int pad; /* help for cross compilers */ + vm_offset_t tsize; /* text size in bytes, padded to FW */ + vm_offset_t dsize; /* initialized data size */ + vm_offset_t bsize; /* uninitialized data size */ + vm_offset_t entry; /* entry point, value of "start" */ + vm_offset_t text_start; /* base of text used for this file */ + vm_offset_t data_start; /* base of data used for this file */ + vm_offset_t bss_start; /* base of bss used for this file */ + int gprmask; /* general purpose register mask*/ + int fprmask; /* FPA register mask */ + vm_offset_t gp_value; /* the gp value used for this object*/ +}; + +struct exechdr { + struct filehdr f; + struct aouthdr a; +}; + +/* Linker and assembler screwed: .o are not aligned, images are */ +#define SCNROUND ((long)16) + +#define N_COFFBADMAG(a) \ + ((a).magic != OMAGIC && (a).magic != NMAGIC && (a).magic != ZMAGIC) + +#define N_COFFTXTOFF(f, a) \ + (((a).magic == ZMAGIC) ? 0 : \ + (((f).f_flags & F_EXEC) ? \ + (((sizeof(struct filehdr) + sizeof(struct aouthdr) + \ + (f).f_nscns * sizeof(struct scnhdr)) + SCNROUND-1) & ~(SCNROUND-1)) \ + : (sizeof(struct filehdr) + sizeof(struct aouthdr) + \ + (f).f_nscns * sizeof(struct scnhdr)))) diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h new file mode 100644 index 00000000000..0fc461d410b --- /dev/null +++ b/sys/arch/alpha/include/cpu.h @@ -0,0 +1,126 @@ +/* $NetBSD: cpu.h,v 1.6 1995/06/28 02:55:18 cgd Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1990, 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. + * + * from: Utah $Hdr: cpu.h 1.16 91/03/25$ + * + * @(#)cpu.h 8.4 (Berkeley) 1/5/94 + */ + +#ifndef _ALPHA_CPU_H_ +#define _ALPHA_CPU_H_ + +/* + * Exported definitions unique to Alpha cpu support. + */ + +#include <machine/frame.h> + +/* + * definitions of cpu-dependent requirements + * referenced in generic code + */ +#define cpu_wait(p) /* nothing */ +#define cpu_setstack(p, ap) (p)->p_addr->u_pcb.pcb_usp + +/* + * Arguments to hardclock and gatherstats encapsulate the previous + * machine state in an opaque clockframe. One the Alpha, we use + * what we push on an interrupt (a trapframe). + */ +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) +/* + * XXX No way to accurately tell if we were in interrupt mode before taking + * clock interrupt. + */ +#define CLKF_INTR(framep) (0) + +/* + * Preempt the current process if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ +#define need_resched() { want_resched = 1; aston(); } + +/* + * Give a profiling tick to the current process when the user profiling + * buffer pages are invalid. On the hp300, request an ast to send us + * through trap, marking the proc as needing a profiling tick. + */ +#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } + +/* + * Notify the current process (p) that it has a signal pending, + * process as soon as possible. + */ +#define signotify(p) aston() + +#define aston() (astpending = 1) + +u_int64_t astpending; /* need to trap before returning to user mode */ +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_MAXID 2 /* number of valid machdep ids */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "console_device", CTLTYPE_STRUCT }, \ +} + +#endif /* _ALPHA_CPU_H_ */ diff --git a/sys/arch/alpha/include/disklabel.h b/sys/arch/alpha/include/disklabel.h new file mode 100644 index 00000000000..0c41adf1c92 --- /dev/null +++ b/sys/arch/alpha/include/disklabel.h @@ -0,0 +1,46 @@ +/* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */ + +/* + * Copyright (c) 1994 Christopher G. Demetriou + * 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 Christopher G. Demetriou. + * 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 THE AUTHOR ``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 AUTHOR 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. + */ + +#ifndef _MACHINE_DISKLABEL_H_ +#define _MACHINE_DISKLABEL_H_ + +#define LABELSECTOR 0 /* sector containing label */ +#define LABELOFFSET 64 /* offset of label in sector */ +#define MAXPARTITIONS 8 /* number of partitions */ +#define RAW_PART 2 /* raw partition: xx?c */ + +/* Just a dummy */ +struct cpu_disklabel { + int cd_dummy; /* must have one element. */ +}; + +#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/alpha/include/ecoff.h b/sys/arch/alpha/include/ecoff.h new file mode 100644 index 00000000000..c67b3286f16 --- /dev/null +++ b/sys/arch/alpha/include/ecoff.h @@ -0,0 +1,50 @@ +/* $NetBSD: ecoff.h,v 1.1 1995/02/13 23:07:35 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 ea_bldrev; /* XXX */ + +#define ECOFF_MACHDEP \ + u_int ea_gprmask; \ + u_int ea_fprmask; \ + u_long ea_gp_value + +#define ECOFF_MAGIC_ALPHA 0603 +#define ECOFF_MAGIC_NETBSD_ALPHA 0605 +#define ECOFF_BADMAG(ex) \ + (ex->ef_magic != ECOFF_MAGIC_ALPHA && \ + ex->ef_magic != ECOFF_MAGIC_NETBSD_ALPHA) + +#define ECOFF_SEGMENT_ALIGNMENT(eap) (eap->ea_vstamp < 23 ? 8 : 16) diff --git a/sys/arch/alpha/include/endian.h b/sys/arch/alpha/include/endian.h new file mode 100644 index 00000000000..a78a5bcfca1 --- /dev/null +++ b/sys/arch/alpha/include/endian.h @@ -0,0 +1,89 @@ +/* $NetBSD: endian.h,v 1.1 1995/02/13 23:07:36 cgd Exp $ */ + +/* + * Copyright (c) 1987, 1991, 1993 + * The Regents of the University of California. 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 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. + * + * @(#)endian.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _ENDIAN_H_ +#define _ENDIAN_H_ + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + +#ifndef _POSIX_SOURCE +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +#define BYTE_ORDER LITTLE_ENDIAN + +#include <sys/cdefs.h> + +__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)); +__END_DECLS + +/* + * Macros for network/external number representation conversion. + */ +#if BYTE_ORDER == BIG_ENDIAN && !defined(lint) +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define NTOHL(x) (x) +#define NTOHS(x) (x) +#define HTONL(x) (x) +#define HTONS(x) (x) + +#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) +#endif +#endif /* !_POSIX_SOURCE */ +#endif /* !_ENDIAN_H_ */ diff --git a/sys/arch/alpha/include/exec.h b/sys/arch/alpha/include/exec.h new file mode 100644 index 00000000000..7ff3e50e63a --- /dev/null +++ b/sys/arch/alpha/include/exec.h @@ -0,0 +1,38 @@ +/* $NetBSD: exec.h,v 1.1 1995/02/13 23:07:37 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. + */ + +#ifndef _ALPHA_EXEC_H_ +#define _ALPHA_EXEC_H_ + +#define cpu_exec_aout_makecmds(p, epp) ENOEXEC + +/* Size of a page in an object file. */ +#define __LDPGSZ 8192 + +#endif /* !_ALPHA_EXEC_H_ */ diff --git a/sys/arch/alpha/include/float.h b/sys/arch/alpha/include/float.h new file mode 100644 index 00000000000..47a9efa669b --- /dev/null +++ b/sys/arch/alpha/include/float.h @@ -0,0 +1,78 @@ +/* $NetBSD: float.h,v 1.4 1995/06/20 20:45:22 jtc Exp $ */ + +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. 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 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. + */ + +#ifndef _ALPHA_FLOAT_H_ +#define _ALPHA_FLOAT_H_ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +extern int __flt_rounds(); +__END_DECLS + +#define FLT_RADIX 2 /* b */ +#define FLT_ROUNDS __flt_rounds() + +#define FLT_MANT_DIG 24 /* p */ +#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ +#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ +#define FLT_MIN_EXP -125 /* emin */ +#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ +#define FLT_MIN_10_EXP -37 /* ceil(log10(b**(emin-1))) */ +#define FLT_MAX_EXP 128 /* emax */ +#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ +#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ + +#define DBL_MANT_DIG 53 +#define DBL_EPSILON 2.2204460492503131E-16 +#define DBL_DIG 15 +#define DBL_MIN_EXP -1021 +#define DBL_MIN 2.2250738585072014E-308 +#define DBL_MIN_10_EXP -307 +#define DBL_MAX_EXP 1024 +#define DBL_MAX 1.7976931348623157E+308 +#define DBL_MAX_10_EXP 308 + +#define LDBL_MANT_DIG DBL_MANT_DIG +#define LDBL_EPSILON DBL_EPSILON +#define LDBL_DIG DBL_DIG +#define LDBL_MIN_EXP DBL_MIN_EXP +#define LDBL_MIN DBL_MIN +#define LDBL_MIN_10_EXP DBL_MIN_10_EXP +#define LDBL_MAX_EXP DBL_MAX_EXP +#define LDBL_MAX DBL_MAX +#define LDBL_MAX_10_EXP DBL_MAX_10_EXP + +#endif /* _ALPHA_FLOAT_H_ */ diff --git a/sys/arch/alpha/include/frame.h b/sys/arch/alpha/include/frame.h new file mode 100644 index 00000000000..694d25e160d --- /dev/null +++ b/sys/arch/alpha/include/frame.h @@ -0,0 +1,89 @@ +/* $NetBSD: frame.h,v 1.1 1995/02/13 23:07:39 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. + */ + +#ifndef _ALPHA_FRAME_H_ +#define _ALPHA_FRAME_H_ + +/* + * XXX where did this info come from? + */ + +/* + * Trap 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. + */ + +/* Number of registers saved, including padding. */ +#define FRAME_NSAVEREGS 28 + +/* The offsets of the registers to be saved, into the array. */ +#define FRAME_V0 0 +#define FRAME_T0 1 +#define FRAME_T1 2 +#define FRAME_T2 3 +#define FRAME_T3 4 +#define FRAME_T4 5 +#define FRAME_T5 6 +#define FRAME_T6 7 +#define FRAME_T7 8 +#define FRAME_S0 9 +#define FRAME_S1 10 +#define FRAME_S2 11 +#define FRAME_S3 12 +#define FRAME_S4 13 +#define FRAME_S5 14 +#define FRAME_S6 15 +#define FRAME_A3 16 +#define FRAME_A4 17 +#define FRAME_A5 18 +#define FRAME_T8 19 +#define FRAME_T9 20 +#define FRAME_T10 21 +#define FRAME_T11 22 +#define FRAME_RA 23 +#define FRAME_T12 24 +#define FRAME_AT 25 +#define FRAME_SP 26 +#define FRAME_SPARE 27 /* spare; padding */ + +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] */ +}; + +#endif /* _ALPHA_FRAME_H_ */ diff --git a/sys/arch/alpha/include/ieee.h b/sys/arch/alpha/include/ieee.h new file mode 100644 index 00000000000..9d5f206a6fb --- /dev/null +++ b/sys/arch/alpha/include/ieee.h @@ -0,0 +1,123 @@ +/* $NetBSD: ieee.h,v 1.1 1995/02/13 23:07:40 cgd Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * 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, Lawrence Berkeley Laboratory. + * + * 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. + * + * @(#)ieee.h 8.1 (Berkeley) 6/11/93 + * + * from: Header: ieee.h,v 1.7 92/11/26 02:04:37 torek Exp + */ + +/* + * ieee.h defines the machine-dependent layout of the machine's IEEE + * floating point. It does *not* define (yet?) any of the rounding + * mode bits, exceptions, and so forth. + */ + +/* + * Define the number of bits in each fraction and exponent. + * + * k k+1 + * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented + * + * (-exp_bias+1) + * as fractions that look like 0.fffff x 2 . This means that + * + * -126 + * the number 0.10000 x 2 , for instance, is the same as the normalized + * + * -127 -128 + * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero + * + * -129 + * in the fraction; to represent 2 , we need two, and so on. This + * + * (-exp_bias-fracbits+1) + * implies that the smallest denormalized number is 2 + * + * for whichever format we are talking about: for single precision, for + * + * -126 -149 + * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and + * + * -149 == -127 - 23 + 1. + */ +#define SNG_EXPBITS 8 +#define SNG_FRACBITS 23 + +#define DBL_EXPBITS 11 +#define DBL_FRACBITS 52 + +struct ieee_single { + u_int sng_frac:23; + u_int sng_exp:8; + u_int sng_sign:1; +}; + +struct ieee_double { + u_int dbl_fracl; + u_int dbl_frach:20; + u_int dbl_exp:11; + u_int dbl_sign:1; +}; + +/* + * Floats whose exponent is in [1..INFNAN) (of whatever type) are + * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. + * Floats whose exponent is zero are either zero (iff all fraction + * bits are zero) or subnormal values. + * + * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its + * high fraction; if the bit is set, it is a `quiet NaN'. + */ +#define SNG_EXP_INFNAN 255 +#define DBL_EXP_INFNAN 2047 + +#if 0 +#define SNG_QUIETNAN (1 << 22) +#define DBL_QUIETNAN (1 << 19) +#endif + +/* + * Exponent biases. + */ +#define SNG_EXP_BIAS 127 +#define DBL_EXP_BIAS 1023 diff --git a/sys/arch/alpha/include/ieeefp.h b/sys/arch/alpha/include/ieeefp.h new file mode 100644 index 00000000000..99d8fffe9f6 --- /dev/null +++ b/sys/arch/alpha/include/ieeefp.h @@ -0,0 +1,26 @@ +/* $NetBSD: ieeefp.h,v 1.1 1995/04/29 01:09:17 cgd Exp $ */ + +/* + * Written by J.T. Conklin, Apr 28, 1995 + * Public domain. + */ + +#ifndef _ALPHA_IEEEFP_H_ +#define _ALPHA_IEEEFP_H_ + +typedef int fp_except; +#define FP_X_INV 0x01 /* invalid operation exception */ +#define FP_X_DZ 0x02 /* divide-by-zero exception */ +#define FP_X_OFL 0x04 /* overflow exception */ +#define FP_X_UFL 0x08 /* underflow exception */ +#define FP_X_IMP 0x10 /* imprecise (loss of precision; "inexact") */ +#define FP_X_IOV 0x20 /* integer overflow XXX? */ + +typedef enum { + FP_RZ=0, /* round to zero (truncate) */ + FP_RM=1, /* round toward negative infinity */ + FP_RN=2, /* round to nearest representable number */ + FP_RP=3 /* round toward positive infinity */ +} fp_rnd; + +#endif /* _ALPHA_IEEEFP_H_ */ diff --git a/sys/arch/alpha/include/limits.h b/sys/arch/alpha/include/limits.h new file mode 100644 index 00000000000..7fb490baef2 --- /dev/null +++ b/sys/arch/alpha/include/limits.h @@ -0,0 +1,84 @@ +/* $NetBSD: limits.h,v 1.1 1995/02/13 23:07:41 cgd Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. 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 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. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + */ + +#define CHAR_BIT 8 /* number of bits in a char */ +#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ + +/* + * According to ANSI (section 2.2.4.2), the values below must be usable by + * #if preprocessing directives. Additionally, the expression must have the + * same type as would an expression that is an object of the corresponding + * type converted according to the integral promotions. The subtraction for + * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an + * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). + * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values + * are written as hex so that GCC will be quiet about large integer constants. + */ +#define SCHAR_MAX 127 /* min value for a signed char */ +#define SCHAR_MIN (-128) /* max value for a signed char */ + +#define UCHAR_MAX 255 /* max value for an unsigned char */ +#define CHAR_MAX 127 /* max value for a char */ +#define CHAR_MIN (-128) /* min value for a char */ + +#define USHRT_MAX 65535 /* max value for an unsigned short */ +#define SHRT_MAX 32767 /* max value for a short */ +#define SHRT_MIN (-32768) /* min value for a short */ + +#define UINT_MAX 0xffffffff /* max value for an unsigned int */ +#define INT_MAX 2147483647 /* max value for an int */ +#define INT_MIN (-2147483647-1) /* min value for an int */ + +#define ULONG_MAX 0xffffffffffffffff /* max value for an unsigned long */ + /* max value for a long */ +#define LONG_MAX 0x7fffffffffffffff +#define LONG_MIN (-LONG_MAX-1) /* min value for a long */ + +#if !defined(_ANSI_SOURCE) +#define SSIZE_MAX INT_MAX /* max value for a ssize_t */ + +#if !defined(_POSIX_SOURCE) +#define SIZE_T_MAX UINT_MAX /* max value for a size_t */ + +/* GCC requires that quad constants be written as expressions. */ +#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */ + /* max value for a quad_t */ +#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1)) +#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */ + +#endif /* !_POSIX_SOURCE */ +#endif /* !_ANSI_SOURCE */ diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h new file mode 100644 index 00000000000..85a1b3e7925 --- /dev/null +++ b/sys/arch/alpha/include/param.h @@ -0,0 +1,177 @@ +/* $NetBSD: param.h,v 1.8 1995/08/13 00:03:11 mycroft Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 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 and Ralph Campbell. + * + * 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. + * + * from: Utah $Hdr: machparam.h 1.11 89/08/14$ + * + * @(#)param.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * Machine dependent constants for the Alpha. + */ +#define MACHINE "alpha" +#define MACHINE_ARCH "alpha" +#define MID_MACHINE MID_ALPHA + +#ifdef _KERNEL /* XXX */ +#include <machine/cpu.h> /* XXX */ +#endif /* XXX */ + +/* + * Round p (pointer or byte index) up to a correctly-aligned value for all + * data types (int, long, ...). The result is u_long and must be cast to + * any desired pointer type. + */ +#define ALIGNBYTES 7 +#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) + +#define NBPG 8192 /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte off. into pg */ +#define PGSHIFT 13 /* LOG2(NBPG) */ +#define NPTEPG (1 << (PGSHIFT-PTESHIFT)) /* pte's/page */ + +#define SEGSHIFT (PGSHIFT + (PGSHIFT-PTESHIFT)) /* LOG2(NBSEG) */ +#define NBSEG (1 << SEGSHIFT) /* bytes/segment (8M) */ +#define SEGOFSET (NBSEG-1) /* byte off. into seg */ + +#define KERNBASE 0xfffffe0000000000 /* start of kernel virtual */ +#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) + +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ + +#define CLSIZE 1 +#define CLSIZELOG2 0 + +/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ +#define SSIZE 1 /* initial stack size/NBPG */ +#define SINCR 1 /* increment of stack/NBPG */ + +#define UPAGES 2 /* pages of u-area */ +#define USPACE (UPAGES * NBPG) /* total size of u-area */ + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * on machines that exchange pages of input or output buffers with mbuf + * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple + * of the hardware page size. + */ +#define MSIZE 256 /* size of an mbuf */ +#define MCLBYTES 2048 /* large enough for ether MTU */ +#define MCLSHIFT 11 +#define MCLOFSET (MCLBYTES - 1) +#ifndef NMBCLUSTERS +#ifdef GATEWAY +#define NMBCLUSTERS 512 /* map size, max cluster allocation */ +#else +#define NMBCLUSTERS 256 /* map size, max cluster allocation */ +#endif +#endif + +/* + * Size of kernel malloc arena in CLBYTES-sized logical pages + */ +#ifndef NKMEMCLUSTERS +#define NKMEMCLUSTERS (4096*1024/CLBYTES) /* XXX? */ +#endif + +/* pages ("clicks") to disk blocks */ +#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) +#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) + +/* pages to bytes */ +#define ctob(x) ((x) << PGSHIFT) +#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) + +/* bytes to disk blocks */ +#define btodb(x) ((x) >> DEV_BSHIFT) +#define dbtob(x) ((x) << DEV_BSHIFT) + +/* + * Map a ``block device block'' to a file system block. + * This should be device dependent, and should use the bsize + * field from the disk label. + * For now though just use DEV_BSIZE. + */ +#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) + +/* + * Mach derived conversion macros + */ +#define alpha_round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1)) +#define alpha_trunc_page(x) ((unsigned long)(x) & ~(NBPG-1)) +#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) + +#ifdef _KERNEL +#ifndef LOCORE + +/* This was calibrated empirically */ +extern u_int64_t cycles_per_usec; +#define DELAY(n) { \ + register long long N = cycles_per_usec * (n); \ + do N -= 3; while (N > 0); \ +} + +int spl0 __P((void)); /* drop ipl to zero */ + +#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 new file mode 100644 index 00000000000..a2486affd16 --- /dev/null +++ b/sys/arch/alpha/include/pcb.h @@ -0,0 +1,71 @@ +/* $NetBSD: pcb.h,v 1.1 1995/02/13 23:07:43 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. + */ + +#include <machine/frame.h> +#include <machine/reg.h> + +/* + * XXX where did this info come from? + */ + +/* + * PCB: process control block + * + * In this case, the hardware structure that is the defining element + * for a process, and the additional state that must be saved by software + * on a context switch. Fields marked [HW] are mandated by hardware; fields + * marked [SW] are for the software. + * + * It's said in the VMS PALcode section of the AARM that the pcb address + * passed to the swpctx PALcode call has to be a physical address. Not + * knowing this (and trying a virtual) address proved this correct. + * 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 fpreg pcb_fp; /* FP registers [SW] */ + caddr_t pcb_onfault; /* for copy faults [SW] */ +}; + +/* + * The pcb is augmented with machine-dependent additional data for + * core dumps. For the Alpha, that's a trap frame and the floating + * point registers. + */ +struct md_coredump { + struct trapframe md_tf; +}; diff --git a/sys/arch/alpha/include/pio.h b/sys/arch/alpha/include/pio.h new file mode 100644 index 00000000000..9fd16f4af20 --- /dev/null +++ b/sys/arch/alpha/include/pio.h @@ -0,0 +1,88 @@ +/* $NetBSD: pio.h,v 1.1 1995/06/28 01:16:33 cgd Exp $ */ + +/* + * Copyright (c) 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. + */ + +/* Prototypes for ISA-ish I/O space access functions. */ + +/* + * XXX + * XXX THIS WILL LIKELY HAVE TO BE COMPLETELY CHANGED. + * XXX e.g. to take softc for bus. + * XXX + */ + +struct isa_pio_fcns { + /* input functions */ + u_int8_t (*isa_inb) __P((int port)); + void (*isa_insb) __P((int port, void *addr, int cnt)); + u_int16_t (*isa_inw) __P((int port)); + void (*isa_insw) __P((int port, void *addr, int cnt)); + u_int32_t (*isa_inl) __P((int port)); + void (*isa_insl) __P((int port, void *addr, int cnt)); + + /* output functions */ + void (*isa_outb) __P((int port, u_int8_t datum)); + void (*isa_outsb) __P((int port, void *addr, int cnt)); + void (*isa_outw) __P((int port, u_int16_t datum)); + void (*isa_outsw) __P((int port, void *addr, int cnt)); + void (*isa_outl) __P((int port, u_int32_t datum)); + void (*isa_outsl) __P((int port, void *addr, int cnt)); +}; + +/* + * Global which tells which set of functions are correct + * for this machine. + */ +struct isa_pio_fcns *isa_pio_fcns; + +/* + * Individual chipsets' versions. + */ +extern struct isa_pio_fcns apecs_pio_fcns; +extern struct isa_pio_fcns jensen_pio_fcns; + + +/* + * macros to use input functions + */ +#define inb(p) (*isa_pio_fcns->isa_inb)(p) +#define insb(p, a, c) (*isa_pio_fcns->isa_insb)(p, a, c) +#define inw(p) (*isa_pio_fcns->isa_inw)(p) +#define insw(p, a, c) (*isa_pio_fcns->isa_insw)(p, a, c) +#define inl(p) (*isa_pio_fcns->isa_inl)(p) +#define insl(p, a, c) (*isa_pio_fcns->isa_insl)(p, a, c) + +/* + * macros to use output functions + */ +#define outb(p, d) (*isa_pio_fcns->isa_outb)(p, d) +#define outsb(p, a, c) (*isa_pio_fcns->isa_outsb)(p, a, c) +#define outw(p, d) (*isa_pio_fcns->isa_outw)(p, d) +#define outsw(p, a, c) (*isa_pio_fcns->isa_outsw)(p, a, c) +#define outl(p, d) (*isa_pio_fcns->isa_outl)(p, d) +#define outsl(p, a, c) (*isa_pio_fcns->isa_outsl)(p, a, c) diff --git a/sys/arch/alpha/include/pmap.h b/sys/arch/alpha/include/pmap.h new file mode 100644 index 00000000000..4339565011f --- /dev/null +++ b/sys/arch/alpha/include/pmap.h @@ -0,0 +1,116 @@ +/* $NetBSD: pmap.h,v 1.3 1995/04/10 12:41:38 mycroft 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> + +#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 */ + +#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. */ +#endif /* _KERNEL */ + +#endif /* _PMAP_MACHINE_ */ diff --git a/sys/arch/alpha/include/proc.h b/sys/arch/alpha/include/proc.h new file mode 100644 index 00000000000..81da608913d --- /dev/null +++ b/sys/arch/alpha/include/proc.h @@ -0,0 +1,40 @@ +/* $NetBSD: proc.h,v 1.2 1995/03/24 15:01:36 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. + */ + +/* + * Machine-dependent part of the proc struct for the Alpha. + */ + +struct mdproc { + u_long md_flags; + struct trapframe *md_tf; /* trap/syscall registers */ + struct pcb *md_pcbpaddr; /* phys addr of the pcb */ +}; + +#define MDP_FPUSED 0x0001 /* Process used the FPU */ diff --git a/sys/arch/alpha/include/profile.h b/sys/arch/alpha/include/profile.h new file mode 100644 index 00000000000..d3ba252db6f --- /dev/null +++ b/sys/arch/alpha/include/profile.h @@ -0,0 +1,39 @@ +/* $NetBSD: profile.h,v 1.2 1995/03/28 18:13:57 jtc 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. + */ + +/* XXX XXX XXX XXX XXX */ + +#define MCOUNT \ +extern void mcount() /* XXX asm("mcount") */; void mcount() { \ +} + +#ifdef _KERNEL +#define MCOUNT_ENTER +#define MCOUNT_EXIT +#endif diff --git a/sys/arch/alpha/include/prom.h b/sys/arch/alpha/include/prom.h new file mode 100644 index 00000000000..66cda050fc4 --- /dev/null +++ b/sys/arch/alpha/include/prom.h @@ -0,0 +1,80 @@ +/* $NetBSD: prom.h,v 1.1 1995/02/13 23:07:48 cgd Exp $ */ + +/* + * Copyright (c) 1994, 1995 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Keith Bostic, 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 ASSEMBLER +struct prom_vec { + int (*routine)(); + struct crd *routine_arg; +}; + +/* The return value from a prom call. */ +typedef union { + struct { + u_int64_t + retval : 32, /* return value. */ + unit : 8, + mbz : 8, + error : 13, + status : 3; + } u; + u_int64_t bits; +} prom_return_t; + +#ifdef STANDALONE +int getchar __P((void)); +int prom_open __P((char *, int)); +void putchar __P((int)); +#endif + +int prom_getenv __P((int, char *, int)); +#endif + +/* Prom operation values. */ +#define PROM_R_CLOSE 0x11 +#define PROM_R_GETC 0x01 +#define PROM_R_GETENV 0x22 +#define PROM_R_OPEN 0x10 +#define PROM_R_PUTS 0x02 +#define PROM_R_READ 0x13 + +/* Environment variable values. */ +#define PROM_E_BOOTED_DEV 0x4 +#define PROM_E_BOOTED_FILE 0x6 +#define PROM_E_BOOTED_OSFLAGS 0x8 +#define PROM_E_TTY_DEV 0xf + +/* + * There have to be stub routines to do the copying that ensures that the + * PROM doesn't get called with an address larger than 32 bits. Calls that + * either don't need to copy anything, or don't need the copy because it's + * already being done elsewhere, are defined here. + */ +#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) diff --git a/sys/arch/alpha/include/psl.h b/sys/arch/alpha/include/psl.h new file mode 100644 index 00000000000..3b019596c44 --- /dev/null +++ b/sys/arch/alpha/include/psl.h @@ -0,0 +1,85 @@ +/* $NetBSD: psl.h,v 1.3 1995/08/03 00:03:09 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. + */ + +/* + * 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. + */ +#if 0 +#define wbflush() alpha_mb() /* Flush all write buffers */ +#else +/* Flush all write buffers */ +#define wbflush() __asm __volatile("mb") +#endif +#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 */ +void pal_tbi __P((u_int64_t, void *)); /* Invalidate TLB entries */ +#endif /* _KERNEL */ diff --git a/sys/arch/alpha/include/pte.h b/sys/arch/alpha/include/pte.h new file mode 100644 index 00000000000..7611d097cf4 --- /dev/null +++ b/sys/arch/alpha/include/pte.h @@ -0,0 +1,109 @@ +/* $NetBSD: pte.h,v 1.2 1995/03/28 18:14:04 jtc 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. + */ + +/* + * Alpha page table entry. + * Things which are in the VMS PALcode but not in the OSF PALcode + * are marked with "(VMS)". + * + * This information derived from pp. (II) 3-3 - (II) 3-6 and + * (III) 3-3 - (III) 3-5 of the "Alpha Architecture Reference Manual" by + * Richard L. Sites. + */ + +/* + * Alpha Page Table Entry + */ +typedef u_int64_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_RSVD 0x000000000000cc80 /* Reserved fpr hardware */ +#define PG_WIRED 0x0000000000010000 /* Wired. [SOFTWARE] */ +#define PG_MOD 0x0000000000020000 /* Modified. [SOFTWARE] */ +#define PG_USED 0x0000000000040000 /* Referenced. [SOFTWARE] */ +#define PG_FRAME 0xffffffff00000000 +#define PG_SHIFT 32 +#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT) + +#if defined(_KERNEL) && !defined(LOCORE) +#define K0SEG_BEGIN 0xfffffc0000000000 /* unmapped, cached */ +#define K0SEG_END 0xfffffe0000000000 +#define PHYS_UNCACHED 0x0000000040000000 + +#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) + +#define PTEMASK (NPTEPG - 1) +#define vatopte(va) (((va) >> PGSHIFT) & PTEMASK) +#define vatoste(va) (((va) >> SEGSHIFT) & PTEMASK) +#define vatopa(va) \ + ((PG_PFNUM(*kvtopte(va)) << PGSHIFT) | ((vm_offset_t)(va) & PGOFSET)) + +#define ALPHA_STSIZE NBPG /* 8k */ +#define ALPHA_MAX_PTSIZE (NPTEPG * NBPG) /* 8M */ + +/* + * Kernel virtual address to Sysmap entry and visa versa. + */ +#define kvtopte(va) \ + (Sysmap + (((vm_offset_t)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT)) +#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(); \ +} + +extern pt_entry_t *Lev1map; /* Alpha Level One page table */ +extern pt_entry_t *Sysmap; /* kernel pte table */ +extern vm_size_t Sysmapsize; /* number of pte's in Sysmap */ +#endif diff --git a/sys/arch/alpha/include/ptrace.h b/sys/arch/alpha/include/ptrace.h new file mode 100644 index 00000000000..d11bb33c4f4 --- /dev/null +++ b/sys/arch/alpha/include/ptrace.h @@ -0,0 +1,40 @@ +/* $NetBSD: ptrace.h,v 1.1 1995/02/13 23:07:51 cgd Exp $ */ + +/* + * Copyright (c) 1994 Christopher G. Demetriou + * 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 Christopher G. Demetriou. + * 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 THE AUTHOR ``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 AUTHOR 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. + */ + +/* + * Alpha-dependent ptrace definitions. + * Note that PT_STEP is _not_ supported. + */ +#define PT_GETREGS (PT_FIRSTMACH + 0) +#define PT_SETREGS (PT_FIRSTMACH + 1) +#define PT_GETFPREGS (PT_FIRSTMACH + 2) +#define PT_SETFPREGS (PT_FIRSTMACH + 3) diff --git a/sys/arch/alpha/include/reg.h b/sys/arch/alpha/include/reg.h new file mode 100644 index 00000000000..c1577d962f7 --- /dev/null +++ b/sys/arch/alpha/include/reg.h @@ -0,0 +1,98 @@ +/* $NetBSD: reg.h,v 1.2 1995/03/28 18:14:07 jtc 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. + */ + +#ifndef _ALPHA_REG_H_ +#define _ALPHA_REG_H_ + +/* + * XXX where did this info come from? + */ + +/* + * Struct reg, used for procfs and in signal contexts + * Note that in signal contexts, it's represented as an array. + * That array has to look exactly like 'struct reg' though. + */ +#define R_V0 0 +#define R_T0 1 +#define R_T1 2 +#define R_T2 3 +#define R_T3 4 +#define R_T4 5 +#define R_T5 6 +#define R_T6 7 +#define R_T7 8 +#define R_S0 9 +#define R_S1 10 +#define R_S2 11 +#define R_S3 12 +#define R_S4 13 +#define R_S5 14 +#define R_S6 15 +#define R_A0 16 +#define R_A1 17 +#define R_A2 18 +#define R_A3 19 +#define R_A4 20 +#define R_A5 21 +#define R_T8 22 +#define R_T9 23 +#define R_T10 24 +#define R_T11 25 +#define R_RA 26 +#define R_T12 27 +#define R_AT 28 +#define R_GP 29 +#define R_SP 30 +#define R_ZERO 31 + +struct reg { + u_int64_t r_regs[32]; +}; + +/* + * Floating point unit state. (also, register set used for ptrace.) + * + * The floating point registers for a process, saved only when + * necessary. + * + * Note that in signal contexts, it's represented as an array. + * That array has to look exactly like 'struct reg' though. + */ +struct fpreg { + u_int64_t fpr_regs[32]; + u_int64_t fpr_cr; +}; + +#ifdef _KERNEL +void restorefpstate __P((struct fpreg *)); +void savefpstate __P((struct fpreg *)); +#endif + +#endif /* _ALPHA_REG_H_ */ diff --git a/sys/arch/alpha/include/rpb.h b/sys/arch/alpha/include/rpb.h new file mode 100644 index 00000000000..ed931b87657 --- /dev/null +++ b/sys/arch/alpha/include/rpb.h @@ -0,0 +1,352 @@ +/* $NetBSD: rpb.h,v 1.5 1995/06/28 01:14:41 cgd Exp $ */ + +/* + * Copyright (c) 1994, 1995 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Keith Bostic, 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. + */ + +/* + * From DEC 3000 300/400/500/600/700/800/900 System Programmer's Manual, + * EK-D3SYS-PM.B01. + */ + +/* + * HWRPB (Hardware Restart Parameter Block). + */ +#define HWRPB_ADDR 0x10000000 /* virtual address, at boot */ + +#ifndef ASSEMBLER +struct rpb { + struct restart_blk *rpb; /* 0: HWRPB phys. address. */ + char rpb_magic[8]; /* 8: "HWRPB" (in ASCII) */ + u_int64_t rpb_version; /* 10 */ + u_int64_t rpb_size; /* 18: HWRPB size in bytes */ + u_int64_t rpb_primary_cpu_id; /* 20 */ + u_int64_t rpb_page_size; /* 28: (8192) */ + u_int64_t rpb_phys_addr_size; /* 30: (34) */ + u_int64_t rpb_max_asn; /* 38: (16) */ + char rpb_ssn[16]; /* 40: only first 10 valid */ + +#define ST_ADU 1 /* Alpha Demo. Unit (?) */ +#define ST_DEC_4000 2 /* "Cobra" (?) */ +#define ST_DEC_7000 3 /* "Ruby" (?) */ +#define ST_DEC_3000_500 4 /* "Flamingo" family (TC) */ +#define ST_DEC_2000_300 6 /* "Jensen" (EISA/ISA) */ +#define ST_DEC_3000_300 7 /* "Pelican" (TC) */ +#define ST_DEC_2100_A500 9 /* "Sable" (?) */ +#define ST_DEC_APXVME_64 10 /* "AXPvme" (VME?) */ +#define ST_DEC_AXPPCI_33 11 /* "NoName" (PCI/ISA?) */ +#define ST_DEC_2100_A50 13 /* "Avanti" (PCI/ISA) */ +#define ST_DEC_MUSTANG 14 /* "Mustang" (?) */ +#define ST_DEC_1000 17 /* "Mikasa" (PCI/ISA?) */ + + u_int64_t rpb_type; /* 50: */ + +#define SV_MPCAP 0x00000001 /* multiprocessor capable */ + +#define SV_CONSOLE 0x0000001e /* console hardware mask */ +#define SV_CONSOLE_DETACHED 0x00000002 +#define SV_CONSOLE_EMBEDDED 0x00000004 + +#define SV_POWERFAIL 0x000000e0 /* powerfail mask */ +#define SV_PF_UNITED 0x00000020 +#define SV_PF_SEPARATE 0x00000040 +#define SV_PF_BBACKUP 0x00000060 +#define SV_PF_ACTION 0x00000100 /* powerfail restart */ + +#define SV_GRAPHICS 0x00000200 /* graphic engine present */ + +#define SV_ST_MASK 0x0000fc00 /* system type mask */ +#define SV_ST_RESERVED 0x00000000 /* RESERVED */ + +/* + * System types for the DEC 3000/500 (Flamingo) Family + */ +#define SV_ST_SANDPIPER 0x00000400 /* Sandpiper; 3000/400 */ +#define SV_ST_FLAMINGO 0x00000800 /* Flamingo; 3000/500 */ +#define SV_ST_HOTPINK 0x00000c00 /* "Hot Pink"; 3000/500X */ +#define SV_ST_FLAMINGOPLUS 0x00001000 /* Flamingo+; 3000/800 */ +#define SV_ST_ULTRA 0x00001400 /* "Ultra", aka Flamingo+ */ +#define SV_ST_SANDPLUS 0x00001800 /* Sandpiper+; 3000/600 */ +#define SV_ST_SANDPIPER45 0x00001c00 /* Sandpiper45; 3000/700 */ +#define SV_ST_FLAMINGO45 0x00002000 /* Flamingo45; 3000/900 */ + +/* + * System types for ??? + */ +#define SV_ST_SABLE 0x00000400 /* Sable (???) */ + +/* + * System types for the DEC 3000/300 (Pelican) Family + */ +#define SV_ST_PELICAN 0x00000000 /* Pelican; 3000/300 */ +#define SV_ST_PELICA 0x00000400 /* Pelica; 3000/300L */ +#define SV_ST_PELICANPLUS 0x00000800 /* Pelican+; 3000/300X */ +#define SV_ST_PELICAPLUS 0x00000c00 /* Pelica+; 3000/300LX */ + +/* + * System types for the AlphaStation Family + */ +#define SV_ST_AVANTI 0x00000000 /* Avanti; 400 4/233 */ +#define SV_ST_MUSTANG2_4_166 0x00000800 /* Mustang II; 200 4/166 */ +#define SV_ST_MUSTANG2_4_233 0x00001000 /* Mustang II; 200 4/233 */ +#define SV_ST_AVANTI_XXX 0x00001400 /* also Avanti; 400 4/233 */ +#define SV_ST_MUSTANG2_4_100 0x00002400 /* Mustang II; 200 4/100 */ + + u_int64_t rpb_variation; /* 58 */ + + char rpb_revision[8]; /* 60; only first 4 valid */ + u_int64_t rpb_intr_freq; /* 68; scaled by 4096 */ + u_int64_t rpb_cc_freq; /* 70: cycle cntr frequency */ + vm_offset_t rpb_vptb; /* 78: */ + u_int64_t rpb_reserved_arch; /* 80: */ + vm_offset_t rpb_tbhint_off; /* 88: */ + u_int64_t rpb_pcs_cnt; /* 90: */ + u_int64_t rpb_pcs_size; /* 98; pcs size in bytes */ + vm_offset_t rpb_pcs_off; /* A0: offset to pcs info */ + u_int64_t rpb_ctb_cnt; /* A8: console terminal */ + u_int64_t rpb_ctb_size; /* B0: ctb size in bytes */ + vm_offset_t rpb_ctb_off; /* B8: offset to ctb */ + vm_offset_t rpb_crb_off; /* C0: offset to crb */ + 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 */ + long rpb_save_term_val; /* E8: */ + long (*rpb_rest_term)(); /* F0: terminal restore */ + long rpb_rest_term_val; /* F8: */ + long (*rpb_restart)(); /* 100: restart */ + long rpb_restart_val; /* 108: */ + u_int64_t rpb_reserve_os; /* 110: */ + u_int64_t rpb_reserve_hw; /* 118: */ + u_int64_t rpb_checksum; /* 120: HWRPB checksum */ + u_int64_t rpb_rxrdy; /* 128: receive ready */ + u_int64_t rpb_txrdy; /* 130: transmit ready */ + vm_offset_t rpb_dsrdb_off; /* 138: HWRPB + DSRDB offset */ + u_int64_t rpb_tbhint[8]; /* 149: TB hint block */ +}; + +#ifdef _KERNEL +extern struct rpb *hwrpb; +#endif + +/* + * PCS: Per-CPU information. + */ +struct pcs { + u_int8_t pcs_hwpcb[128]; /* 0: PAL dependent */ + +#define PCS_BIP 0x000001 /* boot in progress */ +#define PCS_RC 0x000002 /* restart possible */ +#define PCS_PA 0x000004 /* processor available */ +#define PCS_PP 0x000008 /* processor present */ +#define PCS_OH 0x000010 /* user halted */ +#define PCS_CV 0x000020 /* context valid */ +#define PCS_PV 0x000040 /* PALcode valid */ +#define PCS_PMV 0x000080 /* PALcode memory valid */ +#define PCS_PL 0x000100 /* PALcode loaded */ +#define PCS_PE 0x000200 /* primary eligible (SMP) */ + +#define PCS_HALT_REQ 0xff0000 /* halt request mask */ +#define PCS_HALT_DEFAULT 0x000000 +#define PCS_HALT_SAVE_EXIT 0x010000 +#define PCS_HALT_COLD_BOOT 0x020000 +#define PCS_HALT_WARM_BOOT 0x030000 +#define PCS_HALT_STAY_HALTED 0x040000 +#define PCS_mbz 0xffffffffff000000 /* 24:63 -- must be zero */ + u_int64_t pcs_flags; /* 80: */ + + u_int64_t pcs_pal_memsize; /* 88: PAL memory size */ + u_int64_t pcs_pal_scrsize; /* 90: PAL scratch size */ + vm_offset_t pcs_pal_memaddr; /* 98: PAL memory addr */ + vm_offset_t pcs_pal_scraddr; /* A0: PAL scratch addr */ + struct { + u_int64_t + pcs_alpha : 8, /* alphabetic char 'a' - 'z' */ +#define PAL_TYPE_STANDARD 0 +#define PAL_TYPE_VMS 1 +#define PAL_TYPE_OSF1 2 + pcs_pal_type : 8, /* PALcode type: + * 0 == standard + * 1 == OpenVMS + * 2 == OSF/1 + * 3-127 DIGITAL reserv. + * 128-255 non-DIGITAL reserv. + */ + sbz1 : 16, + pcs_proc_cnt : 7, /* Processor count */ + sbz2 : 25; + } pcs_pal_rev; /* A8: */ +#define pcs_alpha pcs_pal_rev.alpha +#define pcs_pal_type pcs_pal_rev.pal_type +#define pcs_proc_cnt pcs_pal_rev.proc_cnt + + u_int64_t pcs_proc_type; /* B0: processor type */ + +#define PCS_PROC_MAJOR 0x00000000ffffffff +#define PCS_PROC_MAJORSHIFT 0 +#define PCS_PROC_EV3 1 /* EV3 */ +#define PCS_PROC_EV4 2 /* EV4: 21064 */ +#define PCS_PROC_SIMULATOR 3 /* simulation */ +#define PCS_PROC_LCA4 4 /* LCA4: 2106[68] */ +#define PCS_PROC_EV5 5 /* EV5: 21164 */ +#define PCS_PROC_EV45 6 /* EV45: 21064A */ + +#define PCS_PROC_MINOR 0xffffffff00000000 +#define PCS_PROC_MINORSHIFT 32 +#define PCS_PROC_PASS2 0 /* pass 2 or 2.1 */ +#define PCS_PROC_PASS3 1 /* pass 3 */ + /* 4 == ev4s? or 1 == ... ? */ + /* minor on the LCA appears to be pass number */ + + u_int64_t pcs_proc_var; /* B8: processor variation. */ + +#define PCS_VAR_VAXFP 0x0000000000000001 /* VAX FP support */ +#define PCS_VAR_IEEEFP 0x0000000000000002 /* IEEE FP support */ +#define PCS_VAR_IOACCESS 0x0000000000000004 /* Has I/O access */ +#define PCS_VAR_RESERVED 0xfffffffffffffff8 /* Reserved */ + + char pcs_proc_revision[8]; /* C0: only first 4 valid */ + char pcs_proc_sn[16]; /* C8: only first 10 valid */ + vm_offset_t pcs_machcheck; /* D8: mach chk phys addr. */ + u_int64_t pcs_machcheck_len; /* E0: length in bytes */ + vm_offset_t pcs_halt_pcbb; /* E8: phys addr of halt PCB */ + vm_offset_t pcs_halt_pc; /* F0: halt PC */ + u_int64_t pcs_halt_ps; /* F8: halt PS */ + u_int64_t pcs_halt_r25; /* 100: halt argument list */ + u_int64_t pcs_halt_r26; /* 108: halt return addr list */ + u_int64_t pcs_halt_r27; /* 110: halt procedure value */ + +#define PCS_HALT_RESERVED 0 +#define PCS_HALT_POWERUP 1 +#define PCS_HALT_CONSOLE_HALT 2 +#define PCS_HALT_CONSOLE_CRASH 3 +#define PCS_HALT_KERNEL_MODE 4 +#define PCS_HALT_KERNEL_STACK_INVALID 5 +#define PCS_HALT_DOUBLE_ERROR_ABORT 6 +#define PCS_HALT_SCBB 7 +#define PCS_HALT_PTBR 8 /* 9-FF: reserved */ + u_int64_t pcs_halt_reason; /* 118: */ + + u_int64_t pcs_reserved_soft; /* 120: preserved software */ + u_int64_t pcs_buffer[21]; /* 128: console buffers */ + +#define PALvar_reserved 0 +#define PALvar_OpenVMS 1 +#define PALvar_OSF1 2 + u_int64_t pcs_palrevisions[16]; /* 1D0: PALcode revisions */ + + u_int64_t pcs_reserved_arch[6]; /* 250: reserved arch */ +}; + +/* + * CTB: Console Terminal Block + */ +struct ctb { + u_int64_t ctb_type; /* 0: always 4 */ + u_int64_t ctb_unit; /* 8: */ + u_int64_t ctb_reserved; /* 16: */ + u_int64_t ctb_len; /* 24: bytes of info */ + u_int64_t ctb_ipl; /* 32: console ipl level */ + vm_offset_t ctb_tintr_vec; /* 40: transmit vec (0x800) */ + vm_offset_t ctb_rintr_vec; /* 48: receive vec (0x800) */ + +#define CTB_GRAPHICS 3 /* graphics device */ +#define CTB_NETWORK 0xC0 /* network device */ +#define CTB_PRINTERPORT 2 /* printer port on the SCC */ + u_int64_t ctb_term_type; /* 56: terminal type */ + + u_int64_t ctb_keybd_type; /* 64: keyboard nationality */ + vm_offset_t ctb_keybd_trans; /* 72: trans. table addr */ + vm_offset_t ctb_keybd_map; /* 80: map table addr */ + u_int64_t ctb_keybd_state; /* 88: keyboard flags */ + u_int64_t ctb_keybd_last; /* 96: last key entered */ + vm_offset_t ctb_font_us; /* 104: US font table addr */ + vm_offset_t ctb_font_mcs; /* 112: MCS font table addr */ + u_int64_t ctb_font_width; /* 120: font width, height */ + u_int64_t ctb_font_height; /* 128: in pixels */ + u_int64_t ctb_mon_width; /* 136: monitor width, height */ + u_int64_t ctb_mon_height; /* 144: in pixels */ + u_int64_t ctb_dpi; /* 152: monitor dots per inch */ + u_int64_t ctb_planes; /* 160: # of planes */ + u_int64_t ctb_cur_width; /* 168: cursor width, height */ + u_int64_t ctb_cur_height; /* 176: in pixels */ + u_int64_t ctb_head_cnt; /* 184: # of heads */ + u_int64_t ctb_opwindow; /* 192: opwindow on screen */ + vm_offset_t ctb_head_offset; /* 200: offset to head info */ + vm_offset_t ctb_putchar; /* 208: output char to TURBO */ + u_int64_t ctb_io_state; /* 216: I/O flags */ + u_int64_t ctb_listen_state; /* 224: listener flags */ + vm_offset_t ctb_xaddr; /* 232: extended info addr */ + u_int64_t ctb_turboslot; /* 248: TURBOchannel slot # */ + u_int64_t ctb_server_off; /* 256: offset to server info */ + u_int64_t ctb_line_off; /* 264: line parameter offset */ + u_int8_t ctb_csd; /* 272: console specific data */ +}; + +/* + * CRD: Console Routine Descriptor + */ +struct crd { + int64_t descriptor; + int (*code)(); +}; + +/* + * CRB: Console Routine Block + */ +struct crb { + struct crd *crb_v_dispatch; /* 0: virtual dispatch addr */ + vm_offset_t crb_p_dispatch; /* 8: phys dispatch addr */ + struct crd *crb_v_fixup; /* 10: virtual fixup addr */ + vm_offset_t crb_p_fixup; /* 18: phys fixup addr */ + u_int64_t crb_map_cnt; /* 20: phys/virt map entries */ + u_int64_t crb_page_cnt; /* 28: pages to be mapped */ +}; + +/* + * MDDT: Memory Data Descriptor Table + */ +struct mddt { + int64_t mddt_cksum; /* 0: 7-N checksum */ + vm_offset_t mddt_physaddr; /* 8: bank config addr + * IMPLEMENTATION SPECIFIC + */ + u_int64_t mddt_cluster_cnt; /* 10: memory cluster count */ + struct { + vm_offset_t mddt_pfn; /* 0: starting PFN */ + u_int64_t mddt_pg_cnt; /* 8: 8KB page count */ + u_int64_t mddt_pg_test; /* 10: tested page count */ + vm_offset_t mddt_v_bitaddr; /* 18: bitmap virt addr */ + vm_offset_t mddt_p_bitaddr; /* 20: bitmap phys addr */ + int64_t mddt_bit_cksum; /* 28: bitmap checksum */ + +#define MDDT_PALCODE 0x01 /* console and PAL only */ +#define MDDT_SYSTEM 0x00 /* system software only */ +#define MDDT_mbz 0xfffffffffffffffe /* 1:63 -- must be zero */ + int64_t mddt_usage; /* 30: bitmap permissions */ + } mddt_clusters[1]; /* variable length array */ +}; +#endif /* ASSEMBLER */ diff --git a/sys/arch/alpha/include/setjmp.h b/sys/arch/alpha/include/setjmp.h new file mode 100644 index 00000000000..9b3eb6dfa7b --- /dev/null +++ b/sys/arch/alpha/include/setjmp.h @@ -0,0 +1,34 @@ +/* $NetBSD: setjmp.h,v 1.1 1995/02/13 23:07:55 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. + */ + +/* + * machine/setjmp.h: machine dependent setjmp-related information. + */ + +#define _JBLEN 81 /* size, in longs, of a jmp_buf */ diff --git a/sys/arch/alpha/include/signal.h b/sys/arch/alpha/include/signal.h new file mode 100644 index 00000000000..de7b1c6b312 --- /dev/null +++ b/sys/arch/alpha/include/signal.h @@ -0,0 +1,62 @@ +/* $NetBSD: signal.h,v 1.2 1995/02/16 03:08:08 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. + */ + +#ifndef _ALPHA_SIGNAL_H_ +#define _ALPHA_SIGNAL_H_ + +typedef long sig_atomic_t; + +#ifndef _ANSI_SOURCE +/* + * Information pushed on stack when a signal is delivered. + * This is used by the kernel to restore state following + * execution of the signal handler. It is also made available + * to the handler to allow it to restore state properly if + * a non-standard exit is performed. + * + * Note that sc_regs[] and sc_fpregs[]+sc_fpcr are inline + * representations of 'struct reg' and 'struct fpreg', respectively. + */ +struct sigcontext { + long sc_onstack; /* sigstack state to restore */ + long sc_mask; /* signal mask to restore */ + long sc_pc; /* pc to restore */ + long sc_ps; /* ps to restore */ + unsigned long sc_regs[32]; /* integer register set (see above) */ +#define sc_sp sc_regs[R_SP] + long sc_ownedfp; /* fp has been used */ + unsigned long sc_fpregs[32]; /* FP register set (see above) */ + unsigned long sc_fpcr; /* FP control register (see above) */ + unsigned long sc_fp_control; /* FP software control word */ + long sc_reserved[2]; /* XXX */ + long sc_xxx[8]; /* XXX */ +}; + +#endif /* !_ANSI_SOURCE */ +#endif /* !_ALPHA_SIGNAL_H_*/ diff --git a/sys/arch/alpha/include/stdarg.h b/sys/arch/alpha/include/stdarg.h new file mode 100644 index 00000000000..d67aa9a7294 --- /dev/null +++ b/sys/arch/alpha/include/stdarg.h @@ -0,0 +1,67 @@ +/* $NetBSD: stdarg.h,v 1.2 1995/02/16 03:08:08 cgd Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. 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 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. + * + * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _STDARG_H_ +#define _STDARG_H_ + +#include <machine/ansi.h> + +typedef _BSD_VA_LIST_ va_list; + +/* + * Note that these macros are significantly different than the 'standard' + * ones. On the alpha, all arguments are passed as 64 bit quantities. + */ + +#define va_start(a, last) \ + (__builtin_next_arg(last), (a) = *(va_list *)__builtin_saveregs()) + +#define __va_size(type) \ + (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) + +#define __REAL_TYPE_CLASS 8 +#define __va_arg_offset(a, type) \ + ((__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS && \ + (a).offset <= (6 * 8) ? -(6 * 8) : 0) - __va_size(type)) + +#define va_arg(a, type) \ + (*((a).offset += __va_size(type), \ + (type *)((a).base + (a).offset + __va_arg_offset(a, type)))) + +#define va_end(a) ((void) 0) + +#endif /* !_STDARG_H_ */ diff --git a/sys/arch/alpha/include/trap.h b/sys/arch/alpha/include/trap.h new file mode 100644 index 00000000000..ccc8581d25d --- /dev/null +++ b/sys/arch/alpha/include/trap.h @@ -0,0 +1,48 @@ +/* $NetBSD: trap.h,v 1.1 1995/02/13 23:07:58 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. + */ + +#define T_ASTFLT 0x00 +#define T_UNAFLT 0x01 +#define T_ARITHFLT 0x02 + +#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 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) + +#define T_USER 0x80 /* user-mode flag or'ed with type */ diff --git a/sys/arch/alpha/include/types.h b/sys/arch/alpha/include/types.h new file mode 100644 index 00000000000..0eba44e1345 --- /dev/null +++ b/sys/arch/alpha/include/types.h @@ -0,0 +1,74 @@ +/* $NetBSD: types.h,v 1.4 1995/07/06 03:39:32 cgd Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. 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 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. + * + * @(#)types.h 8.3 (Berkeley) 1/5/94 + */ + +#ifndef _MACHTYPES_H_ +#define _MACHTYPES_H_ + +#include <sys/cdefs.h> + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +typedef struct _physadr { + long r[1]; +} *physadr; + +typedef struct label_t { + long val[10]; +} label_t; +#endif + +typedef unsigned long vm_offset_t; +typedef unsigned long vm_size_t; + +/* + * Basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#define __BIT_TYPES_DEFINED__ +typedef __signed char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef long int64_t; +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 new file mode 100644 index 00000000000..183ae618b73 --- /dev/null +++ b/sys/arch/alpha/include/varargs.h @@ -0,0 +1,75 @@ +/* $NetBSD: varargs.h,v 1.2 1995/02/16 03:08:11 cgd Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. + * + * @(#)varargs.h 8.2 (Berkeley) 3/22/94 + */ + +#ifndef _VARARGS_H_ +#define _VARARGS_H_ + +#include <machine/ansi.h> + +typedef _BSD_VA_LIST_ va_list; + +/* + * Note that these macros are significantly different than the 'standard' + * ones. On the alpha, all arguments are passed as 64 bit quantities. + */ + +#define va_alist __builtin_va_alist +#define va_dcl va_list __builtin_va_alist; ... + +#define va_start(a) \ + ((a) = *(va_list *)__builtin_saveregs()) + +#define __va_size(type) \ + (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) + +#define __REAL_TYPE_CLASS 8 +#define __va_arg_offset(a, type) \ + ((__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS && \ + (a).offset <= (6 * 8) ? -(6 * 8) : 0) - __va_size(type)) + +#define va_arg(a, type) \ + (*((a).offset += __va_size(type), \ + (type *)((a).base + (a).offset + __va_arg_offset(a, type)))) + +#define va_end(a) ((void) 0) + +#endif /* !_VARARGS_H_ */ diff --git a/sys/arch/alpha/include/vmparam.h b/sys/arch/alpha/include/vmparam.h new file mode 100644 index 00000000000..fa2b0360940 --- /dev/null +++ b/sys/arch/alpha/include/vmparam.h @@ -0,0 +1,178 @@ +/* $NetBSD: vmparam.h,v 1.1 1995/02/13 23:08:01 cgd Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1992, 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 and Ralph Campbell. + * + * 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. + * + * from: Utah $Hdr: vmparam.h 1.16 91/01/18$ + * + * @(#)vmparam.h 8.2 (Berkeley) 4/22/94 + */ + +/* + * Machine dependent constants for Alpha. + */ +/* + * USRTEXT is the start of the user text/data space, while USRSTACK + * is the top (end) of the user stack. Immediately above the user stack + * resides the user structure, which is UPAGES long and contains the + * kernel stack. + */ +#define USRTEXT CLBYTES +#define USRSTACK VM_MAXUSER_ADDRESS + +/* + * Virtual memory related constants, all in bytes + */ +#ifndef MAXTSIZ +#define MAXTSIZ (1<<30) /* max text size (1G) */ +#endif +#ifndef DFLDSIZ +#define DFLDSIZ (1<<27) /* initial data size (128M) */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (1<<30) /* max data size (1G) */ +#endif +#ifndef DFLSSIZ +#define DFLSSIZ (1<<21) /* initial stack size (2M) */ +#endif +#ifndef MAXSSIZ +#define MAXSSIZ (1<<25) /* max stack size (32M) */ +#endif + +/* + * Default sizes of swap allocation chunks (see dmap.h). + * The actual values may be changed in vminit() based on MAXDSIZ. + * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. + * DMMIN should be at least ctod(1) so that vtod() works. + * vminit() insures this. + */ +#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. + */ +#ifndef USRIOSIZE +#define USRIOSIZE 64 +#endif + +/* + * PTEs for system V style shared memory. + * This is basically slop for kmempt which we actually allocate (malloc) from. + */ +#ifndef SHMMAXPGS +#define SHMMAXPGS 1024 /* 8mb */ +#endif + +/* + * Boundary at which to place first MAPMEM segment if not explicitly + * specified. Should be a power of two. This allows some slop for + * the data segment to grow underneath the first mapped segment. + */ +#define MMSEG 0x200000 + +/* + * The size of the clock loop. + */ +#define LOOPPAGES (maxfree - firstfree) + +/* + * The time for a process to be blocked before being very swappable. + * This is a number of seconds which the system takes as being a non-trivial + * amount of real time. You probably shouldn't change this; + * it is used in subtle ways (fractions and multiples of it are, that is, like + * half of a ``long time'', almost a long time, etc.) + * It is related to human patience and other factors which don't really + * change over time. + */ +#define MAXSLP 20 + +/* + * A swapped in process is given a small amount of core without being bothered + * by the page replacement algorithm. Basically this says that if you are + * 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. + */ +#define SAFERSS 4 /* 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_MAX_ADDRESS VM_MAXUSER_ADDRESS +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xfffffe0000000000) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xffffffffffffffff) + +/* virtual sizes (bytes) for various kernel submaps */ +#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) +#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) + +/* some Alpha-specific constants */ +#define VM_MAX_PHYSADDR ((vm_offset_t)0x0000000080000000) /* max phys addr */ +#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 */ |