diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1994-05-25 09:21:21 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1994-05-25 09:21:21 +0000 |
commit | 2469c867a164210ce96143517059f21db7f1fd17 (patch) | |
tree | 9179427ac860211c445df663fd2b86267366bfba /sys/i386/include | |
parent | cb0aba89af15a48e2655e898a503946ac4cb42ae (diff) | |
download | FreeBSD-src-2469c867a164210ce96143517059f21db7f1fd17.zip FreeBSD-src-2469c867a164210ce96143517059f21db7f1fd17.tar.gz |
The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.
Reviewed by: Rodney W. Grimes
Submitted by: John Dyson and David Greenman
Diffstat (limited to 'sys/i386/include')
-rw-r--r-- | sys/i386/include/_limits.h | 66 | ||||
-rw-r--r-- | sys/i386/include/ansi.h | 33 | ||||
-rw-r--r-- | sys/i386/include/cpu.h | 34 | ||||
-rw-r--r-- | sys/i386/include/cpufunc.h | 139 | ||||
-rw-r--r-- | sys/i386/include/exec.h | 93 | ||||
-rw-r--r-- | sys/i386/include/frame.h | 26 | ||||
-rw-r--r-- | sys/i386/include/limits.h | 66 | ||||
-rw-r--r-- | sys/i386/include/param.h | 1 | ||||
-rw-r--r-- | sys/i386/include/pcb.h | 7 | ||||
-rw-r--r-- | sys/i386/include/pmap.h | 72 | ||||
-rw-r--r-- | sys/i386/include/proc.h | 4 | ||||
-rw-r--r-- | sys/i386/include/pte.h | 5 | ||||
-rw-r--r-- | sys/i386/include/reg.h | 16 | ||||
-rw-r--r-- | sys/i386/include/signal.h | 28 | ||||
-rw-r--r-- | sys/i386/include/spl.h | 5 | ||||
-rw-r--r-- | sys/i386/include/stdarg.h | 24 | ||||
-rw-r--r-- | sys/i386/include/types.h | 26 | ||||
-rw-r--r-- | sys/i386/include/vmparam.h | 14 |
18 files changed, 303 insertions, 356 deletions
diff --git a/sys/i386/include/_limits.h b/sys/i386/include/_limits.h index 5aed870..e507313 100644 --- a/sys/i386/include/_limits.h +++ b/sys/i386/include/_limits.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. + * 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 @@ -30,40 +30,60 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)limits.h 7.2 (Berkeley) 6/28/90 - * $Id: limits.h,v 1.5 1994/02/26 00:56:02 ache Exp $ + * @(#)limits.h 8.3 (Berkeley) 1/4/94 */ #ifndef _MACHINE_LIMITS_H_ #define _MACHINE_LIMITS_H_ 1 #define CHAR_BIT 8 /* number of bits in a char */ -#define MB_LEN_MAX 6 /* allow 21-bit UTF2 */ +#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ -#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */ -#define SCHAR_MAX 0x7f /* min value for a signed char */ -#define UCHAR_MAX 0xff /* 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 CLK_TCK 128 /* ticks per second */ + +/* + * 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 0xffff /* 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 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 0x7fffffff /* max value for an int */ -#define INT_MIN (-0x7fffffff-1) /* min value for an int */ +#define INT_MAX 2147483647 /* max value for an int */ +#define INT_MIN (-2147483647-1) /* min value for an int */ #define ULONG_MAX 0xffffffff /* max value for an unsigned long */ -#define LONG_MAX 0x7fffffff /* max value for a long */ -#define LONG_MIN (-0x7fffffff-1) /* min value for a long */ +#define LONG_MAX 2147483647 /* max value for a long */ +#define LONG_MIN (-2147483647-1) /* min value for a long */ -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -#define CLK_TCK 128 /* ticks per second */ -#define UQUAD_MAX 0xffffffffffffffffLL /* max unsigned quad */ -#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ -#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ -#endif +#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 */ #endif /* _MACHINE_LIMITS_H_ */ diff --git a/sys/i386/include/ansi.h b/sys/i386/include/ansi.h index 1665aad..0ef060a 100644 --- a/sys/i386/include/ansi.h +++ b/sys/i386/include/ansi.h @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. + * 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 @@ -30,8 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)ansi.h 7.1 (Berkeley) 3/9/91 - * $Id: ansi.h,v 1.2 1993/10/16 14:39:05 rgrimes Exp $ + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 */ #ifndef _ANSI_H_ @@ -41,18 +40,17 @@ * Types which are fundamental to the implementation and may appear in * more than one standard header are defined here. Standard headers * then use: - * #ifdef _SIZE_T_ - * typedef _SIZE_T_ size_t; - * #undef _SIZE_T_ + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ * #endif - * - * Thanks, ANSI! */ -#define _CLOCK_T_ unsigned long /* clock() */ -#define _PTRDIFF_T_ int /* ptr1 - ptr2 */ -#define _SIZE_T_ unsigned int /* sizeof() */ -#define _TIME_T_ long /* time() */ -#define _VA_LIST_ char * /* va_list */ +#define _BSD_CLOCK_T_ unsigned long /* clock() */ +#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ +#define _BSD_SIZE_T_ unsigned int /* sizeof() */ +#define _BSD_SSIZE_T_ int /* byte count or error */ +#define _BSD_TIME_T_ long /* time() */ +#define _BSD_VA_LIST_ char * /* va_list */ /* * Runes (wchar_t) is declared to be an ``int'' instead of the more natural @@ -63,13 +61,12 @@ * 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 */ - +#define _BSD_WCHAR_T_ int /* wchar_t */ +#define _BSD_RUNE_T_ int /* rune_t */ #endif /* _ANSI_H_ */ diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index a2df023..2216d71 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -45,6 +45,7 @@ */ #include "machine/frame.h" #include "machine/segments.h" +#include <machine/spl.h> /* * definitions of cpu-dependent requirements @@ -53,20 +54,16 @@ #undef COPY_SIGCODE /* don't copy sigcode above user stack in exec */ #define cpu_exec(p) /* nothing */ +#define cpu_swapin(p) /* nothing */ +#define cpu_setstack(p, ap) (p)->p_md.md_regs = ap +#define cpu_set_init_frame(p, fp) (p)->p_md.md_regs = fp -/* - * Arguments to hardclock, softclock and gatherstats - * encapsulate the previous machine state in an opaque - * clockframe; for now, use generic intrframe. - * XXX softclock() has been fixed. It never needed a - * whole frame, only a usermode flag, at least on this - * machine. Fix the rest. - */ -typedef struct intrframe clockframe; +#define CLKF_USERMODE(framep) (ISPL((framep)->cf_cs) == SEL_UPL) +#define CLKF_INTR(framep) (0) +#define CLKF_BASEPRI(framep) (((framep)->cf_ppl & ~SWI_AST_MASK) == 0) +#define CLKF_PC(framep) ((framep)->cf_eip) -#define CLKF_USERMODE(framep) (ISPL((framep)->if_cs) == SEL_UPL) -#define CLKF_BASEPRI(framep) (((framep)->if_ppl & ~SWI_AST_MASK) == 0) -#define CLKF_PC(framep) ((framep)->if_eip) +#define resettodr() /* no todr to set */ /* * Preempt the current process if in interrupt from user mode, @@ -79,7 +76,7 @@ typedef struct intrframe clockframe; * interrupt. On tahoe, request an ast to send us through trap(), * marking the proc as needing a profiling tick. */ -#define profile_tick(p, framep) { (p)->p_flag |= SOWEUPC; aston(); } +#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); } /* * Notify the current process (p) that it has a signal pending, @@ -100,6 +97,17 @@ struct cpu_nameclass { int cpu_class; }; +/* + * 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 }, \ +} + #ifdef KERNEL extern int want_resched; /* resched was called */ diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 3c2dcc9..729a5c0 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -71,145 +71,6 @@ tlbflush() __asm __volatile("movl %%cr3, %%eax; movl %%eax, %%cr3" : : : "ax"); } -static inline -int -imin(a, b) - int a, b; -{ - - return (a < b ? a : b); -} - -static inline -int -imax(a, b) - int a, b; -{ - - return (a > b ? a : b); -} - -static inline -unsigned int -min(a, b) - unsigned int a, b; -{ - - return (a < b ? a : b); -} - -static inline -unsigned int -max(a, b) - unsigned int a, b; -{ - - return (a > b ? a : b); -} - -static inline -long -lmin(a, b) - long a, b; -{ - - return (a < b ? a : b); -} - -static inline -long -lmax(a, b) - long a, b; -{ - - return (a > b ? a : b); -} - -static inline -unsigned long -ulmin(a, b) - unsigned long a, b; -{ - - return (a < b ? a : b); -} - -static inline -unsigned long -ulmax(a, b) - unsigned long a, b; -{ - - return (a > b ? a : b); -} - -static inline -int -ffs(mask) - register long mask; -{ - register int bit; - - if (!mask) - return(0); - for (bit = 1;; ++bit) { - if (mask&0x01) - return(bit); - mask >>= 1; - } -} - -static inline -int -bcmp(v1, v2, len) - void *v1, *v2; - register unsigned len; -{ - register u_char *s1 = v1, *s2 = v2; - - while (len--) - if (*s1++ != *s2++) - return (1); - return (0); -} - -static inline -size_t -strlen(s1) - register const char *s1; -{ - register size_t len; - - for (len = 0; *s1++ != '\0'; len++) - ; - return (len); -} - -struct quehead { - struct quehead *qh_link; - struct quehead *qh_rlink; -}; - -static inline void -insque(void *a, void *b) -{ - register struct quehead *element = a, *head = b; - element->qh_link = head->qh_link; - head->qh_link = (struct quehead *)element; - element->qh_rlink = (struct quehead *)head; - ((struct quehead *)(element->qh_link))->qh_rlink - = (struct quehead *)element; -} - -static inline void -remque(void *a) -{ - register struct quehead *element = a; - ((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; - ((struct quehead *)(element->qh_rlink))->qh_link = element->qh_link; - element->qh_rlink = 0; -} - #else /* not __GNUC__ */ extern void insque __P((void *, void *)); extern void remque __P((void *)); diff --git a/sys/i386/include/exec.h b/sys/i386/include/exec.h index eb587a4..f63ec49 100644 --- a/sys/i386/include/exec.h +++ b/sys/i386/include/exec.h @@ -33,51 +33,96 @@ * @(#)exec.h 8.1 (Berkeley) 6/11/93 */ -/* Size of a page in an object file. */ +#ifndef _EXEC_H_ +#define _EXEC_H_ + #define __LDPGSZ 4096 /* Valid magic number check. */ #define N_BADMAG(ex) \ - ((ex).a_magic != NMAGIC && (ex).a_magic != OMAGIC && \ - (ex).a_magic != ZMAGIC) + (N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \ + N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC && \ + N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \ + N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC) + +#define N_ALIGN(ex,x) \ + (N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC || \ + N_GETMAGIC_NET(ex) == ZMAGIC || N_GETMAGIC_NET(ex) == QMAGIC ? \ + ((x) + __LDPGSZ - 1) & ~(__LDPGSZ - 1) : (x)) /* Address of the bottom of the text segment. */ -#define N_TXTADDR(X) 0 +#define N_TXTADDR(ex) \ + ((N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC || \ + N_GETMAGIC(ex) == ZMAGIC) ? 0 : __LDPGSZ) /* Address of the bottom of the data segment. */ #define N_DATADDR(ex) \ - (N_TXTADDR(ex) + ((ex).a_magic == OMAGIC ? (ex).a_text \ - : __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1)))) + N_ALIGN(ex, N_TXTADDR(ex) + (ex).a_text) + +#define N_GETMAGIC(ex) \ + ( (ex).a_midmag & 0xffff ) +#define N_GETMID(ex) \ + ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETMID_NET(ex) : \ + ((ex).a_midmag >> 16) & 0x03ff ) +#define N_GETFLAG(ex) \ + ( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETFLAG_NET(ex) : \ + ((ex).a_midmag >> 26) & 0x3f ) +#define N_SETMAGIC(ex,mag,mid,flag) \ + ( (ex).a_midmag = (((flag) & 0x3f) <<26) | (((mid) & 0x03ff) << 16) | \ + ((mag) & 0xffff) ) + +#define N_GETMAGIC_NET(ex) \ + (ntohl((ex).a_midmag) & 0xffff) +#define N_GETMID_NET(ex) \ + ((ntohl((ex).a_midmag) >> 16) & 0x03ff) +#define N_GETFLAG_NET(ex) \ + ((ntohl((ex).a_midmag) >> 26) & 0x3f) +#define N_SETMAGIC_NET(ex,mag,mid,flag) \ + ( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \ + (((mag)&0xffff)) ) ) /* Text segment offset. */ #define N_TXTOFF(ex) \ - ((ex).a_magic == ZMAGIC ? __LDPGSZ : sizeof(struct exec)) + (N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC || \ + N_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : sizeof(struct exec)) /* Data segment offset. */ #define N_DATOFF(ex) \ - (N_TXTOFF(ex) + ((ex).a_magic != ZMAGIC ? (ex).a_text : \ - __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1)))) + N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text) + +/* Relocation table offset. */ +#define N_RELOFF(ex) \ + N_ALIGN(ex, N_DATOFF(ex) + (ex).a_data) /* Symbol table offset. */ #define N_SYMOFF(ex) \ - (N_TXTOFF(ex) + (ex).a_text + (ex).a_data + (ex).a_trsize + \ - (ex).a_drsize) + (N_RELOFF(ex) + (ex).a_trsize + (ex).a_drsize) /* String table offset. */ #define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms) -/* Description of the object file header (a.out format). */ +/* + * Header prepended to each a.out file. + * only manipulate the a_midmag field via the + * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros in a.out.h + */ + struct exec { -#define OMAGIC 0407 /* old impure format */ -#define NMAGIC 0410 /* read-only text */ -#define ZMAGIC 0413 /* demand load format */ - long a_magic; /* magic number */ - - u_long a_text; /* text segment size */ - u_long a_data; /* initialized data size */ - u_long a_bss; /* uninitialized data size */ - u_long a_syms; /* symbol table size */ - u_long a_entry; /* entry point */ - u_long a_trsize; /* text relocation size */ - u_long a_drsize; /* data relocation size */ +unsigned long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */ +unsigned long a_text; /* text segment size */ +unsigned long a_data; /* initialized data size */ +unsigned long a_bss; /* uninitialized data size */ +unsigned long a_syms; /* symbol table size */ +unsigned long a_entry; /* entry point */ +unsigned long a_trsize; /* text relocation size */ +unsigned long a_drsize; /* data relocation size */ }; +#define a_magic a_midmag /* XXX Hack to work with current kern_execve.c */ + +/* a_magic */ +#define OMAGIC 0407 /* old impure format */ +#define NMAGIC 0410 /* read-only text */ +#define ZMAGIC 0413 /* demand load format */ +#define QMAGIC 0314 /* "compact" demand load format */ + +#endif /* !_EXEC_H_ */ diff --git a/sys/i386/include/frame.h b/sys/i386/include/frame.h index 05bf265..db2993e 100644 --- a/sys/i386/include/frame.h +++ b/sys/i386/include/frame.h @@ -100,6 +100,32 @@ struct intrframe { int if_ss; }; +/* frame of clock (same as interrupt frame) */ + +struct clockframe { + int cf_vec; + int cf_ppl; + int cf_es; + int cf_ds; + int cf_edi; + int cf_esi; + int cf_ebp; + int :32; + int cf_ebx; + int cf_edx; + int cf_ecx; + int cf_eax; + int :32; /* for compat with trap frame - trapno */ + int :32; /* for compat with trap frame - err */ + /* below portion defined in 386 hardware */ + int cf_eip; + int cf_cs; + int cf_eflags; + /* below only when transitting rings (e.g. user to kernel) */ + int cf_esp; + int cf_ss; +}; + /* * Signal frame */ diff --git a/sys/i386/include/limits.h b/sys/i386/include/limits.h index 5aed870..e507313 100644 --- a/sys/i386/include/limits.h +++ b/sys/i386/include/limits.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 1988 The Regents of the University of California. - * All rights reserved. + * 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 @@ -30,40 +30,60 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)limits.h 7.2 (Berkeley) 6/28/90 - * $Id: limits.h,v 1.5 1994/02/26 00:56:02 ache Exp $ + * @(#)limits.h 8.3 (Berkeley) 1/4/94 */ #ifndef _MACHINE_LIMITS_H_ #define _MACHINE_LIMITS_H_ 1 #define CHAR_BIT 8 /* number of bits in a char */ -#define MB_LEN_MAX 6 /* allow 21-bit UTF2 */ +#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ -#define SCHAR_MIN (-0x7f-1) /* max value for a signed char */ -#define SCHAR_MAX 0x7f /* min value for a signed char */ -#define UCHAR_MAX 0xff /* 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 CLK_TCK 128 /* ticks per second */ + +/* + * 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 0xffff /* 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 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 0x7fffffff /* max value for an int */ -#define INT_MIN (-0x7fffffff-1) /* min value for an int */ +#define INT_MAX 2147483647 /* max value for an int */ +#define INT_MIN (-2147483647-1) /* min value for an int */ #define ULONG_MAX 0xffffffff /* max value for an unsigned long */ -#define LONG_MAX 0x7fffffff /* max value for a long */ -#define LONG_MIN (-0x7fffffff-1) /* min value for a long */ +#define LONG_MAX 2147483647 /* max value for a long */ +#define LONG_MIN (-2147483647-1) /* min value for a long */ -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -#define CLK_TCK 128 /* ticks per second */ -#define UQUAD_MAX 0xffffffffffffffffLL /* max unsigned quad */ -#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ -#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ -#endif +#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 */ #endif /* _MACHINE_LIMITS_H_ */ diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index b847afc..ab8ad9c 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -152,6 +152,7 @@ */ #define trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) #define round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) + #define atop(x) ((unsigned)(x) >> PG_SHIFT) #define ptoa(x) ((unsigned)(x) << PG_SHIFT) diff --git a/sys/i386/include/pcb.h b/sys/i386/include/pcb.h index a7a29df..990e5f9 100644 --- a/sys/i386/include/pcb.h +++ b/sys/i386/include/pcb.h @@ -79,6 +79,13 @@ struct pcb { int pcb_cmap2; /* XXX temporary PTE - will prefault instead */ }; +/* + * The pcb is augmented with machine-dependent additional data for + * core dumps. For the i386: ??? + */ +struct md_coredump { +}; + #ifdef KERNEL extern struct pcb *curpcb; /* our current running pcb */ #endif diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h index 74f002d..7ddcebd 100644 --- a/sys/i386/include/pmap.h +++ b/sys/i386/include/pmap.h @@ -48,75 +48,8 @@ #ifndef _PMAP_MACHINE_ #define _PMAP_MACHINE_ 1 -#include "vm/vm_prot.h" -/* - * 386 page table entry and page table directory - * W.Jolitz, 8/89 - */ -struct pde -{ -unsigned int - pd_v:1, /* valid bit */ - pd_prot:2, /* access control */ - pd_mbz1:2, /* reserved, must be zero */ - pd_u:1, /* hardware maintained 'used' bit */ - :1, /* not used */ - pd_mbz2:2, /* reserved, must be zero */ - :3, /* reserved for software */ - pd_pfnum:20; /* physical page frame number of pte's*/ -}; - -#define PD_MASK 0xffc00000UL /* page directory address bits */ -#define PT_MASK 0x003ff000UL /* page table address bits */ -#define PD_SHIFT 22 /* page directory address shift */ -#define PG_SHIFT 12 /* page table address shift */ - -struct pte -{ -unsigned int - pg_v:1, /* valid bit */ - pg_prot:2, /* access control */ - pg_mbz1:2, /* reserved, must be zero */ - pg_u:1, /* hardware maintained 'used' bit */ - pg_m:1, /* hardware maintained modified bit */ - pg_mbz2:2, /* reserved, must be zero */ - pg_w:1, /* software, wired down page */ - :1, /* software (unused) */ - pg_nc:1, /* 'uncacheable page' bit */ - pg_pfnum:20; /* physical page frame number */ -}; - -#define PG_V 0x00000001 -#define PG_RO 0x00000000 -#define PG_RW 0x00000002 -#define PG_u 0x00000004 -#define PG_PROT 0x00000006 /* all protection bits . */ -#define PG_W 0x00000200 -#define PG_N 0x00000800 /* Non-cacheable */ -#define PG_M 0x00000040 -#define PG_U 0x00000020 -#define PG_FRAME 0xfffff000UL - -#define PG_NOACC 0 -#define PG_KR 0x00000000 -#define PG_KW 0x00000002 -#define PG_URKR 0x00000004 -#define PG_URKW 0x00000004 -#define PG_UW 0x00000006 - -/* Garbage for current bastardized pager that assumes a hp300 */ -#define PG_NV 0 -#define PG_CI 0 - -/* - * Page Protection Exception bits - */ -#define PGEX_P 0x01 /* Protection violation vs. not present */ -#define PGEX_W 0x02 /* during a Write cycle */ -#define PGEX_U 0x04 /* access from User mode (UPL) */ +#include <machine/pte.h> -/* typedef struct pde pd_entry_t; */ /* page directory entry */ -/* typedef struct pte pt_entry_t; */ /* Mach page table entry */ typedef unsigned int *pd_entry_t; typedef unsigned int *pt_entry_t; @@ -129,7 +62,7 @@ typedef unsigned int *pt_entry_t; * given to the user (NUPDE) */ #ifndef NKPT -#define NKPT 15 /* actual number of kernel pte's */ +#define NKPT 24 /* actual number of kernel pte's */ #endif #ifndef NKPDE #define NKPDE 63 /* addressable number of kpte's */ @@ -159,7 +92,6 @@ typedef unsigned int *pt_entry_t; #ifdef KERNEL extern pt_entry_t PTmap[], APTmap[], Upte; extern pd_entry_t PTD[], APTD[], PTDpde, APTDpde, Upde; -extern pt_entry_t *Sysmap; extern int IdlePTD; /* physical address of "Idle" state directory */ #endif diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 1b9e4a2..92de3af 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -42,9 +42,7 @@ */ struct mdproc { int md_flags; /* machine-dependent flags */ -#ifdef notyet - int *p_regs; /* registers on current frame */ -#endif + int *md_regs; /* registers on current frame */ }; /* md_flags */ diff --git a/sys/i386/include/pte.h b/sys/i386/include/pte.h index 227a8ae..feb74a4 100644 --- a/sys/i386/include/pte.h +++ b/sys/i386/include/pte.h @@ -82,14 +82,19 @@ unsigned int #define PD_MASK 0xffc00000 /* page directory address bits */ #define PD_SHIFT 22 /* page directory address bits */ +#define PT_MASK 0x003ff000UL /* page table address bits */ +#define PG_SHIFT 12 /* page table address shift */ #define PG_V 0x00000001 +#define PG_RW 0x00000002 +#define PG_u 0x00000004 #define PG_PROT 0x00000006 /* all protection bits . */ #define PG_NC_PWT 0x00000008 /* page cache write through */ #define PG_NC_PCD 0x00000010 /* page cache disable */ #define PG_N 0x00000018 /* Non-cacheable */ #define PG_U 0x00000020 /* page was accessed */ #define PG_M 0x00000040 /* page was modified */ +#define PG_W 0x00000200 #define PG_FRAME 0xfffff000 #define PG_NOACC 0 diff --git a/sys/i386/include/reg.h b/sys/i386/include/reg.h index d20f8d0..2a1f061 100644 --- a/sys/i386/include/reg.h +++ b/sys/i386/include/reg.h @@ -74,23 +74,33 @@ * use whichver order, defined above, is correct, so that it * is all invisible to the user. */ -struct regs { +struct reg { unsigned int r_es; unsigned int r_ds; unsigned int r_edi; unsigned int r_esi; unsigned int r_ebp; + unsigned int r_isp; unsigned int r_ebx; unsigned int r_edx; unsigned int r_ecx; unsigned int r_eax; + unsigned int r_trapno; + unsigned int r_err; unsigned int r_eip; unsigned int r_cs; unsigned int r_eflags; unsigned int r_esp; unsigned int r_ss; - unsigned int r_fs; - unsigned int r_gs; +}; + +/* + * Register set accessible via /proc/$pid/fpreg + */ +struct fpreg { +#if 0 + int fpr_xxx; /* not implemented */ +#endif }; #endif /* _MACHINE_REG_H_ */ diff --git a/sys/i386/include/signal.h b/sys/i386/include/signal.h index 98793f2..16cbef2 100644 --- a/sys/i386/include/signal.h +++ b/sys/i386/include/signal.h @@ -51,11 +51,25 @@ typedef int sig_atomic_t; * a non-standard exit is performed. */ struct sigcontext { - int sc_onstack; /* sigstack state to restore */ - int sc_mask; /* signal mask to restore */ - int sc_sp; /* sp to restore */ - int sc_fp; /* fp to restore */ - int sc_ap; /* ap to restore */ - int sc_pc; /* pc to restore */ - int sc_ps; /* psl to restore */ + int sc_onstack; /* sigstack state to restore */ + int sc_mask; /* signal mask to restore */ + int sc_esp; /* machine state */ + int sc_ebp; + int sc_isp; + int sc_eip; + int sc_efl; + int sc_es; + int sc_ds; + int sc_cs; + int sc_ss; + int sc_edi; + int sc_esi; + int sc_ebx; + int sc_edx; + int sc_ecx; + int sc_eax; +# define sc_sp sc_esp +# define sc_fp sc_ebp +# define sc_pc sc_eip +# define sc_ps sc_efl }; diff --git a/sys/i386/include/spl.h b/sys/i386/include/spl.h index 0be9364..c916df3 100644 --- a/sys/i386/include/spl.h +++ b/sys/i386/include/spl.h @@ -1,7 +1,7 @@ #ifndef _MACHINE_IPL_H_ #define _MACHINE_IPL_H_ -#include "machine/../isa/ipl.h" /* XXX "machine" means cpu for i386 */ +#include <machine/ipl.h> /* XXX "machine" means cpu for i386 */ /* * Software interrupt bit numbers in priority order. The priority only @@ -75,12 +75,15 @@ static __inline int name(void) \ GENSPL(splbio, cpl |= bio_imask) GENSPL(splclock, cpl = HWI_MASK | SWI_MASK) GENSPL(splhigh, cpl = HWI_MASK | SWI_MASK) +GENSPL(splstatclock, cpl = HWI_MASK | SWI_MASK) GENSPL(splimp, cpl |= net_imask) GENSPL(splnet, cpl |= SWI_NET_MASK) GENSPL(splsoftclock, cpl = SWI_CLOCK_MASK) GENSPL(splsofttty, cpl |= SWI_TTY_MASK) GENSPL(spltty, cpl |= tty_imask) +#define splnone() spl0() + static __inline void spl0(void) { diff --git a/sys/i386/include/stdarg.h b/sys/i386/include/stdarg.h index 91dab8b..1110b66 100644 --- a/sys/i386/include/stdarg.h +++ b/sys/i386/include/stdarg.h @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. + * 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 @@ -30,15 +30,20 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)stdarg.h 7.2 (Berkeley) 5/4/91 - * $Id: stdarg.h,v 1.2 1993/10/16 14:39:34 rgrimes Exp $ + * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 */ -#ifndef _MACHINE_STDARG_H_ -#define _MACHINE_STDARG_H_ 1 +#ifndef _STDARG_H_ +#define _STDARG_H_ typedef char *va_list; +#define __va_promote(type) \ + (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) + +#define va_start(ap, last) \ + (ap = ((char *)&(last) + __va_promote(last))) + #ifdef KERNEL #define va_arg(ap, type) \ ((type *)(ap += sizeof(type)))[-1] @@ -50,9 +55,4 @@ typedef char *va_list; #define va_end(ap) -#define __va_promote(type) \ - (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) - -#define va_start(ap, last) \ - (ap = ((char *)&(last) + __va_promote(last))) -#endif /* _MACHINE_STDARG_H_ */ +#endif /* !_STDARG_H_ */ diff --git a/sys/i386/include/types.h b/sys/i386/include/types.h index 118290c..dcbb29c 100644 --- a/sys/i386/include/types.h +++ b/sys/i386/include/types.h @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. + * 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 @@ -30,13 +30,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)types.h 7.5 (Berkeley) 3/9/91 - * $Id$ + * @(#)types.h 8.3 (Berkeley) 1/5/94 */ #ifndef _MACHTYPES_H_ #define _MACHTYPES_H_ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) typedef struct _physadr { int r[1]; } *physadr; @@ -44,8 +44,22 @@ typedef struct _physadr { typedef struct label_t { int val[6]; } label_t; +#endif -typedef u_long vm_offset_t; -typedef u_long vm_size_t; +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. + */ +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 long int64_t; +typedef unsigned long long u_int64_t; #endif /* _MACHTYPES_H_ */ diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index df90126..05218ad 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -174,20 +174,6 @@ #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ /* - * Paging thresholds (see vm_sched.c). - * Strategy of 1/19/85: - * lotsfree is 512k bytes, but at most 1/4 of memory - * desfree is 200k bytes, but at most 1/8 of memory - * minfree is 64k bytes, but at most 1/2 of desfree - */ -#define LOTSFREE (512 * 1024) -#define LOTSFREEFRACT 4 -#define DESFREE (200 * 1024) -#define DESFREEFRACT 8 -#define MINFREE (64 * 1024) -#define MINFREEFRACT 2 - -/* * There are two clock hands, initially separated by HANDSPREAD bytes * (but at most all of user memory). The amount of time to reclaim * a page once the pageout process examines it increases with this |