diff options
Diffstat (limited to 'sys/i386/include')
32 files changed, 731 insertions, 231 deletions
diff --git a/sys/i386/include/asmacros.h b/sys/i386/include/asmacros.h new file mode 100644 index 000000000000..f0f2c014178c --- /dev/null +++ b/sys/i386/include/asmacros.h @@ -0,0 +1,43 @@ +#define ALIGN_DATA .align 2 /* 4 byte alignment, zero filled */ +#define ALIGN_TEXT .align 2,0x90 /* 4-byte alignment, nop filled */ +#define SUPERALIGN_TEXT .align 4,0x90 /* 16-byte alignment (better for 486), nop filled */ + +#define GEN_ENTRY(name) ALIGN_TEXT; .globl name; name: +#define NON_GPROF_ENTRY(name) GEN_ENTRY(_/**/name) + +#ifdef GPROF +/* + * ALTENTRY() must be before a corresponding ENTRY() so that it can jump + * over the mcounting. + */ +#define ALTENTRY(name) GEN_ENTRY(_/**/name); MCOUNT; jmp 2f +#define ENTRY(name) GEN_ENTRY(_/**/name); MCOUNT; 2: +/* + * The call to mcount supports the usual (bad) conventions. We allocate + * some data and pass a pointer to it although the FreeBSD doesn't use + * the data. We set up a frame before calling mcount because that is + * the standard convention although it makes work for both mcount and + * callers. + */ +#define MCOUNT .data; ALIGN_DATA; 1:; .long 0; .text; \ + pushl %ebp; movl %esp,%ebp; \ + movl $1b,%eax; call mcount; popl %ebp +#else +/* + * ALTENTRY() has to align because it is before a corresponding ENTRY(). + * ENTRY() has to align to because there may be no ALTENTRY() before it. + * If there is a previous ALTENTRY() then the alignment code is empty. + */ +#define ALTENTRY(name) GEN_ENTRY(_/**/name) +#define ENTRY(name) GEN_ENTRY(_/**/name) + +#endif + +#ifdef DUMMY_NOPS /* this will break some older machines */ +#define FASTER_NOP +#define NOP +#else +#define FASTER_NOP pushl %eax ; inb $0x84,%al ; popl %eax +#define NOP pushl %eax ; inb $0x84,%al ; inb $0x84,%al ; popl %eax +#endif + diff --git a/sys/i386/include/cons.h b/sys/i386/include/cons.h new file mode 100644 index 000000000000..f66277e1f04d --- /dev/null +++ b/sys/i386/include/cons.h @@ -0,0 +1,6 @@ +/* + * Console support headers should be in <machine/cons.h> since MI software + * needs to access these functions. In the mean time, just include the + * header where it sits. + */ +#include <i386/i386/cons.h> diff --git a/sys/i386/include/console.h b/sys/i386/include/console.h index 47734ba8c2f6..011889032ecc 100644 --- a/sys/i386/include/console.h +++ b/sys/i386/include/console.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1992, 1993 Søren Schmidt + * Copyright (C) 1992, 1993, 1994 Søren Schmidt * * This program is free software; you may redistribute it and/or * modify it, provided that it retain the above copyright notice @@ -9,11 +9,12 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * Søren Schmidt Email: sos@kmd-ac.dk - * Tritonvej 36 UUCP: ...uunet!dkuug!kmd-ac!sos + * Søren Schmidt Email: sos@login.dkuug.dk + * Tritonvej 36 UUCP: ...uunet!dkuug!login!sos * DK9210 Aalborg SO Phone: +45 9814 8076 * - * $Id: console.h,v 1.3 1993/10/16 14:39:07 rgrimes Exp $ + * from:@(#)console.h 1.1 940105 + * $Id: console.h,v 1.7 1994/02/04 10:35:29 chmr Exp $ */ #ifndef _CONSOLE_H_ @@ -32,7 +33,7 @@ #define KDSKBSTATE _IO('K', 20) #define KDENABIO _IO('K', 60) #define KDDISABIO _IO('K', 61) -#define KIOCSOUND _IO('k', 63) +#define KIOCSOUND _IO('K', 63) #define KDGKBTYPE _IOR('K', 64, int) #define KDGETLED _IOR('K', 65, int) #define KDSETLED _IO('K', 66) @@ -46,6 +47,8 @@ #define PIO_KEYMAP _IOW('k', 7, keymap_t) #define CONS_BLANKTIME _IOW('c', 4, long) +#define CONS_SSAVER _IOW('c', 5, ssaver_t) +#define CONS_GSAVER _IOWR('c', 6, ssaver_t) #define PIO_FONT8x8 _IOW('c', 64, fnt8_t) #define GIO_FONT8x8 _IOR('c', 65, fnt8_t) #define PIO_FONT8x14 _IOW('c', 66, fnt14_t) @@ -85,7 +88,6 @@ struct vt_mode { short frsig; /* not implemented yet SOS */ }; -typedef struct vt_mode vtmode_t; #define KD_MONO 1 /* monochrome adapter */ #define KD_HERCULES 2 /* hercules adapter */ @@ -101,26 +103,26 @@ typedef struct vt_mode vtmode_t; #define K_RAW 0 /* keyboard returns scancodes */ #define K_XLATE 1 /* keyboard returns ascii */ -#define KB_84 1 -#define KB_101 2 -#define KB_OTHER 3 +#define KB_84 1 /* 'old' 84 key AT-keyboard */ +#define KB_101 2 /* MF-101 or MF-102 keyboard */ +#define KB_OTHER 3 /* keyboard not known */ -#define CLKED 1 -#define NLKED 2 -#define SLKED 4 -#define ALKED 8 -#define LED_CAP 1 -#define LED_NUM 2 -#define LED_SCR 4 +#define CLKED 1 /* Caps locked */ +#define NLKED 2 /* Num locked */ +#define SLKED 4 /* Scroll locked */ +#define ALKED 8 /* AltGr locked */ +#define LED_CAP 1 /* Caps lock LED */ +#define LED_NUM 2 /* Num lock LED */ +#define LED_SCR 4 /* Scroll lock LED */ /* possible flag values */ #define FLAG_LOCK_O 0 #define FLAG_LOCK_C 1 #define FLAG_LOCK_N 2 -#define NUM_KEYS 256 -#define NUM_STATES 8 -#define ALTGR_OFFSET 128 +#define NUM_KEYS 256 /* number of keys in table */ +#define NUM_STATES 8 /* states per key */ +#define ALTGR_OFFSET 128 /* offset for altlock keys */ struct keymap { u_short n_keys; @@ -161,35 +163,52 @@ struct vid_info { u_char mk_keylock; }; +#define MAXSSAVER 16 + +struct ssaver { + char name[MAXSSAVER]; + int num; + long time; +}; + typedef struct keymap keymap_t; typedef struct fkeytab fkeytab_t; typedef struct fkeyarg fkeyarg_t; typedef struct vid_info vid_info_t; +typedef struct vt_mode vtmode_t; typedef struct {char scrmap[256];} scrmap_t; typedef struct {char fnt8x8[8*256];} fnt8_t; typedef struct {char fnt8x14[14*256];} fnt14_t; typedef struct {char fnt8x16[16*256];} fnt16_t; +typedef struct ssaver ssaver_t; + +/* defines for "special" keys (spcl bit set in keymap) */ +#define NOP 0x00 /* nothing (dead key) */ +#define LSH 0x02 /* left shift key */ +#define RSH 0x03 /* right shift key */ +#define CLK 0x04 /* caps lock key */ +#define NLK 0x05 /* num lock key */ +#define SLK 0x06 /* scroll lock key */ +#define LALT 0x07 /* left alt key */ +#define LCTR 0x09 /* left control key */ +#define NEXT 0x0a /* switch to next screen */ +#define F_SCR 0x0b /* switch to first screen */ +#define L_SCR 0x1a /* switch to last screen */ +#define F_FN 0x1b /* first function key */ +#define L_FN 0x7a /* last function key */ +#define RCTR 0x7b /* right control key */ +#define RALT 0x7c /* right alt (altgr) key */ +#define ALK 0x7d /* alt lock key */ +#define ASH 0x7e /* alt shift key */ +#define META 0x7f /* meta key */ +#define RBT 0x80 /* boot machine */ +#define DBG 0x81 /* call debugger */ #define F(x) ((x)+F_FN-1) #define S(x) ((x)+F_SCR-1) -#define NOP 0x00 -#define LSH 0x02 -#define RSH 0x03 -#define CLK 0x04 -#define NLK 0x05 -#define SLK 0x06 -#define LALT 0x07 -#define LCTR 0x09 -#define RCTR 0x7b -#define RALT 0x7c -#define ALK 0x7d -#define ASH 0x7e - -#define F_SCR 11 /* switch to first screen */ -#define L_SCR 26 /* switch to last screen */ -#define F_FN 27 /* first function key */ -#define L_FN 122 /* last function key */ +#define NOKEY 0x100 /* no key pressed marker */ #define FKEY 0x200 /* funtion key marker */ +#define MKEY 0x400 /* meta key marker (prepend ESC)*/ #define KB_DATA 0x60 /* kbd data port */ #define KB_STAT 0x64 /* kbd status port */ diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index 80a2799bf09a..184f5b86151d 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 - * $Id: cpu.h,v 1.3 1993/10/08 20:50:57 rgrimes Exp $ + * $Id: cpu.h,v 1.4 1993/11/07 17:42:46 wollman Exp $ */ +#ifndef _MACHINE_CPU_H_ +#define _MACHINE_CPU_H_ 1 + /* * Definitions unique to i386 cpu support. */ @@ -83,9 +86,6 @@ typedef struct intrframe clockframe; #define aston() (astpending++) -int astpending; /* need to trap before returning to user mode */ -int want_resched; /* resched() was called */ - /* * pull in #defines for kinds of processors */ @@ -97,7 +97,11 @@ struct cpu_nameclass { }; #ifdef KERNEL +extern int astpending; /* want a trap before returning to user mode */ +extern int want_resched; /* resched was called */ + extern int cpu; extern int cpu_class; extern struct cpu_nameclass i386_cpus[]; #endif +#endif /* _MACHINE_CPU_H_ */ diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 56fcd53222a9..65cc855793f0 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -2,15 +2,18 @@ * Functions to provide access to special i386 instructions. * XXX - bezillions more are defined in locore.s but are not declared anywhere. * - * $Id: cpufunc.h,v 1.3 1993/10/16 14:39:08 rgrimes Exp $ + * $Id: cpufunc.h,v 1.9 1994/01/31 23:48:23 davidg Exp $ */ +#ifndef _MACHINE_CPUFUNC_H_ +#define _MACHINE_CPUFUNC_H_ 1 + #include <sys/cdefs.h> #include <sys/types.h> #ifdef __GNUC__ -static __inline int bdb(void) +static inline int bdb(void) { extern int bdb_exists; @@ -20,13 +23,13 @@ static __inline int bdb(void) return (1); } -static __inline void +static inline void disable_intr(void) { __asm __volatile("cli"); } -static __inline void +static inline void enable_intr(void) { __asm __volatile("sti"); @@ -38,7 +41,7 @@ enable_intr(void) */ #define inb(port) ((u_char) u_int_inb(port)) -static __inline u_int +static inline u_int u_int_inb(u_int port) { u_char data; @@ -51,7 +54,7 @@ u_int_inb(u_int port) return data; } -static __inline void +static inline void outb(u_int port, u_char data) { register u_char al asm("ax"); @@ -60,7 +63,14 @@ outb(u_int port, u_char data) __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); } -static __inline__ +static inline void +tlbflush() +{ + __asm __volatile("movl %%cr3, %%eax; movl %%eax, %%cr3" : : : "ax"); +} + +static inline +int imin(a, b) int a, b; { @@ -68,7 +78,8 @@ imin(a, b) return (a < b ? a : b); } -static __inline__ +static inline +int imax(a, b) int a, b; { @@ -76,7 +87,7 @@ imax(a, b) return (a > b ? a : b); } -static __inline__ +static inline unsigned int min(a, b) unsigned int a, b; @@ -85,7 +96,7 @@ min(a, b) return (a < b ? a : b); } -static __inline__ +static inline unsigned int max(a, b) unsigned int a, b; @@ -94,7 +105,7 @@ max(a, b) return (a > b ? a : b); } -static __inline__ +static inline long lmin(a, b) long a, b; @@ -103,7 +114,7 @@ lmin(a, b) return (a < b ? a : b); } -static __inline__ +static inline long lmax(a, b) long a, b; @@ -112,7 +123,7 @@ lmax(a, b) return (a > b ? a : b); } -static __inline__ +static inline unsigned long ulmin(a, b) unsigned long a, b; @@ -121,7 +132,7 @@ ulmin(a, b) return (a < b ? a : b); } -static __inline__ +static inline unsigned long ulmax(a, b) unsigned long a, b; @@ -130,7 +141,8 @@ ulmax(a, b) return (a > b ? a : b); } -static __inline__ +static inline +int ffs(mask) register long mask; { @@ -145,7 +157,8 @@ ffs(mask) } } -static __inline__ +static inline +int bcmp(v1, v2, len) void *v1, *v2; register unsigned len; @@ -158,10 +171,10 @@ bcmp(v1, v2, len) return (0); } -static __inline__ +static inline size_t strlen(s1) - register __const__ char *s1; + register const char *s1; { register size_t len; @@ -170,7 +183,34 @@ strlen(s1) 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 *)); int bdb __P((void)); void disable_intr __P((void)); @@ -180,16 +220,19 @@ void outb __P((u_int port, u_int data)); /* XXX - incompat */ #endif /* __GNUC__ */ -#define really_u_int int /* XXX */ -#define really_void int /* XXX */ - void load_cr0 __P((u_int cr0)); -really_u_int rcr0 __P((void)); - -#ifdef notyet -really_void setidt __P((int idx, /*XXX*/caddr_t func, int typ, int dpl)); -#endif - -#undef really_u_int -#undef really_void - +u_int rcr0 __P((void)); +void load_cr3(u_long); +u_long rcr3(void); +u_long rcr2(void); + +void setidt __P((int, void (*)(), int, int)); +extern u_long kvtop(void *); +extern void outw(int /*u_short*/, int /*u_short*/); /* XXX inline!*/ +extern void outsb(int /*u_short*/, void *, size_t); +extern void outsw(int /*u_short*/, void *, size_t); +extern void insw(int /*u_short*/, void *, size_t); +extern void fillw(int /*u_short*/, void *, size_t); +extern void filli(int, void *, size_t); + +#endif /* _MACHINE_CPUFUNC_H_ */ diff --git a/sys/i386/include/cputypes.h b/sys/i386/include/cputypes.h index 2489a56601a8..32d9f8147da1 100644 --- a/sys/i386/include/cputypes.h +++ b/sys/i386/include/cputypes.h @@ -24,9 +24,12 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cputypes.h,v 1.1 1993/10/08 13:40:54 rgrimes Exp $ + * $Id: cputypes.h,v 1.2 1993/11/07 17:42:49 wollman Exp $ */ +#ifndef _MACHINE_CPUTYPES_H_ +#define _MACHINE_CPUTYPES_H_ 1 + /* * Classes of Processor */ @@ -47,3 +50,4 @@ #define CPU_486 4 /* Intel 80486DX */ #define CPU_586 5 /* Intel P.....m (I hate lawyers; it's TM) */ +#endif /* _MACHINE_CPUTYPES_H_ */ diff --git a/sys/i386/include/db_machdep.h b/sys/i386/include/db_machdep.h index f9297ac4020c..939293553929 100644 --- a/sys/i386/include/db_machdep.h +++ b/sys/i386/include/db_machdep.h @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. * - * $Id: db_machdep.h,v 1.2 1993/10/16 14:39:10 rgrimes Exp $ + * $Id: db_machdep.h,v 1.3 1993/11/07 17:42:50 wollman Exp $ */ #ifndef _I386_DB_MACHDEP_H_ @@ -54,7 +54,7 @@ typedef vm_offset_t db_addr_t; /* address - unsigned */ typedef int db_expr_t; /* expression - signed */ typedef struct i386_saved_state db_regs_t; -db_regs_t ddb_regs; /* register state */ +extern db_regs_t ddb_regs; /* register state */ #define DDB_REGS (&ddb_regs) #define PC_REGS(regs) ((db_addr_t)(regs)->tf_eip) diff --git a/sys/i386/include/dkio.h b/sys/i386/include/dkio.h index 160ce5ff8932..7c808e91101a 100644 --- a/sys/i386/include/dkio.h +++ b/sys/i386/include/dkio.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)dkio.h 5.2 (Berkeley) 1/18/91 - * $Id: dkio.h,v 1.2 1993/10/16 14:39:12 rgrimes Exp $ + * $Id: dkio.h,v 1.3 1993/11/07 17:42:51 wollman Exp $ */ +#ifndef _MACHINE_DKIO_H_ +#define _MACHINE_DKIO_H_ 1 + /* * Structures and definitions for disk io control commands * @@ -47,3 +50,4 @@ /* disk io control commands */ #define DKIOCHDR _IO(d, 1) /* next I/O will read/write header */ +#endif /* _MACHINE_DKIO_H_ */ diff --git a/sys/i386/include/endian.h b/sys/i386/include/endian.h index b47f6393b84d..d4581e80ddb3 100644 --- a/sys/i386/include/endian.h +++ b/sys/i386/include/endian.h @@ -31,9 +31,18 @@ * SUCH DAMAGE. * * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 - * $Id: endian.h,v 1.2 1993/10/16 14:39:15 rgrimes Exp $ + * $Id: endian.h,v 1.4 1993/12/19 05:14:45 alm Exp $ */ +#ifndef _MACHINE_ENDIAN_H_ +#define _MACHINE_ENDIAN_H_ 1 + +/* + * Define the order of 32-bit words in 64-bit words. + */ +#define _QUAD_HIGHWORD 1 +#define _QUAD_LOWWORD 0 + /* * Definitions for byte order, according to byte significance from low * address to high. @@ -108,3 +117,4 @@ #define HTONL(x) (x) = htonl((u_long)x) #define HTONS(x) (x) = htons((u_short)x) #endif +#endif /* _MACHINE_ENDIAN_H_ */ diff --git a/sys/i386/include/float.h b/sys/i386/include/float.h index 4593c9f3c179..3024ca2b3dd3 100644 --- a/sys/i386/include/float.h +++ b/sys/i386/include/float.h @@ -31,9 +31,12 @@ * SUCH DAMAGE. * * from: @(#)float.h 7.1 (Berkeley) 5/8/90 - * $Id: float.h,v 1.4 1993/10/16 14:39:16 rgrimes Exp $ + * $Id: float.h,v 1.5 1993/11/07 17:42:53 wollman Exp $ */ +#ifndef _MACHINE_FLOAT_H_ +#define _MACHINE_FLOAT_H_ 1 + #define FLT_RADIX 2 /* b */ #define FLT_ROUNDS 1 /* FP addition rounds to nearest */ @@ -66,3 +69,4 @@ #define LDBL_MAX_EXP DBL_MAX_EXP #define LDBL_MAX DBL_MAX #define LDBL_MAX_10_EXP DBL_MAX_10_EXP +#endif /* _MACHINE_FLOAT_H_ */ diff --git a/sys/i386/include/floatingpoint.h b/sys/i386/include/floatingpoint.h index c1248ddfd041..9055b28413ac 100644 --- a/sys/i386/include/floatingpoint.h +++ b/sys/i386/include/floatingpoint.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#) floatingpoint.h 1.0 (Berkeley) 9/23/93 - * $Id: floatingpoint.h,v 1.3 1993/10/16 14:39:18 rgrimes Exp $ + * $Id: floatingpoint.h,v 1.4 1993/11/07 17:42:55 wollman Exp $ */ /* @@ -46,12 +46,13 @@ #ifdef __GNUC__ +#ifdef __i386__ + #define fnstcw(addr) __asm("fnstcw %0" : "=m" (*addr) : "0" (*addr)) #define fnstsw(addr) __asm("fnstsw %0" : "=m" (*addr) : "0" (*addr)) #define fnstenv(addr) __asm("fnstenv %0" : "=m" (*addr) : "0" (*addr)) #define fldenv(addr) __asm("fldenv %0" : : "m" (*addr)) -#ifdef __i386__ /* * return the contents of a FP register diff --git a/sys/i386/include/frame.h b/sys/i386/include/frame.h index 4a844dce209b..4b031dcf708e 100644 --- a/sys/i386/include/frame.h +++ b/sys/i386/include/frame.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)frame.h 5.2 (Berkeley) 1/18/91 - * $Id: frame.h,v 1.2 1993/10/08 20:50:59 rgrimes Exp $ + * $Id: frame.h,v 1.8 1994/01/31 10:27:09 davidg Exp $ */ +#ifndef _MACHINE_FRAME_H_ +#define _MACHINE_FRAME_H_ 1 + #include <sys/signal.h> /* @@ -69,6 +72,8 @@ struct trapframe { int tf_ss; }; +extern int kdb_trap(int, int, struct trapframe *); + /* Interrupt stack frame */ struct intrframe { @@ -102,32 +107,8 @@ struct sigframe { int sf_signum; int sf_code; struct sigcontext *sf_scp; + char *sf_addr; sig_t sf_handler; - int sf_eax; - int sf_edx; - int sf_ecx; struct sigcontext sf_sc; -} ; - -/* - * Call Gate/System Call Stack Frame - */ - -struct syscframe { - int sf_edi; - int sf_esi; - int sf_ebp; - int :32; /* redundant save of isp */ - int sf_ebx; - int sf_edx; - int sf_ecx; - int sf_eax; - int sf_eflags; - /* below portion defined in 386 hardware */ -/* int sf_args[N]; /* if call gate copy args enabled!*/ - int sf_eip; - int sf_cs; - /* below only when transitting rings (e.g. user to kernel) */ - int sf_esp; - int sf_ss; }; +#endif /* _MACHINE_FRAME_H_ */ diff --git a/sys/i386/include/ioctl_fd.h b/sys/i386/include/ioctl_fd.h new file mode 100644 index 000000000000..2e3ac3104726 --- /dev/null +++ b/sys/i386/include/ioctl_fd.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 1992-1993 by Joerg Wunsch, Dresden + * 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. + * + * 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 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 _IOCTL_FD_H +#define _IOCTL_FD_H + +#include <sys/types.h> +#include <sys/ioctl.h> + +#define FD_FORMAT_VERSION 110 /* used to validate before formatting */ +#define FD_MAX_NSEC 36 /* highest known number of spt - allow for */ + /* 2.88 MB drives */ + +struct fd_formb { + int format_version; /* == FD_FORMAT_VERSION */ + int cyl, head; + int transfer_rate; /* fdreg.h: FDC_???KBPS */ + + union { + struct fd_form_data { + /* + * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS + * it is hardware-dependant since it exactly + * matches the byte sequence to write to FDC + * during its `format track' operation + */ + u_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */ + u_char nsecs; /* must be <= FD_MAX_NSEC */ + u_char gaplen; /* GAP 3 length; usually 84 */ + u_char fillbyte; /* usually 0xf6 */ + struct fd_idfield_data { + /* + * data to write into id fields; + * for obscure formats, they mustn't match + * the real values (but mostly do) + */ + u_char cylno; /* 0 thru 79 (or 39) */ + u_char headno; /* 0, or 1 */ + u_char secno; /* starting at 1! */ + u_char secsize; /* usually 2 */ + } idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */ + } structured; + u_char raw[1]; /* to have continuous indexed access */ + } format_info; +}; + +/* make life easier */ +# define fd_formb_secshift format_info.structured.secshift +# define fd_formb_nsecs format_info.structured.nsecs +# define fd_formb_gaplen format_info.structured.gaplen +# define fd_formb_fillbyte format_info.structured.fillbyte +/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */ +# define fd_formb_cylno(i) format_info.structured.idfields[i].cylno +# define fd_formb_headno(i) format_info.structured.idfields[i].headno +# define fd_formb_secno(i) format_info.structured.idfields[i].secno +# define fd_formb_secsize(i) format_info.structured.idfields[i].secsize + +struct fd_type { + int sectrac; /* sectors per track */ + int secsize; /* size code for sectors */ + int datalen; /* data len when secsize = 0 */ + int gap; /* gap len between sectors */ + int tracks; /* total num of tracks */ + int size; /* size of disk in sectors */ + int steptrac; /* steps per cylinder */ + int trans; /* transfer speed code */ + int heads; /* number of heads */ + int f_gap; /* format gap len */ + int f_inter; /* format interleave factor */ +}; + +#define FD_FORM _IOW('F', 61, struct fd_formb) /* format a track */ +#define FD_GTYPE _IOR('F', 62, struct fd_type) /* get drive type */ + +#endif /* !def _IOCTL_FD_H */ diff --git a/sys/i386/include/limits.h b/sys/i386/include/limits.h index 763f43039e1a..568ad40848a3 100644 --- a/sys/i386/include/limits.h +++ b/sys/i386/include/limits.h @@ -31,9 +31,12 @@ * SUCH DAMAGE. * * from: @(#)limits.h 7.2 (Berkeley) 6/28/90 - * $Id: limits.h,v 1.2 1993/10/16 14:39:19 rgrimes Exp $ + * $Id: limits.h,v 1.4 1993/12/19 05:14:46 alm Exp $ */ +#ifndef _MACHINE_LIMITS_H_ +#define _MACHINE_LIMITS_H_ 1 + #define CHAR_BIT 8 /* number of bits in a char */ #define CLK_TCK 60 /* ticks per second */ #define MB_LEN_MAX 1 /* no multibyte characters */ @@ -56,3 +59,11 @@ #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 */ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#define UQUAD_MAX 0xffffffffffffffffLL /* max unsigned quad */ +#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ +#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ +#endif + +#endif /* _MACHINE_LIMITS_H_ */ diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 0e279d239248..fe97ad809b25 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $Id: param.h,v 1.7.2.1 1993/11/14 18:12:50 rgrimes Exp $ + * $Id: param.h,v 1.13 1994/01/31 04:18:54 davidg Exp $ */ +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ 1 + /* * Machine dependent constants for Intel 386. */ @@ -54,7 +57,10 @@ /* XXX PGSHIFT and PG_SHIFT are two names for the same thing */ #define PGSHIFT 12 /* LOG2(NBPG) */ -#define NBPG (1 << PGSHIFT) /* bytes/page */ +#define PAGE_SHIFT 12 +#define NBPG (1 << PAGE_SHIFT) /* bytes/page */ +#define PAGE_SIZE (1 << PAGE_SHIFT) +#define PAGE_MASK (PAGE_SIZE-1) #define PGOFSET (NBPG-1) /* byte offset into page */ #define NPTEPG (NBPG/(sizeof (struct pte))) @@ -68,8 +74,7 @@ * defined in pmap.h which is included after this we can't do that * (YET!) */ -#define KERNBASE 0xFE000000 /* start of kernel virtual */ -#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) +#define BTOPKERNBASE (KERNBASE >> PGSHIFT) #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #define DEV_BSIZE (1 << DEV_BSHIFT) @@ -145,6 +150,11 @@ /* * Mach derived conversion macros */ +#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) + #define i386_round_pdr(x) ((((unsigned)(x)) + NBPDR - 1) & ~(NBPDR-1)) #define i386_trunc_pdr(x) ((unsigned)(x) & ~(NBPDR-1)) #define i386_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) @@ -154,7 +164,4 @@ #define i386_btop(x) ((unsigned)(x) >> PGSHIFT) #define i386_ptob(x) ((unsigned)(x) << PGSHIFT) -/* - * phystokv stolen from SCSI device drivers and fixed to use KERNBASE - */ -#define PHYSTOKV(x) (x | KERNBASE) +#endif /* _MACHINE_PARAM_H_ */ diff --git a/sys/i386/include/pcb.h b/sys/i386/include/pcb.h index 96f7983cb652..cd772b9124ed 100644 --- a/sys/i386/include/pcb.h +++ b/sys/i386/include/pcb.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 - * $Id: pcb.h,v 1.2 1993/10/08 20:51:00 rgrimes Exp $ + * $Id: pcb.h,v 1.4 1994/01/03 07:55:33 davidg Exp $ */ #ifndef _I386_PCB_H_ @@ -72,7 +72,6 @@ struct pcb { #define FP_NEEDSRESTORE 0x04 /* ... that needs restore on next DNA fault */ #endif #define FP_USESEMC 0x08 /* process uses EMC memory-mapped mode */ -#define FM_TRAP 0x10 /* process entered kernel on a trap frame */ #define FP_SOFTFP 0x20 /* process using software fltng pnt emulator */ short pcb_iml; /* interrupt mask level */ caddr_t pcb_onfault; /* copyin/out fault recovery */ @@ -81,7 +80,7 @@ struct pcb { }; #ifdef KERNEL -struct pcb *curpcb; /* our current running pcb */ +extern struct pcb *curpcb; /* our current running pcb */ #endif #endif /* _I386_PCB_H_ */ diff --git a/sys/i386/include/pio.h b/sys/i386/include/pio.h index 9ed5f37a7043..b8f62b53c795 100644 --- a/sys/i386/include/pio.h +++ b/sys/i386/include/pio.h @@ -5,9 +5,12 @@ * the terms and conditions for use and redistribution. * * from: Mach, unknown, 386BSD patch kit - * $Id: pio.h,v 1.2 1993/10/16 14:39:23 rgrimes Exp $ + * $Id: pio.h,v 1.3 1993/11/07 17:43:01 wollman Exp $ */ +#ifndef _MACHINE_PIO_H_ +#define _MACHINE_PIO_H_ 1 + #define inl(y) \ ({ unsigned long _tmp__; \ asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \ @@ -42,3 +45,4 @@ #define outb(x, y) \ { asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); } +#endif /* _MACHINE_PIO_H_ */ diff --git a/sys/i386/include/pmap.h b/sys/i386/include/pmap.h index 4715cae23c5a..ba27f793735d 100644 --- a/sys/i386/include/pmap.h +++ b/sys/i386/include/pmap.h @@ -42,12 +42,13 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $Id: pmap.h,v 1.4.2.1 1993/11/14 18:12:52 rgrimes Exp $ + * $Id: pmap.h,v 1.10 1994/01/31 04:19:00 davidg Exp $ */ #ifndef _PMAP_MACHINE_ #define _PMAP_MACHINE_ 1 +#include "vm/vm_prot.h" /* * 386 page table entry and page table directory * W.Jolitz, 8/89 @@ -65,8 +66,8 @@ unsigned int pd_pfnum:20; /* physical page frame number of pte's*/ }; -#define PD_MASK 0xffc00000 /* page directory address bits */ -#define PT_MASK 0x003ff000 /* page table address bits */ +#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 */ @@ -94,7 +95,7 @@ unsigned int #define PG_N 0x00000800 /* Non-cacheable */ #define PG_M 0x00000040 #define PG_U 0x00000020 -#define PG_FRAME 0xfffff000 +#define PG_FRAME 0xfffff000UL #define PG_NOACC 0 #define PG_KR 0x00000000 @@ -121,8 +122,19 @@ typedef struct pte pt_entry_t; /* Mach page table entry */ * NKPDE controls the virtual space of the kernel, what ever is left, minus * the alternate page table area is given to the user (NUPDE) */ -#define NKPDE 7 /* number of kernel pde's */ -#define NUPDE (NPTEPG-NKPDE-1)/* number of user pde's */ +/* + * NKPDE controls the virtual space of the kernel, what ever is left is + * given to the user (NUPDE) + */ +#ifndef NKPT +#define NKPT 15 /* actual number of kernel pte's */ +#endif +#ifndef NKPDE +#define NKPDE 63 /* addressable number of kpte's */ +#endif + +#define NUPDE (NPTEPG-NKPDE) /* number of user pde's */ + /* * The *PTDI values control the layout of virtual memory * @@ -199,7 +211,7 @@ extern pmap_t kernel_pmap; #define PMAP_ACTIVATE(pmapp, pcbp) \ if ((pmapp) != NULL /*&& (pmapp)->pm_pdchanged */) { \ (pcbp)->pcb_cr3 = \ - pmap_extract(kernel_pmap, (pmapp)->pm_pdir); \ + pmap_extract(kernel_pmap, (vm_offset_t)(pmapp)->pm_pdir); \ if ((pmapp) == &curproc->p_vmspace->vm_pmap) \ load_cr3((pcbp)->pcb_cr3); \ (pmapp)->pm_pdchanged = FALSE; \ @@ -215,7 +227,6 @@ typedef struct pv_entry { struct pv_entry *pv_next; /* next pv_entry */ pmap_t pv_pmap; /* pmap where mapping lies */ vm_offset_t pv_va; /* virtual address for mapping */ - int pv_flags; /* flags */ } *pv_entry_t; #define PV_ENTRY_NULL ((pv_entry_t) 0) @@ -232,6 +243,24 @@ pv_entry_t pv_table; /* array of entries, one per page */ #define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +extern pmap_t pmap_create(vm_size_t); +extern void pmap_pinit(struct pmap *); +extern void pmap_destroy(pmap_t); +extern void pmap_release(struct pmap *); +extern void pmap_reference(pmap_t); +extern void pmap_remove(struct pmap *, vm_offset_t, vm_offset_t); +extern void pmap_protect(struct pmap *, vm_offset_t, vm_offset_t, vm_prot_t); +extern void pmap_enter(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); +extern void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t); +extern inline struct pte *pmap_pte(pmap_t, vm_offset_t); +extern vm_offset_t pmap_extract(pmap_t, vm_offset_t); +extern void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); +extern void pmap_collect(pmap_t); +struct pcb; extern void pmap_activate(pmap_t, struct pcb *); +extern pmap_t pmap_kernel(void); +extern void pmap_pageable(pmap_t, vm_offset_t, vm_offset_t, boolean_t); + + #endif /* KERNEL */ #endif /* _PMAP_MACHINE_ */ diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index b18d64a27c6c..6deea1e4f489 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -31,9 +31,12 @@ * SUCH DAMAGE. * * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 - * $Id: proc.h,v 1.2 1993/10/16 14:39:24 rgrimes Exp $ + * $Id: proc.h,v 1.3 1993/11/07 17:43:03 wollman Exp $ */ +#ifndef _MACHINE_PROC_H_ +#define _MACHINE_PROC_H_ 1 + /* * Machine-dependent part of the proc structure for hp300. */ @@ -46,3 +49,4 @@ struct mdproc { /* md_flags */ #define MDP_AST 0x0001 /* async trap pending */ +#endif /* _MACHINE_PROC_H_ */ diff --git a/sys/i386/include/psl.h b/sys/i386/include/psl.h index 7f89c2bdf48e..eb15d181b464 100644 --- a/sys/i386/include/psl.h +++ b/sys/i386/include/psl.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)psl.h 5.2 (Berkeley) 1/18/91 - * $Id: psl.h,v 1.2 1993/10/16 14:39:26 rgrimes Exp $ + * $Id: psl.h,v 1.3.2.1 1994/03/07 01:23:56 rgrimes Exp $ */ +#ifndef _MACHINE_PSL_H_ +#define _MACHINE_PSL_H_ 1 + /* * 386 processor status longword. */ @@ -54,8 +57,9 @@ #define PSL_RF 0x00010000 /* restart flag bit */ #define PSL_VM 0x00020000 /* virtual 8086 mode bit */ -#define PSL_MBZ 0xfffc7fb7 /* must be zero bits */ +#define PSL_MBZ 0xffc08028 /* must be zero bits */ #define PSL_MBO 0x00000002 /* must be one bits */ -#define PSL_USERSET (PSL_IOPL) -#define PSL_USERCLR (PSL_I|PSL_NT) +#define PSL_USERSET (PSL_MBO | PSL_I) +#define PSL_USERCLR (PSL_MBZ | PSL_NT) +#endif /* _MACHINE_PSL_H_ */ diff --git a/sys/i386/include/pte.h b/sys/i386/include/pte.h index 37e6e69b1e4b..ac0cb541de95 100644 --- a/sys/i386/include/pte.h +++ b/sys/i386/include/pte.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)pte.h 5.5 (Berkeley) 5/9/91 - * $Id: pte.h,v 1.2 1993/10/16 14:39:27 rgrimes Exp $ + * $Id: pte.h,v 1.4 1994/01/31 06:52:41 davidg Exp $ */ +#ifndef _MACHINE_PTE_H_ +#define _MACHINE_PTE_H_ 1 + /* * 386 page table entry and page table directory * W.Jolitz, 8/89 @@ -49,48 +52,32 @@ */ #ifndef LOCORE -struct pde -{ + +struct pde { unsigned int pd_v:1, /* valid bit */ pd_prot:2, /* access control */ - pd_mbz1:2, /* reserved, must be zero */ + pd_ncpwt:1, /* page cache write through */ + pd_ncpcd:1, /* page cache disable */ pd_u:1, /* hardware maintained 'used' bit */ - :1, /* not used */ + pd_m:1, /* not used */ pd_mbz2:2, /* reserved, must be zero */ :3, /* reserved for software */ pd_pfnum:20; /* physical page frame number of pte's*/ }; -struct pte -{ + +struct pte { unsigned int pg_v:1, /* valid bit */ pg_prot:2, /* access control */ - pg_mbz1:2, /* reserved, must be zero */ + pg_ncpwt:1, /* page cache write through */ + pg_ncpcd:1, /* page cache disable */ pg_u:1, /* hardware maintained 'used' bit */ pg_m:1, /* hardware maintained modified bit */ pg_mbz2:2, /* reserved, must be zero */ - pg_fod:1, /* is fill on demand (=0) */ - :1, /* must write back to swap (unused) */ - pg_nc:1, /* 'uncacheable page' bit */ + :3, /* (unused) */ pg_pfnum:20; /* physical page frame number */ }; -struct hpte -{ -unsigned int - pg_high:12, /* special for clustering */ - pg_pfnum:20; -}; -struct fpte -{ -unsigned int - pg_v:1, /* valid bit */ - pg_prot:2, /* access control */ - :5, - pg_fileno:1, /* file mapped from or TEXT or ZERO */ - pg_fod:1, /* is fill on demand (=1) */ - pg_blkno:22; /* file system block number */ -}; #endif #define PD_MASK 0xffc00000 /* page directory address bits */ @@ -98,17 +85,13 @@ unsigned int #define PG_V 0x00000001 #define PG_PROT 0x00000006 /* all protection bits . */ -#define PG_FOD 0x00000200 -#define PG_SWAPM 0x00000400 -#define PG_N 0x00000800 /* Non-cacheable */ -#define PG_M 0x00000040 -#define PG_U 0x00000020 /* not currently used */ +#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_FRAME 0xfffff000 -#define PG_FZERO 0 -#define PG_FTEXT 1 -#define PG_FMAX (PG_FTEXT) - #define PG_NOACC 0 #define PG_KR 0x00000000 #define PG_KW 0x00000002 @@ -116,6 +99,10 @@ unsigned int #define PG_URKW 0x00000004 #define PG_UW 0x00000006 +#define PG_FZERO 0 +#define PG_FTEXT 1 +#define PG_FMAX (PG_FTEXT) + /* * Page Protection Exception bits */ @@ -135,3 +122,4 @@ unsigned int extern struct pte *Sysmap; #endif #endif +#endif /* _MACHINE_PTE_H_ */ diff --git a/sys/i386/include/reg.h b/sys/i386/include/reg.h index 7ed460b975ab..28c03590ce1b 100644 --- a/sys/i386/include/reg.h +++ b/sys/i386/include/reg.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)reg.h 5.5 (Berkeley) 1/18/91 - * $Id: reg.h,v 1.2 1993/10/16 14:39:29 rgrimes Exp $ + * $Id: reg.h,v 1.7 1994/01/31 10:27:11 davidg Exp $ */ +#ifndef _MACHINE_REG_H_ +#define _MACHINE_REG_H_ 1 + /* * Location of the users' stored * registers within appropriate frame of 'trap' and 'syscall', relative to @@ -51,44 +54,43 @@ #define tEDI (2) #define tESI (3) #define tEBP (4) - +#define tISP (5) #define tEBX (6) #define tEDX (7) #define tECX (8) #define tEAX (9) +#define tERR (11) + #define tEIP (12) #define tCS (13) #define tEFLAGS (14) #define tESP (15) #define tSS (16) -/* During a system call, registers are at these offsets instead of above. */ - -#define sEDI (0) -#define sESI (1) -#define sEBP (2) - -#define sEBX (4) -#define sEDX (5) -#define sECX (6) -#define sEAX (7) -#define sEFLAGS (8) -#define sEIP (9) -#define sCS (10) -#define sESP (11) -#define sSS (12) - -#define PC sEIP -#define SP sESP -#define PS sEFLAGS -#define R0 sEDX -#define R1 sECX /* * Registers accessible to ptrace(2) syscall for debugger + * The machine-dependent code for PT_{SET,GET}REGS needs to + * use whichver order, defined above, is correct, so that it + * is all invisible to the user. */ -#ifdef IPCREG -#define NIPCREG 14 -int ipcreg[NIPCREG] = - { tES,tDS,tEDI,tESI,tEBP,tEBX,tEDX,tECX,tEAX,tEIP,tCS,tEFLAGS,tESP,tSS }; -#endif +struct regs { + unsigned int r_es; + unsigned int r_ds; + unsigned int r_edi; + unsigned int r_esi; + unsigned int r_ebp; + unsigned int r_ebx; + unsigned int r_edx; + unsigned int r_ecx; + unsigned int r_eax; + 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; +}; + +#endif /* _MACHINE_REG_H_ */ diff --git a/sys/i386/include/segments.h b/sys/i386/include/segments.h index 710f72f71d91..79a6044af9b6 100644 --- a/sys/i386/include/segments.h +++ b/sys/i386/include/segments.h @@ -35,9 +35,12 @@ * SUCH DAMAGE. * * from: @(#)segments.h 7.1 (Berkeley) 5/9/91 - * $Id: segments.h,v 1.2 1993/10/16 14:39:30 rgrimes Exp $ + * $Id: segments.h,v 1.4 1994/01/31 10:27:13 davidg Exp $ */ +#ifndef _MACHINE_SEGMENTS_H_ +#define _MACHINE_SEGMENTS_H_ 1 + /* * 386 Segmentation Data Structures and definitions * William F. Jolitz (william@ernie.berkeley.edu) 6/20/1989 @@ -61,7 +64,8 @@ */ struct segment_descriptor { unsigned sd_lolimit:16 ; /* segment extent (lsb) */ - unsigned sd_lobase:24 ; /* segment base address (lsb) */ + unsigned sd_lobase:24 __attribute__ ((packed)); + /* segment base address (lsb) */ unsigned sd_type:5 ; /* segment type */ unsigned sd_dpl:2 ; /* segment descriptor priority level */ unsigned sd_p:1 ; /* segment descriptor present */ @@ -175,8 +179,8 @@ extern sdtossd() ; /* to encode a sd */ * region descriptors, used to load gdt/idt tables before segments yet exist. */ struct region_descriptor { - unsigned rd_limit:16; /* segment extent */ - unsigned rd_base:32; /* base address */ + unsigned rd_limit:16; /* segment extent */ + unsigned rd_base:32 __attribute__ ((packed)); /* base address */ }; /* @@ -195,3 +199,37 @@ struct region_descriptor { #define NIDT 256 #define NRSVIDT 32 /* reserved entries for cpu exceptions */ + +/* + * Entries in the Global Descriptor Table (GDT) + */ +#define GNULL_SEL 0 /* Null Descriptor */ +#define GCODE_SEL 1 /* Kernel Code Descriptor */ +#define GDATA_SEL 2 /* Kernel Data Descriptor */ +#define GLDT_SEL 3 /* LDT - eventually one per process */ +#define GTGATE_SEL 4 /* Process task switch gate */ +#define GPANIC_SEL 5 /* Task state to consider panic from */ +#define GPROC0_SEL 6 /* Task state process slot zero and up */ +#define GUSERLDT_SEL 7 /* User LDT */ +#define NGDT GUSERLDT_SEL+1 + +/* + * Entries in the Local Descriptor Table (LDT) + */ +#define LSYS5CALLS_SEL 0 /* forced by intel BCS */ +#define LSYS5SIGR_SEL 1 +#define L43BSDCALLS_SEL 2 /* notyet */ +#define LUCODE_SEL 3 +#define LUDATA_SEL 4 +/* seperate stack, es,fs,gs sels ? */ +/* #define LPOSIXCALLS_SEL 5*/ /* notyet */ +#define NLDT LUDATA_SEL+1 + +#ifdef KERNEL +extern int currentldt; +extern union descriptor gdt[NGDT]; +extern union descriptor ldt[NLDT]; +extern struct soft_segment_descriptor gdt_segs[]; +#endif + +#endif /* _MACHINE_SEGMENTS_H_ */ diff --git a/sys/i386/include/soundcard.h b/sys/i386/include/soundcard.h index f853de470ddf..23f20313d98a 100644 --- a/sys/i386/include/soundcard.h +++ b/sys/i386/include/soundcard.h @@ -1,5 +1,5 @@ -#ifndef SOUNDCARD_H -#define SOUNDCARD_H +#ifndef _SOUNDCARD_H_ +#define _SOUNDCARD_H_ 1 /* * Copyright by Hannu Savolainen 1993 * @@ -12,10 +12,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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) @@ -30,7 +30,7 @@ /* * If you make modifications to this file, please contact me before * distributing the modified version. There is already enough - * divercity in the world. + * diversity in the world. * * Regards, * Hannu Savolainen @@ -603,7 +603,7 @@ struct sb_mixer_params * These macros define the API which should be used when possible. */ -void seqbuf_dump(); /* This function must be provided by programs */ +void seqbuf_dump(void); /* This function must be provided by programs */ /* Sample seqbuf_dump() implementation: * @@ -734,4 +734,4 @@ void seqbuf_dump(); /* This function must be provided by programs */ #endif long soundcard_init(long mem_start); -#endif +#endif /* _SOUNDCARD_H_ */ diff --git a/sys/i386/include/speaker.h b/sys/i386/include/speaker.h new file mode 100644 index 000000000000..af80a282e28b --- /dev/null +++ b/sys/i386/include/speaker.h @@ -0,0 +1,30 @@ +/* + * speaker.h -- interface definitions for speaker ioctl() + * + * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 + * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su> + */ + +#ifndef _SPEAKER_H_ +#define _SPEAKER_H_ + +#include <sys/ioctl.h> + +#define SPKRTONE _IOW('S', 1, tone_t) /* emit tone */ +#define SPKRTUNE _IO('S', 2) /* emit tone sequence*/ + +typedef struct +{ + int frequency; /* in hertz */ + int duration; /* in 1/100ths of a second */ +} +tone_t; + +/* + * Strings written to the speaker device are interpreted as tunes and played; + * see the spkr(4) man page for details. + */ + +#endif /* _SPEAKER_H_ */ + +/* speaker.h ends here */ diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h index 98d806c22999..64e9cffcf030 100644 --- a/sys/i386/include/specialreg.h +++ b/sys/i386/include/specialreg.h @@ -31,9 +31,12 @@ * SUCH DAMAGE. * * from: @(#)specialreg.h 7.1 (Berkeley) 5/9/91 - * $Id: specialreg.h,v 1.2 1993/10/16 14:39:32 rgrimes Exp $ + * $Id: specialreg.h,v 1.3 1993/11/07 17:43:11 wollman Exp $ */ +#ifndef _MACHINE_SPECIALREG_H_ +#define _MACHINE_SPECIALREG_H_ 1 + /* * Bits in 386 special registers: */ @@ -58,3 +61,4 @@ #ifdef notyet #define CR0_AM 0x00040000 /* Alignment Mask (set to enable AC flag) */ #endif +#endif /* _MACHINE_SPECIALREG_H_ */ diff --git a/sys/i386/include/stdarg.h b/sys/i386/include/stdarg.h index 39e22920311c..92d7f05ca83b 100644 --- a/sys/i386/include/stdarg.h +++ b/sys/i386/include/stdarg.h @@ -31,9 +31,12 @@ * 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 $ + * $Id: stdarg.h,v 1.3 1993/11/07 17:43:12 wollman Exp $ */ +#ifndef _MACHINE_STDARG_H_ +#define _MACHINE_STDARG_H_ 1 + typedef char *va_list; #ifdef KERNEL @@ -52,3 +55,4 @@ typedef char *va_list; #define va_start(ap, last) \ (ap = ((char *)&(last) + __va_promote(last))) +#endif /* _MACHINE_STDARG_H_ */ diff --git a/sys/i386/include/sysarch.h b/sys/i386/include/sysarch.h index 27be89c992d2..59446d513c10 100644 --- a/sys/i386/include/sysarch.h +++ b/sys/i386/include/sysarch.h @@ -1,12 +1,24 @@ /* * Architecture specific syscalls (i386) * - * $Id: sysarch.h,v 1.2 1993/10/16 14:39:35 rgrimes Exp $ + * $Id: sysarch.h,v 1.3 1993/11/07 17:43:13 wollman Exp $ */ +#ifndef _MACHINE_SYSARCH_H_ +#define _MACHINE_SYSARCH_H_ 1 + +#include <sys/cdefs.h> + #define I386_GET_LDT 0 #define I386_SET_LDT 1 -#ifndef KERNEL +#ifdef KERNEL +/* nothing here yet... */ +#else /* not KERNEL */ +__BEGIN_DECLS + int i386_get_ldt __P((int, union descriptor *, int)); int i386_set_ldt __P((int, union descriptor *, int)); -#endif + +__END_DECLS +#endif /* not KERNEL */ +#endif /* _MACHINE_SYSARCH_H_ */ diff --git a/sys/i386/include/trap.h b/sys/i386/include/trap.h index d61861420a65..21c26ce87ed7 100644 --- a/sys/i386/include/trap.h +++ b/sys/i386/include/trap.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)trap.h 5.4 (Berkeley) 5/9/91 - * $Id: trap.h,v 1.2 1993/10/16 14:39:37 rgrimes Exp $ + * $Id: trap.h,v 1.3 1993/11/07 17:43:15 wollman Exp $ */ +#ifndef _MACHINE_TRAP_H_ +#define _MACHINE_TRAP_H_ 1 + /* * Trap type values * also known in trap.c for name strings @@ -95,3 +98,4 @@ /* Trap's coming from user mode */ #define T_USER 0x100 +#endif /* _MACHINE_TRAP_H_ */ diff --git a/sys/i386/include/tss.h b/sys/i386/include/tss.h index 85d5cb465a0c..483f0fbd1464 100644 --- a/sys/i386/include/tss.h +++ b/sys/i386/include/tss.h @@ -34,9 +34,12 @@ * SUCH DAMAGE. * * from: @(#)tss.h 5.4 (Berkeley) 1/18/91 - * $Id: tss.h,v 1.2 1993/10/16 14:39:38 rgrimes Exp $ + * $Id: tss.h,v 1.4 1993/11/17 23:25:04 wollman Exp $ */ +#ifndef _MACHINE_TSS_H_ +#define _MACHINE_TSS_H_ 1 + /* * Intel 386 Context Data Type */ @@ -50,7 +53,6 @@ struct i386tss { int tss_ss1; /* actually 16 bits: top 16 bits must be zero */ int tss_esp2; /* kernel stack pointer priviledge level 2 */ int tss_ss2; /* actually 16 bits: top 16 bits must be zero */ - /* struct ptd *tss_cr3; /* page table directory */ int tss_cr3; /* page table directory */ #define tss_ptd tss_cr3 int tss_eip; /* program counter */ @@ -77,3 +79,4 @@ struct i386tss { int tss_ioopt; /* options & io offset bitmap: currently zero */ /* XXX unimplemented .. i/o permission bitmap */ }; +#endif /* _MACHINE_TSS_H_ */ diff --git a/sys/i386/include/ultrasound.h b/sys/i386/include/ultrasound.h new file mode 100644 index 000000000000..9b6e78fbadce --- /dev/null +++ b/sys/i386/include/ultrasound.h @@ -0,0 +1,124 @@ +#ifndef _ULTRASOUND_H_ +#define _ULTRASOUND_H_ +/* + * Copyright by Hannu Savolainen 1993 + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + */ + +/* + * ultrasound.h - Macros for programming the Gravis Ultrasound + * These macros are extremely device dependent + * and not portable. + */ + +#ifdef linux +#include <linux/soundcard.h> +#else +#include <machine/soundcard.h> +#endif + +/* + * Private events for Gravis Ultrasound (GUS) + * + * Format: + * byte 0 - SEQ_PRIVATE (0xfe) + * byte 1 - Synthesizer device number (0-N) + * byte 2 - Command (see below) + * byte 3 - Voice number (0-31) + * bytes 4 and 5 - parameter P1 (unsigned short) + * bytes 6 and 7 - parameter P2 (unsigned short) + * + * Commands: + * Each command affects one voice defined in byte 3. + * Unused parameters (P1 and/or P2 *MUST* be initialized to zero). + * _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16) + * _GUS_VOICESAMPLE- ************ OBSOLETE ************* + * _GUS_VOICEON - Starts voice (P1=voice mode) + * _GUS_VOICEOFF - Stops voice (no parameters) + * _GUS_VOICEFADE - Stops the voice smoothly. + * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) + * _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7) + * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) + * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) + * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) + * (Like GUS_VOICEVOL but doesn't change the hw + * volume. It just updates volume in the voice table). + * + * _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume) + * _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate) + * _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode) + * _GUS_RAMPON - Starts volume ramping (no parameters) + * _GUS_RAMPOFF - Stops volume ramping (no parameters) + * _GUS_VOLUME_SCALE - Changes the volume calculation constants + * for all voices. + */ + +#define _GUS_NUMVOICES 0x00 +#define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */ +#define _GUS_VOICEON 0x02 +#define _GUS_VOICEOFF 0x03 +#define _GUS_VOICEMODE 0x04 +#define _GUS_VOICEBALA 0x05 +#define _GUS_VOICEFREQ 0x06 +#define _GUS_VOICEVOL 0x07 +#define _GUS_RAMPRANGE 0x08 +#define _GUS_RAMPRATE 0x09 +#define _GUS_RAMPMODE 0x0a +#define _GUS_RAMPON 0x0b +#define _GUS_RAMPOFF 0x0c +#define _GUS_VOICEFADE 0x0d +#define _GUS_VOLUME_SCALE 0x0e +#define _GUS_VOICEVOL2 0x0f + +/* + * GUS API macros + */ + +#define _GUS_CMD(chn, voice, cmd, p1, p2) \ + {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\ + _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\ + _seqbuf[_seqbufptr+3] = voice;\ + *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\ + *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\ + _SEQ_ADVBUF(8);} + +#define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0) +#define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */ +#define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0) +#define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0) +#define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0) +#define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0) +#define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0) +#define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \ + (p) & 0xffff, ((p) >> 16) & 0xffff) +#define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0) +#define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0) +#define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high)) +#define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2)) +#define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0) +#define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0) +#define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0) +#define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2)) + +#endif diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index 316489920ce0..a5b657cd82c2 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -1,6 +1,8 @@ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. + * Copyright (c) 1994 John S. Dyson + * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. @@ -34,10 +36,13 @@ * SUCH DAMAGE. * * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - * $Id: vmparam.h,v 1.7 1993/10/15 10:07:45 rgrimes Exp $ + * $Id: vmparam.h,v 1.11.2.1 1994/03/24 08:57:03 rgrimes Exp $ */ +#ifndef _MACHINE_VMPARAM_H_ +#define _MACHINE_VMPARAM_H_ 1 + /* * Machine dependent constants for 386. */ @@ -53,27 +58,30 @@ * Immediately after the user structure is the page table map, and then * kernal address space. */ -#define USRTEXT 0 -#define USRSTACK 0xFDBFE000 +#define USRTEXT 0UL +/* #define USRSTACK 0xFDBFE000UL */ #define BTOPUSRSTACK (0xFDC00-(UPAGES)) /* btop(USRSTACK) */ -#define LOWPAGES 0 +#define LOWPAGES 0UL #define HIGHPAGES UPAGES /* * Virtual memory related constants, all in bytes */ -#define MAXTSIZ (6*1024*1024) /* max text size */ +#define MAXTSIZ (16UL*1024*1024) /* max text size */ #ifndef DFLDSIZ -#define DFLDSIZ (16*1024*1024) /* initial data size limit */ +#define DFLDSIZ (64UL*1024*1024) /* initial data size limit */ #endif #ifndef MAXDSIZ -#define MAXDSIZ (32*1024*1024) /* max data size */ +#define MAXDSIZ (128UL*1024*1024) /* max data size */ #endif #ifndef DFLSSIZ -#define DFLSSIZ (512*1024) /* initial stack size limit */ +#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ #endif #ifndef MAXSSIZ -#define MAXSSIZ (8*1024*1024) /* max stack size */ +#define MAXSSIZ (64UL*1024*1024) /* max stack size */ +#endif +#ifndef SGROWSIZ +#define SGROWSIZ (128UL*1024) /* amount to grow stack */ #endif /* @@ -101,7 +109,7 @@ /* * Size of User Raw I/O map */ -#define USRIOSIZE 300 +#define USRIOSIZE 1024 /* * The size of the clock loop. @@ -207,16 +215,23 @@ */ /* user/kernel map constants */ +#define KERNBASE (0-(NKPDE+1)*(NBPG*NPTEPG)) +#define KERNSIZE (NKPDE*NBPG*NPTEPG) + #define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0xFDBFE000) -#define UPT_MIN_ADDRESS ((vm_offset_t)0xFDC00000) -#define UPT_MAX_ADDRESS ((vm_offset_t)0xFDFF7000) +#define VM_MAXUSER_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*(NPTEPG+UPAGES))) +#define USRSTACK VM_MAXUSER_ADDRESS +#define UPT_MIN_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*NPTEPG)) +#define UPT_MAX_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*(NKPDE+2))) #define VM_MAX_ADDRESS UPT_MAX_ADDRESS -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)0xFDFF7000) +#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*(NKPDE+2))) #define UPDT VM_MIN_KERNEL_ADDRESS -#define KPT_MIN_ADDRESS ((vm_offset_t)0xFDFF8000) -#define KPT_MAX_ADDRESS ((vm_offset_t)0xFDFFF000) -#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)0xFF7FF000) +#define KPT_MIN_ADDRESS ((vm_offset_t)(KERNBASE) - (NBPG*(NKPDE+1))) +#define KPT_MAX_ADDRESS ((vm_offset_t)(KERNBASE) - NBPG) +#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)ALT_MIN_ADDRESS - NBPG) +#define ALT_MIN_ADDRESS ((vm_offset_t)((APTDPTDI) << 22)) +#define HIGHPAGES UPAGES + /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) @@ -259,3 +274,4 @@ : "ax"); \ }) #endif +#endif /* _MACHINE_VMPARAM_H_ */ |
