The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.
Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman
This commit is contained in:
parent
dbda0ec78e
commit
26f9a76710
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1549
@ -52,9 +52,9 @@
|
||||
/*
|
||||
* The following primitives manipulate the run queues.
|
||||
* _whichqs tells which of the 32 queues _qs
|
||||
* have processes in them. Setrq puts processes into queues, Remrq
|
||||
* have processes in them. setrunqueue puts processes into queues, Remrq
|
||||
* removes them from queues. The running process is on no queue,
|
||||
* other processes are on a queue related to p->p_pri, divided by 4
|
||||
* other processes are on a queue related to p->p_priority, divided by 4
|
||||
* actually to shrink the 0-127 range of priorities into the 32 available
|
||||
* queues.
|
||||
*/
|
||||
@ -72,11 +72,11 @@ _want_resched: .long 0 /* we need to re-run the scheduler */
|
||||
|
||||
.text
|
||||
/*
|
||||
* Setrq(p)
|
||||
* setrunqueue(p)
|
||||
*
|
||||
* Call should be made at spl6(), and p->p_stat should be SRUN
|
||||
*/
|
||||
ENTRY(setrq)
|
||||
ENTRY(setrunqueue)
|
||||
movl 4(%esp),%eax
|
||||
cmpl $0,P_RLINK(%eax) /* should not be on q already */
|
||||
je set1
|
||||
@ -95,7 +95,7 @@ set1:
|
||||
movl %eax,P_LINK(%ecx)
|
||||
ret
|
||||
|
||||
set2: .asciz "setrq"
|
||||
set2: .asciz "setrunqueue"
|
||||
|
||||
/*
|
||||
* Remrq(p)
|
||||
@ -131,10 +131,10 @@ rem2:
|
||||
ret
|
||||
|
||||
rem3: .asciz "remrq"
|
||||
sw0: .asciz "swtch"
|
||||
sw0: .asciz "cpu_switch"
|
||||
|
||||
/*
|
||||
* When no processes are on the runq, swtch() branches to _idle
|
||||
* When no processes are on the runq, cpu_switch() branches to _idle
|
||||
* to wait for something to come ready.
|
||||
*/
|
||||
ALIGN_TEXT
|
||||
@ -146,8 +146,8 @@ _idle:
|
||||
sti
|
||||
|
||||
/*
|
||||
* XXX callers of swtch() do a bogus splclock(). Locking should
|
||||
* be left to swtch().
|
||||
* XXX callers of cpu_switch() do a bogus splclock(). Locking should
|
||||
* be left to cpu_switch().
|
||||
*/
|
||||
movl $SWI_AST_MASK,_cpl
|
||||
testl $~SWI_AST_MASK,_ipending
|
||||
@ -169,9 +169,9 @@ badsw:
|
||||
/*NOTREACHED*/
|
||||
|
||||
/*
|
||||
* Swtch()
|
||||
* cpu_switch()
|
||||
*/
|
||||
ENTRY(swtch)
|
||||
ENTRY(cpu_switch)
|
||||
incl _cnt+V_SWTCH
|
||||
|
||||
/* switch to new process. first, save context as needed */
|
||||
@ -340,7 +340,7 @@ ENTRY(swtch_to_inactive)
|
||||
/*
|
||||
* savectx(pcb, altreturn)
|
||||
* Update pcb, saving current processor state and arranging
|
||||
* for alternate return ala longjmp in swtch if altreturn is true.
|
||||
* for alternate return ala longjmp in cpu_switch if altreturn is true.
|
||||
*/
|
||||
ENTRY(savectx)
|
||||
movl 4(%esp),%ecx
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "ddb/ddb.h"
|
||||
|
||||
#include <sys/reboot.h>
|
||||
#include <vm/vm_statistics.h>
|
||||
/* #include <vm/vm_statistics.h> */
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <setjmp.h>
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/lock.h>
|
||||
#include <vm/vm_statistics.h>
|
||||
#include <vm/vm_prot.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/pmap.h>
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
|
@ -438,7 +438,7 @@ npxintr(frame)
|
||||
* in doreti, and the frame for that could easily be set up
|
||||
* just before it is used).
|
||||
*/
|
||||
curproc->p_regs = (int *)&frame.if_es;
|
||||
curproc->p_md.md_regs = (int *)&frame.if_es;
|
||||
#ifdef notyet
|
||||
/*
|
||||
* Encode the appropriate code for detailed information on
|
||||
|
@ -37,21 +37,19 @@
|
||||
* $Id: genassym.c,v 1.6 1993/11/13 02:24:59 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "sys/param.h"
|
||||
#include "sys/buf.h"
|
||||
#include "sys/vmmeter.h"
|
||||
#include "sys/proc.h"
|
||||
#include "sys/user.h"
|
||||
#include "sys/mbuf.h"
|
||||
#include "sys/msgbuf.h"
|
||||
#include "sys/resourcevar.h"
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/trap.h"
|
||||
#include "machine/psl.h"
|
||||
#include "sys/syscall.h"
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/vm_map.h"
|
||||
#include "machine/pmap.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/map.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <vm/vm.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
main()
|
||||
{
|
||||
@ -70,12 +68,12 @@ main()
|
||||
|
||||
printf("#define\tI386_CR3PAT %d\n", I386_CR3PAT);
|
||||
printf("#define\tUDOT_SZ %d\n", sizeof(struct user));
|
||||
printf("#define\tP_LINK %d\n", &p->p_link);
|
||||
printf("#define\tP_RLINK %d\n", &p->p_rlink);
|
||||
printf("#define\tP_LINK %d\n", &p->p_forw);
|
||||
printf("#define\tP_RLINK %d\n", &p->p_back);
|
||||
printf("#define\tP_VMSPACE %d\n", &p->p_vmspace);
|
||||
printf("#define\tVM_PMAP %d\n", &vms->vm_pmap);
|
||||
printf("#define\tP_ADDR %d\n", &p->p_addr);
|
||||
printf("#define\tP_PRI %d\n", &p->p_pri);
|
||||
printf("#define\tP_PRI %d\n", &p->p_priority);
|
||||
printf("#define\tP_STAT %d\n", &p->p_stat);
|
||||
printf("#define\tP_WCHAN %d\n", &p->p_wchan);
|
||||
printf("#define\tP_FLAG %d\n", &p->p_flag);
|
||||
@ -87,10 +85,10 @@ main()
|
||||
printf("#define\tV_SYSCALL %d\n", &vm->v_syscall);
|
||||
printf("#define\tV_INTR %d\n", &vm->v_intr);
|
||||
printf("#define\tV_SOFT %d\n", &vm->v_soft);
|
||||
printf("#define\tV_PDMA %d\n", &vm->v_pdma);
|
||||
/* printf("#define\tV_PDMA %d\n", &vm->v_pdma); */
|
||||
printf("#define\tV_FAULTS %d\n", &vm->v_faults);
|
||||
printf("#define\tV_PGREC %d\n", &vm->v_pgrec);
|
||||
printf("#define\tV_FASTPGREC %d\n", &vm->v_fastpgrec);
|
||||
/* printf("#define\tV_PGREC %d\n", &vm->v_pgrec); */
|
||||
/* printf("#define\tV_FASTPGREC %d\n", &vm->v_fastpgrec); */
|
||||
printf("#define\tUPAGES %d\n", UPAGES);
|
||||
printf("#define\tHIGHPAGES %d\n", HIGHPAGES);
|
||||
printf("#define\tCLSIZE %d\n", CLSIZE);
|
||||
|
@ -274,7 +274,7 @@ NON_GPROF_ENTRY(btext)
|
||||
movl $0xa0,%ecx
|
||||
1:
|
||||
#endif /* BDE_DEBUGGER */
|
||||
movl $PG_V|PG_KW,%eax /* having these bits set, */
|
||||
movl $PG_V|PG_KW|PG_NC_PWT,%eax /* kernel R/W, valid, cache write-through */
|
||||
lea ((1+UPAGES+1)*NBPG)(%esi),%ebx /* phys addr of kernel PT base */
|
||||
movl %ebx,_KPTphys-KERNBASE /* save in global */
|
||||
fillkpt
|
||||
@ -302,7 +302,7 @@ NON_GPROF_ENTRY(btext)
|
||||
movl $(1+UPAGES+1+NKPT),%ecx /* number of PTEs */
|
||||
movl %esi,%eax /* phys address of PTD */
|
||||
andl $PG_FRAME,%eax /* convert to PFN, should be a NOP */
|
||||
orl $PG_V|PG_KW,%eax /* valid, kernel read/write */
|
||||
orl $PG_V|PG_KW|PG_NC_PWT,%eax /* valid, kernel read/write, cache write-though */
|
||||
movl %esi,%ebx /* calculate pte offset to ptd */
|
||||
shrl $PGSHIFT-2,%ebx
|
||||
addl %esi,%ebx /* address of page directory */
|
||||
@ -452,11 +452,27 @@ reloc_gdt:
|
||||
|
||||
pushl %esi /* value of first for init386(first) */
|
||||
call _init386 /* wire 386 chip for unix operation */
|
||||
|
||||
movl $0,_PTD
|
||||
call _main /* autoconfiguration, mountroot etc */
|
||||
popl %esi
|
||||
|
||||
#if 0
|
||||
movl $0,_PTD
|
||||
#endif
|
||||
|
||||
.globl __ucodesel,__udatasel
|
||||
|
||||
pushl $0 /* unused */
|
||||
pushl __udatasel /* ss */
|
||||
pushl $0 /* esp - filled in by execve() */
|
||||
pushl $0x3200 /* eflags (ring 3, int enab) */
|
||||
pushl __ucodesel /* cs */
|
||||
pushl $0 /* eip - filled in by execve() */
|
||||
subl $(12*4),%esp /* space for rest of registers */
|
||||
|
||||
pushl %esp /* call main with frame pointer */
|
||||
call _main /* autoconfiguration, mountroot etc */
|
||||
|
||||
addl $(13*4),%esp /* back to a frame we can return with */
|
||||
|
||||
/*
|
||||
* now we've run main() and determined what cpu-type we are, we can
|
||||
* enable WP mode on i486 cpus and above.
|
||||
@ -473,69 +489,16 @@ reloc_gdt:
|
||||
* set up address space and stack so that we can 'return' to user mode
|
||||
*/
|
||||
1:
|
||||
.globl __ucodesel,__udatasel
|
||||
movl __ucodesel,%eax
|
||||
movl __udatasel,%ecx
|
||||
/* build outer stack frame */
|
||||
pushl %ecx /* user ss */
|
||||
pushl $USRSTACK /* user esp */
|
||||
pushl %eax /* user cs */
|
||||
pushl $0 /* user ip */
|
||||
|
||||
movl %cx,%ds
|
||||
movl %cx,%es
|
||||
movl %ax,%fs /* double map cs to fs */
|
||||
movl %cx,%gs /* and ds to gs */
|
||||
lret /* goto user! */
|
||||
iret /* goto user! */
|
||||
|
||||
pushl $lretmsg1 /* "should never get here!" */
|
||||
call _panic
|
||||
lretmsg1:
|
||||
.asciz "lret: toinit\n"
|
||||
|
||||
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
|
||||
/*
|
||||
* Icode is copied out to process 1 and executed in user mode:
|
||||
* execve("/sbin/init", argv, envp); exit(0);
|
||||
* If the execve fails, process 1 exits and the system panics.
|
||||
*/
|
||||
NON_GPROF_ENTRY(icode)
|
||||
pushl $0 /* envp for execve() */
|
||||
|
||||
# pushl $argv-_icode /* can't do this 'cos gas 1.38 is broken */
|
||||
movl $argv,%eax
|
||||
subl $_icode,%eax
|
||||
pushl %eax /* argp for execve() */
|
||||
|
||||
# pushl $init-_icode
|
||||
movl $init,%eax
|
||||
subl $_icode,%eax
|
||||
pushl %eax /* fname for execve() */
|
||||
|
||||
pushl %eax /* dummy return address */
|
||||
|
||||
movl $SYS_execve,%eax
|
||||
LCALL(0x7,0x0)
|
||||
|
||||
/* exit if something botches up in the above execve() */
|
||||
pushl %eax /* execve failed, the errno will do for an */
|
||||
/* exit code because errnos are < 128 */
|
||||
pushl %eax /* dummy return address */
|
||||
movl $SYS_exit,%eax
|
||||
LCALL(0x7,0x0)
|
||||
|
||||
init:
|
||||
.asciz "/sbin/init"
|
||||
ALIGN_DATA
|
||||
argv:
|
||||
.long init+6-_icode /* argv[0] = "init" ("/sbin/init" + 6) */
|
||||
.long eicode-_icode /* argv[1] follows icode after copyout */
|
||||
.long 0
|
||||
eicode:
|
||||
|
||||
.globl _szicode
|
||||
_szicode:
|
||||
.long _szicode-_icode
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
|
||||
|
||||
NON_GPROF_ENTRY(sigcode)
|
||||
call SIGF_HANDLER(%esp)
|
||||
|
@ -274,7 +274,7 @@ NON_GPROF_ENTRY(btext)
|
||||
movl $0xa0,%ecx
|
||||
1:
|
||||
#endif /* BDE_DEBUGGER */
|
||||
movl $PG_V|PG_KW,%eax /* having these bits set, */
|
||||
movl $PG_V|PG_KW|PG_NC_PWT,%eax /* kernel R/W, valid, cache write-through */
|
||||
lea ((1+UPAGES+1)*NBPG)(%esi),%ebx /* phys addr of kernel PT base */
|
||||
movl %ebx,_KPTphys-KERNBASE /* save in global */
|
||||
fillkpt
|
||||
@ -302,7 +302,7 @@ NON_GPROF_ENTRY(btext)
|
||||
movl $(1+UPAGES+1+NKPT),%ecx /* number of PTEs */
|
||||
movl %esi,%eax /* phys address of PTD */
|
||||
andl $PG_FRAME,%eax /* convert to PFN, should be a NOP */
|
||||
orl $PG_V|PG_KW,%eax /* valid, kernel read/write */
|
||||
orl $PG_V|PG_KW|PG_NC_PWT,%eax /* valid, kernel read/write, cache write-though */
|
||||
movl %esi,%ebx /* calculate pte offset to ptd */
|
||||
shrl $PGSHIFT-2,%ebx
|
||||
addl %esi,%ebx /* address of page directory */
|
||||
@ -452,11 +452,27 @@ reloc_gdt:
|
||||
|
||||
pushl %esi /* value of first for init386(first) */
|
||||
call _init386 /* wire 386 chip for unix operation */
|
||||
|
||||
movl $0,_PTD
|
||||
call _main /* autoconfiguration, mountroot etc */
|
||||
popl %esi
|
||||
|
||||
#if 0
|
||||
movl $0,_PTD
|
||||
#endif
|
||||
|
||||
.globl __ucodesel,__udatasel
|
||||
|
||||
pushl $0 /* unused */
|
||||
pushl __udatasel /* ss */
|
||||
pushl $0 /* esp - filled in by execve() */
|
||||
pushl $0x3200 /* eflags (ring 3, int enab) */
|
||||
pushl __ucodesel /* cs */
|
||||
pushl $0 /* eip - filled in by execve() */
|
||||
subl $(12*4),%esp /* space for rest of registers */
|
||||
|
||||
pushl %esp /* call main with frame pointer */
|
||||
call _main /* autoconfiguration, mountroot etc */
|
||||
|
||||
addl $(13*4),%esp /* back to a frame we can return with */
|
||||
|
||||
/*
|
||||
* now we've run main() and determined what cpu-type we are, we can
|
||||
* enable WP mode on i486 cpus and above.
|
||||
@ -473,69 +489,16 @@ reloc_gdt:
|
||||
* set up address space and stack so that we can 'return' to user mode
|
||||
*/
|
||||
1:
|
||||
.globl __ucodesel,__udatasel
|
||||
movl __ucodesel,%eax
|
||||
movl __udatasel,%ecx
|
||||
/* build outer stack frame */
|
||||
pushl %ecx /* user ss */
|
||||
pushl $USRSTACK /* user esp */
|
||||
pushl %eax /* user cs */
|
||||
pushl $0 /* user ip */
|
||||
|
||||
movl %cx,%ds
|
||||
movl %cx,%es
|
||||
movl %ax,%fs /* double map cs to fs */
|
||||
movl %cx,%gs /* and ds to gs */
|
||||
lret /* goto user! */
|
||||
iret /* goto user! */
|
||||
|
||||
pushl $lretmsg1 /* "should never get here!" */
|
||||
call _panic
|
||||
lretmsg1:
|
||||
.asciz "lret: toinit\n"
|
||||
|
||||
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
|
||||
/*
|
||||
* Icode is copied out to process 1 and executed in user mode:
|
||||
* execve("/sbin/init", argv, envp); exit(0);
|
||||
* If the execve fails, process 1 exits and the system panics.
|
||||
*/
|
||||
NON_GPROF_ENTRY(icode)
|
||||
pushl $0 /* envp for execve() */
|
||||
|
||||
# pushl $argv-_icode /* can't do this 'cos gas 1.38 is broken */
|
||||
movl $argv,%eax
|
||||
subl $_icode,%eax
|
||||
pushl %eax /* argp for execve() */
|
||||
|
||||
# pushl $init-_icode
|
||||
movl $init,%eax
|
||||
subl $_icode,%eax
|
||||
pushl %eax /* fname for execve() */
|
||||
|
||||
pushl %eax /* dummy return address */
|
||||
|
||||
movl $SYS_execve,%eax
|
||||
LCALL(0x7,0x0)
|
||||
|
||||
/* exit if something botches up in the above execve() */
|
||||
pushl %eax /* execve failed, the errno will do for an */
|
||||
/* exit code because errnos are < 128 */
|
||||
pushl %eax /* dummy return address */
|
||||
movl $SYS_exit,%eax
|
||||
LCALL(0x7,0x0)
|
||||
|
||||
init:
|
||||
.asciz "/sbin/init"
|
||||
ALIGN_DATA
|
||||
argv:
|
||||
.long init+6-_icode /* argv[0] = "init" ("/sbin/init" + 6) */
|
||||
.long eicode-_icode /* argv[1] follows icode after copyout */
|
||||
.long 0
|
||||
eicode:
|
||||
|
||||
.globl _szicode
|
||||
_szicode:
|
||||
.long _szicode-_icode
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
|
||||
|
||||
NON_GPROF_ENTRY(sigcode)
|
||||
call SIGF_HANDLER(%esp)
|
||||
|
@ -41,23 +41,24 @@
|
||||
#include "npx.h"
|
||||
#include "isa.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "signalvar.h"
|
||||
#include "kernel.h"
|
||||
#include "map.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "exec.h" /* for PS_STRINGS */
|
||||
#include "buf.h"
|
||||
#include "reboot.h"
|
||||
#include "conf.h"
|
||||
#include "file.h"
|
||||
#include "callout.h"
|
||||
#include "malloc.h"
|
||||
#include "mbuf.h"
|
||||
#include "msgbuf.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/map.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include "sys/shm.h"
|
||||
@ -94,7 +95,7 @@ static void identifycpu(void);
|
||||
static void initcpu(void);
|
||||
static int test_page(int *, int);
|
||||
|
||||
extern int grow(struct proc *,int);
|
||||
extern int grow(struct proc *,u_int);
|
||||
const char machine[] = "PC-Class";
|
||||
const char *cpu_model;
|
||||
|
||||
@ -121,6 +122,7 @@ int bouncepages = BOUNCEPAGES;
|
||||
#else
|
||||
int bouncepages = 0;
|
||||
#endif
|
||||
int msgbufmapped = 0; /* set when safe to use msgbuf */
|
||||
extern int freebufspace;
|
||||
extern char *bouncememory;
|
||||
|
||||
@ -141,6 +143,12 @@ extern cyloffset;
|
||||
int cpu_class;
|
||||
|
||||
void dumpsys __P((void));
|
||||
vm_offset_t buffer_sva, buffer_eva;
|
||||
vm_offset_t clean_sva, clean_eva;
|
||||
vm_offset_t pager_sva, pager_eva;
|
||||
int maxbkva, pager_map_size;
|
||||
|
||||
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
||||
|
||||
void
|
||||
cpu_startup()
|
||||
@ -275,18 +283,19 @@ cpu_startup()
|
||||
if ((vm_size_t)(v - firstaddr) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Allocate a submap for buffer space allocations.
|
||||
* XXX we are NOT using buffer_map, but due to
|
||||
* the references to it we will just allocate 1 page of
|
||||
* vm (not real memory) to make things happy...
|
||||
*/
|
||||
buffer_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
/* bufpages * */NBPG, TRUE);
|
||||
clean_map = kmem_suballoc(kernel_map, &clean_sva, &clean_eva,
|
||||
(nbuf*MAXBSIZE) + VM_PHYS_SIZE + maxbkva + pager_map_size, TRUE);
|
||||
|
||||
io_map = kmem_suballoc(clean_map, &minaddr, &maxaddr, maxbkva, FALSE);
|
||||
pager_map = kmem_suballoc(clean_map, &pager_sva, &pager_eva,
|
||||
pager_map_size, TRUE);
|
||||
|
||||
buffer_map = kmem_suballoc(clean_map, &buffer_sva, &buffer_eva,
|
||||
(nbuf * MAXBSIZE), TRUE);
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
phys_map = kmem_suballoc(clean_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, TRUE);
|
||||
|
||||
/*
|
||||
@ -296,7 +305,7 @@ cpu_startup()
|
||||
mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
|
||||
M_MBUF, M_NOWAIT);
|
||||
bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
|
||||
mb_map = kmem_suballoc(kmem_map, (vm_offset_t)&mbutl, &maxaddr,
|
||||
mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr,
|
||||
VM_MBUF_SIZE, FALSE);
|
||||
/*
|
||||
* Initialize callouts
|
||||
@ -305,7 +314,7 @@ cpu_startup()
|
||||
for (i = 1; i < ncallout; i++)
|
||||
callout[i-1].c_next = &callout[i];
|
||||
|
||||
printf("avail memory = %d (%d pages)\n", ptoa(vm_page_free_count), vm_page_free_count);
|
||||
printf("avail memory = %d (%d pages)\n", ptoa(cnt.v_free_count), cnt.v_free_count);
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
|
||||
@ -437,11 +446,11 @@ sendsig(catcher, sig, mask, code)
|
||||
register struct proc *p = curproc;
|
||||
register int *regs;
|
||||
register struct sigframe *fp;
|
||||
struct sigacts *ps = p->p_sigacts;
|
||||
struct sigacts *psp = p->p_sigacts;
|
||||
int oonstack, frmtrap;
|
||||
|
||||
regs = p->p_regs;
|
||||
oonstack = ps->ps_onstack;
|
||||
regs = p->p_md.md_regs;
|
||||
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
|
||||
/*
|
||||
* Allocate and validate space for the signal handler
|
||||
* context. Note that if the stack is in P0 space, the
|
||||
@ -449,10 +458,12 @@ sendsig(catcher, sig, mask, code)
|
||||
* will fail if the process has not already allocated
|
||||
* the space with a `brk'.
|
||||
*/
|
||||
if (!ps->ps_onstack && (ps->ps_sigonstack & sigmask(sig))) {
|
||||
fp = (struct sigframe *)(ps->ps_sigsp
|
||||
- sizeof(struct sigframe));
|
||||
ps->ps_onstack = 1;
|
||||
if ((psp->ps_flags & SAS_ALTSTACK) &&
|
||||
(psp->ps_sigstk.ss_flags & SA_ONSTACK) == 0 &&
|
||||
(psp->ps_sigonstack & sigmask(sig))) {
|
||||
fp = (struct sigframe *)(psp->ps_sigstk.ss_base +
|
||||
psp->ps_sigstk.ss_size - sizeof(struct sigframe));
|
||||
psp->ps_sigstk.ss_flags |= SA_ONSTACK;
|
||||
} else {
|
||||
fp = (struct sigframe *)(regs[tESP]
|
||||
- sizeof(struct sigframe));
|
||||
@ -540,7 +551,7 @@ sigreturn(p, uap, retval)
|
||||
{
|
||||
register struct sigcontext *scp;
|
||||
register struct sigframe *fp;
|
||||
register int *regs = p->p_regs;
|
||||
register int *regs = p->p_md.md_regs;
|
||||
int eflags;
|
||||
|
||||
/*
|
||||
@ -614,7 +625,10 @@ sigreturn(p, uap, retval)
|
||||
if (useracc((caddr_t)scp, sizeof (*scp), 0) == 0)
|
||||
return(EINVAL);
|
||||
|
||||
p->p_sigacts->ps_onstack = scp->sc_onstack & 01;
|
||||
if (scp->sc_onstack & 01)
|
||||
p->p_sigacts->ps_sigstk.ss_flags |= SA_ONSTACK;
|
||||
else
|
||||
p->p_sigacts->ps_sigstk.ss_flags &= ~SA_ONSTACK;
|
||||
p->p_sigmask = scp->sc_mask &~
|
||||
(sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
|
||||
regs[tEBP] = scp->sc_fp;
|
||||
@ -651,7 +665,7 @@ boot(arghowto)
|
||||
for(;;);
|
||||
}
|
||||
howto = arghowto;
|
||||
if ((howto&RB_NOSYNC) == 0 && waittime < 0 && bfreelist[0].b_forw) {
|
||||
if ((howto&RB_NOSYNC) == 0 && waittime < 0) {
|
||||
register struct buf *bp;
|
||||
int iter, nbusy;
|
||||
|
||||
@ -818,13 +832,13 @@ setregs(p, entry, stack)
|
||||
u_long entry;
|
||||
u_long stack;
|
||||
{
|
||||
p->p_regs[tEBP] = 0; /* bottom of the fp chain */
|
||||
p->p_regs[tEIP] = entry;
|
||||
p->p_regs[tESP] = stack;
|
||||
p->p_regs[tSS] = _udatasel;
|
||||
p->p_regs[tDS] = _udatasel;
|
||||
p->p_regs[tES] = _udatasel;
|
||||
p->p_regs[tCS] = _ucodesel;
|
||||
p->p_md.md_regs[tEBP] = 0; /* bottom of the fp chain */
|
||||
p->p_md.md_regs[tEIP] = entry;
|
||||
p->p_md.md_regs[tESP] = stack;
|
||||
p->p_md.md_regs[tSS] = _udatasel;
|
||||
p->p_md.md_regs[tDS] = _udatasel;
|
||||
p->p_md.md_regs[tES] = _udatasel;
|
||||
p->p_md.md_regs[tCS] = _ucodesel;
|
||||
|
||||
p->p_addr->u_pcb.pcb_flags = 0; /* no fp at all */
|
||||
load_cr0(rcr0() | CR0_TS); /* start emulating */
|
||||
@ -833,6 +847,34 @@ setregs(p, entry, stack)
|
||||
#endif /* NNPX > 0 */
|
||||
}
|
||||
|
||||
/*
|
||||
* machine dependent system variables.
|
||||
*/
|
||||
int
|
||||
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
/* all sysctl names at this level are terminal */
|
||||
if (namelen != 1)
|
||||
return (ENOTDIR); /* overloaded */
|
||||
|
||||
switch (name[0]) {
|
||||
case CPU_CONSDEV:
|
||||
return (sysctl_rdstruct(oldp, oldlenp, newp, &cn_tty->t_dev,
|
||||
sizeof cn_tty->t_dev));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize 386 and configure to run kernel
|
||||
*/
|
||||
@ -1105,9 +1147,11 @@ init386(first)
|
||||
r_gdt.rd_limit = sizeof(gdt) - 1;
|
||||
r_gdt.rd_base = (int) gdt;
|
||||
lgdt(&r_gdt);
|
||||
|
||||
r_idt.rd_limit = sizeof(idt) - 1;
|
||||
r_idt.rd_base = (int) idt;
|
||||
lidt(&r_idt);
|
||||
|
||||
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
|
||||
lldt(_default_ldt);
|
||||
currentldt = _default_ldt;
|
||||
@ -1339,7 +1383,7 @@ _remque(element)
|
||||
* The registers are in the frame; the frame is in the user area of
|
||||
* the process in question; when the process is active, the registers
|
||||
* are in "the kernel stack"; when it's not, they're still there, but
|
||||
* things get flipped around. So, since p->p_regs is the whole address
|
||||
* things get flipped around. So, since p->p_md.md_regs is the whole address
|
||||
* of the register set, take its offset from the kernel stack, and
|
||||
* index into the user block. Don't you just *love* virtual memory?
|
||||
* (I'm starting to think seymour is right...)
|
||||
@ -1348,7 +1392,7 @@ _remque(element)
|
||||
int
|
||||
ptrace_set_pc (struct proc *p, unsigned int addr) {
|
||||
void *regs = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
((struct trapframe *)regs)->tf_eip = addr;
|
||||
return 0;
|
||||
@ -1357,7 +1401,7 @@ ptrace_set_pc (struct proc *p, unsigned int addr) {
|
||||
int
|
||||
ptrace_single_step (struct proc *p) {
|
||||
void *regs = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
((struct trapframe *)regs)->tf_eflags |= PSL_T;
|
||||
return 0;
|
||||
@ -1370,7 +1414,7 @@ ptrace_single_step (struct proc *p) {
|
||||
int
|
||||
ptrace_getregs (struct proc *p, unsigned int *addr) {
|
||||
int error;
|
||||
struct regs regs = {0};
|
||||
struct reg regs = {0};
|
||||
|
||||
if (error = fill_regs (p, ®s))
|
||||
return error;
|
||||
@ -1381,7 +1425,7 @@ ptrace_getregs (struct proc *p, unsigned int *addr) {
|
||||
int
|
||||
ptrace_setregs (struct proc *p, unsigned int *addr) {
|
||||
int error;
|
||||
struct regs regs = {0};
|
||||
struct reg regs = {0};
|
||||
|
||||
if (error = copyin (addr, ®s, sizeof(regs)))
|
||||
return error;
|
||||
@ -1390,11 +1434,11 @@ ptrace_setregs (struct proc *p, unsigned int *addr) {
|
||||
}
|
||||
|
||||
int
|
||||
fill_regs(struct proc *p, struct regs *regs) {
|
||||
fill_regs(struct proc *p, struct reg *regs) {
|
||||
int error;
|
||||
struct trapframe *tp;
|
||||
void *ptr = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
tp = ptr;
|
||||
regs->r_es = tp->tf_es;
|
||||
@ -1415,11 +1459,11 @@ fill_regs(struct proc *p, struct regs *regs) {
|
||||
}
|
||||
|
||||
int
|
||||
set_regs (struct proc *p, struct regs *regs) {
|
||||
set_regs (struct proc *p, struct reg *regs) {
|
||||
int error;
|
||||
struct trapframe *tp;
|
||||
void *ptr = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
tp = ptr;
|
||||
tp->tf_es = regs->r_es;
|
||||
@ -1444,6 +1488,69 @@ set_regs (struct proc *p, struct regs *regs) {
|
||||
void
|
||||
Debugger(const char *msg)
|
||||
{
|
||||
printf("Debugger(\"%s\") called.", msg);
|
||||
printf("Debugger(\"%s\") called.\n", msg);
|
||||
}
|
||||
#endif /* no DDB */
|
||||
|
||||
#include <sys/disklabel.h>
|
||||
#define b_cylin b_resid
|
||||
#define dkpart(dev) (minor(dev) & 7)
|
||||
/*
|
||||
* Determine the size of the transfer, and make sure it is
|
||||
* within the boundaries of the partition. Adjust transfer
|
||||
* if needed, and signal errors or early completion.
|
||||
*/
|
||||
int
|
||||
bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
|
||||
{
|
||||
struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
|
||||
int labelsect = lp->d_partitions[0].p_offset;
|
||||
int maxsz = p->p_size,
|
||||
sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
|
||||
|
||||
/* overwriting disk label ? */
|
||||
/* XXX should also protect bootstrap in first 8K */
|
||||
if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
|
||||
#if LABELSECTOR != 0
|
||||
bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
|
||||
#endif
|
||||
(bp->b_flags & B_READ) == 0 && wlabel == 0) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
#if defined(DOSBBSECTOR) && defined(notyet)
|
||||
/* overwriting master boot record? */
|
||||
if (bp->b_blkno + p->p_offset <= DOSBBSECTOR &&
|
||||
(bp->b_flags & B_READ) == 0 && wlabel == 0) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* beyond partition? */
|
||||
if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
|
||||
/* if exactly at end of disk, return an EOF */
|
||||
if (bp->b_blkno == maxsz) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
return(0);
|
||||
}
|
||||
/* or truncate if part of it fits */
|
||||
sz = maxsz - bp->b_blkno;
|
||||
if (sz <= 0) {
|
||||
bp->b_error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
bp->b_bcount = sz << DEV_BSHIFT;
|
||||
}
|
||||
|
||||
/* calculate cylinder for disksort to order transfers with */
|
||||
bp->b_pblkno = bp->b_blkno + p->p_offset;
|
||||
bp->b_cylin = bp->b_pblkno / lp->d_secpercyl;
|
||||
return(1);
|
||||
|
||||
bad:
|
||||
bp->b_flags |= B_ERROR;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@ -45,24 +45,23 @@
|
||||
* Memory special file
|
||||
*/
|
||||
|
||||
#include "param.h"
|
||||
#include "conf.h"
|
||||
#include "buf.h"
|
||||
#include "systm.h"
|
||||
#include "uio.h"
|
||||
#include "malloc.h"
|
||||
#include "proc.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/psl.h"
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/psl.h>
|
||||
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/lock.h"
|
||||
#include "vm/vm_statistics.h"
|
||||
#include "vm/vm_prot.h"
|
||||
#include "vm/pmap.h"
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/lock.h>
|
||||
#include <vm/vm_prot.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
extern char *vmmap; /* poor name! */
|
||||
extern char *ptvmmap; /* poor name! */
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mmclose(dev, uio, flags)
|
||||
@ -74,7 +73,7 @@ mmclose(dev, uio, flags)
|
||||
|
||||
switch (minor(dev)) {
|
||||
case 14:
|
||||
fp = (struct trapframe *)curproc->p_regs;
|
||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
||||
fp->tf_eflags &= ~PSL_IOPL;
|
||||
break;
|
||||
default:
|
||||
@ -93,7 +92,7 @@ mmopen(dev, uio, flags)
|
||||
|
||||
switch (minor(dev)) {
|
||||
case 14:
|
||||
fp = (struct trapframe *)curproc->p_regs;
|
||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
||||
fp->tf_eflags |= PSL_IOPL;
|
||||
break;
|
||||
default:
|
||||
@ -128,25 +127,25 @@ mmrw(dev, uio, flags)
|
||||
/* minor device 0 is physical memory */
|
||||
case 0:
|
||||
v = uio->uio_offset;
|
||||
pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, v,
|
||||
pmap_enter(kernel_pmap, (vm_offset_t)ptvmmap, v,
|
||||
uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE,
|
||||
TRUE);
|
||||
o = (int)uio->uio_offset & PGOFSET;
|
||||
c = (u_int)(NBPG - ((int)iov->iov_base & PGOFSET));
|
||||
c = MIN(c, (u_int)(NBPG - o));
|
||||
c = MIN(c, (u_int)iov->iov_len);
|
||||
error = uiomove((caddr_t)&vmmap[o], (int)c, uio);
|
||||
pmap_remove(pmap_kernel(), (vm_offset_t)vmmap,
|
||||
(vm_offset_t)&vmmap[NBPG]);
|
||||
c = min(c, (u_int)(NBPG - o));
|
||||
c = min(c, (u_int)iov->iov_len);
|
||||
error = uiomove((caddr_t)&ptvmmap[o], (int)c, uio);
|
||||
pmap_remove(kernel_pmap, (vm_offset_t)ptvmmap,
|
||||
(vm_offset_t)&ptvmmap[NBPG]);
|
||||
continue;
|
||||
|
||||
/* minor device 1 is kernel memory */
|
||||
case 1:
|
||||
c = iov->iov_len;
|
||||
if (!kernacc((caddr_t)uio->uio_offset, c,
|
||||
if (!kernacc((caddr_t)(int)uio->uio_offset, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return(EFAULT);
|
||||
error = uiomove((caddr_t)uio->uio_offset, (int)c, uio);
|
||||
error = uiomove((caddr_t)(int)uio->uio_offset, (int)c, uio);
|
||||
continue;
|
||||
|
||||
/* minor device 2 is EOF/RATHOLE */
|
||||
@ -167,7 +166,7 @@ mmrw(dev, uio, flags)
|
||||
malloc(CLBYTES, M_TEMP, M_WAITOK);
|
||||
bzero(zbuf, CLBYTES);
|
||||
}
|
||||
c = MIN(iov->iov_len, CLBYTES);
|
||||
c = min(iov->iov_len, CLBYTES);
|
||||
error = uiomove(zbuf, (int)c, uio);
|
||||
continue;
|
||||
|
||||
|
@ -85,19 +85,19 @@
|
||||
* and to when physical maps must be made correct.
|
||||
*/
|
||||
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "malloc.h"
|
||||
#include "user.h"
|
||||
#include "i386/include/cpufunc.h"
|
||||
#include "i386/include/cputypes.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include "vm/vm_page.h"
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include "i386/isa/isa.h"
|
||||
#include <i386/include/cpufunc.h>
|
||||
#include <i386/include/cputypes.h>
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
/*
|
||||
* Allocate various and sundry SYSMAPs used in the days of old VM
|
||||
@ -149,12 +149,12 @@ static inline void *vm_get_pmap();
|
||||
static inline void vm_put_pmap();
|
||||
inline void pmap_use_pt();
|
||||
inline void pmap_unuse_pt();
|
||||
inline pt_entry_t * const pmap_pte();
|
||||
inline pt_entry_t * pmap_pte();
|
||||
static inline pv_entry_t get_pv_entry();
|
||||
void pmap_alloc_pv_entry();
|
||||
void pmap_clear_modify();
|
||||
void i386_protection_init();
|
||||
extern vm_offset_t pager_sva, pager_eva;
|
||||
extern vm_offset_t clean_sva, clean_eva;
|
||||
extern int cpu_class;
|
||||
|
||||
#if BSDVM_COMPAT
|
||||
@ -163,8 +163,8 @@ extern int cpu_class;
|
||||
/*
|
||||
* All those kernel PT submaps that BSD is so fond of
|
||||
*/
|
||||
pt_entry_t *CMAP1, *CMAP2, *mmap;
|
||||
caddr_t CADDR1, CADDR2, vmmap;
|
||||
pt_entry_t *CMAP1, *CMAP2, *ptmmap;
|
||||
caddr_t CADDR1, CADDR2, ptvmmap;
|
||||
pt_entry_t *msgbufmap;
|
||||
struct msgbuf *msgbufp;
|
||||
#endif
|
||||
@ -180,8 +180,8 @@ void init_pv_entries(int) ;
|
||||
*/
|
||||
|
||||
inline pt_entry_t *
|
||||
const pmap_pte(pmap, va)
|
||||
register pmap_t pmap;
|
||||
pmap_pte(pmap, va)
|
||||
pmap_t pmap;
|
||||
vm_offset_t va;
|
||||
{
|
||||
|
||||
@ -374,7 +374,7 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
|
||||
SYSMAP(caddr_t ,CMAP1 ,CADDR1 ,1 )
|
||||
SYSMAP(caddr_t ,CMAP2 ,CADDR2 ,1 )
|
||||
SYSMAP(caddr_t ,mmap ,vmmap ,1 )
|
||||
SYSMAP(caddr_t ,ptmmap ,ptvmmap ,1 )
|
||||
SYSMAP(struct msgbuf * ,msgbufmap ,msgbufp ,1 )
|
||||
virtual_avail = va;
|
||||
#endif
|
||||
@ -530,7 +530,7 @@ static inline void
|
||||
vm_put_pmap(up)
|
||||
struct pmaplist *up;
|
||||
{
|
||||
kmem_free(kernel_map, up, ctob(1));
|
||||
kmem_free(kernel_map, (vm_offset_t)up, ctob(1));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -851,7 +851,7 @@ pmap_remove(pmap, sva, eva)
|
||||
if (pmap_is_managed(pa)) {
|
||||
if ((((int) oldpte & PG_M) && (sva < USRSTACK || sva > UPT_MAX_ADDRESS))
|
||||
|| (sva >= USRSTACK && sva < USRSTACK+(UPAGES*NBPG))) {
|
||||
if (sva < pager_sva || sva >= pager_eva) {
|
||||
if (sva < clean_sva || sva >= clean_eva) {
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
m->flags &= ~PG_CLEAN;
|
||||
}
|
||||
@ -941,7 +941,7 @@ pmap_remove(pmap, sva, eva)
|
||||
|
||||
if ((((int) oldpte & PG_M) && (va < USRSTACK || va > UPT_MAX_ADDRESS))
|
||||
|| (va >= USRSTACK && va < USRSTACK+(UPAGES*NBPG))) {
|
||||
if (va < pager_sva || va >= pager_eva) {
|
||||
if (va < clean_sva || va >= clean_eva ) {
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
m->flags &= ~PG_CLEAN;
|
||||
}
|
||||
@ -1006,7 +1006,7 @@ pmap_remove_all(pa)
|
||||
if ( (m->flags & PG_CLEAN) &&
|
||||
((((int) *pte) & PG_M) && (pv->pv_va < USRSTACK || pv->pv_va > UPT_MAX_ADDRESS))
|
||||
|| (pv->pv_va >= USRSTACK && pv->pv_va < USRSTACK+(UPAGES*NBPG))) {
|
||||
if (pv->pv_va < pager_sva || pv->pv_va >= pager_eva) {
|
||||
if (pv->pv_va < clean_sva || pv->pv_va >= clean_eva) {
|
||||
m->flags &= ~PG_CLEAN;
|
||||
}
|
||||
}
|
||||
@ -1261,7 +1261,11 @@ pmap_enter(pmap, va, pa, prot, wired)
|
||||
if (va < UPT_MIN_ADDRESS)
|
||||
(int) npte |= PG_u;
|
||||
else if (va < UPT_MAX_ADDRESS)
|
||||
(int) npte |= PG_u | PG_RW;
|
||||
(int) npte |= PG_u | PG_RW | PG_NC_PWT;
|
||||
|
||||
/*
|
||||
printf("mapping: pa: %x, to va: %x, with pte: %x\n", pa, va, npte);
|
||||
*/
|
||||
|
||||
if( *pte != npte) {
|
||||
*pte = npte;
|
||||
@ -1414,7 +1418,7 @@ pmap_enter_quick(pmap, va, pa)
|
||||
/*
|
||||
* Now validate mapping with desired protection/wiring.
|
||||
*/
|
||||
*pte = (pt_entry_t) ( (int) (pa | PG_RO | PG_V | PG_u));
|
||||
*pte = (pt_entry_t) ( (int) (pa | PG_V | PG_u));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1448,16 +1452,16 @@ pmap_object_init_pt(pmap, addr, object, offset, size)
|
||||
*/
|
||||
if( size > object->size / 2) {
|
||||
objbytes = size;
|
||||
p = (vm_page_t) queue_first(&object->memq);
|
||||
while (!queue_end(&object->memq, (queue_entry_t) p) && objbytes != 0) {
|
||||
p = object->memq.tqh_first;
|
||||
while ((p != NULL) && (objbytes != 0)) {
|
||||
tmpoff = p->offset;
|
||||
if( tmpoff < offset) {
|
||||
p = (vm_page_t) queue_next(&p->listq);
|
||||
p = p->listq.tqe_next;
|
||||
continue;
|
||||
}
|
||||
tmpoff -= offset;
|
||||
if( tmpoff >= size) {
|
||||
p = (vm_page_t) queue_next(&p->listq);
|
||||
p = p->listq.tqe_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1469,7 +1473,7 @@ pmap_object_init_pt(pmap, addr, object, offset, size)
|
||||
vm_page_unhold(p);
|
||||
pmap_enter_quick(pmap, addr+tmpoff, VM_PAGE_TO_PHYS(p));
|
||||
}
|
||||
p = (vm_page_t) queue_next(&p->listq);
|
||||
p = p->listq.tqe_next;
|
||||
objbytes -= NBPG;
|
||||
}
|
||||
} else {
|
||||
@ -1699,13 +1703,13 @@ pmap_testbit(pa, bit)
|
||||
* ptes as never modified.
|
||||
*/
|
||||
if (bit & PG_U ) {
|
||||
if ((pv->pv_va >= pager_sva) && (pv->pv_va < pager_eva)) {
|
||||
if ((pv->pv_va >= clean_sva) && (pv->pv_va < clean_eva)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (bit & PG_M ) {
|
||||
if (pv->pv_va >= USRSTACK) {
|
||||
if (pv->pv_va >= pager_sva && pv->pv_va < pager_eva) {
|
||||
if (pv->pv_va >= clean_sva && pv->pv_va < clean_eva) {
|
||||
continue;
|
||||
}
|
||||
if (pv->pv_va < USRSTACK+(UPAGES*NBPG)) {
|
||||
@ -1761,7 +1765,7 @@ pmap_changebit(pa, bit, setem)
|
||||
* don't write protect pager mappings
|
||||
*/
|
||||
if (!setem && (bit == PG_RW)) {
|
||||
if (va >= pager_sva && va < pager_eva)
|
||||
if (va >= clean_sva && va < clean_eva)
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1869,6 +1873,10 @@ pmap_phys_address(ppn)
|
||||
/*
|
||||
* Miscellaneous support routines follow
|
||||
*/
|
||||
/*
|
||||
* This really just builds a table for page write enable
|
||||
* translation.
|
||||
*/
|
||||
|
||||
void
|
||||
i386_protection_init()
|
||||
@ -1879,12 +1887,10 @@ i386_protection_init()
|
||||
for (prot = 0; prot < 8; prot++) {
|
||||
switch (prot) {
|
||||
case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE:
|
||||
*kp++ = 0;
|
||||
break;
|
||||
case VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE:
|
||||
case VM_PROT_READ | VM_PROT_NONE | VM_PROT_EXECUTE:
|
||||
case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_EXECUTE:
|
||||
*kp++ = PG_RO;
|
||||
*kp++ = 0;
|
||||
break;
|
||||
case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE:
|
||||
case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE:
|
||||
|
@ -185,6 +185,7 @@ ENTRY(outsl) /* outsl(port, addr, cnt) */
|
||||
* memory moves on standard DX !!!!!
|
||||
*/
|
||||
|
||||
ALTENTRY(blkclr)
|
||||
ENTRY(bzero)
|
||||
#if defined(I486_CPU) && (defined(I386_CPU) || defined(I586_CPU))
|
||||
cmpl $CPUCLASS_486,_cpu_class
|
||||
@ -656,6 +657,17 @@ ENTRY(fuword)
|
||||
movl $0,PCB_ONFAULT(%ecx)
|
||||
ret
|
||||
|
||||
/*
|
||||
* These two routines are called from the profiling code, potentially
|
||||
* at interrupt time. If they fail, that's okay, good things will
|
||||
* happen later. Fail all the time for now - until the trap code is
|
||||
* able to deal with this.
|
||||
*/
|
||||
ALTENTRY(suswintr)
|
||||
ENTRY(fuswintr)
|
||||
movl $-1,%eax
|
||||
ret
|
||||
|
||||
ENTRY(fusword)
|
||||
movl _curpcb,%ecx
|
||||
movl $fusufault,PCB_ONFAULT(%ecx)
|
||||
|
@ -185,6 +185,7 @@ ENTRY(outsl) /* outsl(port, addr, cnt) */
|
||||
* memory moves on standard DX !!!!!
|
||||
*/
|
||||
|
||||
ALTENTRY(blkclr)
|
||||
ENTRY(bzero)
|
||||
#if defined(I486_CPU) && (defined(I386_CPU) || defined(I586_CPU))
|
||||
cmpl $CPUCLASS_486,_cpu_class
|
||||
@ -656,6 +657,17 @@ ENTRY(fuword)
|
||||
movl $0,PCB_ONFAULT(%ecx)
|
||||
ret
|
||||
|
||||
/*
|
||||
* These two routines are called from the profiling code, potentially
|
||||
* at interrupt time. If they fail, that's okay, good things will
|
||||
* happen later. Fail all the time for now - until the trap code is
|
||||
* able to deal with this.
|
||||
*/
|
||||
ALTENTRY(suswintr)
|
||||
ENTRY(fuswintr)
|
||||
movl $-1,%eax
|
||||
ret
|
||||
|
||||
ENTRY(fusword)
|
||||
movl _curpcb,%ecx
|
||||
movl $fusufault,PCB_ONFAULT(%ecx)
|
||||
|
@ -52,9 +52,9 @@
|
||||
/*
|
||||
* The following primitives manipulate the run queues.
|
||||
* _whichqs tells which of the 32 queues _qs
|
||||
* have processes in them. Setrq puts processes into queues, Remrq
|
||||
* have processes in them. setrunqueue puts processes into queues, Remrq
|
||||
* removes them from queues. The running process is on no queue,
|
||||
* other processes are on a queue related to p->p_pri, divided by 4
|
||||
* other processes are on a queue related to p->p_priority, divided by 4
|
||||
* actually to shrink the 0-127 range of priorities into the 32 available
|
||||
* queues.
|
||||
*/
|
||||
@ -72,11 +72,11 @@ _want_resched: .long 0 /* we need to re-run the scheduler */
|
||||
|
||||
.text
|
||||
/*
|
||||
* Setrq(p)
|
||||
* setrunqueue(p)
|
||||
*
|
||||
* Call should be made at spl6(), and p->p_stat should be SRUN
|
||||
*/
|
||||
ENTRY(setrq)
|
||||
ENTRY(setrunqueue)
|
||||
movl 4(%esp),%eax
|
||||
cmpl $0,P_RLINK(%eax) /* should not be on q already */
|
||||
je set1
|
||||
@ -95,7 +95,7 @@ set1:
|
||||
movl %eax,P_LINK(%ecx)
|
||||
ret
|
||||
|
||||
set2: .asciz "setrq"
|
||||
set2: .asciz "setrunqueue"
|
||||
|
||||
/*
|
||||
* Remrq(p)
|
||||
@ -131,10 +131,10 @@ rem2:
|
||||
ret
|
||||
|
||||
rem3: .asciz "remrq"
|
||||
sw0: .asciz "swtch"
|
||||
sw0: .asciz "cpu_switch"
|
||||
|
||||
/*
|
||||
* When no processes are on the runq, swtch() branches to _idle
|
||||
* When no processes are on the runq, cpu_switch() branches to _idle
|
||||
* to wait for something to come ready.
|
||||
*/
|
||||
ALIGN_TEXT
|
||||
@ -146,8 +146,8 @@ _idle:
|
||||
sti
|
||||
|
||||
/*
|
||||
* XXX callers of swtch() do a bogus splclock(). Locking should
|
||||
* be left to swtch().
|
||||
* XXX callers of cpu_switch() do a bogus splclock(). Locking should
|
||||
* be left to cpu_switch().
|
||||
*/
|
||||
movl $SWI_AST_MASK,_cpl
|
||||
testl $~SWI_AST_MASK,_ipending
|
||||
@ -169,9 +169,9 @@ badsw:
|
||||
/*NOTREACHED*/
|
||||
|
||||
/*
|
||||
* Swtch()
|
||||
* cpu_switch()
|
||||
*/
|
||||
ENTRY(swtch)
|
||||
ENTRY(cpu_switch)
|
||||
incl _cnt+V_SWTCH
|
||||
|
||||
/* switch to new process. first, save context as needed */
|
||||
@ -340,7 +340,7 @@ ENTRY(swtch_to_inactive)
|
||||
/*
|
||||
* savectx(pcb, altreturn)
|
||||
* Update pcb, saving current processor state and arranging
|
||||
* for alternate return ala longjmp in swtch if altreturn is true.
|
||||
* for alternate return ala longjmp in cpu_switch if altreturn is true.
|
||||
*/
|
||||
ENTRY(savectx)
|
||||
movl 4(%esp),%ecx
|
||||
|
@ -41,32 +41,33 @@
|
||||
* 386 Trap and System call handleing
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/acct.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/syscall.h>
|
||||
#ifdef KTRACE
|
||||
#include <sys/ktrace.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <vm/vm_map.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
#include <machine/eflags.h>
|
||||
|
||||
#include <machine/trap.h>
|
||||
|
||||
#include "isa.h"
|
||||
#include "npx.h"
|
||||
#include "ddb.h"
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/reg.h"
|
||||
#include "machine/eflags.h"
|
||||
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "acct.h"
|
||||
#include "kernel.h"
|
||||
#ifdef KTRACE
|
||||
#include "ktrace.h"
|
||||
#endif
|
||||
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/pmap.h"
|
||||
#include "vm/vm_map.h"
|
||||
#include "vm/vm_user.h"
|
||||
#include "vm/vm_page.h"
|
||||
#include "sys/vmmeter.h"
|
||||
|
||||
#include "machine/trap.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
@ -84,7 +85,7 @@ void write_gs __P((/* promoted u_short */ int gs));
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
extern int grow(struct proc *,int);
|
||||
extern int grow(struct proc *,u_int);
|
||||
|
||||
struct sysent sysent[];
|
||||
int nsysent;
|
||||
@ -139,7 +140,7 @@ trap(frame)
|
||||
{
|
||||
register int i;
|
||||
register struct proc *p = curproc;
|
||||
struct timeval syst;
|
||||
u_quad_t sticks = 0;
|
||||
int ucode, type, code, eva, fault_type;
|
||||
|
||||
frame.tf_eflags &= ~PSL_NT; /* clear nested trap XXX */
|
||||
@ -177,10 +178,10 @@ trap(frame)
|
||||
return;
|
||||
}
|
||||
|
||||
syst = p->p_stime;
|
||||
if (ISPL(frame.tf_cs) == SEL_UPL) {
|
||||
type |= T_USER;
|
||||
p->p_regs = (int *)&frame;
|
||||
p->p_md.md_regs = (int *)&frame;
|
||||
sticks = p->p_sticks;
|
||||
}
|
||||
|
||||
skiptoswitch:
|
||||
@ -210,9 +211,9 @@ trap(frame)
|
||||
case T_ASTFLT|T_USER: /* Allow process switch */
|
||||
astoff();
|
||||
cnt.v_soft++;
|
||||
if ((p->p_flag & SOWEUPC) && p->p_stats->p_prof.pr_scale) {
|
||||
if ((p->p_flag & P_OWEUPC) && p->p_stats->p_prof.pr_scale) {
|
||||
addupc(frame.tf_eip, &p->p_stats->p_prof, 1);
|
||||
p->p_flag &= ~SOWEUPC;
|
||||
p->p_flag &= ~P_OWEUPC;
|
||||
}
|
||||
goto out;
|
||||
|
||||
@ -284,7 +285,6 @@ trap(frame)
|
||||
else
|
||||
ftype = VM_PROT_READ;
|
||||
|
||||
oldflags = p->p_flag;
|
||||
if (map != kernel_map) {
|
||||
vm_offset_t pa;
|
||||
vm_offset_t v = (vm_offset_t) vtopte(va);
|
||||
@ -294,7 +294,7 @@ trap(frame)
|
||||
* Keep swapout from messing with us during this
|
||||
* critical time.
|
||||
*/
|
||||
p->p_flag |= SLOCK;
|
||||
++p->p_lock;
|
||||
|
||||
/*
|
||||
* Grow the stack if necessary
|
||||
@ -303,8 +303,7 @@ trap(frame)
|
||||
&& (caddr_t)va < (caddr_t)USRSTACK) {
|
||||
if (!grow(p, va)) {
|
||||
rv = KERN_FAILURE;
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
goto nogo;
|
||||
}
|
||||
}
|
||||
@ -332,13 +331,10 @@ trap(frame)
|
||||
if( ptepg->hold_count == 0 && ptepg->wire_count == 0) {
|
||||
pmap_page_protect( VM_PAGE_TO_PHYS(ptepg),
|
||||
VM_PROT_NONE);
|
||||
if( ptepg->flags & PG_CLEAN)
|
||||
vm_page_free(ptepg);
|
||||
vm_page_free(ptepg);
|
||||
}
|
||||
|
||||
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
} else {
|
||||
/*
|
||||
* Since we know that kernel virtual address addresses
|
||||
@ -482,32 +478,29 @@ trap(frame)
|
||||
|
||||
out:
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
p->p_pri = p->p_usrpri;
|
||||
postsig(i);
|
||||
p->p_priority = p->p_usrpri;
|
||||
if (want_resched) {
|
||||
int s;
|
||||
/*
|
||||
* Since we are curproc, clock will normally just change
|
||||
* our priority without moving us from one queue to another
|
||||
* (since the running process is not on a queue.)
|
||||
* If that happened after we setrq ourselves but before we
|
||||
* swtch()'ed, we might not be on the queue indicated by
|
||||
* If that happened after we setrunqueue ourselves but before we
|
||||
* mi_switch()'ed, we might not be on the queue indicated by
|
||||
* our priority.
|
||||
*/
|
||||
s = splclock();
|
||||
setrq(p);
|
||||
setrunqueue(p);
|
||||
p->p_stats->p_ru.ru_nivcsw++;
|
||||
swtch();
|
||||
mi_switch();
|
||||
splx(s);
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
postsig(i);
|
||||
}
|
||||
if (p->p_stats->p_prof.pr_scale) {
|
||||
int ticks;
|
||||
struct timeval *tv = &p->p_stime;
|
||||
u_quad_t ticks = p->p_sticks - sticks;
|
||||
|
||||
ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
|
||||
(tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
|
||||
if (ticks) {
|
||||
#ifdef PROFTIMER
|
||||
extern int profscale;
|
||||
@ -518,7 +511,7 @@ trap(frame)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
curpri = p->p_pri;
|
||||
curpriority = p->p_priority;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -546,14 +539,12 @@ int trapwrite(addr)
|
||||
p = curproc;
|
||||
vm = p->p_vmspace;
|
||||
|
||||
oldflags = p->p_flag;
|
||||
p->p_flag |= SLOCK;
|
||||
++p->p_lock;
|
||||
|
||||
if ((caddr_t)va >= vm->vm_maxsaddr
|
||||
&& (caddr_t)va < (caddr_t)USRSTACK) {
|
||||
if (!grow(p, va)) {
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
@ -579,8 +570,7 @@ int trapwrite(addr)
|
||||
vm_map_pageable(&vm->vm_map, v, round_page(v+1), TRUE);
|
||||
}
|
||||
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
|
||||
if (rv != KERN_SUCCESS)
|
||||
return 1;
|
||||
@ -603,31 +593,45 @@ syscall(frame)
|
||||
register int i;
|
||||
register struct sysent *callp;
|
||||
register struct proc *p = curproc;
|
||||
struct timeval syst;
|
||||
u_quad_t sticks;
|
||||
int error, opc;
|
||||
int args[8], rval[2];
|
||||
int code;
|
||||
u_int code;
|
||||
|
||||
#ifdef lint
|
||||
r0 = 0; r0 = r0; r1 = 0; r1 = r1;
|
||||
#endif
|
||||
syst = p->p_stime;
|
||||
sticks = p->p_sticks;
|
||||
if (ISPL(frame.tf_cs) != SEL_UPL)
|
||||
panic("syscall");
|
||||
|
||||
code = frame.tf_eax;
|
||||
p->p_regs = (int *)&frame;
|
||||
p->p_md.md_regs = (int *)&frame;
|
||||
params = (caddr_t)frame.tf_esp + sizeof (int) ;
|
||||
|
||||
/*
|
||||
* Reconstruct pc, assuming lcall $X,y is 7 bytes, as it is always.
|
||||
*/
|
||||
opc = frame.tf_eip - 7;
|
||||
if (code == 0) {
|
||||
/*
|
||||
* Need to check if this is a 32 bit or 64 bit syscall.
|
||||
*/
|
||||
if (code == SYS_syscall) {
|
||||
/*
|
||||
* Code is first argument, followed by actual args.
|
||||
*/
|
||||
code = fuword(params);
|
||||
params += sizeof (int);
|
||||
} else if (code == SYS___syscall) {
|
||||
/*
|
||||
* Like syscall, but code is a quad, so as to maintain
|
||||
* quad alignment for the rest of the arguments.
|
||||
*/
|
||||
code = fuword(params + _QUAD_LOWWORD * sizeof(int));
|
||||
params += sizeof(quad_t);
|
||||
}
|
||||
if (code < 0 || code >= nsysent)
|
||||
|
||||
if (code >= nsysent)
|
||||
callp = &sysent[0];
|
||||
else
|
||||
callp = &sysent[code];
|
||||
@ -672,32 +676,29 @@ syscall(frame)
|
||||
*/
|
||||
p = curproc;
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
p->p_pri = p->p_usrpri;
|
||||
postsig(i);
|
||||
p->p_priority = p->p_usrpri;
|
||||
if (want_resched) {
|
||||
int s;
|
||||
/*
|
||||
* Since we are curproc, clock will normally just change
|
||||
* our priority without moving us from one queue to another
|
||||
* (since the running process is not on a queue.)
|
||||
* If that happened after we setrq ourselves but before we
|
||||
* If that happened after we setrunqueue ourselves but before we
|
||||
* swtch()'ed, we might not be on the queue indicated by
|
||||
* our priority.
|
||||
*/
|
||||
s = splclock();
|
||||
setrq(p);
|
||||
setrunqueue(p);
|
||||
p->p_stats->p_ru.ru_nivcsw++;
|
||||
swtch();
|
||||
mi_switch();
|
||||
splx(s);
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
postsig(i);
|
||||
}
|
||||
if (p->p_stats->p_prof.pr_scale) {
|
||||
int ticks;
|
||||
struct timeval *tv = &p->p_stime;
|
||||
u_quad_t ticks = p->p_sticks - sticks;
|
||||
|
||||
ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
|
||||
(tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
|
||||
if (ticks) {
|
||||
#ifdef PROFTIMER
|
||||
extern int profscale;
|
||||
@ -708,21 +709,9 @@ syscall(frame)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
curpri = p->p_pri;
|
||||
curpriority = p->p_priority;
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_SYSRET))
|
||||
ktrsysret(p->p_tracep, code, error, rval[0]);
|
||||
#endif
|
||||
#ifdef DIAGNOSTICx
|
||||
{ extern int _udatasel, _ucodesel;
|
||||
if (frame.tf_ss != _udatasel)
|
||||
printf("ss %x call %d\n", frame.tf_ss, code);
|
||||
if ((frame.tf_cs&0xffff) != _ucodesel)
|
||||
printf("cs %x call %d\n", frame.tf_cs, code);
|
||||
if (frame.tf_eip > VM_MAXUSER_ADDRESS) {
|
||||
printf("eip %x call %d\n", frame.tf_eip, code);
|
||||
frame.tf_eip = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "i386/isa/isa.h"
|
||||
#include "i386/isa/rtc.h"
|
||||
#include "i386/isa/timerreg.h"
|
||||
#include <machine/cpu.h>
|
||||
|
||||
/* X-tals being what they are, it's nice to be able to fudge this one... */
|
||||
/* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */
|
||||
@ -71,15 +72,23 @@ static u_int hardclock_divisor;
|
||||
|
||||
|
||||
void
|
||||
timerintr(struct intrframe frame)
|
||||
clkintr(frame)
|
||||
struct clockframe frame;
|
||||
{
|
||||
timer_func(frame);
|
||||
hardclock(&frame);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
timerintr(struct clockframe frame)
|
||||
{
|
||||
timer_func(&frame);
|
||||
switch (timer0_state) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) {
|
||||
hardclock(frame);
|
||||
hardclock(&frame);
|
||||
timer0_prescale = 0;
|
||||
}
|
||||
break;
|
||||
@ -96,7 +105,7 @@ timerintr(struct intrframe frame)
|
||||
break;
|
||||
case 3:
|
||||
if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) {
|
||||
hardclock(frame);
|
||||
hardclock(&frame);
|
||||
disable_intr();
|
||||
outb(TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT);
|
||||
outb(TIMER_CNTR0, TIMER_DIV(hz)%256);
|
||||
@ -111,6 +120,7 @@ timerintr(struct intrframe frame)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
acquire_timer0(int rate, void (*function)() )
|
||||
@ -395,16 +405,6 @@ test_inittodr(time_t base)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Restart the clock.
|
||||
*/
|
||||
void
|
||||
resettodr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Wire clock interrupt in.
|
||||
*/
|
||||
@ -428,3 +428,15 @@ spinwait(int millisecs)
|
||||
{
|
||||
DELAY(1000 * millisecs);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_initclocks()
|
||||
{
|
||||
startrtclock();
|
||||
enablertclock();
|
||||
}
|
||||
|
||||
void
|
||||
setstatclockrate(int newhz)
|
||||
{
|
||||
}
|
||||
|
@ -42,27 +42,21 @@
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "malloc.h"
|
||||
#include "buf.h"
|
||||
#include "user.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include "../include/cpu.h"
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
||||
#define b_cylin b_resid
|
||||
|
||||
#define MAXCLSTATS 256
|
||||
int clstats[MAXCLSTATS];
|
||||
int rqstats[MAXCLSTATS];
|
||||
|
||||
|
||||
#ifndef NOBOUNCE
|
||||
|
||||
caddr_t bouncememory;
|
||||
vm_offset_t bouncepa, bouncepaend;
|
||||
int bouncepages, bpwait;
|
||||
@ -75,7 +69,8 @@ unsigned *bounceallocarray;
|
||||
int bouncefree;
|
||||
|
||||
#define SIXTEENMEG (4096*4096)
|
||||
#define MAXBKVA 1024
|
||||
#define MAXBKVA 512
|
||||
int maxbkva=MAXBKVA*NBPG;
|
||||
|
||||
/* special list that can be used at interrupt time for eventual kva free */
|
||||
struct kvasfree {
|
||||
@ -258,6 +253,7 @@ int count;
|
||||
pa = vm_bounce_page_find(1);
|
||||
pmap_kenter(kva + i * NBPG, pa);
|
||||
}
|
||||
pmap_update();
|
||||
return kva;
|
||||
}
|
||||
|
||||
@ -309,8 +305,8 @@ vm_bounce_alloc(bp)
|
||||
bp->b_bufsize = bp->b_bcount;
|
||||
}
|
||||
|
||||
vastart = (vm_offset_t) bp->b_un.b_addr;
|
||||
vaend = (vm_offset_t) bp->b_un.b_addr + bp->b_bufsize;
|
||||
vastart = (vm_offset_t) bp->b_data;
|
||||
vaend = (vm_offset_t) bp->b_data + bp->b_bufsize;
|
||||
|
||||
vapstart = i386_trunc_page(vastart);
|
||||
vapend = i386_round_page(vaend);
|
||||
@ -369,11 +365,11 @@ vm_bounce_alloc(bp)
|
||||
/*
|
||||
* save the original buffer kva
|
||||
*/
|
||||
bp->b_savekva = bp->b_un.b_addr;
|
||||
bp->b_savekva = bp->b_data;
|
||||
/*
|
||||
* put our new kva into the buffer (offset by original offset)
|
||||
*/
|
||||
bp->b_un.b_addr = (caddr_t) (((vm_offset_t) kva) |
|
||||
bp->b_data = (caddr_t) (((vm_offset_t) kva) |
|
||||
((vm_offset_t) bp->b_savekva & (NBPG - 1)));
|
||||
return;
|
||||
}
|
||||
@ -403,7 +399,7 @@ vm_bounce_free(bp)
|
||||
return;
|
||||
|
||||
origkva = (vm_offset_t) bp->b_savekva;
|
||||
bouncekva = (vm_offset_t) bp->b_un.b_addr;
|
||||
bouncekva = (vm_offset_t) bp->b_data;
|
||||
|
||||
vastart = bouncekva;
|
||||
vaend = bouncekva + bp->b_bufsize;
|
||||
@ -449,17 +445,15 @@ vm_bounce_free(bp)
|
||||
/*
|
||||
* add the old kva into the "to free" list
|
||||
*/
|
||||
bouncekva = i386_trunc_page((vm_offset_t) bp->b_un.b_addr);
|
||||
bouncekva = i386_trunc_page((vm_offset_t) bp->b_data);
|
||||
vm_bounce_kva_free( bouncekva, countvmpg*NBPG, 0);
|
||||
bp->b_un.b_addr = bp->b_savekva;
|
||||
bp->b_data = bp->b_savekva;
|
||||
bp->b_savekva = 0;
|
||||
bp->b_flags &= ~B_BOUNCE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* NOBOUNCE */
|
||||
|
||||
/*
|
||||
* init the bounce buffer system
|
||||
*/
|
||||
@ -468,10 +462,8 @@ vm_bounce_init()
|
||||
{
|
||||
vm_offset_t minaddr, maxaddr;
|
||||
|
||||
io_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, MAXBKVA * NBPG, FALSE);
|
||||
kvasfreecnt = 0;
|
||||
|
||||
#ifndef NOBOUNCE
|
||||
if (bouncepages == 0)
|
||||
return;
|
||||
|
||||
@ -487,11 +479,10 @@ vm_bounce_init()
|
||||
bouncepa = pmap_kextract((vm_offset_t) bouncememory);
|
||||
bouncepaend = bouncepa + bouncepages * NBPG;
|
||||
bouncefree = bouncepages;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef BROKEN_IN_44
|
||||
static void
|
||||
cldiskvamerge( kvanew, orig1, orig1cnt, orig2, orig2cnt)
|
||||
vm_offset_t kvanew;
|
||||
@ -827,6 +818,7 @@ cldisksort(struct buf *dp, struct buf *bp, vm_offset_t maxio)
|
||||
ap->av_forw = bp;
|
||||
bp->av_back = ap;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* quick version of vm_fault
|
||||
@ -881,7 +873,7 @@ cpu_fork(p1, p2)
|
||||
offset = mvesp() - (int)kstack;
|
||||
bcopy((caddr_t)kstack + offset, (caddr_t)p2->p_addr + offset,
|
||||
(unsigned) ctob(UPAGES) - offset);
|
||||
p2->p_regs = p1->p_regs;
|
||||
p2->p_md.md_regs = p1->p_md.md_regs;
|
||||
|
||||
/*
|
||||
* Wire top of address space of child to it's kstack.
|
||||
@ -930,7 +922,7 @@ cpu_fork(p1, p2)
|
||||
*
|
||||
* Next, we assign a dummy context to be written over by swtch,
|
||||
* calling it to send this process off to oblivion.
|
||||
* [The nullpcb allows us to minimize cost in swtch() by not having
|
||||
* [The nullpcb allows us to minimize cost in mi_switch() by not having
|
||||
* a special case].
|
||||
*/
|
||||
struct proc *swtch_to_inactive();
|
||||
@ -952,8 +944,7 @@ cpu_exit(p)
|
||||
kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
|
||||
|
||||
p->p_addr = (struct user *) &nullpcb;
|
||||
splclock();
|
||||
swtch();
|
||||
mi_switch();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#else
|
||||
@ -965,9 +956,8 @@ cpu_exit(p)
|
||||
#if NNPX > 0
|
||||
npxexit(p);
|
||||
#endif /* NNPX */
|
||||
splclock();
|
||||
curproc = 0;
|
||||
swtch();
|
||||
curproc = p;
|
||||
mi_switch();
|
||||
/*
|
||||
* This is to shutup the compiler, and if swtch() failed I suppose
|
||||
* this would be a good thing. This keeps gcc happy because panic
|
||||
@ -989,6 +979,21 @@ cpu_wait(p) struct proc *p; {
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dump the machine specific header information at the start of a core dump.
|
||||
*/
|
||||
int
|
||||
cpu_coredump(p, vp, cred)
|
||||
struct proc *p;
|
||||
struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
{
|
||||
|
||||
return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, ctob(UPAGES),
|
||||
(off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *)NULL,
|
||||
p));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a red zone in the kernel stack after the u. area.
|
||||
*/
|
||||
@ -1007,6 +1012,43 @@ setredzone(pte, vaddr)
|
||||
and take the dump while still in mapped mode */
|
||||
}
|
||||
|
||||
/*
|
||||
* Move pages from one kernel virtual address to another.
|
||||
* Both addresses are assumed to reside in the Sysmap,
|
||||
* and size must be a multiple of CLSIZE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Move pages from one kernel virtual address to another.
|
||||
* Both addresses are assumed to reside in the Sysmap,
|
||||
* and size must be a multiple of CLSIZE.
|
||||
*/
|
||||
|
||||
void
|
||||
pagemove(from, to, size)
|
||||
register caddr_t from, to;
|
||||
int size;
|
||||
{
|
||||
register vm_offset_t pa;
|
||||
|
||||
if (size & CLOFSET)
|
||||
panic("pagemove");
|
||||
while (size > 0) {
|
||||
pa = pmap_kextract((vm_offset_t)from);
|
||||
if (pa == 0)
|
||||
panic("pagemove 2");
|
||||
if (pmap_kextract((vm_offset_t)to) != 0)
|
||||
panic("pagemove 3");
|
||||
pmap_remove(kernel_pmap,
|
||||
(vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE);
|
||||
pmap_kenter( (vm_offset_t)to, pa);
|
||||
from += PAGE_SIZE;
|
||||
to += PAGE_SIZE;
|
||||
size -= PAGE_SIZE;
|
||||
}
|
||||
pmap_update();
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert kernel VA to physical address
|
||||
*/
|
||||
@ -1036,22 +1078,49 @@ vmapbuf(bp)
|
||||
{
|
||||
register int npf;
|
||||
register caddr_t addr;
|
||||
register long flags = bp->b_flags;
|
||||
struct proc *p;
|
||||
int off;
|
||||
vm_offset_t kva;
|
||||
register vm_offset_t pa;
|
||||
vm_offset_t pa, lastv, v;
|
||||
|
||||
if ((flags & B_PHYS) == 0)
|
||||
if ((bp->b_flags & B_PHYS) == 0)
|
||||
panic("vmapbuf");
|
||||
|
||||
lastv = 0;
|
||||
for (addr = (caddr_t)trunc_page(bp->b_data);
|
||||
addr < bp->b_data + bp->b_bufsize;
|
||||
addr += PAGE_SIZE) {
|
||||
|
||||
/*
|
||||
* make sure that the pde is valid and held
|
||||
*/
|
||||
v = trunc_page(((vm_offset_t)vtopte(addr)));
|
||||
if (v != lastv) {
|
||||
vm_fault_quick(v, VM_PROT_READ);
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, v);
|
||||
vm_page_hold(PHYS_TO_VM_PAGE(pa));
|
||||
lastv = v;
|
||||
}
|
||||
|
||||
/*
|
||||
* do the vm_fault if needed, do the copy-on-write thing when
|
||||
* reading stuff off device into memory.
|
||||
*/
|
||||
vm_fault_quick(addr,
|
||||
(bp->b_flags&B_READ)?(VM_PROT_READ|VM_PROT_WRITE):VM_PROT_READ);
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, (vm_offset_t) addr);
|
||||
/*
|
||||
* hold the data page
|
||||
*/
|
||||
vm_page_hold(PHYS_TO_VM_PAGE(pa));
|
||||
}
|
||||
|
||||
addr = bp->b_saveaddr = bp->b_un.b_addr;
|
||||
off = (int)addr & PGOFSET;
|
||||
p = bp->b_proc;
|
||||
npf = btoc(round_page(bp->b_bufsize + off));
|
||||
kva = kmem_alloc_wait(phys_map, ctob(npf));
|
||||
bp->b_un.b_addr = (caddr_t) (kva + off);
|
||||
while (npf--) {
|
||||
pa = pmap_extract(&p->p_vmspace->vm_pmap, (vm_offset_t)addr);
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, (vm_offset_t)addr);
|
||||
if (pa == 0)
|
||||
panic("vmapbuf: null page frame");
|
||||
pmap_kenter(kva, trunc_page(pa));
|
||||
@ -1071,7 +1140,7 @@ vunmapbuf(bp)
|
||||
{
|
||||
register int npf;
|
||||
register caddr_t addr = bp->b_un.b_addr;
|
||||
vm_offset_t kva;
|
||||
vm_offset_t kva,va,v,lastv,pa;
|
||||
|
||||
if ((bp->b_flags & B_PHYS) == 0)
|
||||
panic("vunmapbuf");
|
||||
@ -1080,6 +1149,32 @@ vunmapbuf(bp)
|
||||
kmem_free_wakeup(phys_map, kva, ctob(npf));
|
||||
bp->b_un.b_addr = bp->b_saveaddr;
|
||||
bp->b_saveaddr = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* unhold the pde, and data pages
|
||||
*/
|
||||
lastv = 0;
|
||||
for (addr = (caddr_t)trunc_page(bp->b_data);
|
||||
addr < bp->b_data + bp->b_bufsize;
|
||||
addr += NBPG) {
|
||||
|
||||
/*
|
||||
* release the data page
|
||||
*/
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, (vm_offset_t) addr);
|
||||
vm_page_unhold(PHYS_TO_VM_PAGE(pa));
|
||||
|
||||
/*
|
||||
* and unhold the page table
|
||||
*/
|
||||
v = trunc_page(((vm_offset_t)vtopte(addr)));
|
||||
if (v != lastv) {
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, v);
|
||||
vm_page_unhold(PHYS_TO_VM_PAGE(pa));
|
||||
lastv = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1104,7 +1199,7 @@ cpu_reset() {
|
||||
int
|
||||
grow(p, sp)
|
||||
struct proc *p;
|
||||
int sp;
|
||||
u_int sp;
|
||||
{
|
||||
unsigned int nss;
|
||||
caddr_t v;
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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 *));
|
||||
|
@ -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). */
|
||||
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 */
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
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 */
|
||||
struct exec {
|
||||
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_ */
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
|
@ -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*/
|
||||
};
|
||||
#include <machine/pte.h>
|
||||
|
||||
#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) */
|
||||
|
||||
/* 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
|
||||
|
@ -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 */
|
||||
|
@ -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_ */
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -173,20 +173,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
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "i386/isa/isa.h"
|
||||
#include "i386/isa/rtc.h"
|
||||
#include "i386/isa/timerreg.h"
|
||||
#include <machine/cpu.h>
|
||||
|
||||
/* X-tals being what they are, it's nice to be able to fudge this one... */
|
||||
/* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */
|
||||
@ -71,15 +72,23 @@ static u_int hardclock_divisor;
|
||||
|
||||
|
||||
void
|
||||
timerintr(struct intrframe frame)
|
||||
clkintr(frame)
|
||||
struct clockframe frame;
|
||||
{
|
||||
timer_func(frame);
|
||||
hardclock(&frame);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
timerintr(struct clockframe frame)
|
||||
{
|
||||
timer_func(&frame);
|
||||
switch (timer0_state) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) {
|
||||
hardclock(frame);
|
||||
hardclock(&frame);
|
||||
timer0_prescale = 0;
|
||||
}
|
||||
break;
|
||||
@ -96,7 +105,7 @@ timerintr(struct intrframe frame)
|
||||
break;
|
||||
case 3:
|
||||
if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) {
|
||||
hardclock(frame);
|
||||
hardclock(&frame);
|
||||
disable_intr();
|
||||
outb(TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT);
|
||||
outb(TIMER_CNTR0, TIMER_DIV(hz)%256);
|
||||
@ -111,6 +120,7 @@ timerintr(struct intrframe frame)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
acquire_timer0(int rate, void (*function)() )
|
||||
@ -395,16 +405,6 @@ test_inittodr(time_t base)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Restart the clock.
|
||||
*/
|
||||
void
|
||||
resettodr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Wire clock interrupt in.
|
||||
*/
|
||||
@ -428,3 +428,15 @@ spinwait(int millisecs)
|
||||
{
|
||||
DELAY(1000 * millisecs);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_initclocks()
|
||||
{
|
||||
startrtclock();
|
||||
enablertclock();
|
||||
}
|
||||
|
||||
void
|
||||
setstatclockrate(int newhz)
|
||||
{
|
||||
}
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include "rlist.h"
|
||||
#include "machine/segments.h"
|
||||
#include "vm/vm.h"
|
||||
#include <machine/spl.h>
|
||||
#include "i386/isa/isa_device.h"
|
||||
#include "i386/isa/isa.h"
|
||||
#include "i386/isa/icu.h"
|
||||
|
@ -438,7 +438,7 @@ npxintr(frame)
|
||||
* in doreti, and the frame for that could easily be set up
|
||||
* just before it is used).
|
||||
*/
|
||||
curproc->p_regs = (int *)&frame.if_es;
|
||||
curproc->p_md.md_regs = (int *)&frame.if_es;
|
||||
#ifdef notyet
|
||||
/*
|
||||
* Encode the appropriate code for detailed information on
|
||||
|
@ -39,7 +39,6 @@ CWARNFLAGS=-W -Wreturn-type -Wcomment
|
||||
# of material assistance.
|
||||
#
|
||||
COPTFLAGS=-O
|
||||
COPTFLAGS+=-D__FreeBSD__
|
||||
INCLUDES= -I. -I$S -I$S/sys
|
||||
COPTS= ${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
|
||||
ASFLAGS=
|
||||
@ -52,10 +51,10 @@ NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
|
||||
DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
|
||||
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
|
||||
SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
|
||||
ioconf.o conf.o machdep.o
|
||||
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
|
||||
ioconf.o conf.o machdep.o vnode_if.o
|
||||
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
|
||||
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
|
||||
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
|
||||
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
|
||||
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
|
||||
${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
|
||||
|
||||
@ -74,6 +73,13 @@ PROFILE_C= ${CC} -S -c ${CFLAGS} $< ; \
|
||||
|
||||
%LOAD
|
||||
|
||||
libkern.a:
|
||||
-@if [ X${PROF} = X ]; \
|
||||
then ln -s $S/libkern/obj/libkern.a libkern.a; \
|
||||
else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
|
||||
fi; \
|
||||
echo ln -s $S/libkern/obj/libkern.a libkern.a
|
||||
|
||||
clean:
|
||||
rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
|
||||
errs linterrs makelinks genassym ,assym.s stamp-assym
|
||||
@ -140,7 +146,7 @@ genassym: Makefile
|
||||
${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
|
||||
${I386}/i386/genassym.c -static -o genassym
|
||||
|
||||
depend: assym.s param.c
|
||||
depend: assym.s param.c vnode_if.h
|
||||
sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
|
||||
sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
|
||||
|
||||
@ -173,6 +179,11 @@ vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
|
||||
sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
|
||||
${CC} ${CFLAGS} -c vers.c
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
|
||||
%RULES
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend uses it
|
||||
|
@ -39,7 +39,6 @@ CWARNFLAGS=-W -Wreturn-type -Wcomment
|
||||
# of material assistance.
|
||||
#
|
||||
COPTFLAGS=-O
|
||||
COPTFLAGS+=-D__FreeBSD__
|
||||
INCLUDES= -I. -I$S -I$S/sys
|
||||
COPTS= ${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
|
||||
ASFLAGS=
|
||||
@ -52,10 +51,10 @@ NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
|
||||
DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
|
||||
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
|
||||
SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
|
||||
ioconf.o conf.o machdep.o
|
||||
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
|
||||
ioconf.o conf.o machdep.o vnode_if.o
|
||||
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
|
||||
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
|
||||
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
|
||||
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
|
||||
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
|
||||
${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
|
||||
|
||||
@ -74,6 +73,13 @@ PROFILE_C= ${CC} -S -c ${CFLAGS} $< ; \
|
||||
|
||||
%LOAD
|
||||
|
||||
libkern.a:
|
||||
-@if [ X${PROF} = X ]; \
|
||||
then ln -s $S/libkern/obj/libkern.a libkern.a; \
|
||||
else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
|
||||
fi; \
|
||||
echo ln -s $S/libkern/obj/libkern.a libkern.a
|
||||
|
||||
clean:
|
||||
rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
|
||||
errs linterrs makelinks genassym ,assym.s stamp-assym
|
||||
@ -140,7 +146,7 @@ genassym: Makefile
|
||||
${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
|
||||
${I386}/i386/genassym.c -static -o genassym
|
||||
|
||||
depend: assym.s param.c
|
||||
depend: assym.s param.c vnode_if.h
|
||||
sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
|
||||
sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
|
||||
|
||||
@ -173,6 +179,11 @@ vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
|
||||
sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
|
||||
${CC} ${CFLAGS} -c vers.c
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
|
||||
%RULES
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend uses it
|
||||
|
@ -1,3 +1,19 @@
|
||||
ddb/db_access.c optional ddb
|
||||
ddb/db_aout.c optional ddb
|
||||
ddb/db_break.c optional ddb
|
||||
ddb/db_command.c optional ddb
|
||||
ddb/db_examine.c optional ddb
|
||||
ddb/db_expr.c optional ddb
|
||||
ddb/db_input.c optional ddb
|
||||
ddb/db_lex.c optional ddb
|
||||
ddb/db_output.c optional ddb
|
||||
ddb/db_print.c optional ddb
|
||||
ddb/db_run.c optional ddb
|
||||
ddb/db_sym.c optional ddb
|
||||
ddb/db_trap.c optional ddb
|
||||
ddb/db_variables.c optional ddb
|
||||
ddb/db_watch.c optional ddb
|
||||
ddb/db_write_cmd.c optional ddb
|
||||
isofs/cd9660/cd9660_bmap.c optional cd9660
|
||||
isofs/cd9660/cd9660_lookup.c optional cd9660
|
||||
isofs/cd9660/cd9660_node.c optional cd9660
|
||||
@ -18,6 +34,8 @@ kdb/kdb_print.c optional kadb
|
||||
kdb/kdb_runpcs.c optional kadb
|
||||
kdb/kdb_sym.c optional kadb
|
||||
kdb/kdb_trap.c optional kadb
|
||||
kern/imgact_aout.c standard
|
||||
kern/imgact_shell.c standard
|
||||
kern/init_main.c standard
|
||||
kern/init_sysent.c standard
|
||||
kern/kern_acct.c standard
|
||||
@ -41,6 +59,7 @@ kern/kern_xxx.c standard
|
||||
kern/subr_log.c standard
|
||||
kern/subr_prf.c standard
|
||||
kern/subr_prof.c standard
|
||||
kern/subr_rlist.c standard
|
||||
kern/subr_rmap.c standard
|
||||
kern/subr_xxx.c standard
|
||||
kern/sys_generic.c standard
|
||||
@ -218,6 +237,15 @@ nfs/nfs_subs.c optional nfs
|
||||
nfs/nfs_syscalls.c optional nfs
|
||||
nfs/nfs_vfsops.c optional nfs
|
||||
nfs/nfs_vnops.c optional nfs
|
||||
scsi/cd.c optional cd
|
||||
scsi/ch.c optional ch
|
||||
scsi/scsiconf.c optional scbus
|
||||
scsi/scsi_base.c optional scbus
|
||||
scsi/scsi_ioctl.c optional scbus
|
||||
scsi/sd.c optional sd
|
||||
scsi/st.c optional st
|
||||
scsi/su.c optional su
|
||||
scsi/uk.c optional uk
|
||||
ufs/ffs/ffs_alloc.c optional ffs
|
||||
ufs/ffs/ffs_alloc.c optional mfs
|
||||
ufs/ffs/ffs_balloc.c optional ffs
|
||||
@ -254,9 +282,9 @@ ufs/ufs/ufs_lookup.c standard
|
||||
ufs/ufs/ufs_quota.c standard
|
||||
ufs/ufs/ufs_vfsops.c standard
|
||||
ufs/ufs/ufs_vnops.c standard
|
||||
vm/device_pager.c optional devpager
|
||||
vm/device_pager.c standard
|
||||
vm/kern_lock.c standard
|
||||
vm/swap_pager.c optional swappager
|
||||
vm/swap_pager.c standard
|
||||
vm/vm_fault.c standard
|
||||
vm/vm_glue.c standard
|
||||
vm/vm_init.c standard
|
||||
@ -271,4 +299,4 @@ vm/vm_pager.c standard
|
||||
vm/vm_swap.c standard
|
||||
vm/vm_unix.c standard
|
||||
vm/vm_user.c standard
|
||||
vm/vnode_pager.c optional vnodepager
|
||||
vm/vnode_pager.c standard
|
||||
|
@ -14,6 +14,7 @@ i386/i386/mem.c standard
|
||||
i386/i386/microtime.s standard
|
||||
i386/i386/ns_cksum.c optional ns
|
||||
i386/i386/pmap.c standard
|
||||
i386/i386/procfs_machdep.c optional procfs
|
||||
i386/i386/sys_machdep.c standard
|
||||
i386/i386/trap.c standard
|
||||
i386/i386/vm_machdep.c standard
|
||||
|
@ -40,9 +40,9 @@ fi
|
||||
|
||||
touch version
|
||||
v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date`
|
||||
echo "char ostype[] = \"4.4BSD\";" > vers.c
|
||||
echo "char osrelease[] = \"4.4BSD-Lite\";" >> vers.c
|
||||
echo "char ostype[] = \"FreeBSD\";" > vers.c
|
||||
echo "char osrelease[] = \"2.0.0 (Development)\";" >> vers.c
|
||||
echo "char sccs[4] = { '@', '(', '#', ')' };" >>vers.c
|
||||
echo "char version[] = \"4.4BSD-Lite #${v}: ${t}\\n ${u}@${h}:${d}\\n\";" >>vers.c
|
||||
echo "char version[] = \"FreeBSD 2.0.0 (Development) #${v}: ${t}\\n ${u}@${h}:${d}\\n\";" >>vers.c
|
||||
|
||||
echo `expr ${v} + 1` > version
|
||||
|
@ -75,7 +75,8 @@ int tickadj = 30000 / (60 * HZ); /* can adjust 30ms in 60s */
|
||||
struct timezone tz = { TIMEZONE, DST };
|
||||
#define NPROC (20 + 16 * MAXUSERS)
|
||||
int maxproc = NPROC;
|
||||
#define NTEXT (80 + NPROC / 8) /* actually the object cache */
|
||||
#define NTEXT NPROC
|
||||
int vm_cache_max = NTEXT/2 + 16;
|
||||
#define NVNODE (NPROC + NTEXT + 100)
|
||||
int desiredvnodes = NVNODE;
|
||||
int maxfiles = 3 * (NPROC + MAXUSERS) + 80;
|
||||
|
@ -307,15 +307,15 @@ extern void db_listbreak_cmd();
|
||||
extern void db_listwatch_cmd();
|
||||
extern void db_show_regs(), db_show_one_thread(), db_show_all_threads();
|
||||
extern void vm_map_print(), vm_object_print(), vm_page_print();
|
||||
extern void db_ps();
|
||||
/* extern void db_ps(); */
|
||||
extern void ipc_port_print();
|
||||
void db_show_help();
|
||||
|
||||
struct command db_show_all_cmds[] = {
|
||||
#if 0
|
||||
{ "threads", db_show_all_threads, 0, 0 },
|
||||
#endif
|
||||
{ "procs", db_ps, 0, 0 },
|
||||
#endif
|
||||
{ (char *)0 }
|
||||
};
|
||||
|
||||
@ -372,7 +372,9 @@ struct command db_command_table[] = {
|
||||
{ "trace", db_stack_trace_cmd, 0, 0 },
|
||||
{ "call", db_fncall, CS_OWN, 0 },
|
||||
{ "show", 0, 0, db_show_cmds },
|
||||
#if 0
|
||||
{ "ps", db_ps, 0, 0 },
|
||||
#endif
|
||||
{ (char *)0, }
|
||||
};
|
||||
|
||||
|
@ -37,7 +37,8 @@
|
||||
#ifndef __h_ddb_ddb
|
||||
#define __h_ddb_ddb 1
|
||||
|
||||
#include "machine/db_machdep.h" /* type definitions */
|
||||
#include <machine/db_machdep.h> /* type definitions */
|
||||
#include <vm/vm.h>
|
||||
|
||||
/*
|
||||
* Global variables...
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
/* For backwards compatibility */
|
||||
#ifndef IFF_ALTPHYS
|
||||
#define IFF_ALTPHYS IFF_LLC0
|
||||
#define IFF_ALTPHYS IFF_LINK0
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -113,7 +113,7 @@ void edintr(int);
|
||||
int ed_ioctl(struct ifnet *, int, caddr_t);
|
||||
int ed_probe(struct isa_device *);
|
||||
void ed_start(struct ifnet *);
|
||||
void ed_reset(int, int);
|
||||
void ed_reset(int);
|
||||
void ed_watchdog(int);
|
||||
|
||||
static void ed_get_packet(struct ed_softc *, char *, int /*u_short*/);
|
||||
@ -1090,9 +1090,8 @@ ed_attach(isa_dev)
|
||||
* Reset interface.
|
||||
*/
|
||||
void
|
||||
ed_reset(unit, uban)
|
||||
ed_reset(unit)
|
||||
int unit;
|
||||
int uban; /* XXX */
|
||||
{
|
||||
int s;
|
||||
|
||||
@ -1147,7 +1146,7 @@ ed_watchdog(unit)
|
||||
log(LOG_ERR, "ed%d: device timeout\n", unit);
|
||||
++sc->arpcom.ac_if.if_oerrors;
|
||||
|
||||
ed_reset(unit, 0);
|
||||
ed_reset(unit);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1501,7 +1500,7 @@ ed_start(ifp)
|
||||
len = ed_pio_write_mbufs(sc, m, buffer);
|
||||
}
|
||||
|
||||
sc->txb_len[sc->txb_new] = MAX(len, ETHER_MIN_LEN);
|
||||
sc->txb_len[sc->txb_new] = max(len, ETHER_MIN_LEN);
|
||||
|
||||
sc->txb_inuse++;
|
||||
|
||||
@ -1652,7 +1651,7 @@ ed_rint(unit)
|
||||
"ed%d: NIC memory corrupt - invalid packet length %d\n",
|
||||
unit, len);
|
||||
++sc->arpcom.ac_if.if_ierrors;
|
||||
ed_reset(unit, 0);
|
||||
ed_reset(unit);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1817,7 +1816,7 @@ edintr(unit)
|
||||
/*
|
||||
* Stop/reset/re-init NIC
|
||||
*/
|
||||
ed_reset(unit, 0);
|
||||
ed_reset(unit);
|
||||
} else {
|
||||
|
||||
/*
|
||||
@ -2388,7 +2387,7 @@ ed_pio_write_mbufs(sc,m,dst)
|
||||
if (!maxwait) {
|
||||
log(LOG_WARNING, "ed%d: remote transmit DMA failed to complete\n",
|
||||
sc->arpcom.ac_if.if_unit);
|
||||
ed_reset(sc->arpcom.ac_if.if_unit, 0);
|
||||
ed_reset(sc->arpcom.ac_if.if_unit);
|
||||
}
|
||||
|
||||
return(len);
|
||||
|
@ -99,7 +99,7 @@ static int epioctl __P((struct ifnet * ifp, int, caddr_t));
|
||||
|
||||
void epinit __P((int));
|
||||
void epintr __P((int));
|
||||
void epmbuffill __P((caddr_t, int));
|
||||
void epmbuffill __P((caddr_t));
|
||||
void epmbufempty __P((struct ep_softc *));
|
||||
void epread __P((struct ep_softc *));
|
||||
void epreset __P((int));
|
||||
@ -953,9 +953,8 @@ is_eeprom_busy(is)
|
||||
}
|
||||
|
||||
void
|
||||
epmbuffill(sp, dummy_arg)
|
||||
epmbuffill(sp)
|
||||
caddr_t sp;
|
||||
int dummy_arg;
|
||||
{
|
||||
struct ep_softc *sc = (struct ep_softc *)sp;
|
||||
int s, i;
|
||||
|
@ -199,7 +199,7 @@ int fd_debug = 1;
|
||||
|
||||
static void fdstart(fdcu_t);
|
||||
void fdintr(fdcu_t);
|
||||
static void fd_turnoff(caddr_t, int);
|
||||
static void fd_turnoff(caddr_t);
|
||||
|
||||
/****************************************************************************/
|
||||
/* autoconfiguration stuff */
|
||||
@ -347,7 +347,7 @@ fdattach(dev)
|
||||
break;
|
||||
}
|
||||
|
||||
fd_turnoff((caddr_t)fdu, 0);
|
||||
fd_turnoff((caddr_t)fdu);
|
||||
hdr = 1;
|
||||
}
|
||||
printf("\n");
|
||||
@ -417,7 +417,7 @@ void fdstrategy(struct buf *bp)
|
||||
dp = &(fdc->head);
|
||||
s = splbio();
|
||||
disksort(dp, bp);
|
||||
untimeout(fd_turnoff, (caddr_t)fdu); /* a good idea */
|
||||
untimeout((timeout_func_t)fd_turnoff, (caddr_t)fdu); /* a good idea */
|
||||
fdstart(fdcu);
|
||||
splx(s);
|
||||
return;
|
||||
@ -463,7 +463,7 @@ set_motor(fdcu, fdu, reset)
|
||||
}
|
||||
|
||||
static void
|
||||
fd_turnoff(caddr_t arg1, int arg2)
|
||||
fd_turnoff(caddr_t arg1)
|
||||
{
|
||||
fdu_t fdu = (fdu_t)arg1;
|
||||
int s;
|
||||
@ -476,7 +476,7 @@ fd_turnoff(caddr_t arg1, int arg2)
|
||||
}
|
||||
|
||||
void
|
||||
fd_motor_on(caddr_t arg1, int arg2)
|
||||
fd_motor_on(caddr_t arg1)
|
||||
{
|
||||
fdu_t fdu = (fdu_t)arg1;
|
||||
int s;
|
||||
@ -502,7 +502,7 @@ fd_turnon(fdu)
|
||||
{
|
||||
fd_turnon1(fdu);
|
||||
fd->flags |= FD_MOTOR_WAIT;
|
||||
timeout(fd_motor_on, (caddr_t)fdu, hz); /* in 1 sec its ok */
|
||||
timeout((timeout_func_t)fd_motor_on, (caddr_t)fdu, hz); /* in 1 sec its ok */
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ fdstart(fdcu)
|
||||
}
|
||||
|
||||
static void
|
||||
fd_timeout(caddr_t arg1, int arg2)
|
||||
fd_timeout(caddr_t arg1)
|
||||
{
|
||||
fdcu_t fdcu = (fdcu_t)arg1;
|
||||
fdu_t fdu = fdc_data[fdcu].fdu;
|
||||
@ -809,8 +809,8 @@ fdstate(fdcu, fdc)
|
||||
TRACE1("fd%d",fdu);
|
||||
TRACE1("[%s]",fdstates[fdc->state]);
|
||||
TRACE1("(0x%x)",fd->flags);
|
||||
untimeout(fd_turnoff, (caddr_t)fdu);
|
||||
timeout(fd_turnoff, (caddr_t)fdu, 4 * hz);
|
||||
untimeout((timeout_func_t)fd_turnoff, (caddr_t)fdu);
|
||||
timeout((timeout_func_t)fd_turnoff, (caddr_t)fdu, 4 * hz);
|
||||
switch (fdc->state)
|
||||
{
|
||||
case DEVIDLE:
|
||||
@ -855,12 +855,12 @@ fdstate(fdcu, fdc)
|
||||
out_fdc(fdcu,bp->b_cylin * fd->ft->steptrac);
|
||||
fd->track = -2;
|
||||
fdc->state = SEEKWAIT;
|
||||
timeout(fd_timeout, (caddr_t)fdcu, 2 * hz);
|
||||
timeout((timeout_func_t)fd_timeout, (caddr_t)fdcu, 2 * hz);
|
||||
return(0); /* will return later */
|
||||
case SEEKWAIT:
|
||||
untimeout(fd_timeout, (caddr_t)fdcu);
|
||||
untimeout((timeout_func_t)fd_timeout, (caddr_t)fdcu);
|
||||
/* allow heads to settle */
|
||||
timeout(fd_pseudointr, (caddr_t)fdcu, hz / 50);
|
||||
timeout((timeout_func_t)fd_pseudointr, (caddr_t)fdcu, hz / 50);
|
||||
fdc->state = SEEKCOMPLETE;
|
||||
return(0); /* will return later */
|
||||
break;
|
||||
@ -925,10 +925,10 @@ fdstate(fdcu, fdc)
|
||||
out_fdc(fdcu,fd->ft->datalen); /* data length */
|
||||
}
|
||||
fdc->state = IOCOMPLETE;
|
||||
timeout(fd_timeout, (caddr_t)fdcu, 2 * hz);
|
||||
timeout((timeout_func_t)fd_timeout, (caddr_t)fdcu, 2 * hz);
|
||||
return(0); /* will return later */
|
||||
case IOCOMPLETE: /* IO DONE, post-analyze */
|
||||
untimeout(fd_timeout, (caddr_t)fdcu);
|
||||
untimeout((timeout_func_t)fd_timeout, (caddr_t)fdcu);
|
||||
for(i=0;i<7;i++)
|
||||
{
|
||||
fdc->status[i] = in_fdc(fdcu);
|
||||
@ -964,7 +964,7 @@ fdstate(fdcu, fdc)
|
||||
/* ALL DONE */
|
||||
fd->skip = 0;
|
||||
bp->b_resid = 0;
|
||||
dp->b_actf = bp->av_forw;
|
||||
dp->b_actf = bp->b_actf;
|
||||
biodone(bp);
|
||||
fdc->fd = (fd_p) 0;
|
||||
fdc->fdu = -1;
|
||||
@ -991,7 +991,7 @@ fdstate(fdcu, fdc)
|
||||
return(0); /* will return later */
|
||||
case RECALWAIT:
|
||||
/* allow heads to settle */
|
||||
timeout(fd_pseudointr, (caddr_t)fdcu, hz / 30);
|
||||
timeout((timeout_func_t)fd_pseudointr, (caddr_t)fdcu, hz / 30);
|
||||
fdc->state = RECALCOMPLETE;
|
||||
return(0); /* will return later */
|
||||
case RECALCOMPLETE:
|
||||
@ -1079,7 +1079,7 @@ retrier(fdcu)
|
||||
bp->b_flags |= B_ERROR;
|
||||
bp->b_error = EIO;
|
||||
bp->b_resid = bp->b_bcount - fdc->fd->skip;
|
||||
dp->b_actf = bp->av_forw;
|
||||
dp->b_actf = bp->b_actf;
|
||||
fdc->fd->skip = 0;
|
||||
biodone(bp);
|
||||
fdc->state = FINDWORK;
|
||||
|
@ -1320,9 +1320,8 @@ iereset(unit, dummy)
|
||||
* This is called if we time out.
|
||||
*/
|
||||
static void
|
||||
chan_attn_timeout(rock, arg2)
|
||||
chan_attn_timeout(rock)
|
||||
caddr_t rock;
|
||||
int arg2;
|
||||
{
|
||||
*(int *)rock = 1;
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ static void mcd_start(int unit)
|
||||
if ((bp = qp->b_actf) != 0) {
|
||||
/* block found to process, dequeue */
|
||||
/*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/
|
||||
qp->b_actf = bp->av_forw;
|
||||
qp->b_actf = bp->b_actf;
|
||||
splx(s);
|
||||
} else {
|
||||
/* nothing to do */
|
||||
|
@ -71,7 +71,7 @@ struct isa_driver msedriver = {
|
||||
struct mse_softc {
|
||||
int sc_flags;
|
||||
int sc_mousetype;
|
||||
pid_t sc_selp;
|
||||
struct selinfo sc_selp;
|
||||
u_int sc_port;
|
||||
void (*sc_enablemouse)();
|
||||
void (*sc_disablemouse)();
|
||||
@ -316,7 +316,7 @@ mseselect(dev, rw, p)
|
||||
* Since this is an exclusive open device, any previous proc.
|
||||
* pointer is trash now, so we can just assign it.
|
||||
*/
|
||||
sc->sc_selp = p->p_pid;
|
||||
selrecord(p, &sc->sc_selp);
|
||||
splx(s);
|
||||
return (0);
|
||||
}
|
||||
@ -350,11 +350,7 @@ mseintr(unit)
|
||||
sc->sc_flags &= ~MSESC_WANT;
|
||||
wakeup((caddr_t)sc);
|
||||
}
|
||||
if (sc->sc_selp) {
|
||||
p = sc->sc_selp;
|
||||
sc->sc_selp = (pid_t)0;
|
||||
selwakeup(p, 0);
|
||||
}
|
||||
selwakeup(&sc->sc_selp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include "sio.h"
|
||||
#if NSIO > 0
|
||||
#define DONT_MALLOC_TTYS
|
||||
/*
|
||||
* Serial driver, based on 386BSD-0.1 com driver.
|
||||
* Mostly rewritten to use pseudo-DMA.
|
||||
@ -61,9 +62,11 @@
|
||||
|
||||
#define FAKE_DCD(unit) ((unit) == comconsole)
|
||||
#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */
|
||||
#define RBSZ 1024
|
||||
#define RB_I_HIGH_WATER (RBSZ - 2 * RS_IBUFSIZE)
|
||||
#define RB_I_LOW_WATER ((RBSZ - 2 * RS_IBUFSIZE) * 7 / 8)
|
||||
#define RS_IBUFSIZE 256
|
||||
#define RS_OBUFSIZE 256
|
||||
#define TTY_BI TTY_FE /* XXX */
|
||||
#define TTY_OE TTY_PE /* XXX */
|
||||
|
||||
@ -221,39 +224,39 @@ struct com_s {
|
||||
#define CE_INPUT_OFFSET RS_IBUFSIZE
|
||||
u_char ibuf1[2 * RS_IBUFSIZE];
|
||||
u_char ibuf2[2 * RS_IBUFSIZE];
|
||||
u_char obuf[RS_OBUFSIZE];
|
||||
};
|
||||
|
||||
/*
|
||||
* The public functions in the com module ought to be declared in a com-driver
|
||||
* system header.
|
||||
*/
|
||||
#define Dev_t int /* promoted dev_t */
|
||||
|
||||
/* Interrupt handling entry points. */
|
||||
void siointr __P((int unit));
|
||||
void siopoll __P((void));
|
||||
|
||||
/* Device switch entry points. */
|
||||
int sioopen __P((Dev_t dev, int oflags, int devtype,
|
||||
int sioopen __P((dev_t dev, int oflags, int devtype,
|
||||
struct proc *p));
|
||||
int sioclose __P((Dev_t dev, int fflag, int devtype,
|
||||
int sioclose __P((dev_t dev, int fflag, int devtype,
|
||||
struct proc *p));
|
||||
int sioread __P((Dev_t dev, struct uio *uio, int ioflag));
|
||||
int siowrite __P((Dev_t dev, struct uio *uio, int ioflag));
|
||||
int sioioctl __P((Dev_t dev, int cmd, caddr_t data,
|
||||
int sioread __P((dev_t dev, struct uio *uio, int ioflag));
|
||||
int siowrite __P((dev_t dev, struct uio *uio, int ioflag));
|
||||
int sioioctl __P((dev_t dev, int cmd, caddr_t data,
|
||||
int fflag, struct proc *p));
|
||||
void siostop __P((struct tty *tp, int rw));
|
||||
#define sioreset noreset
|
||||
int sioselect __P((Dev_t dev, int rw, struct proc *p));
|
||||
int sioselect __P((dev_t dev, int rw, struct proc *p));
|
||||
#define siommap nommap
|
||||
#define siostrategy nostrategy
|
||||
|
||||
/* Console device entry points. */
|
||||
int siocngetc __P((Dev_t dev));
|
||||
int siocngetc __P((dev_t dev));
|
||||
struct consdev;
|
||||
void siocninit __P((struct consdev *cp));
|
||||
void siocnprobe __P((struct consdev *cp));
|
||||
void siocnputc __P((Dev_t dev, int c));
|
||||
void siocnputc __P((dev_t dev, int c));
|
||||
|
||||
static int sioattach __P((struct isa_device *dev));
|
||||
static void comflush __P((struct com_s *com));
|
||||
@ -288,15 +291,9 @@ static int comconsole = -1;
|
||||
static speed_t comdefaultrate = TTYDEF_SPEED;
|
||||
static u_int com_events; /* input chars + weighted output completions */
|
||||
static int commajor;
|
||||
#ifdef DONT_MALLOC_TTYS
|
||||
#define TB_OUT(tp) (&(tp)->t_out)
|
||||
#define TB_RAW(tp) (&(tp)->t_raw)
|
||||
#define TB_OUT(tp) (&(tp)->t_outq)
|
||||
#define TB_RAW(tp) (&(tp)->t_rawq)
|
||||
struct tty sio_tty[NSIO];
|
||||
#else
|
||||
#define TB_OUT(tp) ((tp)->t_out)
|
||||
#define TB_RAW(tp) ((tp)->t_raw)
|
||||
struct tty *sio_tty[NSIO];
|
||||
#endif
|
||||
extern struct tty *constty;
|
||||
extern int tk_nin; /* XXX */
|
||||
extern int tk_rawcc; /* XXX */
|
||||
@ -787,7 +784,7 @@ sioopen(dev, flag, mode, p)
|
||||
}
|
||||
out:
|
||||
if (error == 0)
|
||||
error = (*linesw[tp->t_line].l_open)(dev, tp, 0);
|
||||
error = (*linesw[tp->t_line].l_open)(dev, tp);
|
||||
splx(s);
|
||||
|
||||
#ifdef COM_BIDIR
|
||||
@ -1129,7 +1126,7 @@ sioioctl(dev, cmd, data, flag, p)
|
||||
|
||||
com = com_addr(UNIT(dev));
|
||||
tp = com->tp;
|
||||
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag);
|
||||
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
|
||||
if (error >= 0)
|
||||
return (error);
|
||||
error = ttioctl(tp, cmd, data, flag);
|
||||
@ -1222,6 +1219,7 @@ sioioctl(dev, cmd, data, flag, p)
|
||||
*(int *)data = com->bidir;
|
||||
break;
|
||||
#endif /* COM_BIDIR */
|
||||
#if 0
|
||||
case TIOCMSDTRWAIT:
|
||||
/* must be root since the wait applies to following logins */
|
||||
error = suser(p->p_ucred, &p->p_acflag);
|
||||
@ -1240,6 +1238,7 @@ sioioctl(dev, cmd, data, flag, p)
|
||||
case TIOCMGDTRWAIT:
|
||||
*(int *)data = com->dtr_wait;
|
||||
break;
|
||||
#endif
|
||||
#ifdef TIOCTIMESTAMP
|
||||
case TIOCTIMESTAMP:
|
||||
com->do_timestamp = TRUE;
|
||||
@ -1259,16 +1258,14 @@ static void
|
||||
comflush(com)
|
||||
struct com_s *com;
|
||||
{
|
||||
struct ringb *rbp;
|
||||
struct clist *rbp;
|
||||
|
||||
disable_intr();
|
||||
if (com->state & CS_ODONE)
|
||||
com_events -= LOTS_OF_EVENTS;
|
||||
com->state &= ~(CS_ODONE | CS_BUSY);
|
||||
enable_intr();
|
||||
rbp = TB_OUT(com->tp);
|
||||
rbp->rb_hd += com->ocount;
|
||||
rbp->rb_hd = RB_ROLLOVER(rbp, rbp->rb_hd);
|
||||
while( getc( TB_OUT(com->tp)) != -1);
|
||||
com->ocount = 0;
|
||||
com->tp->t_state &= ~TS_BUSY;
|
||||
}
|
||||
@ -1343,8 +1340,8 @@ siopoll()
|
||||
* CS_RTS_IFLOW is on.
|
||||
*/
|
||||
if ((com->state & CS_RTS_IFLOW)
|
||||
&& !(com->mcr_image & MCR_RTS)
|
||||
&& !(tp->t_state & TS_RTS_IFLOW))
|
||||
&& !(com->mcr_image & MCR_RTS) /*
|
||||
&& !(tp->t_state & TS_RTS_IFLOW) */)
|
||||
outb(com->modem_ctl_port,
|
||||
com->mcr_image |= MCR_RTS);
|
||||
enable_intr();
|
||||
@ -1404,16 +1401,17 @@ siopoll()
|
||||
if (incc <= 0 || !(tp->t_state & TS_ISOPEN))
|
||||
continue;
|
||||
if (com->state & CS_RTS_IFLOW
|
||||
&& RB_LEN(TB_RAW(tp)) + incc >= RB_I_HIGH_WATER
|
||||
&& !(tp->t_state & TS_RTS_IFLOW)
|
||||
&& TB_RAW(tp)->c_cc + incc >= RB_I_HIGH_WATER /*
|
||||
&& !(tp->t_state & TS_RTS_IFLOW) */
|
||||
/*
|
||||
* XXX - need RTS flow control for all line disciplines.
|
||||
* Only have it in standard one now.
|
||||
*/
|
||||
&& linesw[tp->t_line].l_rint == ttyinput) {
|
||||
tp->t_state |= TS_RTS_IFLOW;
|
||||
/* tp->t_state |= TS_RTS_IFLOW; */
|
||||
ttstart(tp);
|
||||
}
|
||||
#if 0
|
||||
/*
|
||||
* Avoid the grotesquely inefficient lineswitch routine
|
||||
* (ttyinput) in "raw" mode. It usually takes about 450
|
||||
@ -1442,6 +1440,7 @@ siopoll()
|
||||
ttstart(tp);
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
do {
|
||||
u_char line_status;
|
||||
int recv_data;
|
||||
@ -1461,7 +1460,9 @@ siopoll()
|
||||
}
|
||||
(*linesw[tp->t_line].l_rint)(recv_data, tp);
|
||||
} while (--incc > 0);
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
if (com_events == 0)
|
||||
break;
|
||||
}
|
||||
@ -1624,10 +1625,12 @@ comstart(tp)
|
||||
com->state &= ~CS_TTGO;
|
||||
else
|
||||
com->state |= CS_TTGO;
|
||||
#if 0
|
||||
if (tp->t_state & TS_RTS_IFLOW) {
|
||||
if (com->mcr_image & MCR_RTS && com->state & CS_RTS_IFLOW)
|
||||
outb(com->modem_ctl_port, com->mcr_image &= ~MCR_RTS);
|
||||
} else {
|
||||
#endif
|
||||
/*
|
||||
* XXX don't raise MCR_RTS if CTS_RTS_IFLOW is off. Set it
|
||||
* appropriately in comparam() if RTS-flow is being changed.
|
||||
@ -1635,31 +1638,29 @@ comstart(tp)
|
||||
*/
|
||||
if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater)
|
||||
outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS);
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
enable_intr();
|
||||
if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP))
|
||||
goto out;
|
||||
if (RB_LEN(TB_OUT(tp)) <= tp->t_lowat) {
|
||||
if (TB_OUT(tp)->c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state & TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)TB_OUT(tp));
|
||||
}
|
||||
if (tp->t_wsel) {
|
||||
selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL);
|
||||
tp->t_wsel = 0;
|
||||
tp->t_state &= ~TS_WCOLL;
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if (com->ocount != 0) {
|
||||
disable_intr();
|
||||
siointr1(com);
|
||||
enable_intr();
|
||||
} else if (RB_LEN(TB_OUT(tp)) != 0) {
|
||||
} else if (TB_OUT(tp)->c_cc != 0) {
|
||||
tp->t_state |= TS_BUSY;
|
||||
com->ocount = RB_CONTIGGET(TB_OUT(tp));
|
||||
disable_intr();
|
||||
com->obufend = (com->optr = (u_char *)TB_OUT(tp)->rb_hd)
|
||||
+ com->ocount;
|
||||
com->ocount = q_to_b(TB_OUT(tp), com->obuf, sizeof com->obuf);
|
||||
com->optr = com->obuf;
|
||||
com->obufend = com->obuf + com->ocount;
|
||||
com->state |= CS_BUSY;
|
||||
siointr1(com); /* fake interrupt to start output */
|
||||
enable_intr();
|
||||
@ -1728,11 +1729,11 @@ comwakeup(chan, ticks)
|
||||
{
|
||||
int unit;
|
||||
|
||||
timeout(comwakeup, (caddr_t) NULL, hz / 100);
|
||||
timeout((timeout_func_t)comwakeup, (caddr_t) NULL, hz / 100);
|
||||
|
||||
if (com_events != 0) {
|
||||
#ifndef OLD_INTERRUPT_HANDLING
|
||||
int s = splsofttty();
|
||||
int s = spltty();
|
||||
#endif
|
||||
siopoll();
|
||||
#ifndef OLD_INTERRUPT_HANDLING
|
||||
|
@ -44,6 +44,7 @@
|
||||
#endif
|
||||
|
||||
#include "param.h"
|
||||
#include <sys/systm.h>
|
||||
#include "conf.h"
|
||||
#include "ioctl.h"
|
||||
#include "proc.h"
|
||||
@ -51,7 +52,6 @@
|
||||
#include "tty.h"
|
||||
#include "uio.h"
|
||||
#include "callout.h"
|
||||
#include "systm.h"
|
||||
#include "kernel.h"
|
||||
#include "syslog.h"
|
||||
#include "errno.h"
|
||||
@ -277,14 +277,20 @@ int ttrstrt();
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if 0
|
||||
#define VIRTUAL_TTY(x) (pccons[x] = ttymalloc(pccons[x]))
|
||||
#define CONSOLE_TTY (pccons[NCONS] = ttymalloc(pccons[NCONS]))
|
||||
struct tty *pccons[NCONS+1];
|
||||
#else
|
||||
#define VIRTUAL_TTY(x) &pccons[x]
|
||||
#define CONSOLE_TTY &pccons[NCONS]
|
||||
struct tty pccons[NCONS+1];
|
||||
#endif
|
||||
#define timeout_t timeout_func_t
|
||||
#define frametype struct trapframe
|
||||
#define eflags tf_eflags
|
||||
#define timeout_t timeout_func_t
|
||||
#define MONO_BUF (KERNBASE+0xB0000)
|
||||
#define CGA_BUF (KERNBASE+0xB8000)
|
||||
struct tty *pccons[NCONS+1];
|
||||
#endif
|
||||
|
||||
#if defined(__386BSD__) && !defined(__FreeBSD__)
|
||||
@ -456,11 +462,7 @@ int pcopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
return(EBUSY);
|
||||
tp->t_state |= TS_CARR_ON;
|
||||
tp->t_cflag |= CLOCAL;
|
||||
#if defined(__FreeBSD__)
|
||||
return((*linesw[tp->t_line].l_open)(dev, tp, 0));
|
||||
#else
|
||||
return((*linesw[tp->t_line].l_open)(dev, tp));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -744,12 +746,12 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
return 0;
|
||||
|
||||
case KDENABIO: /* allow io operations */
|
||||
fp = (frametype *)p->p_regs;
|
||||
fp = (frametype *)p->p_md.md_regs;
|
||||
fp->eflags |= PSL_IOPL;
|
||||
return 0;
|
||||
|
||||
case KDDISABIO: /* disallow io operations (default) */
|
||||
fp = (frametype *)p->p_regs;
|
||||
fp = (frametype *)p->p_md.md_regs;
|
||||
fp->eflags &= ~PSL_IOPL;
|
||||
return 0;
|
||||
|
||||
@ -960,7 +962,7 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
if (saved_console < 0) {
|
||||
saved_console = get_scr_num();
|
||||
switch_scr(minor(dev));
|
||||
fp = (frametype *)p->p_regs;
|
||||
fp = (frametype *)p->p_md.md_regs;
|
||||
fp->eflags |= PSL_IOPL;
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
scp->status |= KBD_RAW_MODE;
|
||||
@ -969,7 +971,7 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
return EAGAIN;
|
||||
|
||||
case CONSOLE_X_MODE_OFF:/* just to be compatible */
|
||||
fp = (frametype *)p->p_regs;
|
||||
fp = (frametype *)p->p_md.md_regs;
|
||||
fp->eflags &= ~PSL_IOPL;
|
||||
if (crtc_vga) {
|
||||
load_font(0, 16, font_8x16);
|
||||
@ -1002,7 +1004,7 @@ int pcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
||||
break;
|
||||
}
|
||||
|
||||
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag);
|
||||
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
|
||||
if (error >= 0)
|
||||
return(error);
|
||||
error = ttioctl(tp, cmd, data, flag);
|
||||
@ -1028,7 +1030,7 @@ void pcxint(dev_t dev)
|
||||
|
||||
void pcstart(struct tty *tp)
|
||||
{
|
||||
#if defined(NetBSD)
|
||||
#if defined(NetBSD) || defined(__FreeBSD__)
|
||||
struct clist *rbp;
|
||||
int i, s, len;
|
||||
u_char buf[PCBURST];
|
||||
@ -1046,10 +1048,6 @@ void pcstart(struct tty *tp)
|
||||
if (buf[i]) ansi_put(scp, buf[i]);
|
||||
s = spltty();
|
||||
tp->t_state &= ~TS_BUSY;
|
||||
if (rbp->c_cc) {
|
||||
tp->t_state |= TS_TIMEOUT;
|
||||
timeout((timeout_t)ttrstrt, (caddr_t)tp, 1);
|
||||
}
|
||||
if (rbp->c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state & TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
@ -1060,7 +1058,7 @@ void pcstart(struct tty *tp)
|
||||
}
|
||||
splx(s);
|
||||
|
||||
#else /* __FreeBSD__ & __386BSD__ */
|
||||
#else /* __386BSD__ */
|
||||
|
||||
int c, s, len, i;
|
||||
scr_stat *scp = get_scr_stat(tp->t_dev);
|
||||
@ -1076,12 +1074,7 @@ void pcstart(struct tty *tp)
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)tp->t_out);
|
||||
}
|
||||
if (tp->t_wsel) {
|
||||
selwakeup(tp->t_wsel,
|
||||
tp->t_state & TS_WCOLL);
|
||||
tp->t_wsel = 0;
|
||||
tp->t_state &= ~TS_WCOLL;
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if (RB_LEN(tp->t_out) == 0)
|
||||
break;
|
||||
|
@ -89,6 +89,7 @@ struct nchstats iso_nchstats;
|
||||
*
|
||||
* NOTE: (LOOKUP | LOCKPARENT) currently returns the parent inode unlocked.
|
||||
*/
|
||||
int
|
||||
cd9660_lookup(ap)
|
||||
struct vop_lookup_args /* {
|
||||
struct vnode *a_dvp;
|
||||
@ -100,9 +101,9 @@ cd9660_lookup(ap)
|
||||
register struct iso_node *dp; /* inode for directory being searched */
|
||||
register struct iso_mnt *imp; /* file system that directory is in */
|
||||
struct buf *bp; /* a buffer of directory entries */
|
||||
struct iso_directory_record *ep;/* the current directory entry */
|
||||
struct iso_directory_record *ep = 0;/* the current directory entry */
|
||||
int entryoffsetinblock; /* offset of ep in bp's buffer */
|
||||
int saveoffset; /* offset of last directory entry in dir */
|
||||
int saveoffset = 0; /* offset of last directory entry in dir */
|
||||
int numdirpasses; /* strategy for directory search */
|
||||
doff_t endsearch; /* offset to end directory search */
|
||||
struct iso_node *pdp; /* saved dp during symlink work */
|
||||
@ -443,6 +444,7 @@ cd9660_lookup(ap)
|
||||
* is non-zero, fill it in with a pointer to the
|
||||
* remaining space in the directory.
|
||||
*/
|
||||
int
|
||||
iso_blkatoff(ip, offset, bpp)
|
||||
struct iso_node *ip;
|
||||
doff_t offset;
|
||||
|
@ -84,6 +84,7 @@ int prtactive; /* 1 => print out reclaim of active vnodes */
|
||||
/*
|
||||
* Initialize hash links for inodes and dnodes.
|
||||
*/
|
||||
int
|
||||
cd9660_init()
|
||||
{
|
||||
register int i;
|
||||
@ -102,6 +103,7 @@ cd9660_init()
|
||||
dh->dh_head[1] = dh;
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef ISODEVMAP
|
||||
@ -163,9 +165,11 @@ iso_dunmap(dev)
|
||||
* return the inode locked. Detection and handling of mount
|
||||
* points must be done by the calling routine.
|
||||
*/
|
||||
int
|
||||
iso_iget(xp, ino, relocated, ipp, isodir)
|
||||
struct iso_node *xp;
|
||||
ino_t ino;
|
||||
int relocated;
|
||||
struct iso_node **ipp;
|
||||
struct iso_directory_record *isodir;
|
||||
{
|
||||
@ -338,6 +342,7 @@ iso_iget(xp, ino, relocated, ipp, isodir)
|
||||
/*
|
||||
* Unlock and decrement the reference count of an inode structure.
|
||||
*/
|
||||
int
|
||||
iso_iput(ip)
|
||||
register struct iso_node *ip;
|
||||
{
|
||||
@ -346,6 +351,7 @@ iso_iput(ip)
|
||||
panic("iso_iput");
|
||||
ISO_IUNLOCK(ip);
|
||||
vrele(ITOV(ip));
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -412,6 +418,7 @@ cd9660_reclaim(ap)
|
||||
/*
|
||||
* Lock an inode. If its already locked, set the WANT bit and sleep.
|
||||
*/
|
||||
int
|
||||
iso_ilock(ip)
|
||||
register struct iso_node *ip;
|
||||
{
|
||||
@ -426,11 +433,13 @@ iso_ilock(ip)
|
||||
ip->i_spare1 = 0;
|
||||
ip->i_spare0 = curproc->p_pid;
|
||||
ip->i_flag |= ILOCKED;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlock an inode. If WANT bit is on, wakeup.
|
||||
*/
|
||||
int
|
||||
iso_iunlock(ip)
|
||||
register struct iso_node *ip;
|
||||
{
|
||||
@ -443,6 +452,7 @@ iso_iunlock(ip)
|
||||
ip->i_flag &= ~IWANT;
|
||||
wakeup((caddr_t)ip);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -157,7 +157,7 @@ int
|
||||
isofncmp(unsigned char *fn,int fnlen,unsigned char *isofn,int isolen)
|
||||
{
|
||||
int i, j;
|
||||
char c;
|
||||
unsigned char c;
|
||||
|
||||
while (--fnlen >= 0) {
|
||||
if (--isolen < 0)
|
||||
|
@ -82,6 +82,7 @@ struct vfsops cd9660_vfsops = {
|
||||
|
||||
static iso_mountfs();
|
||||
|
||||
int
|
||||
cd9660_mountroot()
|
||||
{
|
||||
register struct mount *mp;
|
||||
@ -139,6 +140,7 @@ int iso_doforce = 1;
|
||||
*
|
||||
* mount system call
|
||||
*/
|
||||
int
|
||||
cd9660_mount(mp, path, data, ndp, p)
|
||||
register struct mount *mp;
|
||||
char *path;
|
||||
@ -150,7 +152,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
struct iso_args args;
|
||||
u_int size;
|
||||
int error;
|
||||
struct iso_mnt *imp;
|
||||
struct iso_mnt *imp = 0;
|
||||
|
||||
if (error = copyin(data, (caddr_t)&args, sizeof (struct iso_args)))
|
||||
return (error);
|
||||
@ -211,7 +213,8 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
/*
|
||||
* Common code for mount and mountroot
|
||||
*/
|
||||
static iso_mountfs(devvp, mp, p, argp)
|
||||
static int
|
||||
iso_mountfs(devvp, mp, p, argp)
|
||||
register struct vnode *devvp;
|
||||
struct mount *mp;
|
||||
struct proc *p;
|
||||
@ -381,6 +384,7 @@ static iso_mountfs(devvp, mp, p, argp)
|
||||
* Nothing to do at the moment.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
cd9660_start(mp, flags, p)
|
||||
struct mount *mp;
|
||||
int flags;
|
||||
@ -433,6 +437,7 @@ cd9660_unmount(mp, mntflags, p)
|
||||
/*
|
||||
* Return root of a filesystem
|
||||
*/
|
||||
int
|
||||
cd9660_root(mp, vpp)
|
||||
struct mount *mp;
|
||||
struct vnode **vpp;
|
||||
@ -485,6 +490,7 @@ cd9660_quotactl(mp, cmd, uid, arg, p)
|
||||
/*
|
||||
* Get file system statistics.
|
||||
*/
|
||||
int
|
||||
cd9660_statfs(mp, sbp, p)
|
||||
struct mount *mp;
|
||||
register struct statfs *sbp;
|
||||
@ -659,6 +665,7 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp)
|
||||
* Vnode pointer to File handle
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
cd9660_vptofh(vp, fhp)
|
||||
struct vnode *vp;
|
||||
struct fid *fhp;
|
||||
|
@ -157,6 +157,7 @@ cd9660_close(ap)
|
||||
* super user is granted all permissions.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
cd9660_access(ap)
|
||||
struct vop_access_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -168,6 +169,7 @@ cd9660_access(ap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
cd9660_getattr(ap)
|
||||
struct vop_getattr_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -217,6 +219,7 @@ extern int doclusterread;
|
||||
/*
|
||||
* Vnode op for reading.
|
||||
*/
|
||||
int
|
||||
cd9660_read(ap)
|
||||
struct vop_read_args /* {
|
||||
struct vnode *a_vp;
|
||||
|
@ -156,6 +156,7 @@ dead_lookup(ap)
|
||||
* Open always fails as if device did not exist.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
dead_open(ap)
|
||||
struct vop_open_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -172,6 +173,7 @@ dead_open(ap)
|
||||
* Vnode op for read
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
dead_read(ap)
|
||||
struct vop_read_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -195,6 +197,7 @@ dead_read(ap)
|
||||
* Vnode op for write
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
dead_write(ap)
|
||||
struct vop_write_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -213,6 +216,7 @@ dead_write(ap)
|
||||
* Device ioctl operation.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
dead_ioctl(ap)
|
||||
struct vop_ioctl_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -230,6 +234,7 @@ dead_ioctl(ap)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
dead_select(ap)
|
||||
struct vop_select_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -249,6 +254,7 @@ dead_select(ap)
|
||||
/*
|
||||
* Just call the device strategy routine
|
||||
*/
|
||||
int
|
||||
dead_strategy(ap)
|
||||
struct vop_strategy_args /* {
|
||||
struct buf *a_bp;
|
||||
@ -266,6 +272,7 @@ dead_strategy(ap)
|
||||
/*
|
||||
* Wait until the vnode has finished changing state.
|
||||
*/
|
||||
int
|
||||
dead_lock(ap)
|
||||
struct vop_lock_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -280,6 +287,7 @@ dead_lock(ap)
|
||||
/*
|
||||
* Wait until the vnode has finished changing state.
|
||||
*/
|
||||
int
|
||||
dead_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -299,6 +307,7 @@ dead_bmap(ap)
|
||||
* Print out the contents of a dead vnode.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
dead_print(ap)
|
||||
struct vop_print_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -306,11 +315,13 @@ dead_print(ap)
|
||||
{
|
||||
|
||||
printf("tag VT_NON, dead vnode\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Empty vnode failed operation
|
||||
*/
|
||||
int
|
||||
dead_ebadf()
|
||||
{
|
||||
|
||||
@ -320,6 +331,7 @@ dead_ebadf()
|
||||
/*
|
||||
* Empty vnode bad operation
|
||||
*/
|
||||
int
|
||||
dead_badop()
|
||||
{
|
||||
|
||||
@ -330,6 +342,7 @@ dead_badop()
|
||||
/*
|
||||
* Empty vnode null operation
|
||||
*/
|
||||
int
|
||||
dead_nullop()
|
||||
{
|
||||
|
||||
@ -340,6 +353,7 @@ dead_nullop()
|
||||
* We have to wait during times when the vnode is
|
||||
* in a state of change.
|
||||
*/
|
||||
int
|
||||
chkvnlock(vp)
|
||||
register struct vnode *vp;
|
||||
{
|
||||
|
@ -88,6 +88,7 @@ static struct fdcache fdcache[NFDCACHE];
|
||||
/*
|
||||
* Initialise cache headers
|
||||
*/
|
||||
int
|
||||
fdesc_init()
|
||||
{
|
||||
struct fdcache *fc;
|
||||
@ -96,6 +97,7 @@ fdesc_init()
|
||||
|
||||
for (fc = fdcache; fc < fdcache + NFDCACHE; fc++)
|
||||
fc->fc_forw = fc->fc_back = (struct fdescnode *) fc;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -183,7 +185,7 @@ fdesc_lookup(ap)
|
||||
char *pname;
|
||||
struct proc *p;
|
||||
int nfiles;
|
||||
unsigned fd;
|
||||
unsigned fd = 0;
|
||||
int error;
|
||||
struct vnode *fvp;
|
||||
char *ln;
|
||||
@ -800,6 +802,7 @@ fdesc_reclaim(ap)
|
||||
/*
|
||||
* Return POSIX pathconf information applicable to special devices.
|
||||
*/
|
||||
int
|
||||
fdesc_pathconf(ap)
|
||||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
|
@ -111,6 +111,7 @@ struct vnodeopv_desc fifo_vnodeop_opv_desc =
|
||||
* Trivial lookup routine that always fails.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_lookup(ap)
|
||||
struct vop_lookup_args /* {
|
||||
struct vnode * a_dvp;
|
||||
@ -128,6 +129,7 @@ fifo_lookup(ap)
|
||||
* to find an active instance of a fifo.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_open(ap)
|
||||
struct vop_open_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -218,6 +220,7 @@ fifo_open(ap)
|
||||
* Vnode op for read
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_read(ap)
|
||||
struct vop_read_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -257,6 +260,7 @@ fifo_read(ap)
|
||||
* Vnode op for write
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_write(ap)
|
||||
struct vop_write_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -286,6 +290,7 @@ fifo_write(ap)
|
||||
* Device ioctl operation.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_ioctl(ap)
|
||||
struct vop_ioctl_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -308,6 +313,7 @@ fifo_ioctl(ap)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_select(ap)
|
||||
struct vop_select_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -329,6 +335,7 @@ fifo_select(ap)
|
||||
/*
|
||||
* This is a noop, simply returning what one has been given.
|
||||
*/
|
||||
int
|
||||
fifo_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -349,6 +356,7 @@ fifo_bmap(ap)
|
||||
* At the moment we do not do any locking.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_lock(ap)
|
||||
struct vop_lock_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -359,6 +367,7 @@ fifo_lock(ap)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_unlock(ap)
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -372,6 +381,7 @@ fifo_unlock(ap)
|
||||
* Device close routine
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_close(ap)
|
||||
struct vop_close_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -407,6 +417,7 @@ fifo_close(ap)
|
||||
/*
|
||||
* Print out the contents of a fifo vnode.
|
||||
*/
|
||||
int
|
||||
fifo_print(ap)
|
||||
struct vop_print_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -416,11 +427,13 @@ fifo_print(ap)
|
||||
printf("tag VT_NON");
|
||||
fifo_printinfo(ap->a_vp);
|
||||
printf("\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out internal contents of a fifo vnode.
|
||||
*/
|
||||
int
|
||||
fifo_printinfo(vp)
|
||||
struct vnode *vp;
|
||||
{
|
||||
@ -428,11 +441,13 @@ fifo_printinfo(vp)
|
||||
|
||||
printf(", fifo with %d readers and %d writers",
|
||||
fip->fi_readers, fip->fi_writers);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return POSIX pathconf information applicable to fifo's.
|
||||
*/
|
||||
int
|
||||
fifo_pathconf(ap)
|
||||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -460,6 +475,7 @@ fifo_pathconf(ap)
|
||||
/*
|
||||
* Fifo failed operation
|
||||
*/
|
||||
int
|
||||
fifo_ebadf()
|
||||
{
|
||||
|
||||
@ -470,6 +486,7 @@ fifo_ebadf()
|
||||
* Fifo advisory byte-level locks.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
fifo_advlock(ap)
|
||||
struct vop_advlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -486,6 +503,7 @@ fifo_advlock(ap)
|
||||
/*
|
||||
* Fifo bad operation
|
||||
*/
|
||||
int
|
||||
fifo_badop()
|
||||
{
|
||||
|
||||
|
@ -73,6 +73,7 @@ static struct null_node_cache null_node_cache[NNULLNODECACHE];
|
||||
/*
|
||||
* Initialise cache headers
|
||||
*/
|
||||
int
|
||||
nullfs_init()
|
||||
{
|
||||
struct null_node_cache *ac;
|
||||
@ -82,6 +83,7 @@ nullfs_init()
|
||||
|
||||
for (ac = null_node_cache; ac < null_node_cache + NNULLNODECACHE; ac++)
|
||||
ac->ac_forw = ac->ac_back = (struct null_node *) ac;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -524,6 +524,7 @@ portal_reclaim(ap)
|
||||
/*
|
||||
* Return POSIX pathconf information applicable to special devices.
|
||||
*/
|
||||
int
|
||||
portal_pathconf(ap)
|
||||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
|
@ -62,6 +62,7 @@
|
||||
* mount system call
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
procfs_mount(mp, path, data, ndp, p)
|
||||
struct mount *mp;
|
||||
char *path;
|
||||
@ -96,6 +97,7 @@ procfs_mount(mp, path, data, ndp, p)
|
||||
/*
|
||||
* unmount system call
|
||||
*/
|
||||
int
|
||||
procfs_unmount(mp, mntflags, p)
|
||||
struct mount *mp;
|
||||
int mntflags;
|
||||
@ -118,6 +120,7 @@ procfs_unmount(mp, mntflags, p)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_root(mp, vpp)
|
||||
struct mount *mp;
|
||||
struct vnode **vpp;
|
||||
@ -141,6 +144,7 @@ procfs_root(mp, vpp)
|
||||
/*
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
procfs_start(mp, flags, p)
|
||||
struct mount *mp;
|
||||
int flags;
|
||||
@ -153,6 +157,7 @@ procfs_start(mp, flags, p)
|
||||
/*
|
||||
* Get file system statistics.
|
||||
*/
|
||||
int
|
||||
procfs_statfs(mp, sbp, p)
|
||||
struct mount *mp;
|
||||
struct statfs *sbp;
|
||||
@ -177,6 +182,7 @@ procfs_statfs(mp, sbp, p)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
procfs_quotactl(mp, cmds, uid, arg, p)
|
||||
struct mount *mp;
|
||||
int cmds;
|
||||
@ -188,6 +194,7 @@ procfs_quotactl(mp, cmds, uid, arg, p)
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_sync(mp, waitfor)
|
||||
struct mount *mp;
|
||||
int waitfor;
|
||||
@ -196,6 +203,7 @@ procfs_sync(mp, waitfor)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_vget(mp, ino, vpp)
|
||||
struct mount *mp;
|
||||
ino_t ino;
|
||||
@ -205,6 +213,7 @@ procfs_vget(mp, ino, vpp)
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_fhtovp(mp, fhp, vpp)
|
||||
struct mount *mp;
|
||||
struct fid *fhp;
|
||||
@ -214,6 +223,7 @@ procfs_fhtovp(mp, fhp, vpp)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_vptofh(vp, fhp)
|
||||
struct vnode *vp;
|
||||
struct fid *fhp;
|
||||
@ -222,6 +232,7 @@ procfs_vptofh(vp, fhp)
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
int
|
||||
procfs_init()
|
||||
{
|
||||
|
||||
|
@ -100,6 +100,7 @@ static pid_t atopid __P((const char *, u_int));
|
||||
* is to support exclusive open on process
|
||||
* memory images.
|
||||
*/
|
||||
int
|
||||
procfs_open(ap)
|
||||
struct vop_open_args *ap;
|
||||
{
|
||||
@ -134,6 +135,7 @@ procfs_open(ap)
|
||||
* nothing to do for procfs other than undo
|
||||
* any exclusive open flag (see _open above).
|
||||
*/
|
||||
int
|
||||
procfs_close(ap)
|
||||
struct vop_close_args *ap;
|
||||
{
|
||||
@ -153,6 +155,7 @@ procfs_close(ap)
|
||||
* do an ioctl operation on pfsnode (vp).
|
||||
* (vp) is not locked on entry or exit.
|
||||
*/
|
||||
int
|
||||
procfs_ioctl(ap)
|
||||
struct vop_ioctl_args *ap;
|
||||
{
|
||||
@ -170,6 +173,7 @@ procfs_ioctl(ap)
|
||||
* usual no-op bmap, although returning
|
||||
* (EIO) would be a reasonable alternative.
|
||||
*/
|
||||
int
|
||||
procfs_bmap(ap)
|
||||
struct vop_bmap_args *ap;
|
||||
{
|
||||
@ -197,6 +201,7 @@ procfs_bmap(ap)
|
||||
*
|
||||
* (vp) is not locked on entry or exit.
|
||||
*/
|
||||
int
|
||||
procfs_inactive(ap)
|
||||
struct vop_inactive_args *ap;
|
||||
{
|
||||
@ -215,6 +220,7 @@ procfs_inactive(ap)
|
||||
* to free any private data and remove the node
|
||||
* from any private lists.
|
||||
*/
|
||||
int
|
||||
procfs_reclaim(ap)
|
||||
struct vop_reclaim_args *ap;
|
||||
{
|
||||
@ -227,6 +233,7 @@ procfs_reclaim(ap)
|
||||
/*
|
||||
* Return POSIX pathconf information applicable to special devices.
|
||||
*/
|
||||
int
|
||||
procfs_pathconf(ap)
|
||||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -265,6 +272,7 @@ procfs_pathconf(ap)
|
||||
* just print a readable description
|
||||
* of (vp).
|
||||
*/
|
||||
int
|
||||
procfs_print(ap)
|
||||
struct vop_print_args *ap;
|
||||
{
|
||||
@ -273,6 +281,7 @@ procfs_print(ap)
|
||||
printf("tag VT_PROCFS, pid %d, mode %x, flags %x\n",
|
||||
pfs->pfs_pid,
|
||||
pfs->pfs_mode, pfs->pfs_flags);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -281,6 +290,7 @@ procfs_print(ap)
|
||||
* for undoing any side-effects caused by the lookup.
|
||||
* this will always include freeing the pathname buffer.
|
||||
*/
|
||||
int
|
||||
procfs_abortop(ap)
|
||||
struct vop_abortop_args *ap;
|
||||
{
|
||||
@ -293,6 +303,7 @@ procfs_abortop(ap)
|
||||
/*
|
||||
* generic entry point for unsupported operations
|
||||
*/
|
||||
int
|
||||
procfs_badop()
|
||||
{
|
||||
|
||||
@ -308,6 +319,7 @@ procfs_badop()
|
||||
*
|
||||
* this is relatively minimal for procfs.
|
||||
*/
|
||||
int
|
||||
procfs_getattr(ap)
|
||||
struct vop_getattr_args *ap;
|
||||
{
|
||||
@ -423,6 +435,7 @@ procfs_getattr(ap)
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
procfs_setattr(ap)
|
||||
struct vop_setattr_args *ap;
|
||||
{
|
||||
@ -451,6 +464,7 @@ procfs_setattr(ap)
|
||||
* but does mean that the i/o entry points need to check
|
||||
* that the operation really does make sense.
|
||||
*/
|
||||
int
|
||||
procfs_access(ap)
|
||||
struct vop_access_args *ap;
|
||||
{
|
||||
@ -502,6 +516,7 @@ procfs_access(ap)
|
||||
* filesystem doesn't do any locking of its own. otherwise
|
||||
* read and inwardly digest ufs_lookup().
|
||||
*/
|
||||
int
|
||||
procfs_lookup(ap)
|
||||
struct vop_lookup_args *ap;
|
||||
{
|
||||
@ -612,6 +627,7 @@ procfs_lookup(ap)
|
||||
*
|
||||
* this should just be done through read()
|
||||
*/
|
||||
int
|
||||
procfs_readdir(ap)
|
||||
struct vop_readdir_args *ap;
|
||||
{
|
||||
|
@ -126,6 +126,7 @@ spec_lookup(ap)
|
||||
* Open a special file.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_open(ap)
|
||||
struct vop_open_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -203,6 +204,7 @@ spec_open(ap)
|
||||
* Vnode op for read
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_read(ap)
|
||||
struct vop_read_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -285,6 +287,7 @@ spec_read(ap)
|
||||
* Vnode op for write
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_write(ap)
|
||||
struct vop_write_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -365,6 +368,7 @@ spec_write(ap)
|
||||
* Device ioctl operation.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_ioctl(ap)
|
||||
struct vop_ioctl_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -399,6 +403,7 @@ spec_ioctl(ap)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_select(ap)
|
||||
struct vop_select_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -476,6 +481,7 @@ spec_fsync(ap)
|
||||
/*
|
||||
* Just call the device strategy routine
|
||||
*/
|
||||
int
|
||||
spec_strategy(ap)
|
||||
struct vop_strategy_args /* {
|
||||
struct buf *a_bp;
|
||||
@ -489,6 +495,7 @@ spec_strategy(ap)
|
||||
/*
|
||||
* This is a noop, simply returning what one has been given.
|
||||
*/
|
||||
int
|
||||
spec_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -509,6 +516,7 @@ spec_bmap(ap)
|
||||
* At the moment we do not do any locking.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_lock(ap)
|
||||
struct vop_lock_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -519,6 +527,7 @@ spec_lock(ap)
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_unlock(ap)
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -532,6 +541,7 @@ spec_unlock(ap)
|
||||
* Device close routine
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_close(ap)
|
||||
struct vop_close_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -606,6 +616,7 @@ spec_close(ap)
|
||||
/*
|
||||
* Print out the contents of a special device vnode.
|
||||
*/
|
||||
int
|
||||
spec_print(ap)
|
||||
struct vop_print_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -614,11 +625,13 @@ spec_print(ap)
|
||||
|
||||
printf("tag VT_NON, dev %d, %d\n", major(ap->a_vp->v_rdev),
|
||||
minor(ap->a_vp->v_rdev));
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return POSIX pathconf information applicable to special devices.
|
||||
*/
|
||||
int
|
||||
spec_pathconf(ap)
|
||||
struct vop_pathconf_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -656,6 +669,7 @@ spec_pathconf(ap)
|
||||
* Special device advisory byte-level locks.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
spec_advlock(ap)
|
||||
struct vop_advlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
@ -672,6 +686,7 @@ spec_advlock(ap)
|
||||
/*
|
||||
* Special device failed operation
|
||||
*/
|
||||
int
|
||||
spec_ebadf()
|
||||
{
|
||||
|
||||
@ -681,6 +696,7 @@ spec_ebadf()
|
||||
/*
|
||||
* Special device bad operation
|
||||
*/
|
||||
int
|
||||
spec_badop()
|
||||
{
|
||||
|
||||
|
@ -73,6 +73,7 @@ static struct umap_node_cache umap_node_cache[NUMAPNODECACHE];
|
||||
/*
|
||||
* Initialise cache headers
|
||||
*/
|
||||
int
|
||||
umapfs_init()
|
||||
{
|
||||
struct umap_node_cache *ac;
|
||||
@ -82,6 +83,7 @@ umapfs_init()
|
||||
|
||||
for (ac = umap_node_cache; ac < umap_node_cache + NUMAPNODECACHE; ac++)
|
||||
ac->ac_forw = ac->ac_back = (struct umap_node *) ac;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -67,7 +67,7 @@ umap_bypass(ap)
|
||||
{
|
||||
extern int (**umap_vnodeop_p)(); /* not extern, really "forward" */
|
||||
struct ucred **credpp = 0, *credp = 0;
|
||||
struct ucred *savecredp, *savecompcredp = 0;
|
||||
struct ucred *savecredp = 0, *savecompcredp = 0;
|
||||
struct ucred *compcredp = 0;
|
||||
struct vnode **this_vp_p;
|
||||
int error;
|
||||
|
@ -49,9 +49,7 @@
|
||||
#include <sys/queue.h>
|
||||
#include <miscfs/union/union.h>
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
#include <sys/proc.h>
|
||||
#endif
|
||||
|
||||
/* must be power of two, otherwise change UNION_HASH() */
|
||||
#define NHASH 32
|
||||
@ -71,6 +69,7 @@ union_init()
|
||||
for (i = 0; i < NHASH; i++)
|
||||
LIST_INIT(&unhead[i]);
|
||||
bzero((caddr_t) unvplock, sizeof(unvplock));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -223,10 +222,10 @@ union_allocvp(vpp, mp, undvp, dvp, cnp, uppervp, lowervp)
|
||||
struct vnode *lowervp; /* may be null */
|
||||
{
|
||||
int error;
|
||||
struct union_node *un;
|
||||
struct union_node *un = 0;
|
||||
struct union_node **pp;
|
||||
struct vnode *xlowervp = NULLVP;
|
||||
int hash;
|
||||
int hash = 0;
|
||||
int try;
|
||||
|
||||
if (uppervp == NULLVP && lowervp == NULLVP)
|
||||
|
@ -73,7 +73,7 @@ union_mount(mp, path, data, ndp, p)
|
||||
struct ucred *cred = 0;
|
||||
struct ucred *scred;
|
||||
struct vattr va;
|
||||
char *cp;
|
||||
char *cp = 0;
|
||||
int len;
|
||||
u_int size;
|
||||
|
||||
|
@ -162,7 +162,7 @@ union_lookup(ap)
|
||||
int lockparent = cnp->cn_flags & LOCKPARENT;
|
||||
int rdonly = cnp->cn_flags & RDONLY;
|
||||
struct union_mount *um = MOUNTTOUNIONMOUNT(dvp->v_mount);
|
||||
struct ucred *saved_cred;
|
||||
struct ucred *saved_cred = 0;
|
||||
|
||||
cnp->cn_flags |= LOCKPARENT;
|
||||
|
||||
|
@ -112,7 +112,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
struct indir a[NIADDR], *xap;
|
||||
daddr_t daddr;
|
||||
long metalbn;
|
||||
int error, maxrun, num;
|
||||
int error, maxrun = 0, num;
|
||||
|
||||
ip = VTOI(vp);
|
||||
mp = vp->v_mount;
|
||||
|
@ -112,7 +112,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
|
||||
struct indir a[NIADDR], *xap;
|
||||
daddr_t daddr;
|
||||
long metalbn;
|
||||
int error, maxrun, num;
|
||||
int error, maxrun = 0, num;
|
||||
|
||||
ip = VTOI(vp);
|
||||
mp = vp->v_mount;
|
||||
|
@ -39,7 +39,6 @@ CWARNFLAGS=-W -Wreturn-type -Wcomment
|
||||
# of material assistance.
|
||||
#
|
||||
COPTFLAGS=-O
|
||||
COPTFLAGS+=-D__FreeBSD__
|
||||
INCLUDES= -I. -I$S -I$S/sys
|
||||
COPTS= ${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
|
||||
ASFLAGS=
|
||||
@ -52,10 +51,10 @@ NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
|
||||
DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
|
||||
DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
|
||||
SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
|
||||
ioconf.o conf.o machdep.o
|
||||
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
|
||||
ioconf.o conf.o machdep.o vnode_if.o
|
||||
SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
|
||||
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
|
||||
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
|
||||
SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
|
||||
SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
|
||||
${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
|
||||
|
||||
@ -74,6 +73,13 @@ PROFILE_C= ${CC} -S -c ${CFLAGS} $< ; \
|
||||
|
||||
%LOAD
|
||||
|
||||
libkern.a:
|
||||
-@if [ X${PROF} = X ]; \
|
||||
then ln -s $S/libkern/obj/libkern.a libkern.a; \
|
||||
else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
|
||||
fi; \
|
||||
echo ln -s $S/libkern/obj/libkern.a libkern.a
|
||||
|
||||
clean:
|
||||
rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
|
||||
errs linterrs makelinks genassym ,assym.s stamp-assym
|
||||
@ -140,7 +146,7 @@ genassym: Makefile
|
||||
${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
|
||||
${I386}/i386/genassym.c -static -o genassym
|
||||
|
||||
depend: assym.s param.c
|
||||
depend: assym.s param.c vnode_if.h
|
||||
sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
|
||||
sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
|
||||
|
||||
@ -173,6 +179,11 @@ vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
|
||||
sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
|
||||
${CC} ${CFLAGS} -c vers.c
|
||||
|
||||
vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
|
||||
|
||||
%RULES
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend uses it
|
||||
|
@ -14,6 +14,7 @@ i386/i386/mem.c standard
|
||||
i386/i386/microtime.s standard
|
||||
i386/i386/ns_cksum.c optional ns
|
||||
i386/i386/pmap.c standard
|
||||
i386/i386/procfs_machdep.c optional procfs
|
||||
i386/i386/sys_machdep.c standard
|
||||
i386/i386/trap.c standard
|
||||
i386/i386/vm_machdep.c standard
|
||||
|
@ -274,7 +274,7 @@ int ahb_attach();
|
||||
int ahb_init __P((int unit));
|
||||
int ahbintr();
|
||||
int32 ahb_scsi_cmd();
|
||||
void ahb_timeout(caddr_t, int);
|
||||
void ahb_timeout(caddr_t);
|
||||
void ahb_done();
|
||||
struct ecb *cheat;
|
||||
void ahb_free_ecb();
|
||||
@ -993,7 +993,7 @@ ahb_scsi_cmd(xs)
|
||||
if (!(flags & SCSI_NOMASK)) {
|
||||
s = splbio();
|
||||
ahb_send_immed(unit, xs->sc_link->target, AHB_TARG_RESET);
|
||||
timeout(ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000);
|
||||
timeout((timeout_t)ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000);
|
||||
splx(s);
|
||||
return (SUCCESSFULLY_QUEUED);
|
||||
} else {
|
||||
@ -1122,7 +1122,7 @@ ahb_scsi_cmd(xs)
|
||||
if (!(flags & SCSI_NOMASK)) {
|
||||
s = splbio();
|
||||
ahb_send_mbox(unit, OP_START_ECB, xs->sc_link->target, ecb);
|
||||
timeout(ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000);
|
||||
timeout((timeout_t)ahb_timeout, (caddr_t)ecb, (xs->timeout * hz) / 1000);
|
||||
splx(s);
|
||||
SC_DEBUG(xs->sc_link, SDEV_DB3, ("cmd_sent\n"));
|
||||
return (SUCCESSFULLY_QUEUED);
|
||||
@ -1152,7 +1152,7 @@ ahb_scsi_cmd(xs)
|
||||
}
|
||||
|
||||
void
|
||||
ahb_timeout(caddr_t arg1, int arg2)
|
||||
ahb_timeout(caddr_t arg1)
|
||||
{
|
||||
struct ecb * ecb = (struct ecb *)arg1;
|
||||
int unit;
|
||||
@ -1199,7 +1199,7 @@ ahb_timeout(caddr_t arg1, int arg2)
|
||||
printf("\n");
|
||||
ahb_send_mbox(unit, OP_ABORT_ECB, ecb->xs->sc_link->target, ecb);
|
||||
/* 2 secs for the abort */
|
||||
timeout(ahb_timeout, (caddr_t)ecb, 2 * hz);
|
||||
timeout((timeout_t)ahb_timeout, (caddr_t)ecb, 2 * hz);
|
||||
ecb->flags = ECB_ABORTED;
|
||||
}
|
||||
splx(s);
|
||||
|
@ -44,12 +44,27 @@
|
||||
* $Id: conf.c,v 1.24 1994/04/21 14:10:31 sos Exp $
|
||||
*/
|
||||
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "buf.h"
|
||||
#include "ioctl.h"
|
||||
#include "tty.h"
|
||||
#include "conf.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
typedef int d_open_t __P((dev_t, int, int, struct proc *));
|
||||
typedef int d_close_t __P((dev_t, int, int, struct proc *));
|
||||
typedef int d_strategy_t __P((struct buf *));
|
||||
typedef int d_ioctl_t __P((dev_t, int, caddr_t, int, struct proc *));
|
||||
typedef int d_dump_t __P(());
|
||||
typedef int d_psize_t __P((dev_t));
|
||||
|
||||
typedef int d_rdwr_t __P((dev_t, struct uio *, int));
|
||||
typedef int d_stop_t __P((struct tty *, int));
|
||||
typedef int d_reset_t __P((int));
|
||||
typedef int d_select_t __P((dev_t, int, struct proc *));
|
||||
typedef int d_mmap_t __P((/* XXX */));
|
||||
|
||||
int nullop(), enxio(), enodev();
|
||||
d_rdwr_t rawread, rawwrite;
|
||||
@ -237,7 +252,7 @@ d_close_t pcclose;
|
||||
d_rdwr_t pcread, pcwrite;
|
||||
d_ioctl_t pcioctl;
|
||||
d_mmap_t pcmmap;
|
||||
extern struct tty *pccons;
|
||||
extern struct tty pccons[];
|
||||
|
||||
/* controlling TTY */
|
||||
d_open_t cttyopen;
|
||||
@ -263,7 +278,7 @@ d_close_t ptcclose;
|
||||
d_rdwr_t ptcread, ptcwrite;
|
||||
d_select_t ptcselect;
|
||||
d_ioctl_t ptyioctl;
|
||||
extern struct tty *pt_tty[];
|
||||
extern struct tty pt_tty[];
|
||||
#else
|
||||
#define ptsopen (d_open_t *)enxio
|
||||
#define ptsclose (d_close_t *)enxio
|
||||
@ -288,7 +303,7 @@ d_rdwr_t comwrite;
|
||||
d_ioctl_t comioctl;
|
||||
d_select_t comselect;
|
||||
#define comreset (d_reset_t *)enxio
|
||||
extern struct tty *com_tty[];
|
||||
extern struct tty com_tty[];
|
||||
#else
|
||||
#define comopen (d_open_t *)enxio
|
||||
#define comclose (d_close_t *)enxio
|
||||
@ -463,7 +478,7 @@ d_ioctl_t sioioctl;
|
||||
d_select_t sioselect;
|
||||
d_stop_t siostop;
|
||||
#define sioreset (d_reset_t *)enxio
|
||||
extern struct tty *sio_tty[];
|
||||
extern struct tty sio_tty[];
|
||||
#else
|
||||
#define sioopen (d_open_t *)enxio
|
||||
#define sioclose (d_close_t *)enxio
|
||||
@ -554,7 +569,7 @@ struct cdevsw cdevsw[] =
|
||||
noioc, nostop, nullreset, NULL,
|
||||
seltrue, nommap, nostrat },
|
||||
{ pcopen, pcclose, pcread, pcwrite, /*12*/
|
||||
pcioctl, nullstop, nullreset, &pccons, /* pc */
|
||||
pcioctl, nullstop, nullreset, pccons, /* pc */
|
||||
ttselect, pcmmap, NULL },
|
||||
{ sdopen, sdclose, rawread, rawwrite, /*13*/
|
||||
sdioctl, nostop, nullreset, NULL, /* sd */
|
||||
@ -634,3 +649,108 @@ int mem_no = 2; /* major device number of memory special file */
|
||||
* provided as a character (raw) device.
|
||||
*/
|
||||
dev_t swapdev = makedev(1, 0);
|
||||
|
||||
/*
|
||||
* Routine that identifies /dev/mem and /dev/kmem.
|
||||
*
|
||||
* A minimal stub routine can always return 0.
|
||||
*/
|
||||
int
|
||||
iskmemdev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
|
||||
return (major(dev) == 2 && (minor(dev) == 0 || minor(dev) == 1));
|
||||
}
|
||||
|
||||
int
|
||||
iszerodev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
return (major(dev) == 2 && minor(dev) == 12);
|
||||
}
|
||||
|
||||
/*
|
||||
* Routine to determine if a device is a disk.
|
||||
*
|
||||
* A minimal stub routine can always return 0.
|
||||
*/
|
||||
int
|
||||
isdisk(dev, type)
|
||||
dev_t dev;
|
||||
int type;
|
||||
{
|
||||
|
||||
switch (major(dev)) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
case 6:
|
||||
case 7:
|
||||
if (type == VBLK)
|
||||
return (1);
|
||||
return (0);
|
||||
case 3:
|
||||
case 9:
|
||||
case 13:
|
||||
case 15:
|
||||
case 29:
|
||||
if (type == VCHR)
|
||||
return (1);
|
||||
/* fall through */
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#define MAXDEV 32
|
||||
static int chrtoblktbl[MAXDEV] = {
|
||||
/* VCHR */ /* VBLK */
|
||||
/* 0 */ NODEV,
|
||||
/* 1 */ NODEV,
|
||||
/* 2 */ NODEV,
|
||||
/* 3 */ 0,
|
||||
/* 4 */ NODEV,
|
||||
/* 5 */ NODEV,
|
||||
/* 6 */ NODEV,
|
||||
/* 7 */ NODEV,
|
||||
/* 8 */ NODEV,
|
||||
/* 9 */ 2,
|
||||
/* 10 */ 3,
|
||||
/* 11 */ NODEV,
|
||||
/* 12 */ NODEV,
|
||||
/* 13 */ 4,
|
||||
/* 14 */ 5,
|
||||
/* 15 */ 6,
|
||||
/* 16 */ NODEV,
|
||||
/* 17 */ NODEV,
|
||||
/* 18 */ NODEV,
|
||||
/* 19 */ NODEV,
|
||||
/* 20 */ NODEV,
|
||||
/* 21 */ NODEV,
|
||||
/* 22 */ NODEV,
|
||||
/* 23 */ NODEV,
|
||||
/* 25 */ NODEV,
|
||||
/* 26 */ NODEV,
|
||||
/* 27 */ NODEV,
|
||||
/* 28 */ NODEV,
|
||||
/* 29 */ 7,
|
||||
/* 30 */ NODEV,
|
||||
/* 31 */ NODEV,
|
||||
};
|
||||
/*
|
||||
* Routine to convert from character to block device number.
|
||||
*
|
||||
* A minimal stub routine can always return NODEV.
|
||||
*/
|
||||
int
|
||||
chrtoblk(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
int blkmaj;
|
||||
|
||||
if (major(dev) >= MAXDEV || (blkmaj = chrtoblktbl[major(dev)]) == NODEV)
|
||||
return (NODEV);
|
||||
return (makedev(blkmaj, minor(dev)));
|
||||
}
|
||||
|
@ -41,9 +41,9 @@
|
||||
|
||||
|
||||
#include "sys/param.h"
|
||||
#include <sys/systm.h>
|
||||
#include "sys/proc.h"
|
||||
#include "sys/user.h"
|
||||
#include "sys/systm.h"
|
||||
#include "sys/buf.h"
|
||||
#include "sys/ioctl.h"
|
||||
#include "sys/tty.h"
|
||||
@ -122,7 +122,7 @@ cnopen(dev, flag, mode, p)
|
||||
return (0);
|
||||
|
||||
dev = cn_tab->cn_dev;
|
||||
if ((vfinddev(dev, VCHR, &vp) == 0) && vcount(vp))
|
||||
if (vfinddev(dev, VCHR, &vp) && vcount(vp))
|
||||
return (0);
|
||||
|
||||
return ((*cdevsw[major(dev)].d_open)(dev, flag, mode, p));
|
||||
@ -140,7 +140,7 @@ cnclose(dev, flag, mode, p)
|
||||
return (0);
|
||||
|
||||
dev = cn_tab->cn_dev;
|
||||
if ((vfinddev(dev, VCHR, &vp) == 0) && vcount(vp))
|
||||
if (vfinddev(dev, VCHR, &vp) && vcount(vp))
|
||||
return (0);
|
||||
|
||||
return ((*cdevsw[major(dev)].d_close)(dev, flag, mode, p));
|
||||
|
@ -69,12 +69,12 @@ extern struct tty *cn_tty;
|
||||
struct proc; struct uio;
|
||||
|
||||
/* cdevsw[] entries */
|
||||
extern int cnopen(int /*dev_t*/, int, int, struct proc *);
|
||||
extern int cnclose(int /*dev_t*/, int, int, struct proc *);
|
||||
extern int cnread(int /*dev_t*/, struct uio *, int);
|
||||
extern int cnwrite(int /*dev_t*/, struct uio *, int);
|
||||
extern int cnioctl(int /*dev_t*/, int, caddr_t, int, struct proc *);
|
||||
extern int cnselect(int /*dev_t*/, int, struct proc *);
|
||||
extern int cnopen(dev_t, int, int, struct proc *);
|
||||
extern int cnclose(dev_t, int, int, struct proc *);
|
||||
extern int cnread(dev_t, struct uio *, int);
|
||||
extern int cnwrite(dev_t, struct uio *, int);
|
||||
extern int cnioctl(dev_t, int, caddr_t, int, struct proc *);
|
||||
extern int cnselect(dev_t, int, struct proc *);
|
||||
|
||||
/* other kernel entry points */
|
||||
extern void cninit(void);
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "ddb/ddb.h"
|
||||
|
||||
#include <sys/reboot.h>
|
||||
#include <vm/vm_statistics.h>
|
||||
/* #include <vm/vm_statistics.h> */
|
||||
#include <vm/pmap.h>
|
||||
|
||||
#include <setjmp.h>
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/lock.h>
|
||||
#include <vm/vm_statistics.h>
|
||||
#include <vm/vm_prot.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/pmap.h>
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
|
@ -37,21 +37,19 @@
|
||||
* $Id: genassym.c,v 1.6 1993/11/13 02:24:59 davidg Exp $
|
||||
*/
|
||||
|
||||
#include "sys/param.h"
|
||||
#include "sys/buf.h"
|
||||
#include "sys/vmmeter.h"
|
||||
#include "sys/proc.h"
|
||||
#include "sys/user.h"
|
||||
#include "sys/mbuf.h"
|
||||
#include "sys/msgbuf.h"
|
||||
#include "sys/resourcevar.h"
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/trap.h"
|
||||
#include "machine/psl.h"
|
||||
#include "sys/syscall.h"
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/vm_map.h"
|
||||
#include "machine/pmap.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/map.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <vm/vm.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
main()
|
||||
{
|
||||
@ -70,12 +68,12 @@ main()
|
||||
|
||||
printf("#define\tI386_CR3PAT %d\n", I386_CR3PAT);
|
||||
printf("#define\tUDOT_SZ %d\n", sizeof(struct user));
|
||||
printf("#define\tP_LINK %d\n", &p->p_link);
|
||||
printf("#define\tP_RLINK %d\n", &p->p_rlink);
|
||||
printf("#define\tP_LINK %d\n", &p->p_forw);
|
||||
printf("#define\tP_RLINK %d\n", &p->p_back);
|
||||
printf("#define\tP_VMSPACE %d\n", &p->p_vmspace);
|
||||
printf("#define\tVM_PMAP %d\n", &vms->vm_pmap);
|
||||
printf("#define\tP_ADDR %d\n", &p->p_addr);
|
||||
printf("#define\tP_PRI %d\n", &p->p_pri);
|
||||
printf("#define\tP_PRI %d\n", &p->p_priority);
|
||||
printf("#define\tP_STAT %d\n", &p->p_stat);
|
||||
printf("#define\tP_WCHAN %d\n", &p->p_wchan);
|
||||
printf("#define\tP_FLAG %d\n", &p->p_flag);
|
||||
@ -87,10 +85,10 @@ main()
|
||||
printf("#define\tV_SYSCALL %d\n", &vm->v_syscall);
|
||||
printf("#define\tV_INTR %d\n", &vm->v_intr);
|
||||
printf("#define\tV_SOFT %d\n", &vm->v_soft);
|
||||
printf("#define\tV_PDMA %d\n", &vm->v_pdma);
|
||||
/* printf("#define\tV_PDMA %d\n", &vm->v_pdma); */
|
||||
printf("#define\tV_FAULTS %d\n", &vm->v_faults);
|
||||
printf("#define\tV_PGREC %d\n", &vm->v_pgrec);
|
||||
printf("#define\tV_FASTPGREC %d\n", &vm->v_fastpgrec);
|
||||
/* printf("#define\tV_PGREC %d\n", &vm->v_pgrec); */
|
||||
/* printf("#define\tV_FASTPGREC %d\n", &vm->v_fastpgrec); */
|
||||
printf("#define\tUPAGES %d\n", UPAGES);
|
||||
printf("#define\tHIGHPAGES %d\n", HIGHPAGES);
|
||||
printf("#define\tCLSIZE %d\n", CLSIZE);
|
||||
|
@ -274,7 +274,7 @@ NON_GPROF_ENTRY(btext)
|
||||
movl $0xa0,%ecx
|
||||
1:
|
||||
#endif /* BDE_DEBUGGER */
|
||||
movl $PG_V|PG_KW,%eax /* having these bits set, */
|
||||
movl $PG_V|PG_KW|PG_NC_PWT,%eax /* kernel R/W, valid, cache write-through */
|
||||
lea ((1+UPAGES+1)*NBPG)(%esi),%ebx /* phys addr of kernel PT base */
|
||||
movl %ebx,_KPTphys-KERNBASE /* save in global */
|
||||
fillkpt
|
||||
@ -302,7 +302,7 @@ NON_GPROF_ENTRY(btext)
|
||||
movl $(1+UPAGES+1+NKPT),%ecx /* number of PTEs */
|
||||
movl %esi,%eax /* phys address of PTD */
|
||||
andl $PG_FRAME,%eax /* convert to PFN, should be a NOP */
|
||||
orl $PG_V|PG_KW,%eax /* valid, kernel read/write */
|
||||
orl $PG_V|PG_KW|PG_NC_PWT,%eax /* valid, kernel read/write, cache write-though */
|
||||
movl %esi,%ebx /* calculate pte offset to ptd */
|
||||
shrl $PGSHIFT-2,%ebx
|
||||
addl %esi,%ebx /* address of page directory */
|
||||
@ -452,11 +452,27 @@ reloc_gdt:
|
||||
|
||||
pushl %esi /* value of first for init386(first) */
|
||||
call _init386 /* wire 386 chip for unix operation */
|
||||
|
||||
movl $0,_PTD
|
||||
call _main /* autoconfiguration, mountroot etc */
|
||||
popl %esi
|
||||
|
||||
#if 0
|
||||
movl $0,_PTD
|
||||
#endif
|
||||
|
||||
.globl __ucodesel,__udatasel
|
||||
|
||||
pushl $0 /* unused */
|
||||
pushl __udatasel /* ss */
|
||||
pushl $0 /* esp - filled in by execve() */
|
||||
pushl $0x3200 /* eflags (ring 3, int enab) */
|
||||
pushl __ucodesel /* cs */
|
||||
pushl $0 /* eip - filled in by execve() */
|
||||
subl $(12*4),%esp /* space for rest of registers */
|
||||
|
||||
pushl %esp /* call main with frame pointer */
|
||||
call _main /* autoconfiguration, mountroot etc */
|
||||
|
||||
addl $(13*4),%esp /* back to a frame we can return with */
|
||||
|
||||
/*
|
||||
* now we've run main() and determined what cpu-type we are, we can
|
||||
* enable WP mode on i486 cpus and above.
|
||||
@ -473,69 +489,16 @@ reloc_gdt:
|
||||
* set up address space and stack so that we can 'return' to user mode
|
||||
*/
|
||||
1:
|
||||
.globl __ucodesel,__udatasel
|
||||
movl __ucodesel,%eax
|
||||
movl __udatasel,%ecx
|
||||
/* build outer stack frame */
|
||||
pushl %ecx /* user ss */
|
||||
pushl $USRSTACK /* user esp */
|
||||
pushl %eax /* user cs */
|
||||
pushl $0 /* user ip */
|
||||
|
||||
movl %cx,%ds
|
||||
movl %cx,%es
|
||||
movl %ax,%fs /* double map cs to fs */
|
||||
movl %cx,%gs /* and ds to gs */
|
||||
lret /* goto user! */
|
||||
iret /* goto user! */
|
||||
|
||||
pushl $lretmsg1 /* "should never get here!" */
|
||||
call _panic
|
||||
lretmsg1:
|
||||
.asciz "lret: toinit\n"
|
||||
|
||||
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
|
||||
/*
|
||||
* Icode is copied out to process 1 and executed in user mode:
|
||||
* execve("/sbin/init", argv, envp); exit(0);
|
||||
* If the execve fails, process 1 exits and the system panics.
|
||||
*/
|
||||
NON_GPROF_ENTRY(icode)
|
||||
pushl $0 /* envp for execve() */
|
||||
|
||||
# pushl $argv-_icode /* can't do this 'cos gas 1.38 is broken */
|
||||
movl $argv,%eax
|
||||
subl $_icode,%eax
|
||||
pushl %eax /* argp for execve() */
|
||||
|
||||
# pushl $init-_icode
|
||||
movl $init,%eax
|
||||
subl $_icode,%eax
|
||||
pushl %eax /* fname for execve() */
|
||||
|
||||
pushl %eax /* dummy return address */
|
||||
|
||||
movl $SYS_execve,%eax
|
||||
LCALL(0x7,0x0)
|
||||
|
||||
/* exit if something botches up in the above execve() */
|
||||
pushl %eax /* execve failed, the errno will do for an */
|
||||
/* exit code because errnos are < 128 */
|
||||
pushl %eax /* dummy return address */
|
||||
movl $SYS_exit,%eax
|
||||
LCALL(0x7,0x0)
|
||||
|
||||
init:
|
||||
.asciz "/sbin/init"
|
||||
ALIGN_DATA
|
||||
argv:
|
||||
.long init+6-_icode /* argv[0] = "init" ("/sbin/init" + 6) */
|
||||
.long eicode-_icode /* argv[1] follows icode after copyout */
|
||||
.long 0
|
||||
eicode:
|
||||
|
||||
.globl _szicode
|
||||
_szicode:
|
||||
.long _szicode-_icode
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y ; .word x
|
||||
|
||||
NON_GPROF_ENTRY(sigcode)
|
||||
call SIGF_HANDLER(%esp)
|
||||
|
@ -41,23 +41,24 @@
|
||||
#include "npx.h"
|
||||
#include "isa.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "signalvar.h"
|
||||
#include "kernel.h"
|
||||
#include "map.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "exec.h" /* for PS_STRINGS */
|
||||
#include "buf.h"
|
||||
#include "reboot.h"
|
||||
#include "conf.h"
|
||||
#include "file.h"
|
||||
#include "callout.h"
|
||||
#include "malloc.h"
|
||||
#include "mbuf.h"
|
||||
#include "msgbuf.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/map.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include "sys/shm.h"
|
||||
@ -94,7 +95,7 @@ static void identifycpu(void);
|
||||
static void initcpu(void);
|
||||
static int test_page(int *, int);
|
||||
|
||||
extern int grow(struct proc *,int);
|
||||
extern int grow(struct proc *,u_int);
|
||||
const char machine[] = "PC-Class";
|
||||
const char *cpu_model;
|
||||
|
||||
@ -121,6 +122,7 @@ int bouncepages = BOUNCEPAGES;
|
||||
#else
|
||||
int bouncepages = 0;
|
||||
#endif
|
||||
int msgbufmapped = 0; /* set when safe to use msgbuf */
|
||||
extern int freebufspace;
|
||||
extern char *bouncememory;
|
||||
|
||||
@ -141,6 +143,12 @@ extern cyloffset;
|
||||
int cpu_class;
|
||||
|
||||
void dumpsys __P((void));
|
||||
vm_offset_t buffer_sva, buffer_eva;
|
||||
vm_offset_t clean_sva, clean_eva;
|
||||
vm_offset_t pager_sva, pager_eva;
|
||||
int maxbkva, pager_map_size;
|
||||
|
||||
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
||||
|
||||
void
|
||||
cpu_startup()
|
||||
@ -275,18 +283,19 @@ cpu_startup()
|
||||
if ((vm_size_t)(v - firstaddr) != size)
|
||||
panic("startup: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Allocate a submap for buffer space allocations.
|
||||
* XXX we are NOT using buffer_map, but due to
|
||||
* the references to it we will just allocate 1 page of
|
||||
* vm (not real memory) to make things happy...
|
||||
*/
|
||||
buffer_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
/* bufpages * */NBPG, TRUE);
|
||||
clean_map = kmem_suballoc(kernel_map, &clean_sva, &clean_eva,
|
||||
(nbuf*MAXBSIZE) + VM_PHYS_SIZE + maxbkva + pager_map_size, TRUE);
|
||||
|
||||
io_map = kmem_suballoc(clean_map, &minaddr, &maxaddr, maxbkva, FALSE);
|
||||
pager_map = kmem_suballoc(clean_map, &pager_sva, &pager_eva,
|
||||
pager_map_size, TRUE);
|
||||
|
||||
buffer_map = kmem_suballoc(clean_map, &buffer_sva, &buffer_eva,
|
||||
(nbuf * MAXBSIZE), TRUE);
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
phys_map = kmem_suballoc(clean_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, TRUE);
|
||||
|
||||
/*
|
||||
@ -296,7 +305,7 @@ cpu_startup()
|
||||
mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
|
||||
M_MBUF, M_NOWAIT);
|
||||
bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
|
||||
mb_map = kmem_suballoc(kmem_map, (vm_offset_t)&mbutl, &maxaddr,
|
||||
mb_map = kmem_suballoc(kmem_map, (vm_offset_t *)&mbutl, &maxaddr,
|
||||
VM_MBUF_SIZE, FALSE);
|
||||
/*
|
||||
* Initialize callouts
|
||||
@ -305,7 +314,7 @@ cpu_startup()
|
||||
for (i = 1; i < ncallout; i++)
|
||||
callout[i-1].c_next = &callout[i];
|
||||
|
||||
printf("avail memory = %d (%d pages)\n", ptoa(vm_page_free_count), vm_page_free_count);
|
||||
printf("avail memory = %d (%d pages)\n", ptoa(cnt.v_free_count), cnt.v_free_count);
|
||||
printf("using %d buffers containing %d bytes of memory\n",
|
||||
nbuf, bufpages * CLBYTES);
|
||||
|
||||
@ -437,11 +446,11 @@ sendsig(catcher, sig, mask, code)
|
||||
register struct proc *p = curproc;
|
||||
register int *regs;
|
||||
register struct sigframe *fp;
|
||||
struct sigacts *ps = p->p_sigacts;
|
||||
struct sigacts *psp = p->p_sigacts;
|
||||
int oonstack, frmtrap;
|
||||
|
||||
regs = p->p_regs;
|
||||
oonstack = ps->ps_onstack;
|
||||
regs = p->p_md.md_regs;
|
||||
oonstack = psp->ps_sigstk.ss_flags & SA_ONSTACK;
|
||||
/*
|
||||
* Allocate and validate space for the signal handler
|
||||
* context. Note that if the stack is in P0 space, the
|
||||
@ -449,10 +458,12 @@ sendsig(catcher, sig, mask, code)
|
||||
* will fail if the process has not already allocated
|
||||
* the space with a `brk'.
|
||||
*/
|
||||
if (!ps->ps_onstack && (ps->ps_sigonstack & sigmask(sig))) {
|
||||
fp = (struct sigframe *)(ps->ps_sigsp
|
||||
- sizeof(struct sigframe));
|
||||
ps->ps_onstack = 1;
|
||||
if ((psp->ps_flags & SAS_ALTSTACK) &&
|
||||
(psp->ps_sigstk.ss_flags & SA_ONSTACK) == 0 &&
|
||||
(psp->ps_sigonstack & sigmask(sig))) {
|
||||
fp = (struct sigframe *)(psp->ps_sigstk.ss_base +
|
||||
psp->ps_sigstk.ss_size - sizeof(struct sigframe));
|
||||
psp->ps_sigstk.ss_flags |= SA_ONSTACK;
|
||||
} else {
|
||||
fp = (struct sigframe *)(regs[tESP]
|
||||
- sizeof(struct sigframe));
|
||||
@ -540,7 +551,7 @@ sigreturn(p, uap, retval)
|
||||
{
|
||||
register struct sigcontext *scp;
|
||||
register struct sigframe *fp;
|
||||
register int *regs = p->p_regs;
|
||||
register int *regs = p->p_md.md_regs;
|
||||
int eflags;
|
||||
|
||||
/*
|
||||
@ -614,7 +625,10 @@ sigreturn(p, uap, retval)
|
||||
if (useracc((caddr_t)scp, sizeof (*scp), 0) == 0)
|
||||
return(EINVAL);
|
||||
|
||||
p->p_sigacts->ps_onstack = scp->sc_onstack & 01;
|
||||
if (scp->sc_onstack & 01)
|
||||
p->p_sigacts->ps_sigstk.ss_flags |= SA_ONSTACK;
|
||||
else
|
||||
p->p_sigacts->ps_sigstk.ss_flags &= ~SA_ONSTACK;
|
||||
p->p_sigmask = scp->sc_mask &~
|
||||
(sigmask(SIGKILL)|sigmask(SIGCONT)|sigmask(SIGSTOP));
|
||||
regs[tEBP] = scp->sc_fp;
|
||||
@ -651,7 +665,7 @@ boot(arghowto)
|
||||
for(;;);
|
||||
}
|
||||
howto = arghowto;
|
||||
if ((howto&RB_NOSYNC) == 0 && waittime < 0 && bfreelist[0].b_forw) {
|
||||
if ((howto&RB_NOSYNC) == 0 && waittime < 0) {
|
||||
register struct buf *bp;
|
||||
int iter, nbusy;
|
||||
|
||||
@ -818,13 +832,13 @@ setregs(p, entry, stack)
|
||||
u_long entry;
|
||||
u_long stack;
|
||||
{
|
||||
p->p_regs[tEBP] = 0; /* bottom of the fp chain */
|
||||
p->p_regs[tEIP] = entry;
|
||||
p->p_regs[tESP] = stack;
|
||||
p->p_regs[tSS] = _udatasel;
|
||||
p->p_regs[tDS] = _udatasel;
|
||||
p->p_regs[tES] = _udatasel;
|
||||
p->p_regs[tCS] = _ucodesel;
|
||||
p->p_md.md_regs[tEBP] = 0; /* bottom of the fp chain */
|
||||
p->p_md.md_regs[tEIP] = entry;
|
||||
p->p_md.md_regs[tESP] = stack;
|
||||
p->p_md.md_regs[tSS] = _udatasel;
|
||||
p->p_md.md_regs[tDS] = _udatasel;
|
||||
p->p_md.md_regs[tES] = _udatasel;
|
||||
p->p_md.md_regs[tCS] = _ucodesel;
|
||||
|
||||
p->p_addr->u_pcb.pcb_flags = 0; /* no fp at all */
|
||||
load_cr0(rcr0() | CR0_TS); /* start emulating */
|
||||
@ -833,6 +847,34 @@ setregs(p, entry, stack)
|
||||
#endif /* NNPX > 0 */
|
||||
}
|
||||
|
||||
/*
|
||||
* machine dependent system variables.
|
||||
*/
|
||||
int
|
||||
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
/* all sysctl names at this level are terminal */
|
||||
if (namelen != 1)
|
||||
return (ENOTDIR); /* overloaded */
|
||||
|
||||
switch (name[0]) {
|
||||
case CPU_CONSDEV:
|
||||
return (sysctl_rdstruct(oldp, oldlenp, newp, &cn_tty->t_dev,
|
||||
sizeof cn_tty->t_dev));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize 386 and configure to run kernel
|
||||
*/
|
||||
@ -1105,9 +1147,11 @@ init386(first)
|
||||
r_gdt.rd_limit = sizeof(gdt) - 1;
|
||||
r_gdt.rd_base = (int) gdt;
|
||||
lgdt(&r_gdt);
|
||||
|
||||
r_idt.rd_limit = sizeof(idt) - 1;
|
||||
r_idt.rd_base = (int) idt;
|
||||
lidt(&r_idt);
|
||||
|
||||
_default_ldt = GSEL(GLDT_SEL, SEL_KPL);
|
||||
lldt(_default_ldt);
|
||||
currentldt = _default_ldt;
|
||||
@ -1339,7 +1383,7 @@ _remque(element)
|
||||
* The registers are in the frame; the frame is in the user area of
|
||||
* the process in question; when the process is active, the registers
|
||||
* are in "the kernel stack"; when it's not, they're still there, but
|
||||
* things get flipped around. So, since p->p_regs is the whole address
|
||||
* things get flipped around. So, since p->p_md.md_regs is the whole address
|
||||
* of the register set, take its offset from the kernel stack, and
|
||||
* index into the user block. Don't you just *love* virtual memory?
|
||||
* (I'm starting to think seymour is right...)
|
||||
@ -1348,7 +1392,7 @@ _remque(element)
|
||||
int
|
||||
ptrace_set_pc (struct proc *p, unsigned int addr) {
|
||||
void *regs = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
((struct trapframe *)regs)->tf_eip = addr;
|
||||
return 0;
|
||||
@ -1357,7 +1401,7 @@ ptrace_set_pc (struct proc *p, unsigned int addr) {
|
||||
int
|
||||
ptrace_single_step (struct proc *p) {
|
||||
void *regs = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
((struct trapframe *)regs)->tf_eflags |= PSL_T;
|
||||
return 0;
|
||||
@ -1370,7 +1414,7 @@ ptrace_single_step (struct proc *p) {
|
||||
int
|
||||
ptrace_getregs (struct proc *p, unsigned int *addr) {
|
||||
int error;
|
||||
struct regs regs = {0};
|
||||
struct reg regs = {0};
|
||||
|
||||
if (error = fill_regs (p, ®s))
|
||||
return error;
|
||||
@ -1381,7 +1425,7 @@ ptrace_getregs (struct proc *p, unsigned int *addr) {
|
||||
int
|
||||
ptrace_setregs (struct proc *p, unsigned int *addr) {
|
||||
int error;
|
||||
struct regs regs = {0};
|
||||
struct reg regs = {0};
|
||||
|
||||
if (error = copyin (addr, ®s, sizeof(regs)))
|
||||
return error;
|
||||
@ -1390,11 +1434,11 @@ ptrace_setregs (struct proc *p, unsigned int *addr) {
|
||||
}
|
||||
|
||||
int
|
||||
fill_regs(struct proc *p, struct regs *regs) {
|
||||
fill_regs(struct proc *p, struct reg *regs) {
|
||||
int error;
|
||||
struct trapframe *tp;
|
||||
void *ptr = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
tp = ptr;
|
||||
regs->r_es = tp->tf_es;
|
||||
@ -1415,11 +1459,11 @@ fill_regs(struct proc *p, struct regs *regs) {
|
||||
}
|
||||
|
||||
int
|
||||
set_regs (struct proc *p, struct regs *regs) {
|
||||
set_regs (struct proc *p, struct reg *regs) {
|
||||
int error;
|
||||
struct trapframe *tp;
|
||||
void *ptr = (char*)p->p_addr +
|
||||
((char*) p->p_regs - (char*) kstack);
|
||||
((char*) p->p_md.md_regs - (char*) kstack);
|
||||
|
||||
tp = ptr;
|
||||
tp->tf_es = regs->r_es;
|
||||
@ -1444,6 +1488,69 @@ set_regs (struct proc *p, struct regs *regs) {
|
||||
void
|
||||
Debugger(const char *msg)
|
||||
{
|
||||
printf("Debugger(\"%s\") called.", msg);
|
||||
printf("Debugger(\"%s\") called.\n", msg);
|
||||
}
|
||||
#endif /* no DDB */
|
||||
|
||||
#include <sys/disklabel.h>
|
||||
#define b_cylin b_resid
|
||||
#define dkpart(dev) (minor(dev) & 7)
|
||||
/*
|
||||
* Determine the size of the transfer, and make sure it is
|
||||
* within the boundaries of the partition. Adjust transfer
|
||||
* if needed, and signal errors or early completion.
|
||||
*/
|
||||
int
|
||||
bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
|
||||
{
|
||||
struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
|
||||
int labelsect = lp->d_partitions[0].p_offset;
|
||||
int maxsz = p->p_size,
|
||||
sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
|
||||
|
||||
/* overwriting disk label ? */
|
||||
/* XXX should also protect bootstrap in first 8K */
|
||||
if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
|
||||
#if LABELSECTOR != 0
|
||||
bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
|
||||
#endif
|
||||
(bp->b_flags & B_READ) == 0 && wlabel == 0) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
#if defined(DOSBBSECTOR) && defined(notyet)
|
||||
/* overwriting master boot record? */
|
||||
if (bp->b_blkno + p->p_offset <= DOSBBSECTOR &&
|
||||
(bp->b_flags & B_READ) == 0 && wlabel == 0) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* beyond partition? */
|
||||
if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
|
||||
/* if exactly at end of disk, return an EOF */
|
||||
if (bp->b_blkno == maxsz) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
return(0);
|
||||
}
|
||||
/* or truncate if part of it fits */
|
||||
sz = maxsz - bp->b_blkno;
|
||||
if (sz <= 0) {
|
||||
bp->b_error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
bp->b_bcount = sz << DEV_BSHIFT;
|
||||
}
|
||||
|
||||
/* calculate cylinder for disksort to order transfers with */
|
||||
bp->b_pblkno = bp->b_blkno + p->p_offset;
|
||||
bp->b_cylin = bp->b_pblkno / lp->d_secpercyl;
|
||||
return(1);
|
||||
|
||||
bad:
|
||||
bp->b_flags |= B_ERROR;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@ -35,20 +35,21 @@
|
||||
* hide most of the 387-specific things here.
|
||||
*/
|
||||
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/reg.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "acct.h"
|
||||
#include "kernel.h"
|
||||
#include "signal.h"
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/acct.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#define __ALIGNED_TEMP_REAL 1
|
||||
#include "i386/i386/math_emu.h"
|
||||
#include "math_emu.h"
|
||||
|
||||
#define bswapw(x) __asm__("xchgb %%al,%%ah":"=a" (x):"0" ((short)x))
|
||||
#define ST(x) (*__st((x)))
|
||||
@ -568,7 +569,7 @@ static int __regoffset[] = {
|
||||
tEAX, tECX, tEDX, tEBX, tESP, tEBP, tESI, tEDI
|
||||
};
|
||||
|
||||
#define REG(x) (curproc->p_regs[__regoffset[(x)]])
|
||||
#define REG(x) (curproc->p_md.md_regs[__regoffset[(x)]])
|
||||
|
||||
static char * sib(struct trapframe * info, int mod)
|
||||
{
|
||||
|
@ -45,24 +45,23 @@
|
||||
* Memory special file
|
||||
*/
|
||||
|
||||
#include "param.h"
|
||||
#include "conf.h"
|
||||
#include "buf.h"
|
||||
#include "systm.h"
|
||||
#include "uio.h"
|
||||
#include "malloc.h"
|
||||
#include "proc.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/psl.h"
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/psl.h>
|
||||
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/lock.h"
|
||||
#include "vm/vm_statistics.h"
|
||||
#include "vm/vm_prot.h"
|
||||
#include "vm/pmap.h"
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/lock.h>
|
||||
#include <vm/vm_prot.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
extern char *vmmap; /* poor name! */
|
||||
extern char *ptvmmap; /* poor name! */
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
mmclose(dev, uio, flags)
|
||||
@ -74,7 +73,7 @@ mmclose(dev, uio, flags)
|
||||
|
||||
switch (minor(dev)) {
|
||||
case 14:
|
||||
fp = (struct trapframe *)curproc->p_regs;
|
||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
||||
fp->tf_eflags &= ~PSL_IOPL;
|
||||
break;
|
||||
default:
|
||||
@ -93,7 +92,7 @@ mmopen(dev, uio, flags)
|
||||
|
||||
switch (minor(dev)) {
|
||||
case 14:
|
||||
fp = (struct trapframe *)curproc->p_regs;
|
||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
||||
fp->tf_eflags |= PSL_IOPL;
|
||||
break;
|
||||
default:
|
||||
@ -128,25 +127,25 @@ mmrw(dev, uio, flags)
|
||||
/* minor device 0 is physical memory */
|
||||
case 0:
|
||||
v = uio->uio_offset;
|
||||
pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, v,
|
||||
pmap_enter(kernel_pmap, (vm_offset_t)ptvmmap, v,
|
||||
uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE,
|
||||
TRUE);
|
||||
o = (int)uio->uio_offset & PGOFSET;
|
||||
c = (u_int)(NBPG - ((int)iov->iov_base & PGOFSET));
|
||||
c = MIN(c, (u_int)(NBPG - o));
|
||||
c = MIN(c, (u_int)iov->iov_len);
|
||||
error = uiomove((caddr_t)&vmmap[o], (int)c, uio);
|
||||
pmap_remove(pmap_kernel(), (vm_offset_t)vmmap,
|
||||
(vm_offset_t)&vmmap[NBPG]);
|
||||
c = min(c, (u_int)(NBPG - o));
|
||||
c = min(c, (u_int)iov->iov_len);
|
||||
error = uiomove((caddr_t)&ptvmmap[o], (int)c, uio);
|
||||
pmap_remove(kernel_pmap, (vm_offset_t)ptvmmap,
|
||||
(vm_offset_t)&ptvmmap[NBPG]);
|
||||
continue;
|
||||
|
||||
/* minor device 1 is kernel memory */
|
||||
case 1:
|
||||
c = iov->iov_len;
|
||||
if (!kernacc((caddr_t)uio->uio_offset, c,
|
||||
if (!kernacc((caddr_t)(int)uio->uio_offset, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return(EFAULT);
|
||||
error = uiomove((caddr_t)uio->uio_offset, (int)c, uio);
|
||||
error = uiomove((caddr_t)(int)uio->uio_offset, (int)c, uio);
|
||||
continue;
|
||||
|
||||
/* minor device 2 is EOF/RATHOLE */
|
||||
@ -167,7 +166,7 @@ mmrw(dev, uio, flags)
|
||||
malloc(CLBYTES, M_TEMP, M_WAITOK);
|
||||
bzero(zbuf, CLBYTES);
|
||||
}
|
||||
c = MIN(iov->iov_len, CLBYTES);
|
||||
c = min(iov->iov_len, CLBYTES);
|
||||
error = uiomove(zbuf, (int)c, uio);
|
||||
continue;
|
||||
|
||||
|
@ -85,19 +85,19 @@
|
||||
* and to when physical maps must be made correct.
|
||||
*/
|
||||
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "malloc.h"
|
||||
#include "user.h"
|
||||
#include "i386/include/cpufunc.h"
|
||||
#include "i386/include/cputypes.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include "vm/vm_page.h"
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include "i386/isa/isa.h"
|
||||
#include <i386/include/cpufunc.h>
|
||||
#include <i386/include/cputypes.h>
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
/*
|
||||
* Allocate various and sundry SYSMAPs used in the days of old VM
|
||||
@ -149,12 +149,12 @@ static inline void *vm_get_pmap();
|
||||
static inline void vm_put_pmap();
|
||||
inline void pmap_use_pt();
|
||||
inline void pmap_unuse_pt();
|
||||
inline pt_entry_t * const pmap_pte();
|
||||
inline pt_entry_t * pmap_pte();
|
||||
static inline pv_entry_t get_pv_entry();
|
||||
void pmap_alloc_pv_entry();
|
||||
void pmap_clear_modify();
|
||||
void i386_protection_init();
|
||||
extern vm_offset_t pager_sva, pager_eva;
|
||||
extern vm_offset_t clean_sva, clean_eva;
|
||||
extern int cpu_class;
|
||||
|
||||
#if BSDVM_COMPAT
|
||||
@ -163,8 +163,8 @@ extern int cpu_class;
|
||||
/*
|
||||
* All those kernel PT submaps that BSD is so fond of
|
||||
*/
|
||||
pt_entry_t *CMAP1, *CMAP2, *mmap;
|
||||
caddr_t CADDR1, CADDR2, vmmap;
|
||||
pt_entry_t *CMAP1, *CMAP2, *ptmmap;
|
||||
caddr_t CADDR1, CADDR2, ptvmmap;
|
||||
pt_entry_t *msgbufmap;
|
||||
struct msgbuf *msgbufp;
|
||||
#endif
|
||||
@ -180,8 +180,8 @@ void init_pv_entries(int) ;
|
||||
*/
|
||||
|
||||
inline pt_entry_t *
|
||||
const pmap_pte(pmap, va)
|
||||
register pmap_t pmap;
|
||||
pmap_pte(pmap, va)
|
||||
pmap_t pmap;
|
||||
vm_offset_t va;
|
||||
{
|
||||
|
||||
@ -374,7 +374,7 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
|
||||
SYSMAP(caddr_t ,CMAP1 ,CADDR1 ,1 )
|
||||
SYSMAP(caddr_t ,CMAP2 ,CADDR2 ,1 )
|
||||
SYSMAP(caddr_t ,mmap ,vmmap ,1 )
|
||||
SYSMAP(caddr_t ,ptmmap ,ptvmmap ,1 )
|
||||
SYSMAP(struct msgbuf * ,msgbufmap ,msgbufp ,1 )
|
||||
virtual_avail = va;
|
||||
#endif
|
||||
@ -530,7 +530,7 @@ static inline void
|
||||
vm_put_pmap(up)
|
||||
struct pmaplist *up;
|
||||
{
|
||||
kmem_free(kernel_map, up, ctob(1));
|
||||
kmem_free(kernel_map, (vm_offset_t)up, ctob(1));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -851,7 +851,7 @@ pmap_remove(pmap, sva, eva)
|
||||
if (pmap_is_managed(pa)) {
|
||||
if ((((int) oldpte & PG_M) && (sva < USRSTACK || sva > UPT_MAX_ADDRESS))
|
||||
|| (sva >= USRSTACK && sva < USRSTACK+(UPAGES*NBPG))) {
|
||||
if (sva < pager_sva || sva >= pager_eva) {
|
||||
if (sva < clean_sva || sva >= clean_eva) {
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
m->flags &= ~PG_CLEAN;
|
||||
}
|
||||
@ -941,7 +941,7 @@ pmap_remove(pmap, sva, eva)
|
||||
|
||||
if ((((int) oldpte & PG_M) && (va < USRSTACK || va > UPT_MAX_ADDRESS))
|
||||
|| (va >= USRSTACK && va < USRSTACK+(UPAGES*NBPG))) {
|
||||
if (va < pager_sva || va >= pager_eva) {
|
||||
if (va < clean_sva || va >= clean_eva ) {
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
m->flags &= ~PG_CLEAN;
|
||||
}
|
||||
@ -1006,7 +1006,7 @@ pmap_remove_all(pa)
|
||||
if ( (m->flags & PG_CLEAN) &&
|
||||
((((int) *pte) & PG_M) && (pv->pv_va < USRSTACK || pv->pv_va > UPT_MAX_ADDRESS))
|
||||
|| (pv->pv_va >= USRSTACK && pv->pv_va < USRSTACK+(UPAGES*NBPG))) {
|
||||
if (pv->pv_va < pager_sva || pv->pv_va >= pager_eva) {
|
||||
if (pv->pv_va < clean_sva || pv->pv_va >= clean_eva) {
|
||||
m->flags &= ~PG_CLEAN;
|
||||
}
|
||||
}
|
||||
@ -1261,7 +1261,11 @@ pmap_enter(pmap, va, pa, prot, wired)
|
||||
if (va < UPT_MIN_ADDRESS)
|
||||
(int) npte |= PG_u;
|
||||
else if (va < UPT_MAX_ADDRESS)
|
||||
(int) npte |= PG_u | PG_RW;
|
||||
(int) npte |= PG_u | PG_RW | PG_NC_PWT;
|
||||
|
||||
/*
|
||||
printf("mapping: pa: %x, to va: %x, with pte: %x\n", pa, va, npte);
|
||||
*/
|
||||
|
||||
if( *pte != npte) {
|
||||
*pte = npte;
|
||||
@ -1414,7 +1418,7 @@ pmap_enter_quick(pmap, va, pa)
|
||||
/*
|
||||
* Now validate mapping with desired protection/wiring.
|
||||
*/
|
||||
*pte = (pt_entry_t) ( (int) (pa | PG_RO | PG_V | PG_u));
|
||||
*pte = (pt_entry_t) ( (int) (pa | PG_V | PG_u));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1448,16 +1452,16 @@ pmap_object_init_pt(pmap, addr, object, offset, size)
|
||||
*/
|
||||
if( size > object->size / 2) {
|
||||
objbytes = size;
|
||||
p = (vm_page_t) queue_first(&object->memq);
|
||||
while (!queue_end(&object->memq, (queue_entry_t) p) && objbytes != 0) {
|
||||
p = object->memq.tqh_first;
|
||||
while ((p != NULL) && (objbytes != 0)) {
|
||||
tmpoff = p->offset;
|
||||
if( tmpoff < offset) {
|
||||
p = (vm_page_t) queue_next(&p->listq);
|
||||
p = p->listq.tqe_next;
|
||||
continue;
|
||||
}
|
||||
tmpoff -= offset;
|
||||
if( tmpoff >= size) {
|
||||
p = (vm_page_t) queue_next(&p->listq);
|
||||
p = p->listq.tqe_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1469,7 +1473,7 @@ pmap_object_init_pt(pmap, addr, object, offset, size)
|
||||
vm_page_unhold(p);
|
||||
pmap_enter_quick(pmap, addr+tmpoff, VM_PAGE_TO_PHYS(p));
|
||||
}
|
||||
p = (vm_page_t) queue_next(&p->listq);
|
||||
p = p->listq.tqe_next;
|
||||
objbytes -= NBPG;
|
||||
}
|
||||
} else {
|
||||
@ -1699,13 +1703,13 @@ pmap_testbit(pa, bit)
|
||||
* ptes as never modified.
|
||||
*/
|
||||
if (bit & PG_U ) {
|
||||
if ((pv->pv_va >= pager_sva) && (pv->pv_va < pager_eva)) {
|
||||
if ((pv->pv_va >= clean_sva) && (pv->pv_va < clean_eva)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (bit & PG_M ) {
|
||||
if (pv->pv_va >= USRSTACK) {
|
||||
if (pv->pv_va >= pager_sva && pv->pv_va < pager_eva) {
|
||||
if (pv->pv_va >= clean_sva && pv->pv_va < clean_eva) {
|
||||
continue;
|
||||
}
|
||||
if (pv->pv_va < USRSTACK+(UPAGES*NBPG)) {
|
||||
@ -1761,7 +1765,7 @@ pmap_changebit(pa, bit, setem)
|
||||
* don't write protect pager mappings
|
||||
*/
|
||||
if (!setem && (bit == PG_RW)) {
|
||||
if (va >= pager_sva && va < pager_eva)
|
||||
if (va >= clean_sva && va < clean_eva)
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1869,6 +1873,10 @@ pmap_phys_address(ppn)
|
||||
/*
|
||||
* Miscellaneous support routines follow
|
||||
*/
|
||||
/*
|
||||
* This really just builds a table for page write enable
|
||||
* translation.
|
||||
*/
|
||||
|
||||
void
|
||||
i386_protection_init()
|
||||
@ -1879,12 +1887,10 @@ i386_protection_init()
|
||||
for (prot = 0; prot < 8; prot++) {
|
||||
switch (prot) {
|
||||
case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE:
|
||||
*kp++ = 0;
|
||||
break;
|
||||
case VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE:
|
||||
case VM_PROT_READ | VM_PROT_NONE | VM_PROT_EXECUTE:
|
||||
case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_EXECUTE:
|
||||
*kp++ = PG_RO;
|
||||
*kp++ = 0;
|
||||
break;
|
||||
case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE:
|
||||
case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE:
|
||||
|
@ -73,7 +73,7 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
/*#include <machine/frame.h>*/
|
||||
#include <machine/frame.h>
|
||||
#include <miscfs/procfs/procfs.h>
|
||||
|
||||
int
|
||||
@ -81,15 +81,13 @@ procfs_read_regs(p, regs)
|
||||
struct proc *p;
|
||||
struct reg *regs;
|
||||
{
|
||||
struct frame *f;
|
||||
struct trapframe *f;
|
||||
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
f = (struct frame *) p->p_md.md_regs;
|
||||
bcopy((void *) f->f_regs, (void *) regs->r_regs, sizeof(regs->r_regs));
|
||||
regs->r_pc = f->f_pc;
|
||||
regs->r_sr = f->f_sr;
|
||||
f = (struct trapframe *) p->p_md.md_regs;
|
||||
bcopy((void *) f, (void *) regs, sizeof(*regs));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -105,15 +103,13 @@ procfs_write_regs(p, regs)
|
||||
struct proc *p;
|
||||
struct reg *regs;
|
||||
{
|
||||
struct frame *f;
|
||||
struct trapframe *f;
|
||||
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
f = (struct frame *) p->p_md.md_regs;
|
||||
bcopy((void *) regs->r_regs, (void *) f->f_regs, sizeof(f->f_regs));
|
||||
f->f_pc = regs->r_pc;
|
||||
f->f_sr = regs->r_sr;
|
||||
f = (struct trapframe *) p->p_md.md_regs;
|
||||
bcopy((void *) regs, (void *) f, sizeof(*regs));
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -146,7 +142,7 @@ procfs_sstep(p)
|
||||
|
||||
error = procfs_read_regs(p, &r);
|
||||
if (error == 0) {
|
||||
r.r_sr |= PSL_T;
|
||||
r.r_eflags |= PSL_T;
|
||||
error = procfs_write_regs(p, &r);
|
||||
}
|
||||
|
||||
|
@ -185,6 +185,7 @@ ENTRY(outsl) /* outsl(port, addr, cnt) */
|
||||
* memory moves on standard DX !!!!!
|
||||
*/
|
||||
|
||||
ALTENTRY(blkclr)
|
||||
ENTRY(bzero)
|
||||
#if defined(I486_CPU) && (defined(I386_CPU) || defined(I586_CPU))
|
||||
cmpl $CPUCLASS_486,_cpu_class
|
||||
@ -656,6 +657,17 @@ ENTRY(fuword)
|
||||
movl $0,PCB_ONFAULT(%ecx)
|
||||
ret
|
||||
|
||||
/*
|
||||
* These two routines are called from the profiling code, potentially
|
||||
* at interrupt time. If they fail, that's okay, good things will
|
||||
* happen later. Fail all the time for now - until the trap code is
|
||||
* able to deal with this.
|
||||
*/
|
||||
ALTENTRY(suswintr)
|
||||
ENTRY(fuswintr)
|
||||
movl $-1,%eax
|
||||
ret
|
||||
|
||||
ENTRY(fusword)
|
||||
movl _curpcb,%ecx
|
||||
movl $fusufault,PCB_ONFAULT(%ecx)
|
||||
|
@ -52,9 +52,9 @@
|
||||
/*
|
||||
* The following primitives manipulate the run queues.
|
||||
* _whichqs tells which of the 32 queues _qs
|
||||
* have processes in them. Setrq puts processes into queues, Remrq
|
||||
* have processes in them. setrunqueue puts processes into queues, Remrq
|
||||
* removes them from queues. The running process is on no queue,
|
||||
* other processes are on a queue related to p->p_pri, divided by 4
|
||||
* other processes are on a queue related to p->p_priority, divided by 4
|
||||
* actually to shrink the 0-127 range of priorities into the 32 available
|
||||
* queues.
|
||||
*/
|
||||
@ -72,11 +72,11 @@ _want_resched: .long 0 /* we need to re-run the scheduler */
|
||||
|
||||
.text
|
||||
/*
|
||||
* Setrq(p)
|
||||
* setrunqueue(p)
|
||||
*
|
||||
* Call should be made at spl6(), and p->p_stat should be SRUN
|
||||
*/
|
||||
ENTRY(setrq)
|
||||
ENTRY(setrunqueue)
|
||||
movl 4(%esp),%eax
|
||||
cmpl $0,P_RLINK(%eax) /* should not be on q already */
|
||||
je set1
|
||||
@ -95,7 +95,7 @@ set1:
|
||||
movl %eax,P_LINK(%ecx)
|
||||
ret
|
||||
|
||||
set2: .asciz "setrq"
|
||||
set2: .asciz "setrunqueue"
|
||||
|
||||
/*
|
||||
* Remrq(p)
|
||||
@ -131,10 +131,10 @@ rem2:
|
||||
ret
|
||||
|
||||
rem3: .asciz "remrq"
|
||||
sw0: .asciz "swtch"
|
||||
sw0: .asciz "cpu_switch"
|
||||
|
||||
/*
|
||||
* When no processes are on the runq, swtch() branches to _idle
|
||||
* When no processes are on the runq, cpu_switch() branches to _idle
|
||||
* to wait for something to come ready.
|
||||
*/
|
||||
ALIGN_TEXT
|
||||
@ -146,8 +146,8 @@ _idle:
|
||||
sti
|
||||
|
||||
/*
|
||||
* XXX callers of swtch() do a bogus splclock(). Locking should
|
||||
* be left to swtch().
|
||||
* XXX callers of cpu_switch() do a bogus splclock(). Locking should
|
||||
* be left to cpu_switch().
|
||||
*/
|
||||
movl $SWI_AST_MASK,_cpl
|
||||
testl $~SWI_AST_MASK,_ipending
|
||||
@ -169,9 +169,9 @@ badsw:
|
||||
/*NOTREACHED*/
|
||||
|
||||
/*
|
||||
* Swtch()
|
||||
* cpu_switch()
|
||||
*/
|
||||
ENTRY(swtch)
|
||||
ENTRY(cpu_switch)
|
||||
incl _cnt+V_SWTCH
|
||||
|
||||
/* switch to new process. first, save context as needed */
|
||||
@ -340,7 +340,7 @@ ENTRY(swtch_to_inactive)
|
||||
/*
|
||||
* savectx(pcb, altreturn)
|
||||
* Update pcb, saving current processor state and arranging
|
||||
* for alternate return ala longjmp in swtch if altreturn is true.
|
||||
* for alternate return ala longjmp in cpu_switch if altreturn is true.
|
||||
*/
|
||||
ENTRY(savectx)
|
||||
movl 4(%esp),%ecx
|
||||
|
@ -39,9 +39,9 @@
|
||||
_swapmap
|
||||
#vmstat
|
||||
_cp_time
|
||||
_rate
|
||||
# _rate
|
||||
_total
|
||||
_sum
|
||||
# _sum
|
||||
# _rectime
|
||||
# _pgintime
|
||||
_dk_xfer
|
||||
@ -61,13 +61,13 @@
|
||||
_rawcb
|
||||
_Sysmap
|
||||
_ifnet
|
||||
_rthost
|
||||
_rtnet
|
||||
# _rthost
|
||||
# _rtnet
|
||||
_icmpstat
|
||||
_filehead
|
||||
_nfiles
|
||||
_rthashsize
|
||||
_radix_node_head
|
||||
# _rthashsize
|
||||
# _radix_node_head
|
||||
#routed
|
||||
_ifnet
|
||||
#rwho
|
||||
|
@ -41,32 +41,33 @@
|
||||
* 386 Trap and System call handleing
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/acct.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/syscall.h>
|
||||
#ifdef KTRACE
|
||||
#include <sys/ktrace.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <vm/vm_map.h>
|
||||
#include <vm/vm_page.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/psl.h>
|
||||
#include <machine/reg.h>
|
||||
#include <machine/eflags.h>
|
||||
|
||||
#include <machine/trap.h>
|
||||
|
||||
#include "isa.h"
|
||||
#include "npx.h"
|
||||
#include "ddb.h"
|
||||
#include "machine/cpu.h"
|
||||
#include "machine/psl.h"
|
||||
#include "machine/reg.h"
|
||||
#include "machine/eflags.h"
|
||||
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "acct.h"
|
||||
#include "kernel.h"
|
||||
#ifdef KTRACE
|
||||
#include "ktrace.h"
|
||||
#endif
|
||||
|
||||
#include "vm/vm_param.h"
|
||||
#include "vm/pmap.h"
|
||||
#include "vm/vm_map.h"
|
||||
#include "vm/vm_user.h"
|
||||
#include "vm/vm_page.h"
|
||||
#include "sys/vmmeter.h"
|
||||
|
||||
#include "machine/trap.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
@ -84,7 +85,7 @@ void write_gs __P((/* promoted u_short */ int gs));
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
extern int grow(struct proc *,int);
|
||||
extern int grow(struct proc *,u_int);
|
||||
|
||||
struct sysent sysent[];
|
||||
int nsysent;
|
||||
@ -139,7 +140,7 @@ trap(frame)
|
||||
{
|
||||
register int i;
|
||||
register struct proc *p = curproc;
|
||||
struct timeval syst;
|
||||
u_quad_t sticks = 0;
|
||||
int ucode, type, code, eva, fault_type;
|
||||
|
||||
frame.tf_eflags &= ~PSL_NT; /* clear nested trap XXX */
|
||||
@ -177,10 +178,10 @@ trap(frame)
|
||||
return;
|
||||
}
|
||||
|
||||
syst = p->p_stime;
|
||||
if (ISPL(frame.tf_cs) == SEL_UPL) {
|
||||
type |= T_USER;
|
||||
p->p_regs = (int *)&frame;
|
||||
p->p_md.md_regs = (int *)&frame;
|
||||
sticks = p->p_sticks;
|
||||
}
|
||||
|
||||
skiptoswitch:
|
||||
@ -210,9 +211,9 @@ trap(frame)
|
||||
case T_ASTFLT|T_USER: /* Allow process switch */
|
||||
astoff();
|
||||
cnt.v_soft++;
|
||||
if ((p->p_flag & SOWEUPC) && p->p_stats->p_prof.pr_scale) {
|
||||
if ((p->p_flag & P_OWEUPC) && p->p_stats->p_prof.pr_scale) {
|
||||
addupc(frame.tf_eip, &p->p_stats->p_prof, 1);
|
||||
p->p_flag &= ~SOWEUPC;
|
||||
p->p_flag &= ~P_OWEUPC;
|
||||
}
|
||||
goto out;
|
||||
|
||||
@ -284,7 +285,6 @@ trap(frame)
|
||||
else
|
||||
ftype = VM_PROT_READ;
|
||||
|
||||
oldflags = p->p_flag;
|
||||
if (map != kernel_map) {
|
||||
vm_offset_t pa;
|
||||
vm_offset_t v = (vm_offset_t) vtopte(va);
|
||||
@ -294,7 +294,7 @@ trap(frame)
|
||||
* Keep swapout from messing with us during this
|
||||
* critical time.
|
||||
*/
|
||||
p->p_flag |= SLOCK;
|
||||
++p->p_lock;
|
||||
|
||||
/*
|
||||
* Grow the stack if necessary
|
||||
@ -303,8 +303,7 @@ trap(frame)
|
||||
&& (caddr_t)va < (caddr_t)USRSTACK) {
|
||||
if (!grow(p, va)) {
|
||||
rv = KERN_FAILURE;
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
goto nogo;
|
||||
}
|
||||
}
|
||||
@ -332,13 +331,10 @@ trap(frame)
|
||||
if( ptepg->hold_count == 0 && ptepg->wire_count == 0) {
|
||||
pmap_page_protect( VM_PAGE_TO_PHYS(ptepg),
|
||||
VM_PROT_NONE);
|
||||
if( ptepg->flags & PG_CLEAN)
|
||||
vm_page_free(ptepg);
|
||||
vm_page_free(ptepg);
|
||||
}
|
||||
|
||||
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
} else {
|
||||
/*
|
||||
* Since we know that kernel virtual address addresses
|
||||
@ -482,32 +478,29 @@ trap(frame)
|
||||
|
||||
out:
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
p->p_pri = p->p_usrpri;
|
||||
postsig(i);
|
||||
p->p_priority = p->p_usrpri;
|
||||
if (want_resched) {
|
||||
int s;
|
||||
/*
|
||||
* Since we are curproc, clock will normally just change
|
||||
* our priority without moving us from one queue to another
|
||||
* (since the running process is not on a queue.)
|
||||
* If that happened after we setrq ourselves but before we
|
||||
* swtch()'ed, we might not be on the queue indicated by
|
||||
* If that happened after we setrunqueue ourselves but before we
|
||||
* mi_switch()'ed, we might not be on the queue indicated by
|
||||
* our priority.
|
||||
*/
|
||||
s = splclock();
|
||||
setrq(p);
|
||||
setrunqueue(p);
|
||||
p->p_stats->p_ru.ru_nivcsw++;
|
||||
swtch();
|
||||
mi_switch();
|
||||
splx(s);
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
postsig(i);
|
||||
}
|
||||
if (p->p_stats->p_prof.pr_scale) {
|
||||
int ticks;
|
||||
struct timeval *tv = &p->p_stime;
|
||||
u_quad_t ticks = p->p_sticks - sticks;
|
||||
|
||||
ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
|
||||
(tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
|
||||
if (ticks) {
|
||||
#ifdef PROFTIMER
|
||||
extern int profscale;
|
||||
@ -518,7 +511,7 @@ trap(frame)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
curpri = p->p_pri;
|
||||
curpriority = p->p_priority;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -546,14 +539,12 @@ int trapwrite(addr)
|
||||
p = curproc;
|
||||
vm = p->p_vmspace;
|
||||
|
||||
oldflags = p->p_flag;
|
||||
p->p_flag |= SLOCK;
|
||||
++p->p_lock;
|
||||
|
||||
if ((caddr_t)va >= vm->vm_maxsaddr
|
||||
&& (caddr_t)va < (caddr_t)USRSTACK) {
|
||||
if (!grow(p, va)) {
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
@ -579,8 +570,7 @@ int trapwrite(addr)
|
||||
vm_map_pageable(&vm->vm_map, v, round_page(v+1), TRUE);
|
||||
}
|
||||
|
||||
p->p_flag &= ~SLOCK;
|
||||
p->p_flag |= (oldflags & SLOCK);
|
||||
--p->p_lock;
|
||||
|
||||
if (rv != KERN_SUCCESS)
|
||||
return 1;
|
||||
@ -603,31 +593,45 @@ syscall(frame)
|
||||
register int i;
|
||||
register struct sysent *callp;
|
||||
register struct proc *p = curproc;
|
||||
struct timeval syst;
|
||||
u_quad_t sticks;
|
||||
int error, opc;
|
||||
int args[8], rval[2];
|
||||
int code;
|
||||
u_int code;
|
||||
|
||||
#ifdef lint
|
||||
r0 = 0; r0 = r0; r1 = 0; r1 = r1;
|
||||
#endif
|
||||
syst = p->p_stime;
|
||||
sticks = p->p_sticks;
|
||||
if (ISPL(frame.tf_cs) != SEL_UPL)
|
||||
panic("syscall");
|
||||
|
||||
code = frame.tf_eax;
|
||||
p->p_regs = (int *)&frame;
|
||||
p->p_md.md_regs = (int *)&frame;
|
||||
params = (caddr_t)frame.tf_esp + sizeof (int) ;
|
||||
|
||||
/*
|
||||
* Reconstruct pc, assuming lcall $X,y is 7 bytes, as it is always.
|
||||
*/
|
||||
opc = frame.tf_eip - 7;
|
||||
if (code == 0) {
|
||||
/*
|
||||
* Need to check if this is a 32 bit or 64 bit syscall.
|
||||
*/
|
||||
if (code == SYS_syscall) {
|
||||
/*
|
||||
* Code is first argument, followed by actual args.
|
||||
*/
|
||||
code = fuword(params);
|
||||
params += sizeof (int);
|
||||
} else if (code == SYS___syscall) {
|
||||
/*
|
||||
* Like syscall, but code is a quad, so as to maintain
|
||||
* quad alignment for the rest of the arguments.
|
||||
*/
|
||||
code = fuword(params + _QUAD_LOWWORD * sizeof(int));
|
||||
params += sizeof(quad_t);
|
||||
}
|
||||
if (code < 0 || code >= nsysent)
|
||||
|
||||
if (code >= nsysent)
|
||||
callp = &sysent[0];
|
||||
else
|
||||
callp = &sysent[code];
|
||||
@ -672,32 +676,29 @@ syscall(frame)
|
||||
*/
|
||||
p = curproc;
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
p->p_pri = p->p_usrpri;
|
||||
postsig(i);
|
||||
p->p_priority = p->p_usrpri;
|
||||
if (want_resched) {
|
||||
int s;
|
||||
/*
|
||||
* Since we are curproc, clock will normally just change
|
||||
* our priority without moving us from one queue to another
|
||||
* (since the running process is not on a queue.)
|
||||
* If that happened after we setrq ourselves but before we
|
||||
* If that happened after we setrunqueue ourselves but before we
|
||||
* swtch()'ed, we might not be on the queue indicated by
|
||||
* our priority.
|
||||
*/
|
||||
s = splclock();
|
||||
setrq(p);
|
||||
setrunqueue(p);
|
||||
p->p_stats->p_ru.ru_nivcsw++;
|
||||
swtch();
|
||||
mi_switch();
|
||||
splx(s);
|
||||
while (i = CURSIG(p))
|
||||
psig(i);
|
||||
postsig(i);
|
||||
}
|
||||
if (p->p_stats->p_prof.pr_scale) {
|
||||
int ticks;
|
||||
struct timeval *tv = &p->p_stime;
|
||||
u_quad_t ticks = p->p_sticks - sticks;
|
||||
|
||||
ticks = ((tv->tv_sec - syst.tv_sec) * 1000 +
|
||||
(tv->tv_usec - syst.tv_usec) / 1000) / (tick / 1000);
|
||||
if (ticks) {
|
||||
#ifdef PROFTIMER
|
||||
extern int profscale;
|
||||
@ -708,21 +709,9 @@ syscall(frame)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
curpri = p->p_pri;
|
||||
curpriority = p->p_priority;
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_SYSRET))
|
||||
ktrsysret(p->p_tracep, code, error, rval[0]);
|
||||
#endif
|
||||
#ifdef DIAGNOSTICx
|
||||
{ extern int _udatasel, _ucodesel;
|
||||
if (frame.tf_ss != _udatasel)
|
||||
printf("ss %x call %d\n", frame.tf_ss, code);
|
||||
if ((frame.tf_cs&0xffff) != _ucodesel)
|
||||
printf("cs %x call %d\n", frame.tf_cs, code);
|
||||
if (frame.tf_eip > VM_MAXUSER_ADDRESS) {
|
||||
printf("eip %x call %d\n", frame.tf_eip, code);
|
||||
frame.tf_eip = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "i386/isa/isa.h"
|
||||
#include "i386/isa/rtc.h"
|
||||
#include "i386/isa/timerreg.h"
|
||||
#include <machine/cpu.h>
|
||||
|
||||
/* X-tals being what they are, it's nice to be able to fudge this one... */
|
||||
/* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */
|
||||
@ -71,15 +72,23 @@ static u_int hardclock_divisor;
|
||||
|
||||
|
||||
void
|
||||
timerintr(struct intrframe frame)
|
||||
clkintr(frame)
|
||||
struct clockframe frame;
|
||||
{
|
||||
timer_func(frame);
|
||||
hardclock(&frame);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
timerintr(struct clockframe frame)
|
||||
{
|
||||
timer_func(&frame);
|
||||
switch (timer0_state) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) {
|
||||
hardclock(frame);
|
||||
hardclock(&frame);
|
||||
timer0_prescale = 0;
|
||||
}
|
||||
break;
|
||||
@ -96,7 +105,7 @@ timerintr(struct intrframe frame)
|
||||
break;
|
||||
case 3:
|
||||
if ((timer0_prescale+=timer0_divisor) >= hardclock_divisor) {
|
||||
hardclock(frame);
|
||||
hardclock(&frame);
|
||||
disable_intr();
|
||||
outb(TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT);
|
||||
outb(TIMER_CNTR0, TIMER_DIV(hz)%256);
|
||||
@ -111,6 +120,7 @@ timerintr(struct intrframe frame)
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
acquire_timer0(int rate, void (*function)() )
|
||||
@ -395,16 +405,6 @@ test_inittodr(time_t base)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Restart the clock.
|
||||
*/
|
||||
void
|
||||
resettodr()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Wire clock interrupt in.
|
||||
*/
|
||||
@ -428,3 +428,15 @@ spinwait(int millisecs)
|
||||
{
|
||||
DELAY(1000 * millisecs);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_initclocks()
|
||||
{
|
||||
startrtclock();
|
||||
enablertclock();
|
||||
}
|
||||
|
||||
void
|
||||
setstatclockrate(int newhz)
|
||||
{
|
||||
}
|
||||
|
@ -42,27 +42,21 @@
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
#include "param.h"
|
||||
#include "systm.h"
|
||||
#include "proc.h"
|
||||
#include "malloc.h"
|
||||
#include "buf.h"
|
||||
#include "user.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include "../include/cpu.h"
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
|
||||
#define b_cylin b_resid
|
||||
|
||||
#define MAXCLSTATS 256
|
||||
int clstats[MAXCLSTATS];
|
||||
int rqstats[MAXCLSTATS];
|
||||
|
||||
|
||||
#ifndef NOBOUNCE
|
||||
|
||||
caddr_t bouncememory;
|
||||
vm_offset_t bouncepa, bouncepaend;
|
||||
int bouncepages, bpwait;
|
||||
@ -75,7 +69,8 @@ unsigned *bounceallocarray;
|
||||
int bouncefree;
|
||||
|
||||
#define SIXTEENMEG (4096*4096)
|
||||
#define MAXBKVA 1024
|
||||
#define MAXBKVA 512
|
||||
int maxbkva=MAXBKVA*NBPG;
|
||||
|
||||
/* special list that can be used at interrupt time for eventual kva free */
|
||||
struct kvasfree {
|
||||
@ -258,6 +253,7 @@ int count;
|
||||
pa = vm_bounce_page_find(1);
|
||||
pmap_kenter(kva + i * NBPG, pa);
|
||||
}
|
||||
pmap_update();
|
||||
return kva;
|
||||
}
|
||||
|
||||
@ -309,8 +305,8 @@ vm_bounce_alloc(bp)
|
||||
bp->b_bufsize = bp->b_bcount;
|
||||
}
|
||||
|
||||
vastart = (vm_offset_t) bp->b_un.b_addr;
|
||||
vaend = (vm_offset_t) bp->b_un.b_addr + bp->b_bufsize;
|
||||
vastart = (vm_offset_t) bp->b_data;
|
||||
vaend = (vm_offset_t) bp->b_data + bp->b_bufsize;
|
||||
|
||||
vapstart = i386_trunc_page(vastart);
|
||||
vapend = i386_round_page(vaend);
|
||||
@ -369,11 +365,11 @@ vm_bounce_alloc(bp)
|
||||
/*
|
||||
* save the original buffer kva
|
||||
*/
|
||||
bp->b_savekva = bp->b_un.b_addr;
|
||||
bp->b_savekva = bp->b_data;
|
||||
/*
|
||||
* put our new kva into the buffer (offset by original offset)
|
||||
*/
|
||||
bp->b_un.b_addr = (caddr_t) (((vm_offset_t) kva) |
|
||||
bp->b_data = (caddr_t) (((vm_offset_t) kva) |
|
||||
((vm_offset_t) bp->b_savekva & (NBPG - 1)));
|
||||
return;
|
||||
}
|
||||
@ -403,7 +399,7 @@ vm_bounce_free(bp)
|
||||
return;
|
||||
|
||||
origkva = (vm_offset_t) bp->b_savekva;
|
||||
bouncekva = (vm_offset_t) bp->b_un.b_addr;
|
||||
bouncekva = (vm_offset_t) bp->b_data;
|
||||
|
||||
vastart = bouncekva;
|
||||
vaend = bouncekva + bp->b_bufsize;
|
||||
@ -449,17 +445,15 @@ vm_bounce_free(bp)
|
||||
/*
|
||||
* add the old kva into the "to free" list
|
||||
*/
|
||||
bouncekva = i386_trunc_page((vm_offset_t) bp->b_un.b_addr);
|
||||
bouncekva = i386_trunc_page((vm_offset_t) bp->b_data);
|
||||
vm_bounce_kva_free( bouncekva, countvmpg*NBPG, 0);
|
||||
bp->b_un.b_addr = bp->b_savekva;
|
||||
bp->b_data = bp->b_savekva;
|
||||
bp->b_savekva = 0;
|
||||
bp->b_flags &= ~B_BOUNCE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* NOBOUNCE */
|
||||
|
||||
/*
|
||||
* init the bounce buffer system
|
||||
*/
|
||||
@ -468,10 +462,8 @@ vm_bounce_init()
|
||||
{
|
||||
vm_offset_t minaddr, maxaddr;
|
||||
|
||||
io_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, MAXBKVA * NBPG, FALSE);
|
||||
kvasfreecnt = 0;
|
||||
|
||||
#ifndef NOBOUNCE
|
||||
if (bouncepages == 0)
|
||||
return;
|
||||
|
||||
@ -487,11 +479,10 @@ vm_bounce_init()
|
||||
bouncepa = pmap_kextract((vm_offset_t) bouncememory);
|
||||
bouncepaend = bouncepa + bouncepages * NBPG;
|
||||
bouncefree = bouncepages;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef BROKEN_IN_44
|
||||
static void
|
||||
cldiskvamerge( kvanew, orig1, orig1cnt, orig2, orig2cnt)
|
||||
vm_offset_t kvanew;
|
||||
@ -827,6 +818,7 @@ cldisksort(struct buf *dp, struct buf *bp, vm_offset_t maxio)
|
||||
ap->av_forw = bp;
|
||||
bp->av_back = ap;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* quick version of vm_fault
|
||||
@ -881,7 +873,7 @@ cpu_fork(p1, p2)
|
||||
offset = mvesp() - (int)kstack;
|
||||
bcopy((caddr_t)kstack + offset, (caddr_t)p2->p_addr + offset,
|
||||
(unsigned) ctob(UPAGES) - offset);
|
||||
p2->p_regs = p1->p_regs;
|
||||
p2->p_md.md_regs = p1->p_md.md_regs;
|
||||
|
||||
/*
|
||||
* Wire top of address space of child to it's kstack.
|
||||
@ -930,7 +922,7 @@ cpu_fork(p1, p2)
|
||||
*
|
||||
* Next, we assign a dummy context to be written over by swtch,
|
||||
* calling it to send this process off to oblivion.
|
||||
* [The nullpcb allows us to minimize cost in swtch() by not having
|
||||
* [The nullpcb allows us to minimize cost in mi_switch() by not having
|
||||
* a special case].
|
||||
*/
|
||||
struct proc *swtch_to_inactive();
|
||||
@ -952,8 +944,7 @@ cpu_exit(p)
|
||||
kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
|
||||
|
||||
p->p_addr = (struct user *) &nullpcb;
|
||||
splclock();
|
||||
swtch();
|
||||
mi_switch();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
#else
|
||||
@ -965,9 +956,8 @@ cpu_exit(p)
|
||||
#if NNPX > 0
|
||||
npxexit(p);
|
||||
#endif /* NNPX */
|
||||
splclock();
|
||||
curproc = 0;
|
||||
swtch();
|
||||
curproc = p;
|
||||
mi_switch();
|
||||
/*
|
||||
* This is to shutup the compiler, and if swtch() failed I suppose
|
||||
* this would be a good thing. This keeps gcc happy because panic
|
||||
@ -989,6 +979,21 @@ cpu_wait(p) struct proc *p; {
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dump the machine specific header information at the start of a core dump.
|
||||
*/
|
||||
int
|
||||
cpu_coredump(p, vp, cred)
|
||||
struct proc *p;
|
||||
struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
{
|
||||
|
||||
return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, ctob(UPAGES),
|
||||
(off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *)NULL,
|
||||
p));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set a red zone in the kernel stack after the u. area.
|
||||
*/
|
||||
@ -1007,6 +1012,43 @@ setredzone(pte, vaddr)
|
||||
and take the dump while still in mapped mode */
|
||||
}
|
||||
|
||||
/*
|
||||
* Move pages from one kernel virtual address to another.
|
||||
* Both addresses are assumed to reside in the Sysmap,
|
||||
* and size must be a multiple of CLSIZE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Move pages from one kernel virtual address to another.
|
||||
* Both addresses are assumed to reside in the Sysmap,
|
||||
* and size must be a multiple of CLSIZE.
|
||||
*/
|
||||
|
||||
void
|
||||
pagemove(from, to, size)
|
||||
register caddr_t from, to;
|
||||
int size;
|
||||
{
|
||||
register vm_offset_t pa;
|
||||
|
||||
if (size & CLOFSET)
|
||||
panic("pagemove");
|
||||
while (size > 0) {
|
||||
pa = pmap_kextract((vm_offset_t)from);
|
||||
if (pa == 0)
|
||||
panic("pagemove 2");
|
||||
if (pmap_kextract((vm_offset_t)to) != 0)
|
||||
panic("pagemove 3");
|
||||
pmap_remove(kernel_pmap,
|
||||
(vm_offset_t)from, (vm_offset_t)from + PAGE_SIZE);
|
||||
pmap_kenter( (vm_offset_t)to, pa);
|
||||
from += PAGE_SIZE;
|
||||
to += PAGE_SIZE;
|
||||
size -= PAGE_SIZE;
|
||||
}
|
||||
pmap_update();
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert kernel VA to physical address
|
||||
*/
|
||||
@ -1036,22 +1078,49 @@ vmapbuf(bp)
|
||||
{
|
||||
register int npf;
|
||||
register caddr_t addr;
|
||||
register long flags = bp->b_flags;
|
||||
struct proc *p;
|
||||
int off;
|
||||
vm_offset_t kva;
|
||||
register vm_offset_t pa;
|
||||
vm_offset_t pa, lastv, v;
|
||||
|
||||
if ((flags & B_PHYS) == 0)
|
||||
if ((bp->b_flags & B_PHYS) == 0)
|
||||
panic("vmapbuf");
|
||||
|
||||
lastv = 0;
|
||||
for (addr = (caddr_t)trunc_page(bp->b_data);
|
||||
addr < bp->b_data + bp->b_bufsize;
|
||||
addr += PAGE_SIZE) {
|
||||
|
||||
/*
|
||||
* make sure that the pde is valid and held
|
||||
*/
|
||||
v = trunc_page(((vm_offset_t)vtopte(addr)));
|
||||
if (v != lastv) {
|
||||
vm_fault_quick(v, VM_PROT_READ);
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, v);
|
||||
vm_page_hold(PHYS_TO_VM_PAGE(pa));
|
||||
lastv = v;
|
||||
}
|
||||
|
||||
/*
|
||||
* do the vm_fault if needed, do the copy-on-write thing when
|
||||
* reading stuff off device into memory.
|
||||
*/
|
||||
vm_fault_quick(addr,
|
||||
(bp->b_flags&B_READ)?(VM_PROT_READ|VM_PROT_WRITE):VM_PROT_READ);
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, (vm_offset_t) addr);
|
||||
/*
|
||||
* hold the data page
|
||||
*/
|
||||
vm_page_hold(PHYS_TO_VM_PAGE(pa));
|
||||
}
|
||||
|
||||
addr = bp->b_saveaddr = bp->b_un.b_addr;
|
||||
off = (int)addr & PGOFSET;
|
||||
p = bp->b_proc;
|
||||
npf = btoc(round_page(bp->b_bufsize + off));
|
||||
kva = kmem_alloc_wait(phys_map, ctob(npf));
|
||||
bp->b_un.b_addr = (caddr_t) (kva + off);
|
||||
while (npf--) {
|
||||
pa = pmap_extract(&p->p_vmspace->vm_pmap, (vm_offset_t)addr);
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, (vm_offset_t)addr);
|
||||
if (pa == 0)
|
||||
panic("vmapbuf: null page frame");
|
||||
pmap_kenter(kva, trunc_page(pa));
|
||||
@ -1071,7 +1140,7 @@ vunmapbuf(bp)
|
||||
{
|
||||
register int npf;
|
||||
register caddr_t addr = bp->b_un.b_addr;
|
||||
vm_offset_t kva;
|
||||
vm_offset_t kva,va,v,lastv,pa;
|
||||
|
||||
if ((bp->b_flags & B_PHYS) == 0)
|
||||
panic("vunmapbuf");
|
||||
@ -1080,6 +1149,32 @@ vunmapbuf(bp)
|
||||
kmem_free_wakeup(phys_map, kva, ctob(npf));
|
||||
bp->b_un.b_addr = bp->b_saveaddr;
|
||||
bp->b_saveaddr = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* unhold the pde, and data pages
|
||||
*/
|
||||
lastv = 0;
|
||||
for (addr = (caddr_t)trunc_page(bp->b_data);
|
||||
addr < bp->b_data + bp->b_bufsize;
|
||||
addr += NBPG) {
|
||||
|
||||
/*
|
||||
* release the data page
|
||||
*/
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, (vm_offset_t) addr);
|
||||
vm_page_unhold(PHYS_TO_VM_PAGE(pa));
|
||||
|
||||
/*
|
||||
* and unhold the page table
|
||||
*/
|
||||
v = trunc_page(((vm_offset_t)vtopte(addr)));
|
||||
if (v != lastv) {
|
||||
pa = pmap_extract(&curproc->p_vmspace->vm_pmap, v);
|
||||
vm_page_unhold(PHYS_TO_VM_PAGE(pa));
|
||||
lastv = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1104,7 +1199,7 @@ cpu_reset() {
|
||||
int
|
||||
grow(p, sp)
|
||||
struct proc *p;
|
||||
int sp;
|
||||
u_int sp;
|
||||
{
|
||||
unsigned int nss;
|
||||
caddr_t v;
|
||||
|
@ -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 */
|
||||
|
||||
#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 */
|
||||
/*
|
||||
* According to ANSI (section 2.2.4.2), the values below must be usable by
|
||||
* #if preprocessing directives. Additionally, the expression must have the
|
||||
* same type as would an expression that is an object of the corresponding
|
||||
* type converted according to the integral promotions. The subtraction for
|
||||
* INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
|
||||
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
|
||||
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
|
||||
* are written as hex so that GCC will be quiet about large integer constants.
|
||||
*/
|
||||
#define SCHAR_MAX 127 /* min value for a signed char */
|
||||
#define SCHAR_MIN (-128) /* max value for a signed char */
|
||||
|
||||
#define UCHAR_MAX 255 /* max value for an unsigned char */
|
||||
#define CHAR_MAX 127 /* max value for a char */
|
||||
#define CHAR_MIN (-128) /* min value for a char */
|
||||
|
||||
#define USHRT_MAX 65535 /* max value for an unsigned short */
|
||||
#define SHRT_MAX 32767 /* max value for a short */
|
||||
#define SHRT_MIN (-32768) /* min value for a short */
|
||||
|
||||
#define UINT_MAX 0xffffffff /* max value for an unsigned int */
|
||||
#define INT_MAX 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_ */
|
||||
|
@ -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
|
||||
@ -68,8 +66,7 @@
|
||||
* 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_ */
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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 *));
|
||||
|
@ -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). */
|
||||
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 */
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
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 */
|
||||
struct exec {
|
||||
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_ */
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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 */
|
||||
|
||||
#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 */
|
||||
/*
|
||||
* According to ANSI (section 2.2.4.2), the values below must be usable by
|
||||
* #if preprocessing directives. Additionally, the expression must have the
|
||||
* same type as would an expression that is an object of the corresponding
|
||||
* type converted according to the integral promotions. The subtraction for
|
||||
* INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
|
||||
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
|
||||
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
|
||||
* are written as hex so that GCC will be quiet about large integer constants.
|
||||
*/
|
||||
#define SCHAR_MAX 127 /* min value for a signed char */
|
||||
#define SCHAR_MIN (-128) /* max value for a signed char */
|
||||
|
||||
#define UCHAR_MAX 255 /* max value for an unsigned char */
|
||||
#define CHAR_MAX 127 /* max value for a char */
|
||||
#define CHAR_MIN (-128) /* min value for a char */
|
||||
|
||||
#define USHRT_MAX 65535 /* max value for an unsigned short */
|
||||
#define SHRT_MAX 32767 /* max value for a short */
|
||||
#define SHRT_MIN (-32768) /* min value for a short */
|
||||
|
||||
#define UINT_MAX 0xffffffff /* max value for an unsigned int */
|
||||
#define INT_MAX 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_ */
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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*/
|
||||
};
|
||||
#include <machine/pte.h>
|
||||
|
||||
#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) */
|
||||
|
||||
/* 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
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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_ */
|
||||
|
@ -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
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user