diff --git a/sys/alpha/include/_limits.h b/sys/alpha/include/_limits.h new file mode 100644 index 000000000000..c8adc82fb0ae --- /dev/null +++ b/sys/alpha/include/_limits.h @@ -0,0 +1,96 @@ +/* $Id$ */ +/* From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 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 0x7f /* max value for a signed char */ +#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */ + +#define UCHAR_MAX 0xffU /* max value for an unsigned char */ +#define CHAR_MAX 0x7f /* max value for a char */ +#define CHAR_MIN (-0x7f-1) /* min value for a char */ + +#define USHRT_MAX 0xffffU /* max value for an unsigned short */ +#define SHRT_MAX 0x7fff /* max value for a short */ +#define SHRT_MIN (-0x7fff-1) /* min value for a short */ + +#define UINT_MAX 0xffffffffU /* max value for an unsigned int */ +#define INT_MAX 0x7fffffff /* max value for an int */ +#define INT_MIN (-0x7fffffff-1) /* min value for an int */ + +#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */ +#define LONG_MAX 0x7fffffffffffffffL /* max for a long */ +#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */ + +#if !defined(_ANSI_SOURCE) +#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ + +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) +#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */ + +/* Quads and longs are the same on the alpha */ +#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */ +#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */ +#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */ + +#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE) +#define LONG_BIT 64 +#define WORD_BIT 32 + +#define DBL_DIG 15 +#define DBL_MAX 1.7976931348623157E+308 +#define DBL_MIN 2.2250738585072014E-308 + +#define FLT_DIG 6 +#define FLT_MAX 3.40282347E+38F +#define FLT_MIN 1.17549435E-38F +#endif diff --git a/sys/alpha/include/alpha_cpu.h b/sys/alpha/include/alpha_cpu.h new file mode 100644 index 000000000000..267b12029532 --- /dev/null +++ b/sys/alpha/include/alpha_cpu.h @@ -0,0 +1,322 @@ +/* $Id$ */ +/* From: NetBSD: alpha_cpu.h,v 1.15 1997/09/20 19:02:34 mjacob Exp */ + +/* + * Copyright (c) 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#ifndef __ALPHA_ALPHA_CPU_H__ +#define __ALPHA_ALPHA_CPU_H__ + +/* + * Alpha CPU + OSF/1 PALcode definitions for use by the kernel. + * + * Definitions for: + * + * Process Control Block + * Interrupt/Exception/Syscall Stack Frame + * Processor Status Register + * Machine Check Error Summary Register + * Machine Check Logout Area + * Virtual Memory Management + * Kernel Entry Vectors + * MMCSR Fault Type Codes + * Translation Buffer Invalidation + * + * and miscellaneous PALcode operations. + */ + + +/* + * Process Control Block definitions [OSF/1 PALcode Specific] + */ + +struct alpha_pcb { + unsigned long apcb_ksp; /* kernel stack ptr */ + unsigned long apcb_usp; /* user stack ptr */ + unsigned long apcb_ptbr; /* page table base reg */ + unsigned int apcb_cpc; /* charged process cycles */ + unsigned int apcb_asn; /* address space number */ + unsigned long apcb_unique; /* process unique value */ + unsigned long apcb_flags; /* flags; see below */ + unsigned long apcb_decrsv0; /* DEC reserved */ + unsigned long apcb_decrsv1; /* DEC reserved */ +}; + +#define ALPHA_PCB_FLAGS_FEN 0x0000000000000001 +#define ALPHA_PCB_FLAGS_PME 0x4000000000000000 + +/* + * Interrupt/Exception/Syscall "Hardware" (really PALcode) + * Stack Frame definitions + * + * These are quadword offsets from the sp on kernel entry, i.e. + * to get to the value in question you access (sp + (offset * 8)). + * + * On syscall entry, A0-A2 aren't written to memory but space + * _is_ reserved for them. + */ + +#define ALPHA_HWFRAME_PS 0 /* processor status register */ +#define ALPHA_HWFRAME_PC 1 /* program counter */ +#define ALPHA_HWFRAME_GP 2 /* global pointer */ +#define ALPHA_HWFRAME_A0 3 /* a0 */ +#define ALPHA_HWFRAME_A1 4 /* a1 */ +#define ALPHA_HWFRAME_A2 5 /* a2 */ + +#define ALPHA_HWFRAME_SIZE 6 /* 6 8-byte words */ + +/* + * Processor Status Register [OSF/1 PALcode Specific] + * + * Includes user/kernel mode bit, interrupt priority levels, etc. + */ + +#define ALPHA_PSL_USERMODE 0x0008 /* set -> user mode */ +#define ALPHA_PSL_IPL_MASK 0x0007 /* interrupt level mask */ + +#define ALPHA_PSL_IPL_0 0x0000 /* all interrupts enabled */ +#define ALPHA_PSL_IPL_SOFT 0x0001 /* software ints disabled */ +#define ALPHA_PSL_IPL_IO 0x0004 /* I/O dev ints disabled */ +#define ALPHA_PSL_IPL_CLOCK 0x0005 /* clock ints disabled */ +#define ALPHA_PSL_IPL_HIGH 0x0006 /* all but mchecks disabled */ + +#define ALPHA_PSL_MUST_BE_ZERO 0xfffffffffffffff0 + +/* Convenience constants: what must be set/clear in user mode */ +#define ALPHA_PSL_USERSET ALPHA_PSL_USERMODE +#define ALPHA_PSL_USERCLR (ALPHA_PSL_MUST_BE_ZERO | ALPHA_PSL_IPL_MASK) + +/* + * Interrupt Type Code Definitions [OSF/1 PALcode Specific] + */ + +#define ALPHA_INTR_XPROC 0 /* interprocessor interrupt */ +#define ALPHA_INTR_CLOCK 1 /* clock interrupt */ +#define ALPHA_INTR_ERROR 2 /* correctable error or mcheck */ +#define ALPHA_INTR_DEVICE 3 /* device interrupt */ +#define ALPHA_INTR_PERF 4 /* performance counter */ +#define ALPHA_INTR_PASSIVE 5 /* passive release */ + +/* + * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific] + * + * The following bits are values as read. On write, _PCE, _SCE, and + * _MIP are "write 1 to clear." + */ + +#define ALPHA_MCES_IMP \ + 0xffffffff00000000 /* impl. dependent */ +#define ALPHA_MCES_RSVD \ + 0x00000000ffffffe0 /* reserved */ +#define ALPHA_MCES_DSC \ + 0x0000000000000010 /* disable system correctable error reporting */ +#define ALPHA_MCES_DPC \ + 0x0000000000000008 /* disable processor correctable error reporting */ +#define ALPHA_MCES_PCE \ + 0x0000000000000004 /* processor correctable error in progress */ +#define ALPHA_MCES_SCE \ + 0x0000000000000002 /* system correctable error in progress */ +#define ALPHA_MCES_MIP \ + 0x0000000000000001 /* machine check in progress */ + +/* + * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific] + */ + +struct alpha_logout_area { + unsigned int la_frame_size; /* frame size */ + unsigned int la_flags; /* flags; see below */ + unsigned int la_cpu_offset; /* offset to cpu area */ + unsigned int la_system_offset; /* offset to system area */ +}; + +#define ALPHA_LOGOUT_FLAGS_RETRY 0x80000000 /* OK to continue */ +#define ALPHA_LOGOUT_FLAGS_SE 0x40000000 /* second error */ +#define ALPHA_LOGOUT_FLAGS_SBZ 0x3fffffff /* should be zero */ + +#define ALPHA_LOGOUT_NOT_BUILT \ + (struct alpha_logout_area *)0xffffffffffffffff) + +#define ALPHA_LOGOUT_PAL_AREA(lap) \ + (unsigned long *)((unsigned char *)(lap) + 16) +#define ALPHA_LOGOUT_PAL_SIZE(lap) \ + ((lap)->la_cpu_offset - 16) +#define ALPHA_LOGOUT_CPU_AREA(lap) \ + (unsigned long *)((unsigned char *)(lap) + (lap)->la_cpu_offset) +#define ALPHA_LOGOUT_CPU_SIZE(lap) \ + ((lap)->la_system_offset - (lap)->la_cpu_offset) +#define ALPHA_LOGOUT_SYSTEM_AREA(lap) \ + (unsigned long *)((unsigned char *)(lap) + (lap)->la_system_offset) +#define ALPHA_LOGOUT_SYSTEM_SIZE(lap) \ + ((lap)->la_frame_size - (lap)->la_system_offset) + +/* + * Virtual Memory Management definitions [OSF/1 PALcode Specific] + * + * Includes user and kernel space addresses and information, + * page table entry definitions, etc. + * + * NOTE THAT THESE DEFINITIONS MAY CHANGE IN FUTURE ALPHA CPUS! + */ + +#define ALPHA_PGSHIFT 13 +#define ALPHA_PGBYTES (1 << ALPHA_PGSHIFT) + +#define ALPHA_USEG_BASE 0 /* virtual */ +#define ALPHA_USEG_END 0x000003ffffffffff + +#define ALPHA_K0SEG_BASE 0xfffffc0000000000 /* direct-mapped */ +#define ALPHA_K0SEG_END 0xfffffdffffffffff +#define ALPHA_K1SEG_BASE 0xfffffe0000000000 /* virtual */ +#define ALPHA_K1SEG_END 0xffffffffffffffff + +#define ALPHA_K0SEG_TO_PHYS(x) ((x) & ~ALPHA_K0SEG_BASE) +#define ALPHA_PHYS_TO_K0SEG(x) ((x) | ALPHA_K0SEG_BASE) + +#define ALPHA_PTE_VALID 0x0001 + +#define ALPHA_PTE_FAULT_ON_READ 0x0002 +#define ALPHA_PTE_FAULT_ON_WRITE 0x0004 +#define ALPHA_PTE_FAULT_ON_EXECUTE 0x0008 + +#define ALPHA_PTE_ASM 0x0010 /* addr. space match */ +#define ALPHA_PTE_GRANULARITY 0x0060 /* granularity hint */ + +#define ALPHA_PTE_PROT 0xff00 +#define ALPHA_PTE_KR 0x0100 +#define ALPHA_PTE_UR 0x0200 +#define ALPHA_PTE_KW 0x1000 +#define ALPHA_PTE_UW 0x2000 + +#define ALPHA_PTE_WRITE (ALPHA_PTE_KW | ALPHA_PTE_UW) + +#define ALPHA_PTE_SOFTWARE 0xffff0000 + +#define ALPHA_PTE_PFN 0xffffffff00000000 + +#define ALPHA_PTE_TO_PFN(pte) ((pte) >> 32) +#define ALPHA_PTE_FROM_PFN(pfn) ((pfn) << 32) + +typedef unsigned long alpha_pt_entry_t; + +/* + * Kernel Entry Vectors. [OSF/1 PALcode Specific] + */ + +#define ALPHA_KENTRY_INT 0 +#define ALPHA_KENTRY_ARITH 1 +#define ALPHA_KENTRY_MM 2 +#define ALPHA_KENTRY_IF 3 +#define ALPHA_KENTRY_UNA 4 +#define ALPHA_KENTRY_SYS 5 + +/* + * MMCSR Fault Type Codes. [OSF/1 PALcode Specific] + */ + +#define ALPHA_MMCSR_INVALTRANS 0 +#define ALPHA_MMCSR_ACCESS 1 +#define ALPHA_MMCSR_FOR 2 +#define ALPHA_MMCSR_FOE 3 +#define ALPHA_MMCSR_FOW 4 + +/* + * Instruction Fault Type Codes. [OSF/1 PALcode Specific] + */ + +#define ALPHA_IF_CODE_BPT 0 +#define ALPHA_IF_CODE_BUGCHK 1 +#define ALPHA_IF_CODE_GENTRAP 2 +#define ALPHA_IF_CODE_FEN 3 +#define ALPHA_IF_CODE_OPDEC 4 + +/* + * Translation Buffer Invalidation definitions [OSF/1 PALcode Specific] + */ + +#define ALPHA_TBIA() alpha_pal_tbi(-2, 0) /* all TB entries */ +#define ALPHA_TBIAP() alpha_pal_tbi(-1, 0) /* all per-process */ +#define ALPHA_TBISI(va) alpha_pal_tbi(1, (va)) /* ITB entry for va */ +#define ALPHA_TBISD(va) alpha_pal_tbi(2, (va)) /* DTB entry for va */ +#define ALPHA_TBIS(va) alpha_pal_tbi(3, (va)) /* all for va */ + +/* + * Bits used in the amask instruction [EV56 and later] + */ + +#define ALPHA_AMASK_BWX 0x0001 /* byte/word extension */ +#define ALPHA_AMASK_CIX 0x0002 /* count extension */ +#define ALPHA_AMASK_MAX 0x0100 /* multimedia extension */ + +/* + * Chip family IDs returned by implver instruction + */ + +#define ALPHA_IMPLVER_EV4 0 /* LCA/EV4/EV45 */ +#define ALPHA_IMPLVER_EV5 1 /* EV5/EV56/PCA56 */ +#define ALPHA_IMPLVER_EV6 2 /* EV6 */ + +/* + * Stubs for Alpha instructions normally inaccessible from C. + */ +unsigned long alpha_amask __P((unsigned long)); +unsigned long alpha_implver __P((void)); +unsigned long alpha_rpcc __P((void)); +void alpha_mb __P((void)); +void alpha_wmb __P((void)); + +u_int8_t alpha_ldbu __P((volatile u_int8_t *)); +u_int16_t alpha_ldwu __P((volatile u_int16_t *)); +void alpha_stb __P((volatile u_int8_t *, u_int8_t)); +void alpha_stw __P((volatile u_int16_t *, u_int16_t)); +u_int8_t alpha_sextb __P((u_int8_t)); +u_int16_t alpha_sextw __P((u_int16_t)); + +/* + * Stubs for OSF/1 PALcode operations. + */ +void alpha_pal_imb __P((void)); +void alpha_pal_cflush __P((unsigned long)); +void alpha_pal_draina __P((void)); +void alpha_pal_halt __P((void)) __attribute__((__noreturn__)); +unsigned long alpha_pal_rdmces __P((void)); +unsigned long alpha_pal_rdps __P((void)); +unsigned long alpha_pal_rdusp __P((void)); +unsigned long alpha_pal_rdval __P((void)); +unsigned long alpha_pal_swpipl __P((unsigned long)); +unsigned long _alpha_pal_swpipl __P((unsigned long)); /* for profiling */ +void alpha_pal_tbi __P((unsigned long, vm_offset_t)); +unsigned long alpha_pal_whami __P((void)); +void alpha_pal_wrent __P((void *, unsigned long)); +void alpha_pal_wrfen __P((unsigned long)); +void alpha_pal_wripir __P((unsigned long)); +void alpha_pal_wrusp __P((unsigned long)); +void alpha_pal_wrvptptr __P((unsigned long)); +void alpha_pal_wrmces __P((unsigned long)); +void alpha_pal_wrval __P((unsigned long)); + +#endif /* __ALPHA_ALPHA_CPU_H__ */ diff --git a/sys/alpha/include/ansi.h b/sys/alpha/include/ansi.h new file mode 100644 index 000000000000..5907db23f956 --- /dev/null +++ b/sys/alpha/include/ansi.h @@ -0,0 +1,95 @@ +/* $Id$ */ +/* From: NetBSD: ansi.h,v 1.9 1997/11/23 20:20:53 kleink 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() */ +typedef struct { + char *__base; + int __offset; + int __pad; +} __va_list; +#define _BSD_VA_LIST_ __va_list /* va_list */ +#define _BSD_CLOCKID_T_ int /* clockid_t */ +#define _BSD_TIMER_T_ int /* timer_t */ +#define _BSD_SUSECONDS_T_ int /* suseconds_t */ +#define _BSD_USECONDS_T_ unsigned int /* useconds_t */ + +/* + * Types which are fundamental to the implementation and must be used + * in more than one standard header although they are only declared in + * one (perhaps nonstandard) header are defined here. Standard headers + * use _BSD_XXX_T_ without undef'ing it. + */ +#define _BSD_CT_RUNE_T_ int /* arg type for ctype funcs */ +#define _BSD_OFF_T_ long /* file offset */ +#define _BSD_PID_T_ int /* process [group] */ + +/* + * 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_WINT_T_ int /* wint_t */ +#define _BSD_RUNE_T_ int /* rune_t */ + +#endif /* _ANSI_H_ */ diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h new file mode 100644 index 000000000000..adf0ebac11b8 --- /dev/null +++ b/sys/alpha/include/cpu.h @@ -0,0 +1,179 @@ +/* $Id$ */ +/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob 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 + +/* + * definitions of cpu-dependent requirements + * referenced in generic code + */ +#define cpu_wait(p) /* nothing */ + +/* + * 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_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0) +#define CLKF_BASEPRI(framep) \ + (((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_IPL_MASK) == 0) +#define CLKF_PC(framep) ((framep)->cf_tf.tf_regs[FRAME_PC]) +/* + * XXX No way to accurately tell if we were in interrupt mode before taking + * clock interrupt. + */ +#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) + +#ifdef _KERNEL +u_int64_t astpending; /* need to trap before returning to user mode */ +u_int64_t want_resched; /* resched() was called */ +#endif + + +/* + * CTL_MACHDEP definitions. + */ +#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_ROOT_DEVICE 2 /* string: root device name */ +#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */ +#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */ +#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */ +#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */ +#define CPU_MAXID 7 /* 6 valid machdep IDs */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "console_device", CTLTYPE_STRUCT }, \ + { "root_device", CTLTYPE_STRING }, \ + { "unaligned_print", CTLTYPE_INT }, \ + { "unaligned_fix", CTLTYPE_INT }, \ + { "unaligned_sigbus", CTLTYPE_INT }, \ + { "booted_kernel", CTLTYPE_STRING }, \ +} + +#ifdef _KERNEL + +struct pcb; +struct proc; +struct reg; +struct rpb; +struct trapframe; + +extern int cold; +extern struct proc *fpcurproc; +extern struct rpb *hwrpb; +extern volatile int mc_expected, mc_received; + +void XentArith __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ +void XentIF __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ +void XentInt __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ +void XentMM __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ +void XentRestart __P((void)); /* MAGIC */ +void XentSys __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ +void XentUna __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ +void alpha_init __P((u_long, u_long, u_long, u_long)); +void ast __P((struct trapframe *)); +int badaddr __P((void *, size_t)); +int badaddr_read __P((void *, size_t, void *)); +void child_return __P((struct proc *p)); +void configure __P((void)); +u_int64_t console_restart __P((u_int64_t, u_int64_t, u_int64_t)); +void do_sir __P((void)); +void dumpconf __P((void)); +void exception_return __P((void)); /* MAGIC */ +void frametoreg __P((struct trapframe *, struct reg *)); +long fswintrberr __P((void)); /* MAGIC */ +void init_prom_interface __P((void)); +void interrupt + __P((unsigned long, unsigned long, unsigned long, struct trapframe *)); +void machine_check + __P((unsigned long, struct trapframe *, unsigned long, unsigned long)); +u_int64_t hwrpb_checksum __P((void)); +void hwrpb_restart_setup __P((void)); +void regdump __P((struct trapframe *)); +void regtoframe __P((struct reg *, struct trapframe *)); +void savectx __P((struct pcb *)); +void set_iointr __P((void (*)(void *, unsigned long))); +void switch_exit __P((struct proc *)); /* MAGIC */ +void switch_trampoline __P((void)); /* MAGIC */ +void syscall __P((u_int64_t, struct trapframe *)); +void trap __P((unsigned long, unsigned long, unsigned long, unsigned long, + struct trapframe *)); + +#endif /* _KERNEL */ + +#endif /* _ALPHA_CPU_H_ */ diff --git a/sys/alpha/include/endian.h b/sys/alpha/include/endian.h new file mode 100644 index 000000000000..3646fdcc78b8 --- /dev/null +++ b/sys/alpha/include/endian.h @@ -0,0 +1,96 @@ +/* $Id$ */ +/* From: NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer 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 + +typedef u_int32_t in_addr_t; +typedef u_int16_t in_port_t; + +__BEGIN_DECLS +in_addr_t htonl __P((in_addr_t)); +in_port_t htons __P((in_port_t)); +in_addr_t ntohl __P((in_addr_t)); +in_port_t ntohs __P((in_port_t)); +u_int16_t bswap16 __P((u_int16_t)); +u_int32_t bswap32 __P((u_int32_t)); +u_int64_t bswap64 __P((u_int64_t)); +__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((in_addr_t)x) +#define NTOHS(x) (x) = ntohs((in_port_t)x) +#define HTONL(x) (x) = htonl((in_addr_t)x) +#define HTONS(x) (x) = htons((in_port_t)x) +#endif +#endif /* !_POSIX_SOURCE */ +#endif /* !_ENDIAN_H_ */ diff --git a/sys/alpha/include/frame.h b/sys/alpha/include/frame.h new file mode 100644 index 000000000000..19aaef68ea8d --- /dev/null +++ b/sys/alpha/include/frame.h @@ -0,0 +1,95 @@ +/* $Id$ */ +/* From: NetBSD: frame.h,v 1.4 1997/04/06 08:47:27 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_ + +#include + +/* + * Software trap, exception, and syscall frame. + * + * Includes "hardware" (PALcode) frame. + * + * PALcode puts ALPHA_HWFRAME_* fields on stack. We have to add + * all of the general-purpose registers except for zero, for sp + * (which is automatically saved in the PCB's USP field for entries + * from user mode, and which is implicitly saved and restored by the + * calling conventions for entries from kernel mode), and (on traps + * and exceptions) for a0, a1, and a2 (which are saved by PALcode). + */ + +/* Quadword offsets of the registers to be saved. */ +#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_SW_SIZE (FRAME_SP + 1) +#define FRAME_HW_OFFSET FRAME_SW_SIZE + +#define FRAME_PS (FRAME_HW_OFFSET + ALPHA_HWFRAME_PS) +#define FRAME_PC (FRAME_HW_OFFSET + ALPHA_HWFRAME_PC) +#define FRAME_GP (FRAME_HW_OFFSET + ALPHA_HWFRAME_GP) +#define FRAME_A0 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A0) +#define FRAME_A1 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A1) +#define FRAME_A2 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A2) + +#define FRAME_HW_SIZE ALPHA_HWFRAME_SIZE +#define FRAME_SIZE (FRAME_HW_OFFSET + FRAME_HW_SIZE) + +struct trapframe { + unsigned long tf_regs[FRAME_SIZE]; /* See above */ +}; + +#endif /* _ALPHA_FRAME_H_ */ diff --git a/sys/alpha/include/intr.h b/sys/alpha/include/intr.h new file mode 100644 index 000000000000..2a5f673bb75c --- /dev/null +++ b/sys/alpha/include/intr.h @@ -0,0 +1,124 @@ +/* $Id$ */ +/* From: NetBSD: intr.h,v 1.11 1997/11/10 18:23:50 mjacob Exp */ + +/* + * Copyright (c) 1997 Christopher G. Demetriou. All rights reserved. + * Copyright (c) 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#ifndef _ALPHA_INTR_H_ +#define _ALPHA_INTR_H_ + +#include + +#define IPL_NONE 0 /* disable only this interrupt */ +#define IPL_BIO 1 /* disable block I/O interrupts */ +#define IPL_NET 2 /* disable network interrupts */ +#define IPL_TTY 3 /* disable terminal interrupts */ +#define IPL_CLOCK 4 /* disable clock interrupts */ +#define IPL_HIGH 5 /* disable all interrupts */ + +#define IST_UNUSABLE -1 /* interrupt cannot be used */ +#define IST_NONE 0 /* none (dummy) */ +#define IST_PULSE 1 /* pulsed */ +#define IST_EDGE 2 /* edge-triggered */ +#define IST_LEVEL 3 /* level-triggered */ +#ifdef _KERNEL + +/* IPL-lowering/restoring macros */ +#define splx(s) \ + ((s) == ALPHA_PSL_IPL_0 ? spl0() : alpha_pal_swpipl(s)) +#define splsoft() alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT) +#define splsoftclock() splsoft() +#define splsoftnet() splsoft() + +/* IPL-raising functions/macros */ +static __inline int _splraise __P((int)) __attribute__ ((unused)); +static __inline int +_splraise(s) + int s; +{ + int cur = alpha_pal_rdps() & ALPHA_PSL_IPL_MASK; + return (s > cur ? alpha_pal_swpipl(s) : cur); +} +#define splnet() _splraise(ALPHA_PSL_IPL_IO) +#define splbio() _splraise(ALPHA_PSL_IPL_IO) +#define splimp() _splraise(ALPHA_PSL_IPL_IO) +#define spltty() _splraise(ALPHA_PSL_IPL_IO) +#define splclock() _splraise(ALPHA_PSL_IPL_CLOCK) +#define splstatclock() _splraise(ALPHA_PSL_IPL_CLOCK) +#define splhigh() _splraise(ALPHA_PSL_IPL_HIGH) + +/* + * simulated software interrupt register + */ +extern u_int64_t ssir; + +#define SIR_NET 0x1 +#define SIR_CLOCK 0x2 + +#define setsoftnet() ssir |= SIR_NET +#define setsoftclock() ssir |= SIR_CLOCK + +/* + * Alpha shared-interrupt-line common code. + */ + +struct alpha_shared_intrhand { + TAILQ_ENTRY(alpha_shared_intrhand) + ih_q; + int (*ih_fn) __P((void *)); + void *ih_arg; + int ih_level; +}; + +struct alpha_shared_intr { + TAILQ_HEAD(,alpha_shared_intrhand) + intr_q; + int intr_sharetype; + int intr_dfltsharetype; + int intr_nstrays; + int intr_maxstrays; +}; + +struct alpha_shared_intr *alpha_shared_intr_alloc __P((unsigned int)); +int alpha_shared_intr_dispatch __P((struct alpha_shared_intr *, + unsigned int)); +void *alpha_shared_intr_establish __P((struct alpha_shared_intr *, + unsigned int, int, int, int (*)(void *), void *, const char *)); +int alpha_shared_intr_get_sharetype __P((struct alpha_shared_intr *, + unsigned int)); +int alpha_shared_intr_isactive __P((struct alpha_shared_intr *, + unsigned int)); +void alpha_shared_intr_set_dfltsharetype __P((struct alpha_shared_intr *, + unsigned int, int)); +void alpha_shared_intr_set_maxstrays __P((struct alpha_shared_intr *, + unsigned int, int)); +void alpha_shared_intr_stray __P((struct alpha_shared_intr *, unsigned int, + const char *)); + +#endif +#endif diff --git a/sys/alpha/include/limits.h b/sys/alpha/include/limits.h new file mode 100644 index 000000000000..c8adc82fb0ae --- /dev/null +++ b/sys/alpha/include/limits.h @@ -0,0 +1,96 @@ +/* $Id$ */ +/* From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 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 0x7f /* max value for a signed char */ +#define SCHAR_MIN (-0x7f-1) /* min value for a signed char */ + +#define UCHAR_MAX 0xffU /* max value for an unsigned char */ +#define CHAR_MAX 0x7f /* max value for a char */ +#define CHAR_MIN (-0x7f-1) /* min value for a char */ + +#define USHRT_MAX 0xffffU /* max value for an unsigned short */ +#define SHRT_MAX 0x7fff /* max value for a short */ +#define SHRT_MIN (-0x7fff-1) /* min value for a short */ + +#define UINT_MAX 0xffffffffU /* max value for an unsigned int */ +#define INT_MAX 0x7fffffff /* max value for an int */ +#define INT_MIN (-0x7fffffff-1) /* min value for an int */ + +#define ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */ +#define LONG_MAX 0x7fffffffffffffffL /* max for a long */ +#define LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */ + +#if !defined(_ANSI_SOURCE) +#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ + +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) +#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */ + +/* Quads and longs are the same on the alpha */ +#define UQUAD_MAX (ULONG_MAX) /* max value for a uquad_t */ +#define QUAD_MAX (LONG_MAX) /* max value for a quad_t */ +#define QUAD_MIN (LONG_MIN) /* min value for a quad_t */ + +#endif /* !_POSIX_SOURCE && !_XOPEN_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +#if (!defined(_ANSI_SOURCE)&&!defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE) +#define LONG_BIT 64 +#define WORD_BIT 32 + +#define DBL_DIG 15 +#define DBL_MAX 1.7976931348623157E+308 +#define DBL_MIN 2.2250738585072014E-308 + +#define FLT_DIG 6 +#define FLT_MAX 3.40282347E+38F +#define FLT_MIN 1.17549435E-38F +#endif diff --git a/sys/alpha/include/param.h b/sys/alpha/include/param.h new file mode 100644 index 000000000000..7509c366f8d1 --- /dev/null +++ b/sys/alpha/include/param.h @@ -0,0 +1,180 @@ +/* $Id$ */ +/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo 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 "alpha" +#define _MACHINE_ARCH alpha +#define MACHINE_ARCH "alpha" +#define MID_MACHINE MID_ALPHA + +#include +#include + +/* + * 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. + * + * ALIGNED_POINTER is a boolean macro that checks whether an address + * is valid to fetch data elements of type t from on this architecture. + * This does not reflect the optimal alignment, just the possibility + * (within reasonable limits). + * + */ +#define ALIGNBYTES 7 +#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) +#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) + +#define NBPG (1 << ALPHA_PGSHIFT) /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte off. into pg */ +#define PGSHIFT ALPHA_PGSHIFT /* 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 0xfffffc0000230000 /* 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 +#ifndef MAXPHYS +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ +#endif + +#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 */ + +#ifndef MSGBUFSIZE +#define MSGBUFSIZE NBPG /* default message buffer size */ +#endif + +/* + * 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 */ +#ifndef MCLSHIFT +# define MCLSHIFT 11 /* convert bytes to m_buf clusters */ + /* 2K cluster can hold Ether frame */ +#endif /* MCLSHIFT */ +#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */ +#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 + +#ifdef _KERNEL +#ifndef _LOCORE + +void delay __P((unsigned long)); +#define DELAY(n) delay(n) + +/* XXX THE FOLLOWING PROTOTYPE BELONGS IN INTR.H */ +int spl0 __P((void)); /* drop ipl to zero */ +/* XXX END INTR.H */ + +/* XXX THE FOLLOWING PROTOTYPE SHOULD BE A BUS.H INTERFACE */ +vm_offset_t alpha_XXX_dmamap __P((vm_offset_t)); +/* XXX END BUS.H */ + +#endif +#endif /* !_KERNEL */ diff --git a/sys/alpha/include/signal.h b/sys/alpha/include/signal.h new file mode 100644 index 000000000000..32f14c210aa4 --- /dev/null +++ b/sys/alpha/include/signal.h @@ -0,0 +1,63 @@ +/* $Id$ */ +/* From: NetBSD: signal.h,v 1.3 1997/04/06 08:47: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. + */ + +#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/alpha/include/types.h b/sys/alpha/include/types.h new file mode 100644 index 000000000000..67249e739b1d --- /dev/null +++ b/sys/alpha/include/types.h @@ -0,0 +1,73 @@ +/* $Id$ */ +/* From: NetBSD: types.h,v 1.8 1997/04/06 08:47:45 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 + +#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; + +#endif /* _MACHTYPES_H_ */