summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/apm/apm.c10
-rw-r--r--sys/i386/bios/apm.c10
-rw-r--r--sys/i386/conf/NOTES6
-rw-r--r--sys/i386/i386/apic_vector.s26
-rw-r--r--sys/i386/i386/db_interface.c25
-rw-r--r--sys/i386/i386/db_trace.c11
-rw-r--r--sys/i386/i386/genassym.c33
-rw-r--r--sys/i386/i386/locore.s31
-rw-r--r--sys/i386/i386/machdep.c154
-rw-r--r--sys/i386/i386/math_emu.h2
-rw-r--r--sys/i386/i386/math_emulate.c6
-rw-r--r--sys/i386/i386/mem.c12
-rw-r--r--sys/i386/i386/mp_machdep.c18
-rw-r--r--sys/i386/i386/mptable.c18
-rw-r--r--sys/i386/i386/perfmon.c6
-rw-r--r--sys/i386/i386/pmap.c286
-rw-r--r--sys/i386/i386/procfs_machdep.c44
-rw-r--r--sys/i386/i386/support.s32
-rw-r--r--sys/i386/i386/swtch.s78
-rw-r--r--sys/i386/i386/sys_machdep.c78
-rw-r--r--sys/i386/i386/trap.c49
-rw-r--r--sys/i386/i386/vm86.c11
-rw-r--r--sys/i386/i386/vm86bios.s6
-rw-r--r--sys/i386/i386/vm_machdep.c79
-rw-r--r--sys/i386/ibcs2/ibcs2_fcntl.c55
-rw-r--r--sys/i386/ibcs2/ibcs2_ioctl.c81
-rw-r--r--sys/i386/ibcs2/ibcs2_ipc.c48
-rw-r--r--sys/i386/ibcs2/ibcs2_isc.c6
-rw-r--r--sys/i386/ibcs2/ibcs2_misc.c321
-rw-r--r--sys/i386/ibcs2/ibcs2_msg.c22
-rw-r--r--sys/i386/ibcs2/ibcs2_other.c24
-rw-r--r--sys/i386/ibcs2/ibcs2_proto.h114
-rw-r--r--sys/i386/ibcs2/ibcs2_signal.c60
-rw-r--r--sys/i386/ibcs2/ibcs2_socksys.c66
-rw-r--r--sys/i386/ibcs2/ibcs2_socksys.h4
-rw-r--r--sys/i386/ibcs2/ibcs2_stat.c44
-rw-r--r--sys/i386/ibcs2/ibcs2_sysi86.c10
-rw-r--r--sys/i386/ibcs2/ibcs2_util.c14
-rw-r--r--sys/i386/ibcs2/ibcs2_util.h12
-rw-r--r--sys/i386/ibcs2/ibcs2_xenix.c42
-rw-r--r--sys/i386/ibcs2/ibcs2_xenix.h36
-rw-r--r--sys/i386/ibcs2/imgact_coff.c21
-rw-r--r--sys/i386/include/cpu.h4
-rw-r--r--sys/i386/include/globaldata.h26
-rw-r--r--sys/i386/include/globals.h8
-rw-r--r--sys/i386/include/md_var.h8
-rw-r--r--sys/i386/include/mptable.h18
-rw-r--r--sys/i386/include/mutex.h2
-rw-r--r--sys/i386/include/npx.h2
-rw-r--r--sys/i386/include/param.h7
-rw-r--r--sys/i386/include/pcb_ext.h2
-rw-r--r--sys/i386/include/pcpu.h26
-rw-r--r--sys/i386/include/privatespace.h6
-rw-r--r--sys/i386/include/proc.h3
-rw-r--r--sys/i386/include/reg.h8
-rw-r--r--sys/i386/include/vm86.h2
-rw-r--r--sys/i386/isa/apic_vector.s26
-rw-r--r--sys/i386/isa/asc.c10
-rw-r--r--sys/i386/isa/atpic_vector.s12
-rw-r--r--sys/i386/isa/ctx.c6
-rw-r--r--sys/i386/isa/cx.c10
-rw-r--r--sys/i386/isa/cy.c20
-rw-r--r--sys/i386/isa/gpib.c10
-rw-r--r--sys/i386/isa/gsc.c6
-rw-r--r--sys/i386/isa/icu_vector.s12
-rw-r--r--sys/i386/isa/ipl.s5
-rw-r--r--sys/i386/isa/istallion.c26
-rw-r--r--sys/i386/isa/loran.c4
-rw-r--r--sys/i386/isa/matcd/matcd.c8
-rw-r--r--sys/i386/isa/mcd.c6
-rw-r--r--sys/i386/isa/mse.c18
-rw-r--r--sys/i386/isa/npx.c85
-rw-r--r--sys/i386/isa/pcaudio.c10
-rw-r--r--sys/i386/isa/pcvt/pcvt_drv.c12
-rw-r--r--sys/i386/isa/pcvt/pcvt_ext.c9
-rw-r--r--sys/i386/isa/pcvt/pcvt_hdr.h2
-rw-r--r--sys/i386/isa/rc.c18
-rw-r--r--sys/i386/isa/scd.c6
-rw-r--r--sys/i386/isa/spic.c10
-rw-r--r--sys/i386/isa/spigot.c16
-rw-r--r--sys/i386/isa/spkr.c12
-rw-r--r--sys/i386/isa/stallion.c26
-rw-r--r--sys/i386/isa/tw.c14
-rw-r--r--sys/i386/isa/vesa.c3
-rw-r--r--sys/i386/isa/wt.c6
-rw-r--r--sys/i386/linux/linux.h8
-rw-r--r--sys/i386/linux/linux_machdep.c128
-rw-r--r--sys/i386/linux/linux_proto.h312
-rw-r--r--sys/i386/linux/linux_sysvec.c32
-rw-r--r--sys/i386/svr4/svr4_machdep.c57
-rw-r--r--sys/i386/svr4/svr4_machdep.h6
91 files changed, 1699 insertions, 1385 deletions
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c
index 4d8f188..1b7cbc5 100644
--- a/sys/i386/apm/apm.c
+++ b/sys/i386/apm/apm.c
@@ -1047,7 +1047,7 @@ apm_attach(device_t dev)
}
static int
-apmopen(dev_t dev, int flag, int fmt, struct proc *p)
+apmopen(dev_t dev, int flag, int fmt, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
int ctl = APMDEV(dev);
@@ -1075,7 +1075,7 @@ apmopen(dev_t dev, int flag, int fmt, struct proc *p)
}
static int
-apmclose(dev_t dev, int flag, int fmt, struct proc *p)
+apmclose(dev_t dev, int flag, int fmt, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
int ctl = APMDEV(dev);
@@ -1098,7 +1098,7 @@ apmclose(dev_t dev, int flag, int fmt, struct proc *p)
}
static int
-apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
+apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
struct apm_bios_arg *args;
@@ -1282,7 +1282,7 @@ apmwrite(dev_t dev, struct uio *uio, int ioflag)
}
static int
-apmpoll(dev_t dev, int events, struct proc *p)
+apmpoll(dev_t dev, int events, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
int revents = 0;
@@ -1291,7 +1291,7 @@ apmpoll(dev_t dev, int events, struct proc *p)
if (sc->event_count) {
revents |= events & (POLLIN | POLLRDNORM);
} else {
- selrecord(p, &sc->sc_rsel);
+ selrecord(td, &sc->sc_rsel);
}
}
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index 4d8f188..1b7cbc5 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -1047,7 +1047,7 @@ apm_attach(device_t dev)
}
static int
-apmopen(dev_t dev, int flag, int fmt, struct proc *p)
+apmopen(dev_t dev, int flag, int fmt, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
int ctl = APMDEV(dev);
@@ -1075,7 +1075,7 @@ apmopen(dev_t dev, int flag, int fmt, struct proc *p)
}
static int
-apmclose(dev_t dev, int flag, int fmt, struct proc *p)
+apmclose(dev_t dev, int flag, int fmt, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
int ctl = APMDEV(dev);
@@ -1098,7 +1098,7 @@ apmclose(dev_t dev, int flag, int fmt, struct proc *p)
}
static int
-apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
+apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
struct apm_bios_arg *args;
@@ -1282,7 +1282,7 @@ apmwrite(dev_t dev, struct uio *uio, int ioflag)
}
static int
-apmpoll(dev_t dev, int events, struct proc *p)
+apmpoll(dev_t dev, int events, struct thread *td)
{
struct apm_softc *sc = &apm_softc;
int revents = 0;
@@ -1291,7 +1291,7 @@ apmpoll(dev_t dev, int events, struct proc *p)
if (sc->event_count) {
revents |= events & (POLLIN | POLLRDNORM);
} else {
- selrecord(p, &sc->sc_rsel);
+ selrecord(td, &sc->sc_rsel);
}
}
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 83bf89a..a707b0f 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -84,7 +84,7 @@ options BLKDEV_IOSIZE=8192
# Options for the VM subsystem
options PQ_CACHESIZE=512 # color for 512k/16k cache
-options UPAGES=3 # number of 4k stack pages per process
+options KSTACK_PAGES=3 # number of 4k stack pages per process
# Deprecated options supported for backwards compatibility
#options PQ_NOOPT # No coloring
#options PQ_LARGECACHE # color for 512k/16k cache
@@ -442,7 +442,7 @@ options IPX #IPX/SPX communications protocols
options IPXIP #IPX in IP encapsulation (not available)
options IPTUNNEL #IP in IPX encapsulation (not available)
-options NCP #NetWare Core protocol
+#options NCP #NetWare Core protocol
options NETATALK #Appletalk communications protocols
options NETATALKDEBUG #Appletalk debugging
@@ -692,7 +692,7 @@ options HPFS #OS/2 File system
options MSDOSFS #MS DOS File System (FAT, FAT32)
options NTFS #NT File System
options NULLFS #NULL filesystem
-options NWFS #NetWare filesystem
+#options NWFS #NetWare filesystem
options PORTALFS #Portal filesystem
options PROCFS #Process filesystem
options PSEUDOFS #Pseudo-filesystem framework
diff --git a/sys/i386/i386/apic_vector.s b/sys/i386/i386/apic_vector.s
index 5c68f81..8096d3c 100644
--- a/sys/i386/i386/apic_vector.s
+++ b/sys/i386/i386/apic_vector.s
@@ -48,10 +48,10 @@ IDTVEC(vec_name) ; \
movl $KPSEL,%eax ; \
mov %ax,%fs ; \
FAKE_MCOUNT(13*4(%esp)) ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
pushl intr_unit + (irq_num) * 4 ; \
- call *intr_handler + (irq_num) * 4 ; /* do the work ASAP */ \
+ call *intr_handler + (irq_num) * 4 ; /* do the work ASAP */ \
addl $4, %esp ; \
movl $0, lapic+LA_EOI ; \
lock ; \
@@ -59,7 +59,7 @@ IDTVEC(vec_name) ; \
movl intr_countp + (irq_num) * 4, %eax ; \
lock ; \
incl (%eax) ; \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
jmp doreti
@@ -152,8 +152,8 @@ IDTVEC(vec_name) ; \
MASK_LEVEL_IRQ(irq_num) ; \
EOI_IRQ(irq_num) ; \
0: ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
; \
/* entry point used by doreti_unpend for HWIs. */ \
__CONCAT(Xresume,irq_num): ; \
@@ -162,7 +162,7 @@ __CONCAT(Xresume,irq_num): ; \
call sched_ithd ; \
addl $4, %esp ; /* discard the parameter */ \
; \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
jmp doreti
@@ -227,10 +227,10 @@ Xhardclock:
movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
- movl PCPU(CURPROC),%ebx
- incl P_INTR_NESTING_LEVEL(%ebx)
+ movl PCPU(CURTHREAD),%ebx
+ incl TD_INTR_NESTING_LEVEL(%ebx)
call forwarded_hardclock
- decl P_INTR_NESTING_LEVEL(%ebx)
+ decl TD_INTR_NESTING_LEVEL(%ebx)
MEXITCOUNT
jmp doreti
@@ -252,10 +252,10 @@ Xstatclock:
movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
FAKE_MCOUNT(13*4(%esp))
- movl PCPU(CURPROC),%ebx
- incl P_INTR_NESTING_LEVEL(%ebx)
+ movl PCPU(CURTHREAD),%ebx
+ incl TD_INTR_NESTING_LEVEL(%ebx)
call forwarded_statclock
- decl P_INTR_NESTING_LEVEL(%ebx)
+ decl TD_INTR_NESTING_LEVEL(%ebx)
MEXITCOUNT
jmp doreti
diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c
index a2e5018..7e78088 100644
--- a/sys/i386/i386/db_interface.c
+++ b/sys/i386/i386/db_interface.c
@@ -351,23 +351,24 @@ DB_SHOW_COMMAND(pcpu, db_show_pcpu)
gd = GLOBALDATA;
#endif
db_printf("cpuid = %d\n", gd->gd_cpuid);
- db_printf("curproc = ");
- if (gd->gd_curproc != NULL)
- db_printf("%p: pid %d \"%s\"\n", gd->gd_curproc,
- gd->gd_curproc->p_pid, gd->gd_curproc->p_comm);
+ db_printf("curthread = ");
+ if (gd->gd_curthread != NULL)
+ db_printf("%p: pid %d \"%s\"\n", gd->gd_curthread,
+ gd->gd_curthread->td_proc->p_pid, gd->gd_curthread->td_proc->p_comm);
else
db_printf("none\n");
db_printf("curpcb = %p\n", gd->gd_curpcb);
- db_printf("npxproc = ");
- if (gd->gd_npxproc != NULL)
- db_printf("%p: pid %d \"%s\"\n", gd->gd_npxproc,
- gd->gd_npxproc->p_pid, gd->gd_npxproc->p_comm);
+ db_printf("npxthread = ");
+ if (gd->gd_npxthread != NULL)
+ db_printf("%p: pid %d \"%s\"\n", gd->gd_npxthread,
+ gd->gd_npxthread->td_proc->p_pid, gd->gd_npxthread->td_proc->p_comm);
else
db_printf("none\n");
- db_printf("idleproc = ");
- if (gd->gd_idleproc != NULL)
- db_printf("%p: pid %d \"%s\"\n", gd->gd_idleproc,
- gd->gd_idleproc->p_pid, gd->gd_idleproc->p_comm);
+ db_printf("idlethread = ");
+ if (gd->gd_idlethread != NULL)
+ db_printf("%p: pid %d \"%s\"\n", gd->gd_idlethread,
+ gd->gd_idlethread->td_proc->p_pid,
+ gd->gd_idlethread->td_proc->p_comm);
else
db_printf("none\n");
diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c
index dc1e2f0..3a07050 100644
--- a/sys/i386/i386/db_trace.c
+++ b/sys/i386/i386/db_trace.c
@@ -291,13 +291,15 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
boolean_t first;
struct pcb *pcb;
struct proc *p;
+ struct thread *td;
pid_t pid;
if (count == -1)
count = 1024;
if (!have_addr) {
- p = curproc;
+ td = curthread;
+ p = td->td_proc;
frame = (struct i386_frame *)ddb_regs.tf_ebp;
if (frame == NULL)
frame = (struct i386_frame *)(ddb_regs.tf_esp - 4);
@@ -310,8 +312,9 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
* The pcb for curproc is not valid at this point,
* so fall back to the default case.
*/
- if (pid == curproc->p_pid) {
- p = curproc;
+ if (pid == curthread->td_proc->p_pid) {
+ td = curthread;
+ p = td->td_proc;
frame = (struct i386_frame *)ddb_regs.tf_ebp;
if (frame == NULL)
frame = (struct i386_frame *)
@@ -333,7 +336,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
db_printf("pid %d swapped out\n", pid);
return;
}
- pcb = &p->p_addr->u_pcb;
+ pcb = p->p_thread.td_pcb; /* XXXKSE */
frame = (struct i386_frame *)pcb->pcb_ebp;
if (frame == NULL)
frame = (struct i386_frame *)
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index 0704db7..8f4be92 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -37,7 +37,7 @@
* $FreeBSD$
*/
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,6 +50,7 @@
#include <sys/mutex.h>
#include <sys/socket.h>
#include <sys/resourcevar.h>
+#include <sys/user.h>
/* XXX */
#ifdef KTR_PERCPU
#include <sys/ktr.h>
@@ -79,21 +80,31 @@
ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap));
ASSYM(PM_ACTIVE, offsetof(struct pmap, pm_active));
-ASSYM(P_ADDR, offsetof(struct proc, p_addr));
-ASSYM(P_INTR_NESTING_LEVEL, offsetof(struct proc, p_intr_nesting_level));
ASSYM(P_SFLAG, offsetof(struct proc, p_sflag));
ASSYM(P_STAT, offsetof(struct proc, p_stat));
-ASSYM(P_WCHAN, offsetof(struct proc, p_wchan));
+ASSYM(P_UAREA, offsetof(struct proc, p_uarea));
+
+/*ASSYM(TD_STAT, offsetof(struct thread, td__stat));*/
+ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
+ASSYM(TD_WCHAN, offsetof(struct thread, td_wchan));
+ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
+ASSYM(TD_KSE, offsetof(struct thread, td_kse));
+ASSYM(TD_PROC, offsetof(struct thread, td_proc));
+ASSYM(TD_INTR_NESTING_LEVEL, offsetof(struct thread, td_intr_nesting_level));
+
+ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
-ASSYM(PS_ASTPENDING, PS_ASTPENDING);
-ASSYM(PS_NEEDRESCHED, PS_NEEDRESCHED);
+ASSYM(KEF_ASTPENDING, KEF_ASTPENDING);
+ASSYM(KEF_NEEDRESCHED, KEF_NEEDRESCHED);
ASSYM(SSLEEP, SSLEEP);
ASSYM(SRUN, SRUN);
ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
-ASSYM(UPAGES, UPAGES);
+/* ASSYM(UPAGES, UPAGES);*/
+ASSYM(UAREA_PAGES, UAREA_PAGES);
+ASSYM(KSTACK_PAGES, KSTACK_PAGES);
ASSYM(PAGE_SIZE, PAGE_SIZE);
ASSYM(NPTEPG, NPTEPG);
ASSYM(NPDEPG, NPDEPG);
@@ -133,9 +144,7 @@ ASSYM(PCB_SAVEFPU_SIZE, sizeof(union savefpu));
ASSYM(PCB_SAVE87_SIZE, sizeof(struct save87));
ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
-#ifdef SMP
ASSYM(PCB_SIZE, sizeof(struct pcb));
-#endif
ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
@@ -166,9 +175,9 @@ ASSYM(BI_ESYMTAB, offsetof(struct bootinfo, bi_esymtab));
ASSYM(BI_KERNEND, offsetof(struct bootinfo, bi_kernend));
ASSYM(GD_SIZEOF, sizeof(struct globaldata));
ASSYM(GD_PRVSPACE, offsetof(struct globaldata, gd_prvspace));
-ASSYM(GD_CURPROC, offsetof(struct globaldata, gd_curproc));
-ASSYM(GD_NPXPROC, offsetof(struct globaldata, gd_npxproc));
-ASSYM(GD_IDLEPROC, offsetof(struct globaldata, gd_idleproc));
+ASSYM(GD_CURTHREAD, offsetof(struct globaldata, gd_curthread));
+ASSYM(GD_NPXTHREAD, offsetof(struct globaldata, gd_npxthread));
+ASSYM(GD_IDLETHREAD, offsetof(struct globaldata, gd_idlethread));
ASSYM(GD_CURPCB, offsetof(struct globaldata, gd_curpcb));
ASSYM(GD_COMMON_TSS, offsetof(struct globaldata, gd_common_tss));
ASSYM(GD_SWITCHTIME, offsetof(struct globaldata, gd_switchtime));
diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s
index 97a1e16..ab3dad5 100644
--- a/sys/i386/i386/locore.s
+++ b/sys/i386/i386/locore.s
@@ -147,9 +147,11 @@ IdlePTD: .long 0 /* phys addr of kernel PTD */
#endif
KPTphys: .long 0 /* phys addr of kernel page tables */
- .globl proc0paddr
-proc0paddr: .long 0 /* address of proc 0 address space */
-p0upa: .long 0 /* phys addr of proc0's UPAGES */
+ .globl proc0uarea, proc0kstack
+proc0uarea: .long 0 /* address of proc 0 uarea space */
+proc0kstack: .long 0 /* address of proc 0 kstack space */
+p0upa: .long 0 /* phys addr of proc0's UAREA */
+p0kpa: .long 0 /* phys addr of proc0's STACK */
vm86phystk: .long 0 /* PA of vm86/bios stack */
@@ -369,13 +371,14 @@ NON_GPROF_ENTRY(btext)
/* now running relocated at KERNBASE where the system is linked to run */
begin:
/* set up bootstrap stack */
- movl proc0paddr,%eax /* location of in-kernel pages */
- leal UPAGES*PAGE_SIZE(%eax),%esp /* bootstrap stack end location */
+ movl proc0kstack,%eax /* location of in-kernel stack */
+ /* bootstrap stack end location */
+ leal (KSTACK_PAGES*PAGE_SIZE-PCB_SIZE)(%eax),%esp
xorl %ebp,%ebp /* mark end of frames */
movl IdlePTD,%esi
- movl %esi,PCB_CR3(%eax)
+ movl %esi,(KSTACK_PAGES*PAGE_SIZE-PCB_SIZE+PCB_CR3)(%eax)
testl $CPUID_PGE, R(cpu_feature)
jz 1f
@@ -762,10 +765,15 @@ no_kernend:
movl %esi,R(IdlePTD)
/* Allocate UPAGES */
- ALLOCPAGES(UPAGES)
+ ALLOCPAGES(UAREA_PAGES)
movl %esi,R(p0upa)
addl $KERNBASE, %esi
- movl %esi, R(proc0paddr)
+ movl %esi, R(proc0uarea)
+
+ ALLOCPAGES(KSTACK_PAGES)
+ movl %esi,R(p0kpa)
+ addl $KERNBASE, %esi
+ movl %esi, R(proc0kstack)
ALLOCPAGES(1) /* vm86/bios stack */
movl %esi,R(vm86phystk)
@@ -833,7 +841,12 @@ map_read_write:
/* Map proc0's UPAGES in the physical way ... */
movl R(p0upa), %eax
- movl $UPAGES, %ecx
+ movl $(UAREA_PAGES), %ecx
+ fillkptphys($PG_RW)
+
+/* Map proc0's KSTACK in the physical way ... */
+ movl R(p0kpa), %eax
+ movl $(KSTACK_PAGES), %ecx
fillkptphys($PG_RW)
/* Map ISA hole */
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index e0dade2..6711515 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -49,7 +49,7 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
/* #include "opt_userconfig.h" */
#include <sys/param.h>
@@ -289,14 +289,16 @@ osendsig(catcher, sig, mask, code)
struct osigframe sf;
struct osigframe *fp;
struct proc *p;
+ struct thread *td;
struct sigacts *psp;
struct trapframe *regs;
int oonstack;
- p = curproc;
+ td = curthread;
+ p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
- regs = p->p_frame;
+ regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
/* Allocate and validate space for the signal handler context. */
@@ -386,7 +388,7 @@ osendsig(catcher, sig, mask, code)
if (regs->tf_eflags & PSL_VM) {
/* XXX confusing names: `tf' isn't a trapframe; `regs' is. */
struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs;
- struct vm86_kernel *vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86;
+ struct vm86_kernel *vm86 = &td->td_pcb->pcb_ext->ext_vm86;
sf.sf_siginfo.si_sc.sc_gs = tf->tf_vm86_gs;
sf.sf_siginfo.si_sc.sc_fs = tf->tf_vm86_fs;
@@ -409,7 +411,7 @@ osendsig(catcher, sig, mask, code)
* ...Kill the process.
*/
PROC_LOCK(p);
- sigexit(p, SIGILL);
+ sigexit(td, SIGILL);
/* NOTREACHED */
}
@@ -434,12 +436,14 @@ sendsig(catcher, sig, mask, code)
{
struct sigframe sf;
struct proc *p;
+ struct thread *td;
struct sigacts *psp;
struct trapframe *regs;
struct sigframe *sfp;
int oonstack;
- p = curproc;
+ td = curthread;
+ p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
#ifdef COMPAT_43
@@ -448,7 +452,7 @@ sendsig(catcher, sig, mask, code)
return;
}
#endif
- regs = p->p_frame;
+ regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
/* Save user context. */
@@ -528,7 +532,7 @@ sendsig(catcher, sig, mask, code)
*/
if (regs->tf_eflags & PSL_VM) {
struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs;
- struct vm86_kernel *vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86;
+ struct vm86_kernel *vm86 = &td->td_pcb->pcb_ext->ext_vm86;
sf.sf_uc.uc_mcontext.mc_gs = tf->tf_vm86_gs;
sf.sf_uc.uc_mcontext.mc_fs = tf->tf_vm86_fs;
@@ -561,7 +565,7 @@ sendsig(catcher, sig, mask, code)
* ...Kill the process.
*/
PROC_LOCK(p);
- sigexit(p, SIGILL);
+ sigexit(td, SIGILL);
/* NOTREACHED */
}
@@ -586,17 +590,18 @@ sendsig(catcher, sig, mask, code)
*/
#ifdef COMPAT_43
int
-osigreturn(p, uap)
- struct proc *p;
+osigreturn(td, uap)
+ struct thread *td;
struct osigreturn_args /* {
struct osigcontext *sigcntxp;
} */ *uap;
{
struct trapframe *regs;
struct osigcontext *scp;
+ struct proc *p = td->td_proc;
int eflags;
- regs = p->p_frame;
+ regs = td->td_frame;
scp = uap->sigcntxp;
if (!useracc((caddr_t)scp, sizeof(*scp), VM_PROT_READ))
return (EFAULT);
@@ -609,9 +614,9 @@ osigreturn(p, uap)
* if pcb_ext == 0 or vm86_inited == 0, the user hasn't
* set up the vm86 area, and we can't enter vm86 mode.
*/
- if (p->p_addr->u_pcb.pcb_ext == 0)
+ if (td->td_pcb->pcb_ext == 0)
return (EINVAL);
- vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86;
+ vm86 = &td->td_pcb->pcb_ext->ext_vm86;
if (vm86->vm86_inited == 0)
return (EINVAL);
@@ -697,12 +702,13 @@ osigreturn(p, uap)
#endif
int
-sigreturn(p, uap)
- struct proc *p;
+sigreturn(td, uap)
+ struct thread *td;
struct sigreturn_args /* {
ucontext_t *sigcntxp;
} */ *uap;
{
+ struct proc *p = td->td_proc;
struct trapframe *regs;
ucontext_t *ucp;
int cs, eflags;
@@ -712,7 +718,7 @@ sigreturn(p, uap)
if (!useracc((caddr_t)ucp, sizeof(struct osigcontext), VM_PROT_READ))
return (EFAULT);
if (((struct osigcontext *)ucp)->sc_trapno == 0x01d516)
- return (osigreturn(p, (struct osigreturn_args *)uap));
+ return (osigreturn(td, (struct osigreturn_args *)uap));
/*
* Since ucp is not an osigcontext but a ucontext_t, we have to
* check again if all of it is accessible. A ucontext_t is
@@ -724,7 +730,7 @@ sigreturn(p, uap)
if (!useracc((caddr_t)ucp, sizeof(*ucp), VM_PROT_READ))
return (EFAULT);
- regs = p->p_frame;
+ regs = td->td_frame;
eflags = ucp->uc_mcontext.mc_eflags;
if (eflags & PSL_VM) {
struct trapframe_vm86 *tf = (struct trapframe_vm86 *)regs;
@@ -734,9 +740,9 @@ sigreturn(p, uap)
* if pcb_ext == 0 or vm86_inited == 0, the user hasn't
* set up the vm86 area, and we can't enter vm86 mode.
*/
- if (p->p_addr->u_pcb.pcb_ext == 0)
+ if (td->td_pcb->pcb_ext == 0)
return (EINVAL);
- vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86;
+ vm86 = &td->td_pcb->pcb_ext->ext_vm86;
if (vm86->vm86_inited == 0)
return (EINVAL);
@@ -865,14 +871,14 @@ cpu_idle(void)
* Clear registers on exec
*/
void
-setregs(p, entry, stack, ps_strings)
- struct proc *p;
+setregs(td, entry, stack, ps_strings)
+ struct thread *td;
u_long entry;
u_long stack;
u_long ps_strings;
{
- struct trapframe *regs = p->p_frame;
- struct pcb *pcb = &p->p_addr->u_pcb;
+ struct trapframe *regs = td->td_frame;
+ struct pcb *pcb = td->td_pcb;
if (pcb->pcb_ldt)
user_ldt_free(pcb);
@@ -925,7 +931,7 @@ setregs(p, entry, stack, ps_strings)
* traps to the emulator (if it is done at all) mainly because
* emulators don't provide an entry point for initialization.
*/
- p->p_addr->u_pcb.pcb_flags &= ~FP_SOFTFP;
+ td->td_pcb->pcb_flags &= ~FP_SOFTFP;
/*
* Arrange to trap the next npx or `fwait' instruction (see npx.c
@@ -948,7 +954,7 @@ setregs(p, entry, stack, ps_strings)
* Make sure sure edx is 0x0 on entry. Linux binaries depend
* on it.
*/
- p->p_retval[1] = 0;
+ td->td_retval[1] = 0;
}
void
@@ -1016,7 +1022,8 @@ extern int has_f00f_bug;
static struct i386tss dblfault_tss;
static char dblfault_stack[PAGE_SIZE];
-extern struct user *proc0paddr;
+extern struct user *proc0uarea;
+extern vm_offset_t proc0kstack;
/* software prototypes -- in more palatable form */
@@ -1661,8 +1668,12 @@ init386(first)
struct region_descriptor r_gdt, r_idt;
#endif
- proc0.p_addr = proc0paddr;
-
+ proc_linkup(&proc0);
+ proc0.p_uarea = proc0uarea;
+ thread0 = &proc0.p_thread;
+ thread0->td_kstack = proc0kstack;
+ thread0->td_pcb = (struct pcb *)
+ (thread0->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
atdevbase = ISA_HOLE_START + KERNBASE;
metadata_missing = 0;
@@ -1721,10 +1732,11 @@ init386(first)
lgdt(&r_gdt);
/* setup curproc so that mutexes work */
- PCPU_SET(curproc, &proc0);
+
+ PCPU_SET(curthread, thread0);
PCPU_SET(spinlocks, NULL);
- LIST_INIT(&proc0.p_contested);
+ LIST_INIT(&thread0->td_contested);
/*
* Initialize mutexes.
@@ -1828,8 +1840,9 @@ init386(first)
initializecpu(); /* Initialize CPU registers */
/* make an initial tss so cpu can get interrupt stack on syscall! */
- PCPU_SET(common_tss.tss_esp0,
- (int) proc0.p_addr + UPAGES*PAGE_SIZE - 16);
+ /* Note: -16 is so we can grow the trapframe if we came from vm86 */
+ PCPU_SET(common_tss.tss_esp0, thread0->td_kstack +
+ KSTACK_PAGES * PAGE_SIZE - sizeof(struct pcb) - 16);
PCPU_SET(common_tss.tss_ss0, GSEL(GDATA_SEL, SEL_KPL));
gsel_tss = GSEL(GPROC0_SEL, SEL_KPL);
private_tss = 0;
@@ -1884,10 +1897,10 @@ init386(first)
_udatasel = LSEL(LUDATA_SEL, SEL_UPL);
/* setup proc 0's pcb */
- proc0.p_addr->u_pcb.pcb_flags = 0;
- proc0.p_addr->u_pcb.pcb_cr3 = (int)IdlePTD;
- proc0.p_addr->u_pcb.pcb_ext = 0;
- proc0.p_frame = &proc0_tf;
+ thread0->td_pcb->pcb_flags = 0; /* XXXKSE */
+ thread0->td_pcb->pcb_cr3 = (int)IdlePTD;
+ thread0->td_pcb->pcb_ext = 0;
+ thread0->td_frame = &proc0_tf;
}
#if defined(I586_CPU) && !defined(NO_F00F_HACK)
@@ -1930,31 +1943,26 @@ f00f_hack(void *unused) {
#endif /* defined(I586_CPU) && !NO_F00F_HACK */
int
-ptrace_set_pc(p, addr)
- struct proc *p;
- unsigned long addr;
+ptrace_set_pc(struct thread *td, unsigned long addr)
{
- p->p_frame->tf_eip = addr;
+ td->td_frame->tf_eip = addr;
return (0);
}
int
-ptrace_single_step(p)
- struct proc *p;
+ptrace_single_step(struct thread *td)
{
- p->p_frame->tf_eflags |= PSL_T;
+ td->td_frame->tf_eflags |= PSL_T;
return (0);
}
int
-fill_regs(p, regs)
- struct proc *p;
- struct reg *regs;
+fill_regs(struct thread *td, struct reg *regs)
{
struct pcb *pcb;
struct trapframe *tp;
- tp = p->p_frame;
+ tp = td->td_frame;
regs->r_fs = tp->tf_fs;
regs->r_es = tp->tf_es;
regs->r_ds = tp->tf_ds;
@@ -1970,20 +1978,18 @@ fill_regs(p, regs)
regs->r_eflags = tp->tf_eflags;
regs->r_esp = tp->tf_esp;
regs->r_ss = tp->tf_ss;
- pcb = &p->p_addr->u_pcb;
+ pcb = td->td_pcb;
regs->r_gs = pcb->pcb_gs;
return (0);
}
int
-set_regs(p, regs)
- struct proc *p;
- struct reg *regs;
+set_regs(struct thread *td, struct reg *regs)
{
struct pcb *pcb;
struct trapframe *tp;
- tp = p->p_frame;
+ tp = td->td_frame;
if (!EFL_SECURE(regs->r_eflags, tp->tf_eflags) ||
!CS_SECURE(regs->r_cs))
return (EINVAL);
@@ -2002,7 +2008,7 @@ set_regs(p, regs)
tp->tf_eflags = regs->r_eflags;
tp->tf_esp = regs->r_esp;
tp->tf_ss = regs->r_ss;
- pcb = &p->p_addr->u_pcb;
+ pcb = td->td_pcb;
pcb->pcb_gs = regs->r_gs;
return (0);
}
@@ -2062,45 +2068,39 @@ set_fpregs_xmm(sv_87, sv_xmm)
#endif /* CPU_ENABLE_SSE */
int
-fill_fpregs(p, fpregs)
- struct proc *p;
- struct fpreg *fpregs;
+fill_fpregs(struct thread *td, struct fpreg *fpregs)
{
#ifdef CPU_ENABLE_SSE
if (cpu_fxsr) {
- fill_fpregs_xmm(&p->p_addr->u_pcb.pcb_save.sv_xmm,
+ fill_fpregs_xmm(&td->td_pcb->pcb_save.sv_xmm,
(struct save87 *)fpregs);
return (0);
}
#endif /* CPU_ENABLE_SSE */
- bcopy(&p->p_addr->u_pcb.pcb_save.sv_87, fpregs, sizeof *fpregs);
+ bcopy(&td->td_pcb->pcb_save.sv_87, fpregs, sizeof *fpregs);
return (0);
}
int
-set_fpregs(p, fpregs)
- struct proc *p;
- struct fpreg *fpregs;
+set_fpregs(struct thread *td, struct fpreg *fpregs)
{
#ifdef CPU_ENABLE_SSE
if (cpu_fxsr) {
set_fpregs_xmm((struct save87 *)fpregs,
- &p->p_addr->u_pcb.pcb_save.sv_xmm);
+ &td->td_pcb->pcb_save.sv_xmm);
return (0);
}
#endif /* CPU_ENABLE_SSE */
- bcopy(fpregs, &p->p_addr->u_pcb.pcb_save.sv_87, sizeof *fpregs);
+ bcopy(fpregs, &td->td_pcb->pcb_save.sv_87, sizeof *fpregs);
return (0);
}
int
-fill_dbregs(p, dbregs)
- struct proc *p;
- struct dbreg *dbregs;
+fill_dbregs(struct thread *td, struct dbreg *dbregs)
{
struct pcb *pcb;
- if (p == NULL) {
+ if (td == NULL) {
dbregs->dr0 = rdr0();
dbregs->dr1 = rdr1();
dbregs->dr2 = rdr2();
@@ -2109,9 +2109,8 @@ fill_dbregs(p, dbregs)
dbregs->dr5 = rdr5();
dbregs->dr6 = rdr6();
dbregs->dr7 = rdr7();
- }
- else {
- pcb = &p->p_addr->u_pcb;
+ } else {
+ pcb = td->td_pcb;
dbregs->dr0 = pcb->pcb_dr0;
dbregs->dr1 = pcb->pcb_dr1;
dbregs->dr2 = pcb->pcb_dr2;
@@ -2125,15 +2124,13 @@ fill_dbregs(p, dbregs)
}
int
-set_dbregs(p, dbregs)
- struct proc *p;
- struct dbreg *dbregs;
+set_dbregs(struct thread *td, struct dbreg *dbregs)
{
struct pcb *pcb;
int i;
u_int32_t mask1, mask2;
- if (p == NULL) {
+ if (td == NULL) {
load_dr0(dbregs->dr0);
load_dr1(dbregs->dr1);
load_dr2(dbregs->dr2);
@@ -2142,8 +2139,7 @@ set_dbregs(p, dbregs)
load_dr5(dbregs->dr5);
load_dr6(dbregs->dr6);
load_dr7(dbregs->dr7);
- }
- else {
+ } else {
/*
* Don't let an illegal value for dr7 get set. Specifically,
* check for undefined settings. Setting these bit patterns
@@ -2155,7 +2151,7 @@ set_dbregs(p, dbregs)
if ((dbregs->dr7 & mask1) == mask2)
return (EINVAL);
- pcb = &p->p_addr->u_pcb;
+ pcb = td->td_pcb;
/*
* Don't let a process set a breakpoint that is not within the
@@ -2172,7 +2168,7 @@ set_dbregs(p, dbregs)
* from within kernel mode?
*/
- if (suser(p) != 0) {
+ if (suser_td(td) != 0) {
if (dbregs->dr7 & 0x3) {
/* dr0 is enabled */
if (dbregs->dr0 >= VM_MAXUSER_ADDRESS)
diff --git a/sys/i386/i386/math_emu.h b/sys/i386/i386/math_emu.h
index 545a87d..bc28dc1 100644
--- a/sys/i386/i386/math_emu.h
+++ b/sys/i386/i386/math_emu.h
@@ -69,7 +69,7 @@ struct i387_struct {
int32_t st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */
};
-#define I387 (*(struct i387_struct *)&(((struct pcb *)curproc->p_addr)->pcb_save.sv_87))
+#define I387 (*(struct i387_struct *)&(curthread->td_pcb->pcb_save.sv_87))
#define SWD (*(struct swd *) &I387.swd)
#define ROUNDING ((I387.cwd >> 10) & 3)
#define PRECISION ((I387.cwd >> 8) & 3)
diff --git a/sys/i386/i386/math_emulate.c b/sys/i386/i386/math_emulate.c
index 94f32b1..e7da93e 100644
--- a/sys/i386/i386/math_emulate.c
+++ b/sys/i386/i386/math_emulate.c
@@ -98,8 +98,8 @@ math_emulate(struct trapframe * info)
u_int32_t oldeip;
/* ever used fp? */
- if ((((struct pcb *)curproc->p_addr)->pcb_flags & FP_SOFTFP) == 0) {
- ((struct pcb *)curproc->p_addr)->pcb_flags |= FP_SOFTFP;
+ if ((curthread->td_pcb->pcb_flags & FP_SOFTFP) == 0) {
+ curthread->td_pcb->pcb_flags |= FP_SOFTFP;
I387.cwd = 0x037f;
I387.swd = 0x0000;
I387.twd = 0x0000;
@@ -604,7 +604,7 @@ static int __regoffset[] = {
tEAX, tECX, tEDX, tEBX, tESP, tEBP, tESI, tEDI
};
-#define REG(x) (((int *)curproc->p_frame)[__regoffset[(x)]])
+#define REG(x) (((int *)curthread->td_frame)[__regoffset[(x)]])
static char *
sib(struct trapframe * info, int mod)
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index 5eded32..48ecff8 100644
--- a/sys/i386/i386/mem.c
+++ b/sys/i386/i386/mem.c
@@ -98,17 +98,17 @@ MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors");
struct mem_range_softc mem_range_softc;
static int
-mmclose(dev_t dev, int flags, int fmt, struct proc *p)
+mmclose(dev_t dev, int flags, int fmt, struct thread *td)
{
switch (minor(dev)) {
case 14:
- p->p_frame->tf_eflags &= ~PSL_IOPL;
+ td->td_frame->tf_eflags &= ~PSL_IOPL;
}
return (0);
}
static int
-mmopen(dev_t dev, int flags, int fmt, struct proc *p)
+mmopen(dev_t dev, int flags, int fmt, struct thread *td)
{
int error;
@@ -119,12 +119,12 @@ mmopen(dev_t dev, int flags, int fmt, struct proc *p)
return (EPERM);
break;
case 14:
- error = suser(p);
+ error = suser_td(td);
if (error != 0)
return (error);
if (securelevel > 0)
return (EPERM);
- p->p_frame->tf_eflags |= PSL_IOPL;
+ td->td_frame->tf_eflags |= PSL_IOPL;
break;
}
return (0);
@@ -235,7 +235,7 @@ memmmap(dev_t dev, vm_offset_t offset, int prot)
* and mem_range_attr_set.
*/
static int
-mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
+mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td)
{
int nd, error = 0;
struct mem_range_op *mo = (struct mem_range_op *)data;
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index d912e0c..f558524 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -26,7 +26,7 @@
*/
#include "opt_cpu.h"
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -1960,8 +1960,8 @@ start_all_aps(u_int boot_addr)
SMPpt[pg] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd));
/* allocate and set up an idle stack data page */
- stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
- for (i = 0; i < UPAGES; i++)
+ stack = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE); /* XXXKSE */
+ for (i = 0; i < KSTACK_PAGES; i++)
SMPpt[pg + 1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
@@ -1977,7 +1977,7 @@ start_all_aps(u_int boot_addr)
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
#endif
- bootSTK = &SMP_prvspace[x].idlestack[UPAGES*PAGE_SIZE];
+ bootSTK = &SMP_prvspace[x].idlekstack[KSTACK_PAGES * PAGE_SIZE];
bootAP = x;
/* attempt to start the Application Processor */
@@ -2019,8 +2019,8 @@ start_all_aps(u_int boot_addr)
*/
/* Allocate and setup BSP idle stack */
- stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
- for (i = 0; i < UPAGES; i++)
+ stack = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE);
+ for (i = 0; i < KSTACK_PAGES; i++)
SMPpt[1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
@@ -2241,7 +2241,7 @@ ap_init(void)
* Set curproc to our per-cpu idleproc so that mutexes have
* something unique to lock with.
*/
- PCPU_SET(curproc, PCPU_GET(idleproc));
+ PCPU_SET(curthread, PCPU_GET(idlethread));
PCPU_SET(spinlocks, NULL);
/* lock against other AP's that are waking up */
@@ -2323,7 +2323,7 @@ forwarded_statclock(struct trapframe frame)
{
mtx_lock_spin(&sched_lock);
- statclock_process(curproc, TRAPF_PC(&frame), TRAPF_USERMODE(&frame));
+ statclock_process(curthread->td_kse, TRAPF_PC(&frame), TRAPF_USERMODE(&frame));
mtx_unlock_spin(&sched_lock);
}
@@ -2354,7 +2354,7 @@ forwarded_hardclock(struct trapframe frame)
{
mtx_lock_spin(&sched_lock);
- hardclock_process(curproc, TRAPF_USERMODE(&frame));
+ hardclock_process(curthread, TRAPF_USERMODE(&frame));
mtx_unlock_spin(&sched_lock);
}
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index d912e0c..f558524 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -26,7 +26,7 @@
*/
#include "opt_cpu.h"
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -1960,8 +1960,8 @@ start_all_aps(u_int boot_addr)
SMPpt[pg] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd));
/* allocate and set up an idle stack data page */
- stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
- for (i = 0; i < UPAGES; i++)
+ stack = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE); /* XXXKSE */
+ for (i = 0; i < KSTACK_PAGES; i++)
SMPpt[pg + 1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
@@ -1977,7 +1977,7 @@ start_all_aps(u_int boot_addr)
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
#endif
- bootSTK = &SMP_prvspace[x].idlestack[UPAGES*PAGE_SIZE];
+ bootSTK = &SMP_prvspace[x].idlekstack[KSTACK_PAGES * PAGE_SIZE];
bootAP = x;
/* attempt to start the Application Processor */
@@ -2019,8 +2019,8 @@ start_all_aps(u_int boot_addr)
*/
/* Allocate and setup BSP idle stack */
- stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
- for (i = 0; i < UPAGES; i++)
+ stack = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE);
+ for (i = 0; i < KSTACK_PAGES; i++)
SMPpt[1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
@@ -2241,7 +2241,7 @@ ap_init(void)
* Set curproc to our per-cpu idleproc so that mutexes have
* something unique to lock with.
*/
- PCPU_SET(curproc, PCPU_GET(idleproc));
+ PCPU_SET(curthread, PCPU_GET(idlethread));
PCPU_SET(spinlocks, NULL);
/* lock against other AP's that are waking up */
@@ -2323,7 +2323,7 @@ forwarded_statclock(struct trapframe frame)
{
mtx_lock_spin(&sched_lock);
- statclock_process(curproc, TRAPF_PC(&frame), TRAPF_USERMODE(&frame));
+ statclock_process(curthread->td_kse, TRAPF_PC(&frame), TRAPF_USERMODE(&frame));
mtx_unlock_spin(&sched_lock);
}
@@ -2354,7 +2354,7 @@ forwarded_hardclock(struct trapframe frame)
{
mtx_lock_spin(&sched_lock);
- hardclock_process(curproc, TRAPF_USERMODE(&frame));
+ hardclock_process(curthread, TRAPF_USERMODE(&frame));
mtx_unlock_spin(&sched_lock);
}
diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c
index 2d38312..ed0b53e 100644
--- a/sys/i386/i386/perfmon.c
+++ b/sys/i386/i386/perfmon.c
@@ -288,7 +288,7 @@ static int writer;
static int writerpmc;
static int
-perfmon_open(dev_t dev, int flags, int fmt, struct proc *p)
+perfmon_open(dev_t dev, int flags, int fmt, struct thread *td)
{
if (!perfmon_cpuok)
return ENXIO;
@@ -305,7 +305,7 @@ perfmon_open(dev_t dev, int flags, int fmt, struct proc *p)
}
static int
-perfmon_close(dev_t dev, int flags, int fmt, struct proc *p)
+perfmon_close(dev_t dev, int flags, int fmt, struct thread *td)
{
if (flags & FWRITE) {
int i;
@@ -320,7 +320,7 @@ perfmon_close(dev_t dev, int flags, int fmt, struct proc *p)
}
static int
-perfmon_ioctl(dev_t dev, u_long cmd, caddr_t param, int flags, struct proc *p)
+perfmon_ioctl(dev_t dev, u_long cmd, caddr_t param, int flags, struct thread *td)
{
struct pmc *pmc;
struct pmc_data *pmcd;
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 3ce91ab..b41b11f 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -71,7 +71,7 @@
#include "opt_disable_pse.h"
#include "opt_pmap.h"
#include "opt_msgbuf.h"
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -171,7 +171,7 @@ vm_offset_t kernel_vm_end;
static vm_zone_t pvzone;
static struct vm_zone pvzone_store;
static struct vm_object pvzone_obj;
-static int pv_entry_count=0, pv_entry_max=0, pv_entry_high_water=0;
+static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
static int pmap_pagedaemon_waken = 0;
static struct pv_entry *pvinit;
@@ -183,7 +183,7 @@ static pt_entry_t *CMAP2, *ptmmap;
caddr_t CADDR1 = 0, ptvmmap = 0;
static caddr_t CADDR2;
static pt_entry_t *msgbufmap;
-struct msgbuf *msgbufp=0;
+struct msgbuf *msgbufp = 0;
/*
* Crashdump maps.
@@ -819,7 +819,7 @@ retry:
}
/*
- * Create the UPAGES for a new process.
+ * Create the Uarea stack for a new process.
* This routine directly affects the fork perf for a process.
*/
void
@@ -840,22 +840,22 @@ pmap_new_proc(p)
*/
upobj = p->p_upages_obj;
if (upobj == NULL) {
- upobj = vm_object_allocate(OBJT_DEFAULT, UPAGES);
+ upobj = vm_object_allocate(OBJT_DEFAULT, UAREA_PAGES);
p->p_upages_obj = upobj;
}
- /* get a kernel virtual address for the UPAGES for this proc */
- up = (vm_offset_t)p->p_addr;
+ /* get a kernel virtual address for the U area for this proc */
+ up = (vm_offset_t)p->p_uarea;
if (up == 0) {
- up = kmem_alloc_nofault(kernel_map, UPAGES * PAGE_SIZE);
+ up = kmem_alloc_nofault(kernel_map, UAREA_PAGES * PAGE_SIZE);
if (up == 0)
panic("pmap_new_proc: upage allocation failed");
- p->p_addr = (struct user *)up;
+ p->p_uarea = (struct user *)up;
}
ptek = (unsigned *)vtopte(up);
- for (i = 0; i < UPAGES; i++) {
+ for (i = 0; i < UAREA_PAGES; i++) {
/*
* Get a kernel stack page
*/
@@ -892,7 +892,7 @@ pmap_new_proc(p)
}
/*
- * Dispose the UPAGES for a process that has exited.
+ * Dispose the U-Area for a process that has exited.
* This routine directly impacts the exit perf of a process.
*/
void
@@ -906,9 +906,9 @@ pmap_dispose_proc(p)
unsigned *ptek, oldpte;
upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
+ up = (vm_offset_t)p->p_uarea;
ptek = (unsigned *)vtopte(up);
- for (i = 0; i < UPAGES; i++) {
+ for (i = 0; i < UAREA_PAGES; i++) {
m = vm_page_lookup(upobj, i);
if (m == NULL)
panic("pmap_dispose_proc: upage already missing?");
@@ -927,7 +927,7 @@ pmap_dispose_proc(p)
}
/*
- * Allow the UPAGES for a process to be prejudicially paged out.
+ * Allow the U_AREA for a process to be prejudicially paged out.
*/
void
pmap_swapout_proc(p)
@@ -939,8 +939,8 @@ pmap_swapout_proc(p)
vm_page_t m;
upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
- for (i = 0; i < UPAGES; i++) {
+ up = (vm_offset_t)p->p_uarea;
+ for (i = 0; i < UAREA_PAGES; i++) {
m = vm_page_lookup(upobj, i);
if (m == NULL)
panic("pmap_swapout_proc: upage already missing?");
@@ -951,7 +951,7 @@ pmap_swapout_proc(p)
}
/*
- * Bring the UPAGES for a specified process back in.
+ * Bring the U-Area for a specified process back in.
*/
void
pmap_swapin_proc(p)
@@ -963,8 +963,8 @@ pmap_swapin_proc(p)
vm_page_t m;
upobj = p->p_upages_obj;
- up = (vm_offset_t)p->p_addr;
- for (i = 0; i < UPAGES; i++) {
+ up = (vm_offset_t)p->p_uarea;
+ for (i = 0; i < UAREA_PAGES; i++) {
m = vm_page_grab(upobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
pmap_kenter(up + i * PAGE_SIZE, VM_PAGE_TO_PHYS(m));
if (m->valid != VM_PAGE_BITS_ALL) {
@@ -980,6 +980,191 @@ pmap_swapin_proc(p)
}
}
+/*
+ * Create the kernel stack (including pcb for i386) for a new thread.
+ * This routine directly affects the fork perf for a process and
+ * create performance for a thread.
+ */
+void
+pmap_new_thread(td)
+ struct thread *td;
+{
+#ifdef I386_CPU
+ int updateneeded = 0;
+#endif
+ int i;
+ vm_object_t ksobj;
+ vm_page_t m;
+ vm_offset_t ks;
+ unsigned *ptek, oldpte;
+
+ /*
+ * allocate object for the kstack
+ */
+ ksobj = td->td_kstack_obj;
+ if (ksobj == NULL) {
+ ksobj = vm_object_allocate(OBJT_DEFAULT, KSTACK_PAGES);
+ td->td_kstack_obj = ksobj;
+ }
+
+#ifdef KSTACK_GUARD
+ /* get a kernel virtual address for the kstack for this proc */
+ ks = (vm_offset_t)td->td_kstack;
+ if (ks == 0) {
+ ks = kmem_alloc_nofault(kernel_map,
+ (KSTACK_PAGES + 1) * PAGE_SIZE);
+ if (ks == 0)
+ panic("pmap_new_thread: kstack allocation failed");
+ ks += PAGE_SIZE;
+ td->td_kstack = ks;
+ }
+
+ ptek = (unsigned *)vtopte(ks - PAGE_SIZE);
+ oldpte = *ptek;
+ *ptek = 0;
+ if (oldpte) {
+#ifdef I386_CPU
+ updateneeded = 1;
+#else
+ invlpg(ks - PAGE_SIZE);
+#endif
+ }
+ ptek++;
+#else
+ /* get a kernel virtual address for the kstack for this proc */
+ ks = (vm_offset_t)td->td_kstack;
+ if (ks == 0) {
+ ks = kmem_alloc_nofault(kernel_map, KSTACK_PAGES * PAGE_SIZE);
+ if (ks == 0)
+ panic("pmap_new_thread: kstack allocation failed");
+ td->td_kstack = ks;
+ }
+#endif
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ /*
+ * Get a kernel stack page
+ */
+ m = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
+
+ /*
+ * Wire the page
+ */
+ m->wire_count++;
+ cnt.v_wire_count++;
+
+ oldpte = *(ptek + i);
+ /*
+ * Enter the page into the kernel address space.
+ */
+ *(ptek + i) = VM_PAGE_TO_PHYS(m) | PG_RW | PG_V | pgeflag;
+ if (oldpte) {
+#ifdef I386_CPU
+ updateneeded = 1;
+#else
+ invlpg(ks + i * PAGE_SIZE);
+#endif
+ }
+
+ vm_page_wakeup(m);
+ vm_page_flag_clear(m, PG_ZERO);
+ vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE);
+ m->valid = VM_PAGE_BITS_ALL;
+ }
+#ifdef I386_CPU
+ if (updateneeded)
+ invltlb();
+#endif
+}
+
+/*
+ * Dispose the kernel stack for a thread that has exited.
+ * This routine directly impacts the exit perf of a process and thread.
+ */
+void
+pmap_dispose_thread(td)
+ struct thread *td;
+{
+ int i;
+ vm_object_t ksobj;
+ vm_offset_t ks;
+ vm_page_t m;
+ unsigned *ptek, oldpte;
+
+ ksobj = td->td_kstack_obj;
+ ks = td->td_kstack;
+ ptek = (unsigned *)vtopte(ks);
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ m = vm_page_lookup(ksobj, i);
+ if (m == NULL)
+ panic("pmap_dispose_thread: kstack already missing?");
+ vm_page_busy(m);
+ oldpte = *(ptek + i);
+ *(ptek + i) = 0;
+#ifndef I386_CPU
+ invlpg(ks + i * PAGE_SIZE);
+#endif
+ vm_page_unwire(m, 0);
+ vm_page_free(m);
+ }
+#ifdef I386_CPU
+ invltlb();
+#endif
+}
+
+/*
+ * Allow the Kernel stack for a thread to be prejudicially paged out.
+ */
+void
+pmap_swapout_thread(td)
+ struct thread *td;
+{
+ int i;
+ vm_object_t ksobj;
+ vm_offset_t ks;
+ vm_page_t m;
+
+ ksobj = td->td_kstack_obj;
+ ks = td->td_kstack;
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ m = vm_page_lookup(ksobj, i);
+ if (m == NULL)
+ panic("pmap_swapout_thread: kstack already missing?");
+ vm_page_dirty(m);
+ vm_page_unwire(m, 0);
+ pmap_kremove(ks + i * PAGE_SIZE);
+ }
+}
+
+/*
+ * Bring the kernel stack for a specified thread back in.
+ */
+void
+pmap_swapin_thread(td)
+ struct thread *td;
+{
+ int i, rv;
+ vm_object_t ksobj;
+ vm_offset_t ks;
+ vm_page_t m;
+
+ ksobj = td->td_kstack_obj;
+ ks = td->td_kstack;
+ for (i = 0; i < KSTACK_PAGES; i++) {
+ m = vm_page_grab(ksobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
+ pmap_kenter(ks + i * PAGE_SIZE, VM_PAGE_TO_PHYS(m));
+ if (m->valid != VM_PAGE_BITS_ALL) {
+ rv = vm_pager_get_pages(ksobj, &m, 1, 0);
+ if (rv != VM_PAGER_OK)
+ panic("pmap_swapin_thread: cannot get kstack for proc: %d\n", td->td_proc->p_pid);
+ m = vm_page_lookup(ksobj, i);
+ m->valid = VM_PAGE_BITS_ALL;
+ }
+ vm_page_wire(m);
+ vm_page_wakeup(m);
+ vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE);
+ }
+}
+
/***************************************************
* Page table page management routines.....
***************************************************/
@@ -1517,7 +1702,7 @@ pmap_collect()
{
int i;
vm_page_t m;
- static int warningdone=0;
+ static int warningdone = 0;
if (pmap_pagedaemon_waken == 0)
return;
@@ -2333,7 +2518,7 @@ retry:
pmap->pm_stats.resident_count += size >> PAGE_SHIFT;
npdes = size >> PDRSHIFT;
- for(i=0;i<npdes;i++) {
+ for(i = 0; i < npdes; i++) {
pmap->pm_pdir[ptepindex] =
(pd_entry_t) (ptepa | PG_U | PG_RW | PG_V | PG_PS);
ptepa += NBPDR;
@@ -2444,7 +2629,7 @@ pmap_prefault(pmap, addra, entry)
vm_page_t m, mpte;
vm_object_t object;
- if (!curproc || (pmap != vmspace_pmap(curproc->p_vmspace)))
+ if (!curthread || (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)))
return;
object = entry->object.vm_object;
@@ -2561,6 +2746,7 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
vm_offset_t pdnxt;
unsigned src_frame, dst_frame;
vm_page_t m;
+ pd_entry_t saved_pde;
if (dst_addr != src_addr)
return;
@@ -2580,7 +2766,7 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
invltlb();
#endif
}
-
+ saved_pde = (pd_entry_t)((u_int32_t)APTDpde & (PG_FRAME|PG_RW | PG_V));
for(addr = src_addr; addr < end_addr; addr = pdnxt) {
unsigned *src_pte, *dst_pte;
vm_page_t dstmpte, srcmpte;
@@ -2637,6 +2823,16 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
* block.
*/
dstmpte = pmap_allocpte(dst_pmap, addr);
+ if (((u_int32_t)APTDpde & PG_FRAME) !=
+ ((u_int32_t)saved_pde & PG_FRAME)) {
+ APTDpde = saved_pde;
+printf ("IT HAPPENNED!");
+#if defined(SMP)
+ cpu_invltlb();
+#else
+ invltlb();
+#endif
+ }
if ((*dst_pte == 0) && (ptetemp = *src_pte)) {
/*
* Clear the modified and
@@ -2831,7 +3027,7 @@ pmap_remove_pages(pmap, sva, eva)
vm_page_t m;
#ifdef PMAP_REMOVE_PAGES_CURPROC_ONLY
- if (!curproc || (pmap != vmspace_pmap(curproc->p_vmspace))) {
+ if (!curthread || (pmap != vmspace_pmap(curthread->td_proc->p_vmspace))) {
printf("warning: pmap_remove_pages called with non-current pmap\n");
return;
}
@@ -2839,8 +3035,8 @@ pmap_remove_pages(pmap, sva, eva)
s = splvm();
for(pv = TAILQ_FIRST(&pmap->pm_pvlist);
- pv;
- pv = npv) {
+ pv;
+ pv = npv) {
if (pv->pv_va >= eva || pv->pv_va < sva) {
npv = TAILQ_NEXT(pv, pv_plist);
@@ -2854,6 +3050,12 @@ pmap_remove_pages(pmap, sva, eva)
#endif
tpte = *pte;
+ if (tpte == 0) {
+ printf("TPTE at %p IS ZERO @ VA %08x\n",
+ pte, pv->pv_va);
+ panic("bad pte");
+ }
+
/*
* We cannot remove wired pages from a process' mapping at this time
*/
@@ -2861,15 +3063,19 @@ pmap_remove_pages(pmap, sva, eva)
npv = TAILQ_NEXT(pv, pv_plist);
continue;
}
- *pte = 0;
m = PHYS_TO_VM_PAGE(tpte);
+ KASSERT(m->phys_addr == (tpte & PG_FRAME),
+ ("vm_page_t %p phys_addr mismatch %08x %08x",
+ m, m->phys_addr, tpte));
KASSERT(m < &vm_page_array[vm_page_array_size],
("pmap_remove_pages: bad tpte %x", tpte));
pv->pv_pmap->pm_stats.resident_count--;
+ *pte = 0;
+
/*
* Update the vm_page_t clean and reference bits.
*/
@@ -2877,7 +3083,6 @@ pmap_remove_pages(pmap, sva, eva)
vm_page_dirty(m);
}
-
npv = TAILQ_NEXT(pv, pv_plist);
TAILQ_REMOVE(&pv->pv_pmap->pm_pvlist, pv, pv_plist);
@@ -3255,11 +3460,13 @@ pmap_mincore(pmap, addr)
}
void
-pmap_activate(struct proc *p)
+pmap_activate(struct thread *td)
{
+ struct proc *p = td->td_proc;
pmap_t pmap;
+ u_int32_t cr3;
- pmap = vmspace_pmap(p->p_vmspace);
+ pmap = vmspace_pmap(td->td_proc->p_vmspace);
#if defined(SMP)
pmap->pm_active |= 1 << PCPU_GET(cpuid);
#else
@@ -3268,7 +3475,20 @@ pmap_activate(struct proc *p)
#if defined(SWTCH_OPTIM_STATS)
tlb_flush_count++;
#endif
- load_cr3(p->p_addr->u_pcb.pcb_cr3 = vtophys(pmap->pm_pdir));
+ cr3 = vtophys(pmap->pm_pdir);
+ /* XXXKSE this is wrong.
+ * pmap_activate is for the current thread on the current cpu
+ */
+ if (p->p_flag & P_KSES) {
+ /* Make sure all other cr3 entries are updated. */
+ /* what if they are running? XXXKSE (maybe abort them) */
+ FOREACH_THREAD_IN_PROC(p, td) {
+ td->td_pcb->pcb_cr3 = cr3;
+ }
+ } else {
+ td->td_pcb->pcb_cr3 = cr3;
+ }
+ load_cr3(cr3);
}
vm_offset_t
@@ -3301,14 +3521,14 @@ pmap_pid_dump(int pid)
int i,j;
index = 0;
pmap = vmspace_pmap(p->p_vmspace);
- for(i=0;i<1024;i++) {
+ for(i = 0; i < 1024; i++) {
pd_entry_t *pde;
unsigned *pte;
unsigned base = i << PDRSHIFT;
pde = &pmap->pm_pdir[i];
if (pde && pmap_pde_v(pde)) {
- for(j=0;j<1024;j++) {
+ for(j = 0; j < 1024; j++) {
unsigned va = base + (j << PAGE_SHIFT);
if (va >= (vm_offset_t) VM_MIN_KERNEL_ADDRESS) {
if (index) {
diff --git a/sys/i386/i386/procfs_machdep.c b/sys/i386/i386/procfs_machdep.c
index f951b0f..e8440b1 100644
--- a/sys/i386/i386/procfs_machdep.c
+++ b/sys/i386/i386/procfs_machdep.c
@@ -87,7 +87,7 @@
int error; \
\
mtx_lock_spin(&sched_lock); \
- if ((p->p_sflag & PS_INMEM) == 0) \
+ if ((td->td_proc->p_sflag & PS_INMEM) == 0) \
error = EIO; \
else \
error = (action); \
@@ -96,39 +96,39 @@
} while(0)
int
-procfs_read_regs(p, regs)
- struct proc *p;
+procfs_read_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
- PROCFS_ACTION(fill_regs(p, regs));
+ PROCFS_ACTION(fill_regs(td, regs));
}
int
-procfs_write_regs(p, regs)
- struct proc *p;
+procfs_write_regs(td, regs)
+ struct thread *td;
struct reg *regs;
{
- PROCFS_ACTION(set_regs(p, regs));
+ PROCFS_ACTION(set_regs(td, regs));
}
int
-procfs_read_dbregs(p, dbregs)
- struct proc *p;
+procfs_read_dbregs(td, dbregs)
+ struct thread *td;
struct dbreg *dbregs;
{
- PROCFS_ACTION(fill_dbregs(p, dbregs));
+ PROCFS_ACTION(fill_dbregs(td, dbregs));
}
int
-procfs_write_dbregs(p, dbregs)
- struct proc *p;
+procfs_write_dbregs(td, dbregs)
+ struct thread *td;
struct dbreg *dbregs;
{
- PROCFS_ACTION(set_dbregs(p, dbregs));
+ PROCFS_ACTION(set_dbregs(td, dbregs));
}
/*
@@ -137,27 +137,27 @@ procfs_write_dbregs(p, dbregs)
*/
int
-procfs_read_fpregs(p, fpregs)
- struct proc *p;
+procfs_read_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
- PROCFS_ACTION(fill_fpregs(p, fpregs));
+ PROCFS_ACTION(fill_fpregs(td, fpregs));
}
int
-procfs_write_fpregs(p, fpregs)
- struct proc *p;
+procfs_write_fpregs(td, fpregs)
+ struct thread *td;
struct fpreg *fpregs;
{
- PROCFS_ACTION(set_fpregs(p, fpregs));
+ PROCFS_ACTION(set_fpregs(td, fpregs));
}
int
-procfs_sstep(p)
- struct proc *p;
+procfs_sstep(td)
+ struct thread *td;
{
- PROCFS_ACTION(ptrace_single_step(p));
+ PROCFS_ACTION(ptrace_single_step(td));
}
diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s
index 55bc29c..81181cc 100644
--- a/sys/i386/i386/support.s
+++ b/sys/i386/i386/support.s
@@ -216,8 +216,8 @@ ENTRY(i586_bzero)
* complicated since we avoid it if possible at all levels. We
* want to localize the complications even when that increases them.
* Here the extra work involves preserving CR0_TS in TS.
- * `npxproc != NULL' is supposed to be the condition that all the
- * FPU resources belong to an application, but npxproc and CR0_TS
+ * `npxthread != NULL' is supposed to be the condition that all the
+ * FPU resources belong to an application, but npxthread and CR0_TS
* aren't set atomically enough for this condition to work in
* interrupt handlers.
*
@@ -241,7 +241,7 @@ ENTRY(i586_bzero)
* method. CR0_TS must be preserved although it is very likely to
* always end up as clear.
*/
- cmpl $0,PCPU(NPXPROC)
+ cmpl $0,PCPU(NPXTHREAD)
je i586_bz1
/*
@@ -303,7 +303,7 @@ fpureg_i586_bzero_loop:
cmpl $8,%ecx
jae fpureg_i586_bzero_loop
- cmpl $0,PCPU(NPXPROC)
+ cmpl $0,PCPU(NPXTHREAD)
je i586_bz3
/* XXX check that the condition for cases 1-2 stayed false. */
@@ -517,7 +517,7 @@ ENTRY(i586_bcopy)
sarb $1,kernel_fpu_lock
jc small_i586_bcopy
- cmpl $0,PCPU(NPXPROC)
+ cmpl $0,PCPU(NPXTHREAD)
je i586_bc1
/* XXX turn off handling of cases 1-2, as above. */
@@ -593,7 +593,7 @@ large_i586_bcopy_loop:
cmpl $64,%ecx
jae 4b
- cmpl $0,PCPU(NPXPROC)
+ cmpl $0,PCPU(NPXTHREAD)
je i586_bc2
/* XXX check that the condition for cases 1-2 stayed false. */
@@ -991,14 +991,14 @@ ENTRY(fastmove)
/* XXX grab FPU context atomically. */
cli
-/* if (npxproc != NULL) { */
- cmpl $0,PCPU(NPXPROC)
+/* if (npxthread != NULL) { */
+ cmpl $0,PCPU(NPXTHREAD)
je 6f
/* fnsave(&curpcb->pcb_savefpu); */
movl PCPU(CURPCB),%eax
fnsave PCB_SAVEFPU(%eax)
-/* npxproc = NULL; */
- movl $0,PCPU(NPXPROC)
+/* NPXTHREAD = NULL; */
+ movl $0,PCPU(NPXTHREAD)
/* } */
6:
/* now we own the FPU. */
@@ -1026,9 +1026,9 @@ ENTRY(fastmove)
movl -4(%ebp),%edi
/* stop_emulating(); */
clts
-/* npxproc = curproc; */
- movl PCPU(CURPROC),%eax
- movl %eax,PCPU(NPXPROC)
+/* npxthread = curthread; */
+ movl PCPU(CURTHREAD),%eax
+ movl %eax,PCPU(NPXTHREAD)
movl PCPU(CURPCB),%eax
/* XXX end of atomic FPU context grab. */
@@ -1113,8 +1113,8 @@ fastmove_loop:
smsw %ax
orb $CR0_TS,%al
lmsw %ax
-/* npxproc = NULL; */
- movl $0,PCPU(NPXPROC)
+/* npxthread = NULL; */
+ movl $0,PCPU(NPXTHREAD)
/* XXX end of atomic FPU context ungrab. */
sti
@@ -1154,7 +1154,7 @@ fastmove_fault:
smsw %ax
orb $CR0_TS,%al
lmsw %ax
- movl $0,PCPU(NPXPROC)
+ movl $0,PCPU(NPXTHREAD)
/* XXX end of atomic FPU context ungrab. */
sti
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 0f2f7a8..075aa36 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -77,17 +77,17 @@ ENTRY(cpu_throw)
ENTRY(cpu_switch)
/* switch to new process. first, save context as needed */
- movl PCPU(CURPROC),%ecx
+ movl PCPU(CURTHREAD),%ecx
/* if no process to save, don't bother */
testl %ecx,%ecx
jz sw1
-
- movl P_VMSPACE(%ecx), %edx
+ movl TD_PROC(%ecx), %eax
+ movl P_VMSPACE(%eax), %edx
movl PCPU(CPUID), %eax
btrl %eax, VM_PMAP+PM_ACTIVE(%edx)
- movl P_ADDR(%ecx),%edx
+ movl TD_PCB(%ecx),%edx
movl (%esp),%eax /* Hardware registers */
movl %eax,PCB_EIP(%edx)
@@ -124,7 +124,7 @@ ENTRY(cpu_switch)
#ifdef DEV_NPX
/* have we used fp, and need a save? */
- cmpl %ecx,PCPU(NPXPROC)
+ cmpl %ecx,PCPU(NPXTHREAD)
jne 1f
addl $PCB_SAVEFPU,%edx /* h/w bugs make saving complicated */
pushl %edx
@@ -133,7 +133,11 @@ ENTRY(cpu_switch)
1:
#endif /* DEV_NPX */
+/*##########################################################################*/
+/*##########################################################################*/
+/*##########################################################################*/
/* save is done, now choose a new process */
+ /* But still trashing space above the old "Top Of Stack".. */
sw1:
#ifdef SMP
@@ -143,17 +147,17 @@ sw1:
cmpl $0,PCPU(CPUID)
je 1f
- movl PCPU(IDLEPROC), %eax
- jmp sw1b
+ movl PCPU(IDLETHREAD), %eax
+ jmp sw1b /* Idle thread can run on any kernel context */
1:
#endif
/*
- * Choose a new process to schedule. chooseproc() returns idleproc
+ * Choose a new process to schedule. choosethread() returns idleproc
* if it cannot find another process to run.
*/
sw1a:
- call chooseproc /* trash ecx, edx, ret eax*/
+ call choosethread /* trash ecx, edx, ret eax*/
#ifdef INVARIANTS
testl %eax,%eax /* no process? */
@@ -163,15 +167,20 @@ sw1b:
movl %eax,%ecx
#ifdef INVARIANTS
- cmpb $SRUN,P_STAT(%ecx)
+ movl TD_PROC(%ecx), %eax /* XXXKSE */
+ cmpb $SRUN,P_STAT(%eax)
jne badsw2
#endif
- movl P_ADDR(%ecx),%edx
+ movl TD_PCB(%ecx),%edx
#if defined(SWTCH_OPTIM_STATS)
incl swtch_optim_stats
#endif
+
+/*##########################################################################*/
+/*##########################################################################*/
+/*##########################################################################*/
/* switch address space */
movl %cr3,%ebx
cmpl PCB_CR3(%edx),%ebx
@@ -181,9 +190,8 @@ sw1b:
incl tlb_flush_count
#endif
movl PCB_CR3(%edx),%ebx
- movl %ebx,%cr3
+ movl %ebx,%cr3 /* LOAD NEW PAGE TABLES */
4:
-
movl PCPU(CPUID), %esi
cmpl $0, PCB_EXT(%edx) /* has pcb extension? */
je 1f
@@ -191,12 +199,9 @@ sw1b:
movl PCB_EXT(%edx), %edi /* new tss descriptor */
jmp 2f
1:
-
/* update common_tss.tss_esp0 pointer */
- movl %edx, %ebx /* pcb */
- addl $(UPAGES * PAGE_SIZE - 16), %ebx
- movl %ebx, PCPU(COMMON_TSS) + TSS_ESP0
-
+ /* esp points to base of usable stack */
+ movl %edx, PCPU(COMMON_TSS) + TSS_ESP0 /* stack is below pcb */
btrl %esi, private_tss
jae 3f
PCPU_ADDR(COMMON_TSSD, %edi)
@@ -210,7 +215,9 @@ sw1b:
movl $GPROC0_SEL*8, %esi /* GSEL(entry, SEL_KPL) */
ltr %si
3:
- movl P_VMSPACE(%ecx), %ebx
+ /* note in a vmspace that this cpu is using it */
+ movl TD_PROC(%ecx),%eax /* get proc from thread XXXKSE */
+ movl P_VMSPACE(%eax), %ebx /* get vmspace of proc */
movl PCPU(CPUID), %eax
btsl %eax, VM_PMAP+PM_ACTIVE(%ebx)
@@ -233,22 +240,23 @@ sw1b:
#endif /** GRAB_LOPRIO */
#endif /* SMP */
movl %edx, PCPU(CURPCB)
- movl %ecx, PCPU(CURPROC) /* into next process */
+ movl %ecx, PCPU(CURTHREAD) /* into next process */
#ifdef SMP
/* XXX FIXME: we should be restoring the local APIC TPR */
#endif /* SMP */
- cmpl $0, PCB_USERLDT(%edx)
- jnz 1f
- movl _default_ldt,%eax
- cmpl PCPU(CURRENTLDT),%eax
- je 2f
- lldt _default_ldt
- movl %eax,PCPU(CURRENTLDT)
+ cmpl $0, PCB_USERLDT(%edx) /* if there is one */
+ jnz 1f /* then use it */
+ movl _default_ldt,%eax /* We will use the default */
+ cmpl PCPU(CURRENTLDT),%eax /* check to see if already loaded */
+ je 2f /* if so skip reload */
+ lldt _default_ldt /* load the default... we trust it. */
+ movl %eax,PCPU(CURRENTLDT) /* store what we have */
jmp 2f
-1: pushl %edx
- call set_user_ldt
+
+1: pushl %edx /* call a non-trusting routine */
+ call set_user_ldt /* to check and load the ldt */
popl %edx
2:
@@ -275,7 +283,7 @@ cpu_switch_load_gs:
andl $0x0000fc00,%eax /* reserved bits */
pushl %ebx
movl PCB_DR7(%edx),%ebx
- andl $~0x0000fc00,%ebx
+ andl $~0x0000fc00,%ebx /* re-enable the restored watchpoints */
orl %ebx,%eax
popl %ebx
movl %eax,%dr7
@@ -322,25 +330,25 @@ ENTRY(savectx)
#ifdef DEV_NPX
/*
- * If npxproc == NULL, then the npx h/w state is irrelevant and the
+ * If npxthread == NULL, then the npx h/w state is irrelevant and the
* state had better already be in the pcb. This is true for forks
* but not for dumps (the old book-keeping with FP flags in the pcb
* always lost for dumps because the dump pcb has 0 flags).
*
- * If npxproc != NULL, then we have to save the npx h/w state to
- * npxproc's pcb and copy it to the requested pcb, or save to the
+ * If npxthread != NULL, then we have to save the npx h/w state to
+ * npxthread's pcb and copy it to the requested pcb, or save to the
* requested pcb and reload. Copying is easier because we would
* have to handle h/w bugs for reloading. We used to lose the
* parent's npx state for forks by forgetting to reload.
*/
pushfl
cli
- movl PCPU(NPXPROC),%eax
+ movl PCPU(NPXTHREAD),%eax
testl %eax,%eax
je 1f
pushl %ecx
- movl P_ADDR(%eax),%eax
+ movl TD_PCB(%eax),%eax
leal PCB_SAVEFPU(%eax),%eax
pushl %eax
pushl %eax
diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c
index 23c1cdd..acca4e7 100644
--- a/sys/i386/i386/sys_machdep.c
+++ b/sys/i386/i386/sys_machdep.c
@@ -35,7 +35,7 @@
*
*/
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -65,10 +65,10 @@
-static int i386_get_ldt __P((struct proc *, char *));
-static int i386_set_ldt __P((struct proc *, char *));
-static int i386_get_ioperm __P((struct proc *, char *));
-static int i386_set_ioperm __P((struct proc *, char *));
+static int i386_get_ldt __P((struct thread *, char *));
+static int i386_set_ldt __P((struct thread *, char *));
+static int i386_get_ioperm __P((struct thread *, char *));
+static int i386_set_ioperm __P((struct thread *, char *));
#ifdef SMP
static void set_user_ldt_rv __P((struct pcb *));
#endif
@@ -81,28 +81,28 @@ struct sysarch_args {
#endif
int
-sysarch(p, uap)
- struct proc *p;
+sysarch(td, uap)
+ struct thread *td;
register struct sysarch_args *uap;
{
int error = 0;
switch(uap->op) {
case I386_GET_LDT:
- error = i386_get_ldt(p, uap->parms);
+ error = i386_get_ldt(td, uap->parms);
break;
case I386_SET_LDT:
- error = i386_set_ldt(p, uap->parms);
+ error = i386_set_ldt(td, uap->parms);
break;
case I386_GET_IOPERM:
- error = i386_get_ioperm(p, uap->parms);
+ error = i386_get_ioperm(td, uap->parms);
break;
case I386_SET_IOPERM:
- error = i386_set_ioperm(p, uap->parms);
+ error = i386_set_ioperm(td, uap->parms);
break;
case I386_VM86:
- error = vm86_sysarch(p, uap->parms);
+ error = vm86_sysarch(td, uap->parms);
break;
default:
error = EOPNOTSUPP;
@@ -112,7 +112,7 @@ sysarch(p, uap)
}
int
-i386_extend_pcb(struct proc *p)
+i386_extend_pcb(struct thread *td)
{
int i, offset;
u_long *addr;
@@ -127,12 +127,18 @@ i386_extend_pcb(struct proc *p)
0, /* default 32 size */
0 /* granularity */
};
+ struct proc *p = td->td_proc;
+ if (td->td_proc->p_flag & P_KSES)
+ return (EINVAL); /* XXXKSE */
+/* XXXKSE All the code below only works in 1:1 needs changing */
ext = (struct pcb_ext *)kmem_alloc(kernel_map, ctob(IOPAGES+1));
if (ext == 0)
return (ENOMEM);
bzero(ext, sizeof(struct pcb_ext));
- ext->ext_tss.tss_esp0 = (unsigned)p->p_addr + ctob(UPAGES) - 16;
+ /* -16 is so we can convert a trapframe into vm86trapframe inplace */
+ ext->ext_tss.tss_esp0 = td->td_kstack + ctob(KSTACK_PAGES) -
+ sizeof(struct pcb) - 16;
ext->ext_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL);
/*
* The last byte of the i/o map must be followed by an 0xff byte.
@@ -153,21 +159,21 @@ i386_extend_pcb(struct proc *p)
ssd.ssd_limit -= ((unsigned)&ext->ext_tss - (unsigned)ext);
ssdtosd(&ssd, &ext->ext_tssd);
- KASSERT(p == curproc, ("giving a TSS to non-curproc"));
- KASSERT(p->p_addr->u_pcb.pcb_ext == 0, ("already have a TSS!"));
+ KASSERT(p == curthread->td_proc, ("giving a TSS to non-curproc"));
+ KASSERT(td->td_pcb->pcb_ext == 0, ("already have a TSS!"));
mtx_lock_spin(&sched_lock);
- p->p_addr->u_pcb.pcb_ext = ext;
+ td->td_pcb->pcb_ext = ext;
/* switch to the new TSS after syscall completes */
- p->p_sflag |= PS_NEEDRESCHED;
+ td->td_kse->ke_flags |= KEF_NEEDRESCHED;
mtx_unlock_spin(&sched_lock);
return 0;
}
static int
-i386_set_ioperm(p, args)
- struct proc *p;
+i386_set_ioperm(td, args)
+ struct thread *td;
char *args;
{
int i, error;
@@ -177,7 +183,7 @@ i386_set_ioperm(p, args)
if ((error = copyin(args, &ua, sizeof(struct i386_ioperm_args))) != 0)
return (error);
- if ((error = suser(p)) != 0)
+ if ((error = suser_td(td)) != 0)
return (error);
if (securelevel > 0)
return (EPERM);
@@ -188,10 +194,10 @@ i386_set_ioperm(p, args)
* cause confusion. This probably requires a global 'usage registry'.
*/
- if (p->p_addr->u_pcb.pcb_ext == 0)
- if ((error = i386_extend_pcb(p)) != 0)
+ if (td->td_pcb->pcb_ext == 0)
+ if ((error = i386_extend_pcb(td)) != 0)
return (error);
- iomap = (char *)p->p_addr->u_pcb.pcb_ext->ext_iomap;
+ iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;
if (ua.start + ua.length > IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);
@@ -206,8 +212,8 @@ i386_set_ioperm(p, args)
}
static int
-i386_get_ioperm(p, args)
- struct proc *p;
+i386_get_ioperm(td, args)
+ struct thread *td;
char *args;
{
int i, state, error;
@@ -219,12 +225,12 @@ i386_get_ioperm(p, args)
if (ua.start >= IOPAGES * PAGE_SIZE * NBBY)
return (EINVAL);
- if (p->p_addr->u_pcb.pcb_ext == 0) {
+ if (td->td_pcb->pcb_ext == 0) {
ua.length = 0;
goto done;
}
- iomap = (char *)p->p_addr->u_pcb.pcb_ext->ext_iomap;
+ iomap = (char *)td->td_pcb->pcb_ext->ext_iomap;
i = ua.start;
state = (iomap[i >> 3] >> (i & 7)) & 1;
@@ -351,12 +357,12 @@ user_ldt_free(struct pcb *pcb)
}
static int
-i386_get_ldt(p, args)
- struct proc *p;
+i386_get_ldt(td, args)
+ struct thread *td;
char *args;
{
int error = 0;
- struct pcb *pcb = &p->p_addr->u_pcb;
+ struct pcb *pcb = td->td_pcb;
struct pcb_ldt *pcb_ldt = pcb->pcb_ldt;
int nldt, num;
union descriptor *lp;
@@ -388,19 +394,19 @@ i386_get_ldt(p, args)
error = copyout(lp, uap->descs, num * sizeof(union descriptor));
if (!error)
- p->p_retval[0] = num;
+ td->td_retval[0] = num;
return(error);
}
static int
-i386_set_ldt(p, args)
- struct proc *p;
+i386_set_ldt(td, args)
+ struct thread *td;
char *args;
{
int error = 0, i, n;
int largest_ld;
- struct pcb *pcb = &p->p_addr->u_pcb;
+ struct pcb *pcb = td->td_pcb;
struct pcb_ldt *pcb_ldt = pcb->pcb_ldt;
struct i386_ldt_args ua, *uap = &ua;
caddr_t old_ldt_base;
@@ -530,7 +536,7 @@ i386_set_ldt(p, args)
&((union descriptor *)(pcb_ldt->ldt_base))[uap->start],
uap->num * sizeof(union descriptor));
if (!error)
- p->p_retval[0] = uap->start;
+ td->td_retval[0] = uap->start;
critical_exit(savecrit);
return(error);
diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c
index 4e72f9b..ee036c2 100644
--- a/sys/i386/i386/trap.c
+++ b/sys/i386/i386/trap.c
@@ -173,7 +173,8 @@ void
trap(frame)
struct trapframe frame;
{
- struct proc *p = curproc;
+ struct thread *td = curthread;
+ struct proc *p = td->td_proc;
u_int sticks = 0;
int i = 0, ucode = 0, type, code;
vm_offset_t eva;
@@ -225,8 +226,8 @@ restart:
((frame.tf_eflags & PSL_VM) && !in_vm86call)) {
/* user trap */
- sticks = p->p_sticks;
- p->p_frame = &frame;
+ sticks = td->td_kse->ke_sticks;
+ td->td_frame = &frame;
switch (type) {
case T_PRIVINFLT: /* privileged instruction fault */
@@ -444,7 +445,7 @@ restart:
if (in_vm86call)
break;
- if (p->p_intr_nesting_level != 0)
+ if (td->td_intr_nesting_level != 0)
break;
/*
@@ -620,7 +621,7 @@ restart:
#endif
user:
- userret(p, &frame, sticks);
+ userret(td, &frame, sticks);
if (mtx_owned(&Giant)) /* XXX why would Giant be owned here? */
mtx_unlock(&Giant);
out:
@@ -660,7 +661,7 @@ trap_pfault(frame, usermode, eva)
if (p == NULL ||
(!usermode && va < VM_MAXUSER_ADDRESS &&
- (p->p_intr_nesting_level != 0 ||
+ (td->td_intr_nesting_level != 0 ||
PCPU_GET(curpcb) == NULL ||
PCPU_GET(curpcb)->pcb_onfault == NULL))) {
trap_fatal(frame, eva);
@@ -696,7 +697,7 @@ trap_pfault(frame, usermode, eva)
* a growable stack region, or if the stack
* growth succeeded.
*/
- if (!grow_stack (p, va))
+ if (!grow_stack (td, va))
rv = KERN_FAILURE;
else
/* Fault in the user page: */
@@ -728,7 +729,7 @@ trap_pfault(frame, usermode, eva)
return (0);
nogo:
if (!usermode) {
- if (p->p_intr_nesting_level == 0 &&
+ if (td->td_intr_nesting_level == 0 &&
PCPU_GET(curpcb) != NULL &&
PCPU_GET(curpcb)->pcb_onfault != NULL) {
frame->tf_eip = (int)PCPU_GET(curpcb)->pcb_onfault;
@@ -756,7 +757,8 @@ trap_pfault(frame, usermode, eva)
vm_map_t map = 0;
int rv = 0;
vm_prot_t ftype;
- struct proc *p = curproc;
+ struct thread *td = curthread;
+ struct proc *p = td->td_proc;
va = trunc_page(eva);
if (va >= KERNBASE) {
@@ -839,7 +841,7 @@ trap_pfault(frame, usermode, eva)
return (0);
nogo:
if (!usermode) {
- if (p->p_intr_nesting_level == 0 &&
+ if (td->td_intr_nesting_level == 0 &&
PCPU_GET(curpcb) != NULL &&
PCPU_GET(curpcb)->pcb_onfault != NULL) {
frame->tf_eip = (int)PCPU_GET(curpcb)->pcb_onfault;
@@ -972,6 +974,7 @@ dblfault_handler()
int trapwrite(addr)
unsigned addr;
{
+ struct thread *td;
struct proc *p;
vm_offset_t va;
struct vmspace *vm;
@@ -984,7 +987,8 @@ int trapwrite(addr)
if (va >= VM_MAXUSER_ADDRESS)
return (1);
- p = curproc;
+ td = curthread;
+ p = td->td_proc;
vm = p->p_vmspace;
PROC_LOCK(p);
@@ -1021,7 +1025,8 @@ syscall(frame)
caddr_t params;
int i;
struct sysent *callp;
- struct proc *p = curproc;
+ struct thread *td = curthread;
+ struct proc *p = td->td_proc;
u_int sticks;
int error;
int narg;
@@ -1039,8 +1044,8 @@ syscall(frame)
}
#endif
- sticks = p->p_sticks;
- p->p_frame = &frame;
+ sticks = td->td_kse->ke_sticks;
+ td->td_frame = &frame;
params = (caddr_t)frame.tf_esp + sizeof(int);
code = frame.tf_eax;
@@ -1109,17 +1114,17 @@ syscall(frame)
ktrsyscall(p->p_tracep, code, narg, args);
}
#endif
- p->p_retval[0] = 0;
- p->p_retval[1] = frame.tf_edx;
+ td->td_retval[0] = 0;
+ td->td_retval[1] = frame.tf_edx;
STOPEVENT(p, S_SCE, narg);
- error = (*callp->sy_call)(p, args);
+ error = (*callp->sy_call)(td, args);
switch (error) {
case 0:
- frame.tf_eax = p->p_retval[0];
- frame.tf_edx = p->p_retval[1];
+ frame.tf_eax = td->td_retval[0];
+ frame.tf_edx = td->td_retval[1];
frame.tf_eflags &= ~PSL_C;
break;
@@ -1158,11 +1163,11 @@ bad:
/*
* Handle reschedule and other end-of-syscall issues
*/
- userret(p, &frame, sticks);
+ userret(td, &frame, sticks);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET)) {
- ktrsysret(p->p_tracep, code, error, p->p_retval[0]);
+ ktrsysret(p->p_tracep, code, error, td->td_retval[0]);
}
#endif
@@ -1183,7 +1188,7 @@ bad:
STOPEVENT(p, S_SCX, code);
#ifdef WITNESS
- if (witness_list(p)) {
+ if (witness_list(td)) {
panic("system call %s returning with mutex(s) held\n",
syscallnames[code]);
}
diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c
index bf4a29a..bd7a0ca 100644
--- a/sys/i386/i386/vm86.c
+++ b/sys/i386/i386/vm86.c
@@ -655,10 +655,11 @@ vm86_getptr(vmc, kva, sel, off)
}
int
-vm86_sysarch(p, args)
- struct proc *p;
+vm86_sysarch(td, args)
+ struct thread *td;
char *args;
{
+ struct proc *p = td->td_proc;
int error = 0;
struct i386_vm86_args ua;
struct vm86_kernel *vm86;
@@ -666,10 +667,10 @@ vm86_sysarch(p, args)
if ((error = copyin(args, &ua, sizeof(struct i386_vm86_args))) != 0)
return (error);
- if (p->p_addr->u_pcb.pcb_ext == 0)
- if ((error = i386_extend_pcb(p)) != 0)
+ if (td->td_pcb->pcb_ext == 0)
+ if ((error = i386_extend_pcb(td)) != 0)
return (error);
- vm86 = &p->p_addr->u_pcb.pcb_ext->ext_vm86;
+ vm86 = &td->td_pcb->pcb_ext->ext_vm86;
switch (ua.sub_op) {
case VM86_INIT: {
diff --git a/sys/i386/i386/vm86bios.s b/sys/i386/i386/vm86bios.s
index e12ac41..4cc0645 100644
--- a/sys/i386/i386/vm86bios.s
+++ b/sys/i386/i386/vm86bios.s
@@ -67,13 +67,13 @@ ENTRY(vm86_bioscall)
#ifdef DEV_NPX
pushfl
cli
- movl PCPU(CURPROC),%ecx
- cmpl %ecx,PCPU(NPXPROC) /* do we need to save fp? */
+ movl PCPU(CURTHREAD),%ecx
+ cmpl %ecx,PCPU(NPXTHREAD) /* do we need to save fp? */
jne 1f
testl %ecx,%ecx
je 1f /* no curproc/npxproc */
pushl %edx
- movl P_ADDR(%ecx),%ecx
+ movl TD_PCB(%ecx),%ecx
addl $PCB_SAVEFPU,%ecx
pushl %ecx
call npxsave
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 53cedff..83ddc21 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -47,7 +47,7 @@
#endif
#include "opt_reset.h"
#include "opt_isa.h"
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -117,19 +117,24 @@ vm_fault_quick(v, prot)
* ready to run and return to user mode.
*/
void
-cpu_fork(p1, p2, flags)
- register struct proc *p1, *p2;
+cpu_fork(td1, p2, flags)
+ register struct thread *td1;
+ register struct proc *p2;
int flags;
{
+ register struct proc *p1;
+ struct thread *td2;
struct pcb *pcb2;
#ifdef DEV_NPX
int savecrit;
#endif
+ p1 = td1->td_proc;
+ td2 = &p2->p_thread;
if ((flags & RFPROC) == 0) {
if ((flags & RFMEM) == 0) {
/* unshare user LDT */
- struct pcb *pcb1 = &p1->p_addr->u_pcb;
+ struct pcb *pcb1 = td1->td_pcb;
struct pcb_ldt *pcb_ldt = pcb1->pcb_ldt;
if (pcb_ldt && pcb_ldt->ldt_refcnt > 1) {
pcb_ldt = user_ldt_alloc(pcb1,pcb_ldt->ldt_len);
@@ -145,30 +150,32 @@ cpu_fork(p1, p2, flags)
/* Ensure that p1's pcb is up to date. */
#ifdef DEV_NPX
- if (p1 == curproc)
- p1->p_addr->u_pcb.pcb_gs = rgs();
+ if (td1 == curthread)
+ td1->td_pcb->pcb_gs = rgs();
savecrit = critical_enter();
- if (PCPU_GET(npxproc) == p1)
- npxsave(&p1->p_addr->u_pcb.pcb_save);
+ if (PCPU_GET(npxthread) == td1)
+ npxsave(&td1->td_pcb->pcb_save);
critical_exit(savecrit);
#endif
+ /* Point the pcb to the top of the stack */
+ pcb2 = (struct pcb *)(td2->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
+ td2->td_pcb = pcb2;
+
/* Copy p1's pcb. */
- p2->p_addr->u_pcb = p1->p_addr->u_pcb;
- pcb2 = &p2->p_addr->u_pcb;
+ bcopy(td1->td_pcb, pcb2, sizeof(*pcb2));
/*
* Create a new fresh stack for the new process.
* Copy the trap frame for the return to user mode as if from a
* syscall. This copies most of the user mode register values.
*/
- p2->p_frame = (struct trapframe *)
- ((int)p2->p_addr + UPAGES * PAGE_SIZE - 16) - 1;
- bcopy(p1->p_frame, p2->p_frame, sizeof(struct trapframe));
+ td2->td_frame = (struct trapframe *)td2->td_pcb - 1;
+ bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe));
- p2->p_frame->tf_eax = 0; /* Child returns zero */
- p2->p_frame->tf_eflags &= ~PSL_C; /* success */
- p2->p_frame->tf_edx = 1;
+ td2->td_frame->tf_eax = 0; /* Child returns zero */
+ td2->td_frame->tf_eflags &= ~PSL_C; /* success */
+ td2->td_frame->tf_edx = 1;
/*
* Set registers for trampoline to user mode. Leave space for the
@@ -178,8 +185,8 @@ cpu_fork(p1, p2, flags)
pcb2->pcb_edi = 0;
pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */
pcb2->pcb_ebp = 0;
- pcb2->pcb_esp = (int)p2->p_frame - sizeof(void *);
- pcb2->pcb_ebx = (int)p2; /* fork_trampoline argument */
+ pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *);
+ pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */
pcb2->pcb_eip = (int)fork_trampoline;
/*-
* pcb2->pcb_dr*: cloned above.
@@ -228,8 +235,8 @@ cpu_fork(p1, p2, flags)
* This is needed to make kernel threads stay in kernel mode.
*/
void
-cpu_set_fork_handler(p, func, arg)
- struct proc *p;
+cpu_set_fork_handler(td, func, arg)
+ struct thread *td;
void (*func) __P((void *));
void *arg;
{
@@ -237,18 +244,18 @@ cpu_set_fork_handler(p, func, arg)
* Note that the trap frame follows the args, so the function
* is really called like this: func(arg, frame);
*/
- p->p_addr->u_pcb.pcb_esi = (int) func; /* function */
- p->p_addr->u_pcb.pcb_ebx = (int) arg; /* first arg */
+ td->td_pcb->pcb_esi = (int) func; /* function */
+ td->td_pcb->pcb_ebx = (int) arg; /* first arg */
}
void
-cpu_exit(p)
- register struct proc *p;
+cpu_exit(td)
+ register struct thread *td;
{
- struct pcb *pcb = &p->p_addr->u_pcb;
+ struct pcb *pcb = td->td_pcb;
#ifdef DEV_NPX
- npxexit(p);
+ npxexit(td);
#endif
if (pcb->pcb_ext != 0) {
/*
@@ -280,25 +287,29 @@ cpu_wait(p)
* Dump the machine specific header information at the start of a core dump.
*/
int
-cpu_coredump(p, vp, cred)
- struct proc *p;
+cpu_coredump(td, vp, cred)
+ struct thread *td;
struct vnode *vp;
struct ucred *cred;
{
+ struct proc *p = td->td_proc;
int error;
caddr_t tempuser;
- tempuser = malloc(ctob(UPAGES), M_TEMP, M_WAITOK | M_ZERO);
+ tempuser = malloc(ctob(UAREA_PAGES + KSTACK_PAGES), M_TEMP, M_WAITOK | M_ZERO);
if (!tempuser)
return EINVAL;
- bcopy(p->p_addr, tempuser, sizeof(struct user));
- bcopy(p->p_frame,
- tempuser + ((caddr_t) p->p_frame - (caddr_t) p->p_addr),
+ bcopy(p->p_uarea, tempuser, sizeof(struct user));
+#if 0 /* XXXKSE - broken, fixme!!!!! td_frame is in kstack! */
+ bcopy(td->td_frame,
+ tempuser + ((caddr_t) td->td_frame - (caddr_t) p->p_uarea),
sizeof(struct trapframe));
+#endif
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser, ctob(UPAGES),
- (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, p);
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t) tempuser,
+ ctob(UAREA_PAGES + KSTACK_PAGES),
+ (off_t)0, UIO_SYSSPACE, IO_UNIT, cred, (int *)NULL, td);
free(tempuser, M_TEMP);
diff --git a/sys/i386/ibcs2/ibcs2_fcntl.c b/sys/i386/ibcs2/ibcs2_fcntl.c
index 971adce..6151c5d 100644
--- a/sys/i386/ibcs2/ibcs2_fcntl.c
+++ b/sys/i386/ibcs2/ibcs2_fcntl.c
@@ -169,73 +169,74 @@ oflags2ioflags(flags)
}
int
-ibcs2_open(p, uap)
- struct proc *p;
+ibcs2_open(td, uap)
+ struct thread *td;
struct ibcs2_open_args *uap;
{
+ struct proc *p = td->td_proc;
int noctty = SCARG(uap, flags) & IBCS2_O_NOCTTY;
int ret;
caddr_t sg = stackgap_init();
SCARG(uap, flags) = cvt_o_flags(SCARG(uap, flags));
if (SCARG(uap, flags) & O_CREAT)
- CHECKALTCREAT(p, &sg, SCARG(uap, path));
+ CHECKALTCREAT(td, &sg, SCARG(uap, path));
else
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- ret = open(p, (struct open_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ ret = open(td, (struct open_args *)uap);
#ifdef SPX_HACK
if (ret == ENXIO) {
if (!strcmp(SCARG(uap, path), "/compat/ibcs2/dev/spx"))
- ret = spx_open(p, uap);
+ ret = spx_open(td, uap);
} else
#endif /* SPX_HACK */
PROC_LOCK(p);
if (!ret && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
struct filedesc *fdp = p->p_fd;
- struct file *fp = fdp->fd_ofiles[p->p_retval[0]];
+ struct file *fp = fdp->fd_ofiles[td->td_retval[0]];
PROC_UNLOCK(p);
/* ignore any error, just give it a try */
if (fp->f_type == DTYPE_VNODE)
- fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, p);
+ fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td);
} else
PROC_UNLOCK(p);
return ret;
}
int
-ibcs2_creat(p, uap)
- struct proc *p;
+ibcs2_creat(td, uap)
+ struct thread *td;
struct ibcs2_creat_args *uap;
{
struct open_args cup;
caddr_t sg = stackgap_init();
- CHECKALTCREAT(p, &sg, SCARG(uap, path));
+ CHECKALTCREAT(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, mode) = SCARG(uap, mode);
SCARG(&cup, flags) = O_WRONLY | O_CREAT | O_TRUNC;
- return open(p, &cup);
+ return open(td, &cup);
}
int
-ibcs2_access(p, uap)
- struct proc *p;
+ibcs2_access(td, uap)
+ struct thread *td;
struct ibcs2_access_args *uap;
{
struct access_args cup;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, flags) = SCARG(uap, flags);
- return access(p, &cup);
+ return access(td, &cup);
}
int
-ibcs2_fcntl(p, uap)
- struct proc *p;
+ibcs2_fcntl(td, uap)
+ struct thread *td;
struct ibcs2_fcntl_args *uap;
{
int error;
@@ -248,32 +249,32 @@ ibcs2_fcntl(p, uap)
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = F_DUPFD;
SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg);
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
case IBCS2_F_GETFD:
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = F_GETFD;
SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg);
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
case IBCS2_F_SETFD:
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = F_SETFD;
SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg);
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
case IBCS2_F_GETFL:
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = F_GETFL;
SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg);
- error = fcntl(p, &fa);
+ error = fcntl(td, &fa);
if (error)
return error;
- p->p_retval[0] = oflags2ioflags(p->p_retval[0]);
+ td->td_retval[0] = oflags2ioflags(td->td_retval[0]);
return error;
case IBCS2_F_SETFL:
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = F_SETFL;
SCARG(&fa, arg) = (/* XXX */ int)
ioflags2oflags((int)SCARG(uap, arg));
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
case IBCS2_F_GETLK:
{
@@ -287,7 +288,7 @@ ibcs2_fcntl(p, uap)
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = F_GETLK;
SCARG(&fa, arg) = (/* XXX */ int)flp;
- error = fcntl(p, &fa);
+ error = fcntl(td, &fa);
if (error)
return error;
cvt_flock2iflock(flp, &ifl);
@@ -308,7 +309,7 @@ ibcs2_fcntl(p, uap)
SCARG(&fa, cmd) = F_SETLK;
SCARG(&fa, arg) = (/* XXX */ int)flp;
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
}
case IBCS2_F_SETLKW:
@@ -323,7 +324,7 @@ ibcs2_fcntl(p, uap)
SCARG(&fa, fd) = SCARG(uap, fd);
SCARG(&fa, cmd) = F_SETLKW;
SCARG(&fa, arg) = (/* XXX */ int)flp;
- return fcntl(p, &fa);
+ return fcntl(td, &fa);
}
}
return ENOSYS;
diff --git a/sys/i386/ibcs2/ibcs2_ioctl.c b/sys/i386/ibcs2/ibcs2_ioctl.c
index 4dfa80b..39fdc99 100644
--- a/sys/i386/ibcs2/ibcs2_ioctl.c
+++ b/sys/i386/ibcs2/ibcs2_ioctl.c
@@ -57,7 +57,7 @@ static void stio2stios __P((struct ibcs2_termio *, struct ibcs2_termios *));
int
-ibcs2_gtty(struct proc *p, struct ibcs2_gtty_args *args)
+ibcs2_gtty(struct thread *td, struct ibcs2_gtty_args *args)
{
struct ioctl_args ioctl_arg;
@@ -65,11 +65,11 @@ ibcs2_gtty(struct proc *p, struct ibcs2_gtty_args *args)
ioctl_arg.com = TIOCGETC;
ioctl_arg.data = (caddr_t)args->buf;
- return ioctl(p, &ioctl_arg);
+ return ioctl(td, &ioctl_arg);
}
int
-ibcs2_stty(struct proc *p, struct ibcs2_stty_args *args)
+ibcs2_stty(struct thread *td, struct ibcs2_stty_args *args)
{
struct ioctl_args ioctl_arg;
@@ -77,7 +77,7 @@ ibcs2_stty(struct proc *p, struct ibcs2_stty_args *args)
ioctl_arg.com = TIOCSETC;
ioctl_arg.data = (caddr_t)args->buf;
- return ioctl(p, &ioctl_arg);
+ return ioctl(td, &ioctl_arg);
}
@@ -336,10 +336,11 @@ stio2stios(t, ts)
}
int
-ibcs2_ioctl(p, uap)
- struct proc *p;
+ibcs2_ioctl(td, uap)
+ struct thread *td;
struct ibcs2_ioctl_args *uap;
{
+ struct proc *p = td->td_proc;
struct filedesc *fdp = p->p_fd;
struct file *fp;
int error;
@@ -365,7 +366,7 @@ ibcs2_ioctl(p, uap)
struct ibcs2_termios sts;
struct ibcs2_termio st;
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, p)) != 0)
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, td)) != 0)
return error;
btios2stios (&bts, &sts);
@@ -401,7 +402,7 @@ ibcs2_ioctl(p, uap)
}
/* get full BSD termios so we don't lose information */
- if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, p)) != 0) {
+ if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, td)) != 0) {
DPRINTF(("ibcs2_ioctl(%d): TCSET ctl failed fd %d ",
p->p_pid, SCARG(uap, fd)));
return error;
@@ -416,7 +417,7 @@ ibcs2_ioctl(p, uap)
stios2btios(&sts, &bts);
return fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_TCSETA + TIOCSETA,
- (caddr_t)&bts, p);
+ (caddr_t)&bts, td);
}
case IBCS2_XCSETA:
@@ -432,7 +433,7 @@ ibcs2_ioctl(p, uap)
}
stios2btios (&sts, &bts);
return fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_XCSETA + TIOCSETA,
- (caddr_t)&bts, p);
+ (caddr_t)&bts, td);
}
case IBCS2_OXCSETA:
@@ -448,7 +449,7 @@ ibcs2_ioctl(p, uap)
}
stios2btios (&sts, &bts);
return fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_OXCSETA + TIOCSETA,
- (caddr_t)&bts, p);
+ (caddr_t)&bts, td);
}
case IBCS2_TCSBRK:
@@ -463,9 +464,9 @@ ibcs2_ioctl(p, uap)
DPRINTF(("ibcs2_ioctl(%d): TCXONC ", p->p_pid));
return ENOSYS;
case 2:
- return fo_ioctl(fp, TIOCSTOP, (caddr_t)0, p);
+ return fo_ioctl(fp, TIOCSTOP, (caddr_t)0, td);
case 3:
- return fo_ioctl(fp, TIOCSTART, (caddr_t)1, p);
+ return fo_ioctl(fp, TIOCSTART, (caddr_t)1, td);
default:
return EINVAL;
}
@@ -488,16 +489,16 @@ ibcs2_ioctl(p, uap)
default:
return EINVAL;
}
- return fo_ioctl(fp, TIOCFLUSH, (caddr_t)&arg, p);
+ return fo_ioctl(fp, TIOCFLUSH, (caddr_t)&arg, td);
}
case IBCS2_TIOCGWINSZ:
SCARG(uap, cmd) = TIOCGWINSZ;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_TIOCSWINSZ:
SCARG(uap, cmd) = TIOCSWINSZ;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_TIOCGPGRP:
PROC_LOCK(p);
@@ -512,7 +513,7 @@ ibcs2_ioctl(p, uap)
SCARG(&sa, pid) = 0;
SCARG(&sa, pgid) = (int)SCARG(uap, data);
- if ((error = setpgid(p, &sa)) != 0)
+ if ((error = setpgid(td, &sa)) != 0)
return error;
return 0;
}
@@ -548,96 +549,96 @@ ibcs2_ioctl(p, uap)
case IBCS2_KDGKBMODE: /* get keyboard translation mode */
SCARG(uap, cmd) = KDGKBMODE;
/* printf("ioctl KDGKBMODE = %x\n", SCARG(uap, cmd));*/
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDSKBMODE: /* set keyboard translation mode */
SCARG(uap, cmd) = KDSKBMODE;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDMKTONE: /* sound tone */
SCARG(uap, cmd) = KDMKTONE;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDGETMODE: /* get text/graphics mode */
SCARG(uap, cmd) = KDGETMODE;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDSETMODE: /* set text/graphics mode */
SCARG(uap, cmd) = KDSETMODE;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDSBORDER: /* set ega color border */
SCARG(uap, cmd) = KDSBORDER;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDGKBSTATE:
SCARG(uap, cmd) = KDGKBSTATE;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDSETRAD:
SCARG(uap, cmd) = KDSETRAD;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDENABIO: /* enable direct I/O to ports */
SCARG(uap, cmd) = KDENABIO;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDDISABIO: /* disable direct I/O to ports */
SCARG(uap, cmd) = KDDISABIO;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KIOCSOUND: /* start sound generation */
SCARG(uap, cmd) = KIOCSOUND;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDGKBTYPE: /* get keyboard type */
SCARG(uap, cmd) = KDGKBTYPE;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDGETLED: /* get keyboard LED status */
SCARG(uap, cmd) = KDGETLED;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_KDSETLED: /* set keyboard LED status */
SCARG(uap, cmd) = KDSETLED;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
/* Xenix keyboard and display ioctl's from sys/kd.h -- type 'k' */
case IBCS2_GETFKEY: /* Get function key */
SCARG(uap, cmd) = GETFKEY;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_SETFKEY: /* Set function key */
SCARG(uap, cmd) = SETFKEY;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_GIO_SCRNMAP: /* Get screen output map table */
SCARG(uap, cmd) = GIO_SCRNMAP;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_PIO_SCRNMAP: /* Set screen output map table */
SCARG(uap, cmd) = PIO_SCRNMAP;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_GIO_KEYMAP: /* Get keyboard map table */
SCARG(uap, cmd) = GIO_KEYMAP;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
case IBCS2_PIO_KEYMAP: /* Set keyboard map table */
SCARG(uap, cmd) = PIO_KEYMAP;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
/* socksys */
case IBCS2_SIOCSOCKSYS:
- return ibcs2_socksys(p, (struct ibcs2_socksys_args *)uap);
+ return ibcs2_socksys(td, (struct ibcs2_socksys_args *)uap);
case IBCS2_I_NREAD: /* STREAMS */
SCARG(uap, cmd) = FIONREAD;
- return ioctl(p, (struct ioctl_args *)uap);
+ return ioctl(td, (struct ioctl_args *)uap);
default:
DPRINTF(("ibcs2_ioctl(%d): unknown cmd 0x%lx ",
- p->p_pid, SCARG(uap, cmd)));
+ td->proc->p_pid, SCARG(uap, cmd)));
return ENOSYS;
}
return ENOSYS;
diff --git a/sys/i386/ibcs2/ibcs2_ipc.c b/sys/i386/ibcs2/ibcs2_ipc.c
index 2acf3d2..804f82d 100644
--- a/sys/i386/ibcs2/ibcs2_ipc.c
+++ b/sys/i386/ibcs2/ibcs2_ipc.c
@@ -102,14 +102,14 @@ struct msqid_ds *bp;
}
int
-ibcs2_msgsys(p, uap)
- struct proc *p;
+ibcs2_msgsys(td, uap)
+ struct thread *td;
struct ibcs2_msgsys_args *uap;
{
switch (SCARG(uap, which)) {
case 0: /* msgget */
SCARG(uap, which) = 1;
- return msgsys(p, (struct msgsys_args *)uap);
+ return msgsys(td, (struct msgsys_args *)uap);
case 1: { /* msgctl */
int error;
struct msgsys_args margs;
@@ -122,7 +122,7 @@ ibcs2_msgsys(p, uap)
SCARG(&margs, a3) = SCARG(uap, a3);
switch (SCARG(&margs, a3)) {
case IBCS2_IPC_STAT:
- error = msgsys(p, &margs);
+ error = msgsys(td, &margs);
if (!error)
cvt_msqid2imsqid(
(struct msqid_ds *)SCARG(&margs, a4),
@@ -132,18 +132,18 @@ ibcs2_msgsys(p, uap)
cvt_imsqid2msqid((struct ibcs2_msqid_ds *)SCARG(uap,
a4),
(struct msqid_ds *)SCARG(&margs, a4));
- return msgsys(p, &margs);
+ return msgsys(td, &margs);
case IBCS2_IPC_RMID:
- return msgsys(p, &margs);
+ return msgsys(td, &margs);
}
return EINVAL;
}
case 2: /* msgrcv */
SCARG(uap, which) = 3;
- return msgsys(p, (struct msgsys_args *)uap);
+ return msgsys(td, (struct msgsys_args *)uap);
case 3: /* msgsnd */
SCARG(uap, which) = 2;
- return msgsys(p, (struct msgsys_args *)uap);
+ return msgsys(td, (struct msgsys_args *)uap);
default:
return EINVAL;
}
@@ -233,8 +233,8 @@ struct semid_ds *bp;
}
int
-ibcs2_semsys(p, uap)
- struct proc *p;
+ibcs2_semsys(td, uap)
+ struct thread *td;
struct ibcs2_semsys_args *uap;
{
int error;
@@ -255,7 +255,7 @@ ibcs2_semsys(p, uap)
sup = stackgap_alloc(&sg, sizeof(union semun));
sup->buf = sp;
SCARG(uap, a5) = (int)sup;
- error = semsys(p, (struct semsys_args *)uap);
+ error = semsys(td, (struct semsys_args *)uap);
if (!error) {
SCARG(uap, a5) = (int)ssu.buf;
isp = stackgap_alloc(&sg, sizeof(*isp));
@@ -280,7 +280,7 @@ ibcs2_semsys(p, uap)
return error;
cvt_isemid2semid(isp, sp);
SCARG(uap, a5) = (int)sp;
- return semsys(p, (struct semsys_args *)uap);
+ return semsys(td, (struct semsys_args *)uap);
}
case IBCS2_SETVAL:
{
@@ -290,17 +290,17 @@ ibcs2_semsys(p, uap)
sp = stackgap_alloc(&sg, sizeof(*sp));
sp->val = (int) SCARG(uap, a5);
SCARG(uap, a5) = (int)sp;
- return semsys(p, (struct semsys_args *)uap);
+ return semsys(td, (struct semsys_args *)uap);
}
}
- return semsys(p, (struct semsys_args *)uap);
+ return semsys(td, (struct semsys_args *)uap);
case 1: /* semget */
- return semsys(p, (struct semsys_args *)uap);
+ return semsys(td, (struct semsys_args *)uap);
case 2: /* semop */
- return semsys(p, (struct semsys_args *)uap);
+ return semsys(td, (struct semsys_args *)uap);
}
return EINVAL;
}
@@ -345,15 +345,15 @@ struct shmid_ds *bp;
}
int
-ibcs2_shmsys(p, uap)
- struct proc *p;
+ibcs2_shmsys(td, uap)
+ struct thread *td;
struct ibcs2_shmsys_args *uap;
{
int error;
switch (SCARG(uap, which)) {
case 0: /* shmat */
- return shmsys(p, (struct shmsys_args *)uap);
+ return shmsys(td, (struct shmsys_args *)uap);
case 1: /* shmctl */
switch(SCARG(uap, a3)) {
@@ -366,7 +366,7 @@ ibcs2_shmsys(p, uap)
isp = (struct ibcs2_shmid_ds *)SCARG(uap, a4);
sp = stackgap_alloc(&sg, sizeof(*sp));
SCARG(uap, a4) = (int)sp;
- error = shmsys(p, (struct shmsys_args *)uap);
+ error = shmsys(td, (struct shmsys_args *)uap);
if (!error) {
SCARG(uap, a4) = (int)isp;
isp = stackgap_alloc(&sg, sizeof(*isp));
@@ -391,17 +391,17 @@ ibcs2_shmsys(p, uap)
return error;
cvt_ishmid2shmid(isp, sp);
SCARG(uap, a4) = (int)sp;
- return shmsys(p, (struct shmsys_args *)uap);
+ return shmsys(td, (struct shmsys_args *)uap);
}
}
- return shmsys(p, (struct shmsys_args *)uap);
+ return shmsys(td, (struct shmsys_args *)uap);
case 2: /* shmdt */
- return shmsys(p, (struct shmsys_args *)uap);
+ return shmsys(td, (struct shmsys_args *)uap);
case 3: /* shmget */
- return shmsys(p, (struct shmsys_args *)uap);
+ return shmsys(td, (struct shmsys_args *)uap);
}
return EINVAL;
}
diff --git a/sys/i386/ibcs2/ibcs2_isc.c b/sys/i386/ibcs2/ibcs2_isc.c
index 9c690c9..31ebd0a 100644
--- a/sys/i386/ibcs2/ibcs2_isc.c
+++ b/sys/i386/ibcs2/ibcs2_isc.c
@@ -45,9 +45,9 @@
extern struct sysent isc_sysent[];
int
-ibcs2_isc(struct proc *p, struct ibcs2_isc_args *uap)
+ibcs2_isc(struct thread *td, struct ibcs2_isc_args *uap)
{
- struct trapframe *tf = p->p_frame;
+ struct trapframe *tf = td->td_frame;
struct sysent *callp;
u_int code;
@@ -55,7 +55,7 @@ ibcs2_isc(struct proc *p, struct ibcs2_isc_args *uap)
callp = &isc_sysent[code];
if(code < IBCS2_ISC_MAXSYSCALL)
- return((*callp->sy_call)(p, (void *)uap));
+ return((*callp->sy_call)(td, (void *)uap));
else
return ENOSYS;
}
diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c
index c2e28b9..bbe32eb 100644
--- a/sys/i386/ibcs2/ibcs2_misc.c
+++ b/sys/i386/ibcs2/ibcs2_misc.c
@@ -85,8 +85,8 @@
#include <i386/ibcs2/ibcs2_xenix.h>
int
-ibcs2_ulimit(p, uap)
- struct proc *p;
+ibcs2_ulimit(td, uap)
+ struct thread *td;
struct ibcs2_ulimit_args *uap;
{
#ifdef notyet
@@ -104,31 +104,31 @@ ibcs2_ulimit(p, uap)
switch (SCARG(uap, cmd)) {
case IBCS2_GETFSIZE:
- p->p_retval[0] = p->p_rlimit[RLIMIT_FSIZE].rlim_cur;
- if (p->p_retval[0] == -1) p->p_retval[0] = 0x7fffffff;
+ td->td_retval[0] = td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur;
+ if (td->td_retval[0] == -1) td->td_retval[0] = 0x7fffffff;
return 0;
case IBCS2_SETFSIZE: /* XXX - fix this */
#ifdef notyet
rl.rlim_cur = SCARG(uap, newlimit);
sra.resource = RLIMIT_FSIZE;
sra.rlp = &rl;
- error = setrlimit(p, &sra);
+ error = setrlimit(td, &sra);
if (!error)
- p->p_retval[0] = p->p_rlimit[RLIMIT_FSIZE].rlim_cur;
+ td->td_retval[0] = td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur;
else
DPRINTF(("failed "));
return error;
#else
- p->p_retval[0] = SCARG(uap, newlimit);
+ td->td_retval[0] = SCARG(uap, newlimit);
return 0;
#endif
case IBCS2_GETPSIZE:
mtx_assert(&Giant, MA_OWNED);
- p->p_retval[0] = p->p_rlimit[RLIMIT_RSS].rlim_cur; /* XXX */
+ td->td_retval[0] = td->td_proc->p_rlimit[RLIMIT_RSS].rlim_cur; /* XXX */
return 0;
case IBCS2_GETDTABLESIZE:
uap->cmd = IBCS2_SC_OPEN_MAX;
- return ibcs2_sysconf(p, (struct ibcs2_sysconf_args *)uap);
+ return ibcs2_sysconf(td, (struct ibcs2_sysconf_args *)uap);
default:
return ENOSYS;
}
@@ -137,13 +137,13 @@ ibcs2_ulimit(p, uap)
#define IBCS2_WSTOPPED 0177
#define IBCS2_STOPCODE(sig) ((sig) << 8 | IBCS2_WSTOPPED)
int
-ibcs2_wait(p, uap)
- struct proc *p;
+ibcs2_wait(td, uap)
+ struct thread *td;
struct ibcs2_wait_args *uap;
{
int error, status;
struct wait_args w4;
- struct trapframe *tf = p->p_frame;
+ struct trapframe *tf = td->td_frame;
SCARG(&w4, rusage) = NULL;
if ((tf->tf_eflags & (PSL_Z|PSL_PF|PSL_N|PSL_V))
@@ -158,7 +158,7 @@ ibcs2_wait(p, uap)
SCARG(&w4, status) = (int *)SCARG(uap, a1);
SCARG(&w4, options) = 0;
}
- if ((error = wait4(p, &w4)) != 0)
+ if ((error = wait4(td, &w4)) != 0)
return error;
if (SCARG(&w4, status)) { /* this is real iBCS brain-damage */
error = copyin((caddr_t)SCARG(&w4, status), (caddr_t)&status,
@@ -175,7 +175,7 @@ ibcs2_wait(p, uap)
/* else exit status -- identical */
/* record result/status */
- p->p_retval[1] = status;
+ td->td_retval[1] = status;
return copyout((caddr_t)&status, (caddr_t)SCARG(&w4, status),
sizeof(SCARG(&w4, status)));
}
@@ -184,45 +184,45 @@ ibcs2_wait(p, uap)
}
int
-ibcs2_execv(p, uap)
- struct proc *p;
+ibcs2_execv(td, uap)
+ struct thread *td;
struct ibcs2_execv_args *uap;
{
struct execve_args ea;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&ea, fname) = SCARG(uap, path);
SCARG(&ea, argv) = SCARG(uap, argp);
SCARG(&ea, envv) = NULL;
- return execve(p, &ea);
+ return execve(td, &ea);
}
int
-ibcs2_execve(p, uap)
- struct proc *p;
+ibcs2_execve(td, uap)
+ struct thread *td;
struct ibcs2_execve_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return execve(p, (struct execve_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return execve(td, (struct execve_args *)uap);
}
int
-ibcs2_umount(p, uap)
- struct proc *p;
+ibcs2_umount(td, uap)
+ struct thread *td;
struct ibcs2_umount_args *uap;
{
struct unmount_args um;
SCARG(&um, path) = SCARG(uap, name);
SCARG(&um, flags) = 0;
- return unmount(p, &um);
+ return unmount(td, &um);
}
int
-ibcs2_mount(p, uap)
- struct proc *p;
+ibcs2_mount(td, uap)
+ struct thread *td;
struct ibcs2_mount_args *uap;
{
#ifdef notyet
@@ -279,7 +279,7 @@ ibcs2_mount(p, uap)
if (error = copyout(&na, SCARG(uap, data), sizeof na))
return (error);
}
- return (mount(p, uap));
+ return (mount(td, uap));
#else
return EINVAL;
#endif
@@ -294,8 +294,8 @@ ibcs2_mount(p, uap)
*/
int
-ibcs2_getdents(p, uap)
- struct proc *p;
+ibcs2_getdents(td, uap)
+ struct thread *td;
register struct ibcs2_getdents_args *uap;
{
register struct vnode *vp;
@@ -314,7 +314,7 @@ ibcs2_getdents(p, uap)
#define BSD_DIRENT(cp) ((struct dirent *)(cp))
#define IBCS2_RECLEN(reclen) (reclen + sizeof(u_short))
- if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
+ if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0)
return (error);
if ((fp->f_flag & FREAD) == 0)
return (EBADF);
@@ -327,7 +327,7 @@ ibcs2_getdents(p, uap)
buflen = max(DIRBLKSIZ, SCARG(uap, nbytes));
buflen = min(buflen, MAXBSIZE);
buf = malloc(buflen, M_TEMP, M_WAITOK);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
again:
aiov.iov_base = buf;
aiov.iov_len = buflen;
@@ -335,7 +335,7 @@ again:
auio.uio_iovcnt = 1;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = p;
+ auio.uio_td = td;
auio.uio_resid = buflen;
auio.uio_offset = off;
@@ -425,18 +425,18 @@ again:
goto again;
fp->f_offset = off; /* update the vnode offset */
eof:
- p->p_retval[0] = SCARG(uap, nbytes) - resid;
+ td->td_retval[0] = SCARG(uap, nbytes) - resid;
out:
if (cookies)
free(cookies, M_TEMP);
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
free(buf, M_TEMP);
return (error);
}
int
-ibcs2_read(p, uap)
- struct proc *p;
+ibcs2_read(td, uap)
+ struct thread *td;
struct ibcs2_read_args *uap;
{
register struct vnode *vp;
@@ -456,9 +456,9 @@ ibcs2_read(p, uap)
u_long *cookies = NULL, *cookiep;
int ncookies;
- if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) {
+ if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) {
if (error == EINVAL)
- return read(p, (struct read_args *)uap);
+ return read(td, (struct read_args *)uap);
else
return error;
}
@@ -466,7 +466,7 @@ ibcs2_read(p, uap)
return (EBADF);
vp = (struct vnode *)fp->f_data;
if (vp->v_type != VDIR)
- return read(p, (struct read_args *)uap);
+ return read(td, (struct read_args *)uap);
DPRINTF(("ibcs2_read: read directory\n"));
@@ -474,7 +474,7 @@ ibcs2_read(p, uap)
buflen = max(DIRBLKSIZ, SCARG(uap, nbytes));
buflen = min(buflen, MAXBSIZE);
buf = malloc(buflen, M_TEMP, M_WAITOK);
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
again:
aiov.iov_base = buf;
aiov.iov_len = buflen;
@@ -482,7 +482,7 @@ again:
auio.uio_iovcnt = 1;
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_procp = p;
+ auio.uio_td = td;
auio.uio_resid = buflen;
auio.uio_offset = off;
@@ -576,40 +576,40 @@ again:
goto again;
fp->f_offset = off; /* update the vnode offset */
eof:
- p->p_retval[0] = SCARG(uap, nbytes) - resid;
+ td->td_retval[0] = SCARG(uap, nbytes) - resid;
out:
if (cookies)
free(cookies, M_TEMP);
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
free(buf, M_TEMP);
return (error);
}
int
-ibcs2_mknod(p, uap)
- struct proc *p;
+ibcs2_mknod(td, uap)
+ struct thread *td;
struct ibcs2_mknod_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTCREAT(p, &sg, SCARG(uap, path));
+ CHECKALTCREAT(td, &sg, SCARG(uap, path));
if (S_ISFIFO(SCARG(uap, mode))) {
struct mkfifo_args ap;
SCARG(&ap, path) = SCARG(uap, path);
SCARG(&ap, mode) = SCARG(uap, mode);
- return mkfifo(p, &ap);
+ return mkfifo(td, &ap);
} else {
struct mknod_args ap;
SCARG(&ap, path) = SCARG(uap, path);
SCARG(&ap, mode) = SCARG(uap, mode);
SCARG(&ap, dev) = SCARG(uap, dev);
- return mknod(p, &ap);
+ return mknod(td, &ap);
}
}
int
-ibcs2_getgroups(p, uap)
- struct proc *p;
+ibcs2_getgroups(td, uap)
+ struct thread *td;
struct ibcs2_getgroups_args *uap;
{
int error, i;
@@ -625,23 +625,23 @@ ibcs2_getgroups(p, uap)
iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize) *
sizeof(ibcs2_gid_t));
}
- if ((error = getgroups(p, &sa)) != 0)
+ if ((error = getgroups(td, &sa)) != 0)
return error;
if (SCARG(uap, gidsetsize) == 0)
return 0;
- for (i = 0, gp = SCARG(&sa, gidset); i < p->p_retval[0]; i++)
+ for (i = 0, gp = SCARG(&sa, gidset); i < td->td_retval[0]; i++)
iset[i] = (ibcs2_gid_t)*gp++;
- if (p->p_retval[0] && (error = copyout((caddr_t)iset,
+ if (td->td_retval[0] && (error = copyout((caddr_t)iset,
(caddr_t)SCARG(uap, gidset),
- sizeof(ibcs2_gid_t) * p->p_retval[0])))
+ sizeof(ibcs2_gid_t) * td->td_retval[0])))
return error;
return 0;
}
int
-ibcs2_setgroups(p, uap)
- struct proc *p;
+ibcs2_setgroups(td, uap)
+ struct thread *td;
struct ibcs2_setgroups_args *uap;
{
int error, i;
@@ -663,40 +663,40 @@ ibcs2_setgroups(p, uap)
}
for (i = 0, gp = SCARG(&sa, gidset); i < SCARG(&sa, gidsetsize); i++)
*gp++ = (gid_t)iset[i];
- return setgroups(p, &sa);
+ return setgroups(td, &sa);
}
int
-ibcs2_setuid(p, uap)
- struct proc *p;
+ibcs2_setuid(td, uap)
+ struct thread *td;
struct ibcs2_setuid_args *uap;
{
struct setuid_args sa;
SCARG(&sa, uid) = (uid_t)SCARG(uap, uid);
- return setuid(p, &sa);
+ return setuid(td, &sa);
}
int
-ibcs2_setgid(p, uap)
- struct proc *p;
+ibcs2_setgid(td, uap)
+ struct thread *td;
struct ibcs2_setgid_args *uap;
{
struct setgid_args sa;
SCARG(&sa, gid) = (gid_t)SCARG(uap, gid);
- return setgid(p, &sa);
+ return setgid(td, &sa);
}
int
-ibcs2_time(p, uap)
- struct proc *p;
+ibcs2_time(td, uap)
+ struct thread *td;
struct ibcs2_time_args *uap;
{
struct timeval tv;
microtime(&tv);
- p->p_retval[0] = tv.tv_sec;
+ td->td_retval[0] = tv.tv_sec;
if (SCARG(uap, tp))
return copyout((caddr_t)&tv.tv_sec, (caddr_t)SCARG(uap, tp),
sizeof(ibcs2_time_t));
@@ -705,26 +705,26 @@ ibcs2_time(p, uap)
}
int
-ibcs2_pathconf(p, uap)
- struct proc *p;
+ibcs2_pathconf(td, uap)
+ struct thread *td;
struct ibcs2_pathconf_args *uap;
{
SCARG(uap, name)++; /* iBCS2 _PC_* defines are offset by one */
- return pathconf(p, (struct pathconf_args *)uap);
+ return pathconf(td, (struct pathconf_args *)uap);
}
int
-ibcs2_fpathconf(p, uap)
- struct proc *p;
+ibcs2_fpathconf(td, uap)
+ struct thread *td;
struct ibcs2_fpathconf_args *uap;
{
SCARG(uap, name)++; /* iBCS2 _PC_* defines are offset by one */
- return fpathconf(p, (struct fpathconf_args *)uap);
+ return fpathconf(td, (struct fpathconf_args *)uap);
}
int
-ibcs2_sysconf(p, uap)
- struct proc *p;
+ibcs2_sysconf(td, uap)
+ struct thread *td;
struct ibcs2_sysconf_args *uap;
{
int mib[2], value, len, error;
@@ -742,14 +742,14 @@ ibcs2_sysconf(p, uap)
SCARG(&ga, which) = RLIMIT_NPROC;
SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *));
- if ((error = getrlimit(p, &ga)) != 0)
+ if ((error = getrlimit(td, &ga)) != 0)
return error;
- p->p_retval[0] = SCARG(&ga, rlp)->rlim_cur;
+ td->td_retval[0] = SCARG(&ga, rlp)->rlim_cur;
return 0;
}
case IBCS2_SC_CLK_TCK:
- p->p_retval[0] = hz;
+ td->td_retval[0] = hz;
return 0;
case IBCS2_SC_NGROUPS_MAX:
@@ -762,9 +762,9 @@ ibcs2_sysconf(p, uap)
SCARG(&ga, which) = RLIMIT_NOFILE;
SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *));
- if ((error = getrlimit(p, &ga)) != 0)
+ if ((error = getrlimit(td, &ga)) != 0)
return error;
- p->p_retval[0] = SCARG(&ga, rlp)->rlim_cur;
+ td->td_retval[0] = SCARG(&ga, rlp)->rlim_cur;
return 0;
}
@@ -781,11 +781,11 @@ ibcs2_sysconf(p, uap)
break;
case IBCS2_SC_PASS_MAX:
- p->p_retval[0] = 128; /* XXX - should we create PASS_MAX ? */
+ td->td_retval[0] = 128; /* XXX - should we create PASS_MAX ? */
return 0;
case IBCS2_SC_XOPEN_VERSION:
- p->p_retval[0] = 2; /* XXX: What should that be? */
+ td->td_retval[0] = 2; /* XXX: What should that be? */
return 0;
default:
@@ -800,15 +800,15 @@ ibcs2_sysconf(p, uap)
SCARG(&sa, oldlenp) = &len;
SCARG(&sa, new) = NULL;
SCARG(&sa, newlen) = 0;
- if ((error = __sysctl(p, &sa)) != 0)
+ if ((error = __sysctl(td, &sa)) != 0)
return error;
- p->p_retval[0] = value;
+ td->td_retval[0] = value;
return 0;
}
int
-ibcs2_alarm(p, uap)
- struct proc *p;
+ibcs2_alarm(td, uap)
+ struct thread *td;
struct ibcs2_alarm_args *uap;
{
int error;
@@ -825,18 +825,18 @@ ibcs2_alarm(p, uap)
SCARG(&sa, which) = ITIMER_REAL;
SCARG(&sa, itv) = itp;
SCARG(&sa, oitv) = oitp;
- error = setitimer(p, &sa);
+ error = setitimer(td, &sa);
if (error)
return error;
if (oitp->it_value.tv_usec)
oitp->it_value.tv_sec++;
- p->p_retval[0] = oitp->it_value.tv_sec;
+ td->td_retval[0] = oitp->it_value.tv_sec;
return 0;
}
int
-ibcs2_times(p, uap)
- struct proc *p;
+ibcs2_times(td, uap)
+ struct thread *td;
struct ibcs2_times_args *uap;
{
int error;
@@ -849,29 +849,29 @@ ibcs2_times(p, uap)
SCARG(&ga, who) = RUSAGE_SELF;
SCARG(&ga, rusage) = ru;
- error = getrusage(p, &ga);
+ error = getrusage(td, &ga);
if (error)
return error;
tms.tms_utime = CONVTCK(ru->ru_utime);
tms.tms_stime = CONVTCK(ru->ru_stime);
SCARG(&ga, who) = RUSAGE_CHILDREN;
- error = getrusage(p, &ga);
+ error = getrusage(td, &ga);
if (error)
return error;
tms.tms_cutime = CONVTCK(ru->ru_utime);
tms.tms_cstime = CONVTCK(ru->ru_stime);
microtime(&t);
- p->p_retval[0] = CONVTCK(t);
+ td->td_retval[0] = CONVTCK(t);
return copyout((caddr_t)&tms, (caddr_t)SCARG(uap, tp),
sizeof(struct tms));
}
int
-ibcs2_stime(p, uap)
- struct proc *p;
+ibcs2_stime(td, uap)
+ struct thread *td;
struct ibcs2_stime_args *uap;
{
int error;
@@ -884,14 +884,14 @@ ibcs2_stime(p, uap)
&(SCARG(&sa, tv)->tv_sec), sizeof(long))) != 0)
return error;
SCARG(&sa, tv)->tv_usec = 0;
- if ((error = settimeofday(p, &sa)) != 0)
+ if ((error = settimeofday(td, &sa)) != 0)
return EPERM;
return 0;
}
int
-ibcs2_utime(p, uap)
- struct proc *p;
+ibcs2_utime(td, uap)
+ struct thread *td;
struct ibcs2_utime_args *uap;
{
int error;
@@ -899,7 +899,7 @@ ibcs2_utime(p, uap)
struct timeval *tp;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&sa, path) = SCARG(uap, path);
if (SCARG(uap, buf)) {
struct ibcs2_utimbuf ubuf;
@@ -917,12 +917,12 @@ ibcs2_utime(p, uap)
tp->tv_usec = 0;
} else
SCARG(&sa, tptr) = NULL;
- return utimes(p, &sa);
+ return utimes(td, &sa);
}
int
-ibcs2_nice(p, uap)
- struct proc *p;
+ibcs2_nice(td, uap)
+ struct thread *td;
struct ibcs2_nice_args *uap;
{
int error;
@@ -930,10 +930,10 @@ ibcs2_nice(p, uap)
SCARG(&sa, which) = PRIO_PROCESS;
SCARG(&sa, who) = 0;
- SCARG(&sa, prio) = p->p_nice + SCARG(uap, incr);
- if ((error = setpriority(p, &sa)) != 0)
+ SCARG(&sa, prio) = td->td_ksegrp->kg_nice + SCARG(uap, incr);
+ if ((error = setpriority(td, &sa)) != 0)
return EPERM;
- p->p_retval[0] = p->p_nice;
+ td->td_retval[0] = td->td_ksegrp->kg_nice;
return 0;
}
@@ -942,14 +942,15 @@ ibcs2_nice(p, uap)
*/
int
-ibcs2_pgrpsys(p, uap)
- struct proc *p;
+ibcs2_pgrpsys(td, uap)
+ struct thread *td;
struct ibcs2_pgrpsys_args *uap;
{
+ struct proc *p = td->td_proc;
switch (SCARG(uap, type)) {
case 0: /* getpgrp */
PROC_LOCK(p);
- p->p_retval[0] = p->p_pgrp->pg_id;
+ td->td_retval[0] = p->p_pgrp->pg_id;
PROC_UNLOCK(p);
return 0;
@@ -959,9 +960,9 @@ ibcs2_pgrpsys(p, uap)
SCARG(&sa, pid) = 0;
SCARG(&sa, pgid) = 0;
- setpgid(p, &sa);
+ setpgid(td, &sa);
PROC_LOCK(p);
- p->p_retval[0] = p->p_pgrp->pg_id;
+ td->td_retval[0] = p->p_pgrp->pg_id;
PROC_UNLOCK(p);
return 0;
}
@@ -972,11 +973,11 @@ ibcs2_pgrpsys(p, uap)
SCARG(&sa, pid) = SCARG(uap, pid);
SCARG(&sa, pgid) = SCARG(uap, pgid);
- return setpgid(p, &sa);
+ return setpgid(td, &sa);
}
case 3: /* setsid */
- return setsid(p, NULL);
+ return setsid(td, NULL);
default:
return EINVAL;
@@ -988,8 +989,8 @@ ibcs2_pgrpsys(p, uap)
*/
int
-ibcs2_plock(p, uap)
- struct proc *p;
+ibcs2_plock(td, uap)
+ struct thread *td;
struct ibcs2_plock_args *uap;
{
int error;
@@ -999,7 +1000,7 @@ ibcs2_plock(p, uap)
#define IBCS2_DATALOCK 4
- if ((error = suser(p)) != 0)
+ if ((error = suser_td(td)) != 0)
return EPERM;
switch(SCARG(uap, cmd)) {
case IBCS2_UNLOCK:
@@ -1012,8 +1013,8 @@ ibcs2_plock(p, uap)
}
int
-ibcs2_uadmin(p, uap)
- struct proc *p;
+ibcs2_uadmin(td, uap)
+ struct thread *td;
struct ibcs2_uadmin_args *uap;
{
#define SCO_A_REBOOT 1
@@ -1034,7 +1035,7 @@ ibcs2_uadmin(p, uap)
#define SCO_AD_GETBMAJ 0
#define SCO_AD_GETCMAJ 1
- if (suser(p))
+ if (suser_td(td))
return EPERM;
switch(SCARG(uap, cmd)) {
@@ -1046,11 +1047,11 @@ ibcs2_uadmin(p, uap)
case SCO_AD_PWRDOWN:
case SCO_AD_PWRNAP:
r.opt = RB_HALT;
- reboot(p, &r);
+ reboot(td, &r);
case SCO_AD_BOOT:
case SCO_AD_IBOOT:
r.opt = RB_AUTOBOOT;
- reboot(p, &r);
+ reboot(td, &r);
}
return EINVAL;
case SCO_A_REMOUNT:
@@ -1064,8 +1065,8 @@ ibcs2_uadmin(p, uap)
}
int
-ibcs2_sysfs(p, uap)
- struct proc *p;
+ibcs2_sysfs(td, uap)
+ struct thread *td;
struct ibcs2_sysfs_args *uap;
{
#define IBCS2_GETFSIND 1
@@ -1082,102 +1083,102 @@ ibcs2_sysfs(p, uap)
}
int
-ibcs2_unlink(p, uap)
- struct proc *p;
+ibcs2_unlink(td, uap)
+ struct thread *td;
struct ibcs2_unlink_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return unlink(p, (struct unlink_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return unlink(td, (struct unlink_args *)uap);
}
int
-ibcs2_chdir(p, uap)
- struct proc *p;
+ibcs2_chdir(td, uap)
+ struct thread *td;
struct ibcs2_chdir_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return chdir(p, (struct chdir_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return chdir(td, (struct chdir_args *)uap);
}
int
-ibcs2_chmod(p, uap)
- struct proc *p;
+ibcs2_chmod(td, uap)
+ struct thread *td;
struct ibcs2_chmod_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return chmod(p, (struct chmod_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return chmod(td, (struct chmod_args *)uap);
}
int
-ibcs2_chown(p, uap)
- struct proc *p;
+ibcs2_chown(td, uap)
+ struct thread *td;
struct ibcs2_chown_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return chown(p, (struct chown_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return chown(td, (struct chown_args *)uap);
}
int
-ibcs2_rmdir(p, uap)
- struct proc *p;
+ibcs2_rmdir(td, uap)
+ struct thread *td;
struct ibcs2_rmdir_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return rmdir(p, (struct rmdir_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return rmdir(td, (struct rmdir_args *)uap);
}
int
-ibcs2_mkdir(p, uap)
- struct proc *p;
+ibcs2_mkdir(td, uap)
+ struct thread *td;
struct ibcs2_mkdir_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTCREAT(p, &sg, SCARG(uap, path));
- return mkdir(p, (struct mkdir_args *)uap);
+ CHECKALTCREAT(td, &sg, SCARG(uap, path));
+ return mkdir(td, (struct mkdir_args *)uap);
}
int
-ibcs2_symlink(p, uap)
- struct proc *p;
+ibcs2_symlink(td, uap)
+ struct thread *td;
struct ibcs2_symlink_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- CHECKALTCREAT(p, &sg, SCARG(uap, link));
- return symlink(p, (struct symlink_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ CHECKALTCREAT(td, &sg, SCARG(uap, link));
+ return symlink(td, (struct symlink_args *)uap);
}
int
-ibcs2_rename(p, uap)
- struct proc *p;
+ibcs2_rename(td, uap)
+ struct thread *td;
struct ibcs2_rename_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, from));
- CHECKALTCREAT(p, &sg, SCARG(uap, to));
- return rename(p, (struct rename_args *)uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, from));
+ CHECKALTCREAT(td, &sg, SCARG(uap, to));
+ return rename(td, (struct rename_args *)uap);
}
int
-ibcs2_readlink(p, uap)
- struct proc *p;
+ibcs2_readlink(td, uap)
+ struct thread *td;
struct ibcs2_readlink_args *uap;
{
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- return readlink(p, (struct readlink_args *) uap);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ return readlink(td, (struct readlink_args *) uap);
}
diff --git a/sys/i386/ibcs2/ibcs2_msg.c b/sys/i386/ibcs2/ibcs2_msg.c
index 6c36cf8..413859a 100644
--- a/sys/i386/ibcs2/ibcs2_msg.c
+++ b/sys/i386/ibcs2/ibcs2_msg.c
@@ -41,16 +41,16 @@
int
-ibcs2_getmsg(p, uap)
- struct proc *p;
+ibcs2_getmsg(td, uap)
+ struct thread *td;
struct ibcs2_getmsg_args *uap;
{
return 0; /* fake */
}
int
-ibcs2_putmsg(p, uap)
- struct proc *p;
+ibcs2_putmsg(td, uap)
+ struct thread *td;
struct ibcs2_putmsg_args *uap;
{
return 0; /* fake */
@@ -58,8 +58,8 @@ ibcs2_putmsg(p, uap)
int
-ibcs2_poll(p, uap)
- struct proc *p;
+ibcs2_poll(td, uap)
+ struct thread *td;
struct ibcs2_poll_args *uap;
{
int error, i;
@@ -107,12 +107,12 @@ ibcs2_poll(p, uap)
FD_SET(conv.fd, writefds);
FD_SET(conv.fd, exceptfds);
}
- if ((error = select(p, &tmp_select)) != 0)
+ if ((error = select(td, &tmp_select)) != 0)
return error;
- if (p->p_retval[0] == 0)
+ if (td->td_retval[0] == 0)
return 0;
- p->p_retval[0] = 0;
- for (p->p_retval[0] = 0, i = 0; i < uap->nfds; i++) {
+ td->td_retval[0] = 0;
+ for (td->td_retval[0] = 0, i = 0; i < uap->nfds; i++) {
copyin(uap->fds + i*sizeof(struct ibcs2_poll),
&conv, sizeof(conv));
conv.revents = 0;
@@ -127,7 +127,7 @@ ibcs2_poll(p, uap)
if (FD_ISSET(conv.fd, exceptfds))
conv.revents |= IBCS2_POLLERR;
if (conv.revents)
- ++p->p_retval[0];
+ ++td->td_retval[0];
}
if ((error = copyout(&conv,
uap->fds + i*sizeof(struct ibcs2_poll),
diff --git a/sys/i386/ibcs2/ibcs2_other.c b/sys/i386/ibcs2/ibcs2_other.c
index 4f90159..2881f42 100644
--- a/sys/i386/ibcs2/ibcs2_other.c
+++ b/sys/i386/ibcs2/ibcs2_other.c
@@ -45,14 +45,14 @@
#define IBCS2_SECURE_SETLUID 2
int
-ibcs2_secure(struct proc *p, struct ibcs2_secure_args *uap)
+ibcs2_secure(struct thread *td, struct ibcs2_secure_args *uap)
{
switch (uap->cmd) {
case IBCS2_SECURE_GETLUID: /* get login uid */
- PROC_LOCK(p);
- p->p_retval[0] = p->p_ucred->cr_uid;
- PROC_UNLOCK(p);
+ PROC_LOCK(td->td_proc);
+ td->td_retval[0] = td->td_proc->p_ucred->cr_uid;
+ PROC_UNLOCK(td->td_proc);
return 0;
case IBCS2_SECURE_SETLUID: /* set login uid */
@@ -66,7 +66,7 @@ ibcs2_secure(struct proc *p, struct ibcs2_secure_args *uap)
}
int
-ibcs2_lseek(struct proc *p, register struct ibcs2_lseek_args *uap)
+ibcs2_lseek(struct thread *td, register struct ibcs2_lseek_args *uap)
{
struct lseek_args largs;
int error;
@@ -74,7 +74,7 @@ ibcs2_lseek(struct proc *p, register struct ibcs2_lseek_args *uap)
largs.fd = uap->fd;
largs.offset = uap->offset;
largs.whence = uap->whence;
- error = lseek(p, &largs);
+ error = lseek(td, &largs);
return (error);
}
@@ -83,7 +83,7 @@ ibcs2_lseek(struct proc *p, register struct ibcs2_lseek_args *uap)
#include <sys/un.h>
int
-spx_open(struct proc *p, void *uap)
+spx_open(struct thread *td, void *uap)
{
struct socket_args sock;
struct connect_args conn;
@@ -96,7 +96,7 @@ spx_open(struct proc *p, void *uap)
sock.domain = AF_UNIX;
sock.type = SOCK_STREAM;
sock.protocol = 0;
- error = socket(p, &sock);
+ error = socket(td, &sock);
if (error)
return error;
@@ -108,17 +108,17 @@ spx_open(struct proc *p, void *uap)
strlen(Xaddr->sun_path) + 1;
copyout("/tmp/.X11-unix/X0", Xaddr->sun_path, 18);
- conn.s = fd = p->p_retval[0];
+ conn.s = fd = td->td_retval[0];
conn.name = (caddr_t)Xaddr;
conn.namelen = sizeof(struct sockaddr_un);
- error = connect(p, &conn);
+ error = connect(td, &conn);
if (error) {
struct close_args cl;
cl.fd = fd;
- close(p, &cl);
+ close(td, &cl);
return error;
}
- p->p_retval[0] = fd;
+ td->td_retval[0] = fd;
return 0;
}
#endif /* SPX_HACK */
diff --git a/sys/i386/ibcs2/ibcs2_proto.h b/sys/i386/ibcs2/ibcs2_proto.h
index a91c96d..c7ac3df 100644
--- a/sys/i386/ibcs2/ibcs2_proto.h
+++ b/sys/i386/ibcs2/ibcs2_proto.h
@@ -15,6 +15,8 @@
struct proc;
+struct thread;
+
#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
0 : sizeof(register_t) - sizeof(t))
@@ -273,62 +275,62 @@ struct ibcs2_readlink_args {
struct ibcs2_isc_args {
register_t dummy;
};
-int ibcs2_read __P((struct proc *, struct ibcs2_read_args *));
-int ibcs2_open __P((struct proc *, struct ibcs2_open_args *));
-int ibcs2_wait __P((struct proc *, struct ibcs2_wait_args *));
-int ibcs2_creat __P((struct proc *, struct ibcs2_creat_args *));
-int ibcs2_unlink __P((struct proc *, struct ibcs2_unlink_args *));
-int ibcs2_execv __P((struct proc *, struct ibcs2_execv_args *));
-int ibcs2_chdir __P((struct proc *, struct ibcs2_chdir_args *));
-int ibcs2_time __P((struct proc *, struct ibcs2_time_args *));
-int ibcs2_mknod __P((struct proc *, struct ibcs2_mknod_args *));
-int ibcs2_chmod __P((struct proc *, struct ibcs2_chmod_args *));
-int ibcs2_chown __P((struct proc *, struct ibcs2_chown_args *));
-int ibcs2_stat __P((struct proc *, struct ibcs2_stat_args *));
-int ibcs2_lseek __P((struct proc *, struct ibcs2_lseek_args *));
-int ibcs2_mount __P((struct proc *, struct ibcs2_mount_args *));
-int ibcs2_umount __P((struct proc *, struct ibcs2_umount_args *));
-int ibcs2_setuid __P((struct proc *, struct ibcs2_setuid_args *));
-int ibcs2_stime __P((struct proc *, struct ibcs2_stime_args *));
-int ibcs2_alarm __P((struct proc *, struct ibcs2_alarm_args *));
-int ibcs2_fstat __P((struct proc *, struct ibcs2_fstat_args *));
-int ibcs2_pause __P((struct proc *, struct ibcs2_pause_args *));
-int ibcs2_utime __P((struct proc *, struct ibcs2_utime_args *));
-int ibcs2_stty __P((struct proc *, struct ibcs2_stty_args *));
-int ibcs2_gtty __P((struct proc *, struct ibcs2_gtty_args *));
-int ibcs2_access __P((struct proc *, struct ibcs2_access_args *));
-int ibcs2_nice __P((struct proc *, struct ibcs2_nice_args *));
-int ibcs2_statfs __P((struct proc *, struct ibcs2_statfs_args *));
-int ibcs2_kill __P((struct proc *, struct ibcs2_kill_args *));
-int ibcs2_fstatfs __P((struct proc *, struct ibcs2_fstatfs_args *));
-int ibcs2_pgrpsys __P((struct proc *, struct ibcs2_pgrpsys_args *));
-int ibcs2_xenix __P((struct proc *, struct ibcs2_xenix_args *));
-int ibcs2_times __P((struct proc *, struct ibcs2_times_args *));
-int ibcs2_plock __P((struct proc *, struct ibcs2_plock_args *));
-int ibcs2_setgid __P((struct proc *, struct ibcs2_setgid_args *));
-int ibcs2_sigsys __P((struct proc *, struct ibcs2_sigsys_args *));
-int ibcs2_msgsys __P((struct proc *, struct ibcs2_msgsys_args *));
-int ibcs2_sysi86 __P((struct proc *, struct ibcs2_sysi86_args *));
-int ibcs2_shmsys __P((struct proc *, struct ibcs2_shmsys_args *));
-int ibcs2_semsys __P((struct proc *, struct ibcs2_semsys_args *));
-int ibcs2_ioctl __P((struct proc *, struct ibcs2_ioctl_args *));
-int ibcs2_uadmin __P((struct proc *, struct ibcs2_uadmin_args *));
-int ibcs2_utssys __P((struct proc *, struct ibcs2_utssys_args *));
-int ibcs2_execve __P((struct proc *, struct ibcs2_execve_args *));
-int ibcs2_fcntl __P((struct proc *, struct ibcs2_fcntl_args *));
-int ibcs2_ulimit __P((struct proc *, struct ibcs2_ulimit_args *));
-int ibcs2_rmdir __P((struct proc *, struct ibcs2_rmdir_args *));
-int ibcs2_mkdir __P((struct proc *, struct ibcs2_mkdir_args *));
-int ibcs2_getdents __P((struct proc *, struct ibcs2_getdents_args *));
-int ibcs2_sysfs __P((struct proc *, struct ibcs2_sysfs_args *));
-int ibcs2_getmsg __P((struct proc *, struct ibcs2_getmsg_args *));
-int ibcs2_putmsg __P((struct proc *, struct ibcs2_putmsg_args *));
-int ibcs2_poll __P((struct proc *, struct ibcs2_poll_args *));
-int ibcs2_secure __P((struct proc *, struct ibcs2_secure_args *));
-int ibcs2_symlink __P((struct proc *, struct ibcs2_symlink_args *));
-int ibcs2_lstat __P((struct proc *, struct ibcs2_lstat_args *));
-int ibcs2_readlink __P((struct proc *, struct ibcs2_readlink_args *));
-int ibcs2_isc __P((struct proc *, struct ibcs2_isc_args *));
+int ibcs2_read __P((struct thread *, struct ibcs2_read_args *));
+int ibcs2_open __P((struct thread *, struct ibcs2_open_args *));
+int ibcs2_wait __P((struct thread *, struct ibcs2_wait_args *));
+int ibcs2_creat __P((struct thread *, struct ibcs2_creat_args *));
+int ibcs2_unlink __P((struct thread *, struct ibcs2_unlink_args *));
+int ibcs2_execv __P((struct thread *, struct ibcs2_execv_args *));
+int ibcs2_chdir __P((struct thread *, struct ibcs2_chdir_args *));
+int ibcs2_time __P((struct thread *, struct ibcs2_time_args *));
+int ibcs2_mknod __P((struct thread *, struct ibcs2_mknod_args *));
+int ibcs2_chmod __P((struct thread *, struct ibcs2_chmod_args *));
+int ibcs2_chown __P((struct thread *, struct ibcs2_chown_args *));
+int ibcs2_stat __P((struct thread *, struct ibcs2_stat_args *));
+int ibcs2_lseek __P((struct thread *, struct ibcs2_lseek_args *));
+int ibcs2_mount __P((struct thread *, struct ibcs2_mount_args *));
+int ibcs2_umount __P((struct thread *, struct ibcs2_umount_args *));
+int ibcs2_setuid __P((struct thread *, struct ibcs2_setuid_args *));
+int ibcs2_stime __P((struct thread *, struct ibcs2_stime_args *));
+int ibcs2_alarm __P((struct thread *, struct ibcs2_alarm_args *));
+int ibcs2_fstat __P((struct thread *, struct ibcs2_fstat_args *));
+int ibcs2_pause __P((struct thread *, struct ibcs2_pause_args *));
+int ibcs2_utime __P((struct thread *, struct ibcs2_utime_args *));
+int ibcs2_stty __P((struct thread *, struct ibcs2_stty_args *));
+int ibcs2_gtty __P((struct thread *, struct ibcs2_gtty_args *));
+int ibcs2_access __P((struct thread *, struct ibcs2_access_args *));
+int ibcs2_nice __P((struct thread *, struct ibcs2_nice_args *));
+int ibcs2_statfs __P((struct thread *, struct ibcs2_statfs_args *));
+int ibcs2_kill __P((struct thread *, struct ibcs2_kill_args *));
+int ibcs2_fstatfs __P((struct thread *, struct ibcs2_fstatfs_args *));
+int ibcs2_pgrpsys __P((struct thread *, struct ibcs2_pgrpsys_args *));
+int ibcs2_xenix __P((struct thread *, struct ibcs2_xenix_args *));
+int ibcs2_times __P((struct thread *, struct ibcs2_times_args *));
+int ibcs2_plock __P((struct thread *, struct ibcs2_plock_args *));
+int ibcs2_setgid __P((struct thread *, struct ibcs2_setgid_args *));
+int ibcs2_sigsys __P((struct thread *, struct ibcs2_sigsys_args *));
+int ibcs2_msgsys __P((struct thread *, struct ibcs2_msgsys_args *));
+int ibcs2_sysi86 __P((struct thread *, struct ibcs2_sysi86_args *));
+int ibcs2_shmsys __P((struct thread *, struct ibcs2_shmsys_args *));
+int ibcs2_semsys __P((struct thread *, struct ibcs2_semsys_args *));
+int ibcs2_ioctl __P((struct thread *, struct ibcs2_ioctl_args *));
+int ibcs2_uadmin __P((struct thread *, struct ibcs2_uadmin_args *));
+int ibcs2_utssys __P((struct thread *, struct ibcs2_utssys_args *));
+int ibcs2_execve __P((struct thread *, struct ibcs2_execve_args *));
+int ibcs2_fcntl __P((struct thread *, struct ibcs2_fcntl_args *));
+int ibcs2_ulimit __P((struct thread *, struct ibcs2_ulimit_args *));
+int ibcs2_rmdir __P((struct thread *, struct ibcs2_rmdir_args *));
+int ibcs2_mkdir __P((struct thread *, struct ibcs2_mkdir_args *));
+int ibcs2_getdents __P((struct thread *, struct ibcs2_getdents_args *));
+int ibcs2_sysfs __P((struct thread *, struct ibcs2_sysfs_args *));
+int ibcs2_getmsg __P((struct thread *, struct ibcs2_getmsg_args *));
+int ibcs2_putmsg __P((struct thread *, struct ibcs2_putmsg_args *));
+int ibcs2_poll __P((struct thread *, struct ibcs2_poll_args *));
+int ibcs2_secure __P((struct thread *, struct ibcs2_secure_args *));
+int ibcs2_symlink __P((struct thread *, struct ibcs2_symlink_args *));
+int ibcs2_lstat __P((struct thread *, struct ibcs2_lstat_args *));
+int ibcs2_readlink __P((struct thread *, struct ibcs2_readlink_args *));
+int ibcs2_isc __P((struct thread *, struct ibcs2_isc_args *));
#ifdef COMPAT_43
diff --git a/sys/i386/ibcs2/ibcs2_signal.c b/sys/i386/ibcs2/ibcs2_signal.c
index 6049142..197c295 100644
--- a/sys/i386/ibcs2/ibcs2_signal.c
+++ b/sys/i386/ibcs2/ibcs2_signal.c
@@ -188,8 +188,8 @@ bsd_to_ibcs2_sigaction(bsa, isa)
}
int
-ibcs2_sigaction(p, uap)
- register struct proc *p;
+ibcs2_sigaction(td, uap)
+ register struct thread *td;
struct ibcs2_sigaction_args *uap;
{
struct ibcs2_sigaction *nisa, *oisa, tmpisa;
@@ -221,7 +221,7 @@ ibcs2_sigaction(p, uap)
SCARG(&sa, act) = nbsa;
SCARG(&sa, oact) = obsa;
- if ((error = sigaction(p, &sa)) != 0)
+ if ((error = sigaction(td, &sa)) != 0)
return error;
if (oisa != NULL) {
@@ -236,10 +236,11 @@ ibcs2_sigaction(p, uap)
}
int
-ibcs2_sigsys(p, uap)
- register struct proc *p;
+ibcs2_sigsys(td, uap)
+ register struct thread *td;
struct ibcs2_sigsys_args *uap;
{
+ struct proc *p = td->td_proc;
struct sigaction sa;
int signum = ibcs2_to_bsd_sig[_SIG_IDX(IBCS2_SIGNO(SCARG(uap, sig)))];
int error;
@@ -248,7 +249,7 @@ ibcs2_sigsys(p, uap)
if (signum <= 0 || signum >= IBCS2_NSIG) {
if (IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGNAL_MASK ||
IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGSET_MASK)
- p->p_retval[0] = (int)IBCS2_SIG_ERR;
+ td->td_retval[0] = (int)IBCS2_SIG_ERR;
return EINVAL;
}
@@ -275,7 +276,7 @@ ibcs2_sigsys(p, uap)
SCARG(&sa, how) = SIG_BLOCK;
SCARG(&sa, set) = &mask;
SCARG(&sa, oset) = NULL;
- return sigprocmask(p, &sa);
+ return sigprocmask(td, &sa);
}
case IBCS2_SIGNAL_MASK:
@@ -305,19 +306,19 @@ ibcs2_sigsys(p, uap)
if (signum != SIGALRM)
sa.sa_flags |= SA_RESTART;
#endif
- p->p_retval[0] = (int)IBCS2_SIG_ERR; /* init error return */
+ td->td_retval[0] = (int)IBCS2_SIG_ERR; /* init error return */
/* perform native sigaction() */
if ((error = copyout(&sa, nbsa, sizeof(sa))) != 0)
return error;
- if ((error = sigaction(p, &sa_args)) != 0) {
+ if ((error = sigaction(td, &sa_args)) != 0) {
DPRINTF(("signal: sigaction failed: %d\n",
error));
return error;
}
if ((error = copyin(obsa, &sa, sizeof(sa))) != 0)
return error;
- p->p_retval[0] = (int)sa.sa_handler;
+ td->td_retval[0] = (int)sa.sa_handler;
/* special sigset() check */
if(IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGSET_MASK) {
@@ -325,7 +326,7 @@ ibcs2_sigsys(p, uap)
/* check to make sure signal is not blocked */
if(sigismember(&p->p_sigmask, signum)) {
/* return SIG_HOLD and unblock signal*/
- p->p_retval[0] = (int)IBCS2_SIG_HOLD;
+ td->td_retval[0] = (int)IBCS2_SIG_HOLD;
SIGDELSET(p->p_sigmask, signum);
}
PROC_UNLOCK(p);
@@ -344,7 +345,7 @@ ibcs2_sigsys(p, uap)
SCARG(&sa, how) = SIG_UNBLOCK;
SCARG(&sa, set) = &mask;
SCARG(&sa, oset) = NULL;
- return sigprocmask(p, &sa);
+ return sigprocmask(td, &sa);
}
case IBCS2_SIGIGNORE_MASK:
@@ -362,7 +363,7 @@ ibcs2_sigsys(p, uap)
sa.sa_flags = 0;
if ((error = copyout(&sa, bsa, sizeof(sa))) != 0)
return error;
- if ((error = sigaction(p, &sa_args)) != 0) {
+ if ((error = sigaction(td, &sa_args)) != 0) {
DPRINTF(("sigignore: sigaction failed\n"));
return error;
}
@@ -379,7 +380,7 @@ ibcs2_sigsys(p, uap)
PROC_UNLOCK(p);
SIGDELSET(mask, signum);
SCARG(&sa, sigmask) = &mask;
- return sigsuspend(p, &sa);
+ return sigsuspend(td, &sa);
}
default:
@@ -388,10 +389,11 @@ ibcs2_sigsys(p, uap)
}
int
-ibcs2_sigprocmask(p, uap)
- register struct proc *p;
+ibcs2_sigprocmask(td, uap)
+ register struct thread *td;
struct ibcs2_sigprocmask_args *uap;
{
+ struct proc *p = td->td_proc;
ibcs2_sigset_t iss;
sigset_t bss;
int error = 0;
@@ -442,10 +444,11 @@ ibcs2_sigprocmask(p, uap)
}
int
-ibcs2_sigpending(p, uap)
- register struct proc *p;
+ibcs2_sigpending(td, uap)
+ register struct thread *td;
struct ibcs2_sigpending_args *uap;
{
+ struct proc *p = td->td_proc;
sigset_t bss;
ibcs2_sigset_t iss;
@@ -459,8 +462,8 @@ ibcs2_sigpending(p, uap)
}
int
-ibcs2_sigsuspend(p, uap)
- register struct proc *p;
+ibcs2_sigsuspend(td, uap)
+ register struct thread *td;
struct ibcs2_sigsuspend_args *uap;
{
ibcs2_sigset_t sss;
@@ -473,32 +476,33 @@ ibcs2_sigsuspend(p, uap)
ibcs2_to_bsd_sigset(&sss, &bss);
SCARG(&sa, sigmask) = &bss;
- return sigsuspend(p, &sa);
+ return sigsuspend(td, &sa);
}
int
-ibcs2_pause(p, uap)
- register struct proc *p;
+ibcs2_pause(td, uap)
+ register struct thread *td;
struct ibcs2_pause_args *uap;
{
+ struct proc *p = td->td_proc;
sigset_t mask;
struct sigsuspend_args sa;
PROC_LOCK(p);
- mask = p->p_sigmask;
+ mask = td->td_proc->p_sigmask;
PROC_UNLOCK(p);
SCARG(&sa, sigmask) = &mask;
- return sigsuspend(p, &sa);
+ return sigsuspend(td, &sa);
}
int
-ibcs2_kill(p, uap)
- register struct proc *p;
+ibcs2_kill(td, uap)
+ register struct thread *td;
struct ibcs2_kill_args *uap;
{
struct kill_args ka;
SCARG(&ka, pid) = SCARG(uap, pid);
SCARG(&ka, signum) = ibcs2_to_bsd_sig[_SIG_IDX(SCARG(uap, signo))];
- return kill(p, &ka);
+ return kill(td, &ka);
}
diff --git a/sys/i386/ibcs2/ibcs2_socksys.c b/sys/i386/ibcs2/ibcs2_socksys.c
index 16d964e..533b5c9 100644
--- a/sys/i386/ibcs2/ibcs2_socksys.c
+++ b/sys/i386/ibcs2/ibcs2_socksys.c
@@ -21,6 +21,8 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#include <sys/param.h>
@@ -44,9 +46,9 @@ struct setipdomainname_args {
};
/* Local prototypes */
-static int ibcs2_getipdomainname __P((struct proc *,
+static int ibcs2_getipdomainname __P((struct thread *,
struct getipdomainname_args *));
-static int ibcs2_setipdomainname __P((struct proc *,
+static int ibcs2_setipdomainname __P((struct thread *,
struct setipdomainname_args *));
/*
@@ -54,8 +56,8 @@ static int ibcs2_setipdomainname __P((struct proc *,
*/
int
-ibcs2_socksys(p, uap)
- register struct proc *p;
+ibcs2_socksys(td, uap)
+ register struct thread *td;
register struct ibcs2_socksys_args *uap;
{
int error;
@@ -77,55 +79,55 @@ ibcs2_socksys(p, uap)
passargs = (void *)(realargs + 1);
switch (realargs[0]) {
case SOCKSYS_ACCEPT:
- return accept(p, passargs);
+ return accept(td, passargs);
case SOCKSYS_BIND:
- return bind(p, passargs);
+ return bind(td, passargs);
case SOCKSYS_CONNECT:
- return connect(p, passargs);
+ return connect(td, passargs);
case SOCKSYS_GETPEERNAME:
- return getpeername(p, passargs);
+ return getpeername(td, passargs);
case SOCKSYS_GETSOCKNAME:
- return getsockname(p, passargs);
+ return getsockname(td, passargs);
case SOCKSYS_GETSOCKOPT:
- return getsockopt(p, passargs);
+ return getsockopt(td, passargs);
case SOCKSYS_LISTEN:
- return listen(p, passargs);
+ return listen(td, passargs);
case SOCKSYS_RECV:
realargs[5] = realargs[6] = 0;
/* FALLTHROUGH */
case SOCKSYS_RECVFROM:
- return recvfrom(p, passargs);
+ return recvfrom(td, passargs);
case SOCKSYS_SEND:
realargs[5] = realargs[6] = 0;
/* FALLTHROUGH */
case SOCKSYS_SENDTO:
- return sendto(p, passargs);
+ return sendto(td, passargs);
case SOCKSYS_SETSOCKOPT:
- return setsockopt(p, passargs);
+ return setsockopt(td, passargs);
case SOCKSYS_SHUTDOWN:
- return shutdown(p, passargs);
+ return shutdown(td, passargs);
case SOCKSYS_SOCKET:
- return socket(p, passargs);
+ return socket(td, passargs);
case SOCKSYS_SELECT:
- return select(p, passargs);
+ return select(td, passargs);
case SOCKSYS_GETIPDOMAIN:
- return ibcs2_getipdomainname(p, passargs);
+ return ibcs2_getipdomainname(td, passargs);
case SOCKSYS_SETIPDOMAIN:
- return ibcs2_setipdomainname(p, passargs);
+ return ibcs2_setipdomainname(td, passargs);
case SOCKSYS_ADJTIME:
- return adjtime(p, passargs);
+ return adjtime(td, passargs);
case SOCKSYS_SETREUID:
- return setreuid(p, passargs);
+ return setreuid(td, passargs);
case SOCKSYS_SETREGID:
- return setregid(p, passargs);
+ return setregid(td, passargs);
case SOCKSYS_GETTIME:
- return gettimeofday(p, passargs);
+ return gettimeofday(td, passargs);
case SOCKSYS_SETTIME:
- return settimeofday(p, passargs);
+ return settimeofday(td, passargs);
case SOCKSYS_GETITIMER:
- return getitimer(p, passargs);
+ return getitimer(td, passargs);
case SOCKSYS_SETITIMER:
- return setitimer(p, passargs);
+ return setitimer(td, passargs);
default:
printf("socksys unknown %08x %08x %08x %08x %08x %08x %08x\n",
@@ -138,8 +140,8 @@ ibcs2_socksys(p, uap)
/* ARGSUSED */
static int
-ibcs2_getipdomainname(p, uap)
- struct proc *p;
+ibcs2_getipdomainname(td, uap)
+ struct thread *td;
struct getipdomainname_args *uap;
{
char hname[MAXHOSTNAMELEN], *dptr;
@@ -162,14 +164,14 @@ ibcs2_getipdomainname(p, uap)
/* ARGSUSED */
static int
-ibcs2_setipdomainname(p, uap)
- struct proc *p;
+ibcs2_setipdomainname(td, uap)
+ struct thread *td;
struct setipdomainname_args *uap;
{
char hname[MAXHOSTNAMELEN], *ptr;
int error, sctl[2], hlen;
- if ((error = suser(p)))
+ if ((error = suser_td(td)))
return (error);
/* W/out a hostname a domain-name is nonsense */
@@ -200,5 +202,5 @@ ibcs2_setipdomainname(p, uap)
sctl[0] = CTL_KERN;
sctl[1] = KERN_HOSTNAME;
hlen = strlen(hname) + 1;
- return (kernel_sysctl(p, sctl, 2, 0, 0, hname, hlen, 0));
+ return (kernel_sysctl(td, sctl, 2, 0, 0, hname, hlen, 0));
}
diff --git a/sys/i386/ibcs2/ibcs2_socksys.h b/sys/i386/ibcs2/ibcs2_socksys.h
index f6b212e..f0c72bd 100644
--- a/sys/i386/ibcs2/ibcs2_socksys.h
+++ b/sys/i386/ibcs2/ibcs2_socksys.h
@@ -21,6 +21,8 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#ifndef _I386_IBCS2_IBCS2_SOCKSYS_H_
@@ -121,6 +123,6 @@ struct ibcs2_socksys_args {
caddr_t argsp;
};
-int ibcs2_socksys __P((struct proc *, struct ibcs2_socksys_args *));
+int ibcs2_socksys __P((struct thread *, struct ibcs2_socksys_args *));
#endif /* !_I386_IBCS2_IBCS2_SOCKSYS_H_ */
diff --git a/sys/i386/ibcs2/ibcs2_stat.c b/sys/i386/ibcs2/ibcs2_stat.c
index 824118f..fd39853 100644
--- a/sys/i386/ibcs2/ibcs2_stat.c
+++ b/sys/i386/ibcs2/ibcs2_stat.c
@@ -95,8 +95,8 @@ cvt_statfs(sp, buf, len)
}
int
-ibcs2_statfs(p, uap)
- struct proc *p;
+ibcs2_statfs(td, uap)
+ struct thread *td;
struct ibcs2_statfs_args *uap;
{
register struct mount *mp;
@@ -105,23 +105,23 @@ ibcs2_statfs(p, uap)
struct nameidata nd;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td);
if ((error = namei(&nd)) != 0)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
mp = nd.ni_vp->v_mount;
sp = &mp->mnt_stat;
vrele(nd.ni_vp);
- if ((error = VFS_STATFS(mp, sp, p)) != 0)
+ if ((error = VFS_STATFS(mp, sp, td)) != 0)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len));
}
int
-ibcs2_fstatfs(p, uap)
- struct proc *p;
+ibcs2_fstatfs(td, uap)
+ struct thread *td;
struct ibcs2_fstatfs_args *uap;
{
struct file *fp;
@@ -129,19 +129,19 @@ ibcs2_fstatfs(p, uap)
register struct statfs *sp;
int error;
- if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
+ if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0)
return (error);
mp = ((struct vnode *)fp->f_data)->v_mount;
sp = &mp->mnt_stat;
- if ((error = VFS_STATFS(mp, sp, p)) != 0)
+ if ((error = VFS_STATFS(mp, sp, td)) != 0)
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len));
}
int
-ibcs2_stat(p, uap)
- struct proc *p;
+ibcs2_stat(td, uap)
+ struct thread *td;
struct ibcs2_stat_args *uap;
{
struct stat st;
@@ -150,11 +150,11 @@ ibcs2_stat(p, uap)
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st));
- if ((error = stat(p, &cup)) != 0)
+ if ((error = stat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0)
@@ -165,8 +165,8 @@ ibcs2_stat(p, uap)
}
int
-ibcs2_lstat(p, uap)
- struct proc *p;
+ibcs2_lstat(td, uap)
+ struct thread *td;
struct ibcs2_lstat_args *uap;
{
struct stat st;
@@ -175,11 +175,11 @@ ibcs2_lstat(p, uap)
int error;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
SCARG(&cup, path) = SCARG(uap, path);
SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st));
- if ((error = lstat(p, &cup)) != 0)
+ if ((error = lstat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0)
@@ -190,8 +190,8 @@ ibcs2_lstat(p, uap)
}
int
-ibcs2_fstat(p, uap)
- struct proc *p;
+ibcs2_fstat(td, uap)
+ struct thread *td;
struct ibcs2_fstat_args *uap;
{
struct stat st;
@@ -203,7 +203,7 @@ ibcs2_fstat(p, uap)
SCARG(&cup, fd) = SCARG(uap, fd);
SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(st));
- if ((error = fstat(p, &cup)) != 0)
+ if ((error = fstat(td, &cup)) != 0)
return error;
if ((error = copyin(SCARG(&cup, sb), &st, sizeof(st))) != 0)
@@ -214,8 +214,8 @@ ibcs2_fstat(p, uap)
}
int
-ibcs2_utssys(p, uap)
- struct proc *p;
+ibcs2_utssys(td, uap)
+ struct thread *td;
struct ibcs2_utssys_args *uap;
{
switch (SCARG(uap, flag)) {
diff --git a/sys/i386/ibcs2/ibcs2_sysi86.c b/sys/i386/ibcs2/ibcs2_sysi86.c
index bcc758b..ae5215f 100644
--- a/sys/i386/ibcs2/ibcs2_sysi86.c
+++ b/sys/i386/ibcs2/ibcs2_sysi86.c
@@ -26,7 +26,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * ibcs2_sysi86.c,v 1.1 1994/10/14 08:53:11 sos Exp
+ * $FreeBSD$
*/
#include <sys/param.h>
@@ -51,7 +51,7 @@
extern int hw_float;
int
-ibcs2_sysi86(struct proc *p, struct ibcs2_sysi86_args *args)
+ibcs2_sysi86(struct thread *td, struct ibcs2_sysi86_args *args)
{
switch (SCARG(args, cmd)) {
case SI86_FPHW: { /* Floating Point information */
@@ -73,16 +73,16 @@ ibcs2_sysi86(struct proc *p, struct ibcs2_sysi86_args *args)
int name[2];
int error;
- if ((error = suser(p)))
+ if ((error = suser_td(td)))
return (error);
name[0] = CTL_KERN;
name[1] = KERN_HOSTNAME;
- return (userland_sysctl(p, name, 2, 0, 0, 0,
+ return (userland_sysctl(td, name, 2, 0, 0, 0,
SCARG(args, arg), 7, 0));
}
case SI86_MEM: /* size of physical memory */
- p->p_retval[0] = ctob(physmem);
+ td->td_retval[0] = ctob(physmem);
return 0;
default:
diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c
index bef94fd3..8b0720a 100644
--- a/sys/i386/ibcs2/ibcs2_util.c
+++ b/sys/i386/ibcs2/ibcs2_util.c
@@ -50,8 +50,8 @@ const char ibcs2_emul_path[] = "/compat/ibcs2";
* be in exists.
*/
int
-ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
- struct proc *p;
+ibcs2_emul_find(td, sgp, prefix, path, pbuf, cflag)
+ struct thread *td;
caddr_t *sgp; /* Pointer to stackgap memory */
const char *prefix;
char *path;
@@ -104,7 +104,7 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
for (cp = &ptr[len] - 1; *cp != '/'; cp--);
*cp = '\0';
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
if ((error = namei(&nd)) != 0) {
free(buf, M_TEMP);
@@ -114,7 +114,7 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
*cp = '/';
}
else {
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, td);
if ((error = namei(&nd)) != 0) {
free(buf, M_TEMP);
@@ -130,7 +130,7 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
* to the emulation root directory. This is expensive :-(
*/
NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, ibcs2_emul_path,
- p);
+ td);
if ((error = namei(&ndroot)) != 0) {
/* Cannot happen! */
@@ -140,11 +140,11 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
return error;
}
- if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) {
+ if ((error = VOP_GETATTR(nd.ni_vp, &vat, td->td_proc->p_ucred, td)) != 0) {
goto done;
}
- if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p))
+ if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, td->td_proc->p_ucred, td))
!= 0) {
goto done;
}
diff --git a/sys/i386/ibcs2/ibcs2_util.h b/sys/i386/ibcs2/ibcs2_util.h
index 4ef390f..93382c4 100644
--- a/sys/i386/ibcs2/ibcs2_util.h
+++ b/sys/i386/ibcs2/ibcs2_util.h
@@ -29,6 +29,8 @@
*
* from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp
* from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp
+ *
+ * $FreeBSD$
*/
/*
@@ -60,7 +62,7 @@ static __inline void *stackgap_alloc(caddr_t *, size_t);
static __inline caddr_t
stackgap_init()
{
-#define szsigcode (*(curproc->p_sysent->sv_szsigcode))
+#define szsigcode (*(curthread->td_proc->p_sysent->sv_szsigcode))
return (caddr_t)(PS_STRINGS - szsigcode - SPARE_USRSPACE);
}
@@ -82,17 +84,17 @@ stackgap_alloc(sgp, sz)
extern const char ibcs2_emul_path[];
-int ibcs2_emul_find __P((struct proc *, caddr_t *, const char *, char *,
+int ibcs2_emul_find __P((struct thread *, caddr_t *, const char *, char *,
char **, int));
#define CHECKALTEXIST(p, sgp, path) \
- ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 0)
+ ibcs2_emul_find(td, sgp, ibcs2_emul_path, path, &(path), 0)
#define CHECKALTCREAT(p, sgp, path) \
- ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 1)
+ ibcs2_emul_find(td, sgp, ibcs2_emul_path, path, &(path), 1)
#ifdef SPX_HACK
-int spx_open __P((struct proc *p, void *uap));
+int spx_open __P((struct thread *td, void *uap));
#endif
#endif /* !_IBCS2_UTIL_H_ */
diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c
index b11275c2..2f30195 100644
--- a/sys/i386/ibcs2/ibcs2_xenix.c
+++ b/sys/i386/ibcs2/ibcs2_xenix.c
@@ -53,9 +53,9 @@
extern struct sysent xenix_sysent[];
int
-ibcs2_xenix(struct proc *p, struct ibcs2_xenix_args *uap)
+ibcs2_xenix(struct thread *td, struct ibcs2_xenix_args *uap)
{
- struct trapframe *tf = p->p_frame;
+ struct trapframe *tf = td->td_frame;
struct sysent *callp;
u_int code;
@@ -63,14 +63,14 @@ ibcs2_xenix(struct proc *p, struct ibcs2_xenix_args *uap)
callp = &xenix_sysent[code];
if(code < IBCS2_XENIX_MAXSYSCALL)
- return((*callp->sy_call)(p, (void *)uap));
+ return((*callp->sy_call)(td, (void *)uap));
else
return ENOSYS;
}
int
-xenix_rdchk(p, uap)
- struct proc *p;
+xenix_rdchk(td, uap)
+ struct thread *td;
struct xenix_rdchk_args *uap;
{
int error;
@@ -81,15 +81,15 @@ xenix_rdchk(p, uap)
SCARG(&sa, fd) = SCARG(uap, fd);
SCARG(&sa, com) = FIONREAD;
SCARG(&sa, data) = stackgap_alloc(&sg, sizeof(int));
- if ((error = ioctl(p, &sa)) != 0)
+ if ((error = ioctl(td, &sa)) != 0)
return error;
- p->p_retval[0] = (*((int*)SCARG(&sa, data))) ? 1 : 0;
+ td->td_retval[0] = (*((int*)SCARG(&sa, data))) ? 1 : 0;
return 0;
}
int
-xenix_chsize(p, uap)
- struct proc *p;
+xenix_chsize(td, uap)
+ struct thread *td;
struct xenix_chsize_args *uap;
{
struct ftruncate_args sa;
@@ -98,13 +98,13 @@ xenix_chsize(p, uap)
SCARG(&sa, fd) = SCARG(uap, fd);
SCARG(&sa, pad) = 0;
SCARG(&sa, length) = SCARG(uap, size);
- return ftruncate(p, &sa);
+ return ftruncate(td, &sa);
}
int
-xenix_ftime(p, uap)
- struct proc *p;
+xenix_ftime(td, uap)
+ struct thread *td;
struct xenix_ftime_args *uap;
{
struct timeval tv;
@@ -127,7 +127,7 @@ xenix_ftime(p, uap)
}
int
-xenix_nap(struct proc *p, struct xenix_nap_args *uap)
+xenix_nap(struct thread *td, struct xenix_nap_args *uap)
{
long period;
@@ -140,7 +140,7 @@ xenix_nap(struct proc *p, struct xenix_nap_args *uap)
}
int
-xenix_utsname(struct proc *p, struct xenix_utsname_args *uap)
+xenix_utsname(struct thread *td, struct xenix_utsname_args *uap)
{
struct ibcs2_sco_utsname {
char sysname[9];
@@ -183,26 +183,26 @@ xenix_utsname(struct proc *p, struct xenix_utsname_args *uap)
}
int
-xenix_scoinfo(struct proc *p, struct xenix_scoinfo_args *uap)
+xenix_scoinfo(struct thread *td, struct xenix_scoinfo_args *uap)
{
/* scoinfo (not documented) */
- p->p_retval[0] = 0;
+ td->td_retval[0] = 0;
return 0;
}
int
-xenix_eaccess(struct proc *p, struct xenix_eaccess_args *uap)
+xenix_eaccess(struct thread *td, struct xenix_eaccess_args *uap)
{
- struct ucred *cred = p->p_ucred;
+ struct ucred *cred = td->td_proc->p_ucred;
struct vnode *vp;
struct nameidata nd;
int error, flags;
caddr_t sg = stackgap_init();
- CHECKALTEXIST(p, &sg, SCARG(uap, path));
+ CHECKALTEXIST(td, &sg, SCARG(uap, path));
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
- SCARG(uap, path), p);
+ SCARG(uap, path), td);
if ((error = namei(&nd)) != 0)
return error;
vp = nd.ni_vp;
@@ -217,7 +217,7 @@ xenix_eaccess(struct proc *p, struct xenix_eaccess_args *uap)
if (SCARG(uap, flags) & IBCS2_X_OK)
flags |= VEXEC;
if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
- error = VOP_ACCESS(vp, flags, cred, p);
+ error = VOP_ACCESS(vp, flags, cred, td);
}
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
diff --git a/sys/i386/ibcs2/ibcs2_xenix.h b/sys/i386/ibcs2/ibcs2_xenix.h
index 3d487ee..07e827f 100644
--- a/sys/i386/ibcs2/ibcs2_xenix.h
+++ b/sys/i386/ibcs2/ibcs2_xenix.h
@@ -15,6 +15,8 @@
struct proc;
+struct thread;
+
#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
0 : sizeof(register_t) - sizeof(t))
@@ -80,23 +82,23 @@ struct ibcs2_rename_args {
struct xenix_utsname_args {
long addr; char addr_[PAD_(long)];
};
-int xenix_rdchk __P((struct proc *, struct xenix_rdchk_args *));
-int xenix_chsize __P((struct proc *, struct xenix_chsize_args *));
-int xenix_ftime __P((struct proc *, struct xenix_ftime_args *));
-int xenix_nap __P((struct proc *, struct xenix_nap_args *));
-int xenix_scoinfo __P((struct proc *, struct xenix_scoinfo_args *));
-int xenix_eaccess __P((struct proc *, struct xenix_eaccess_args *));
-int ibcs2_sigaction __P((struct proc *, struct ibcs2_sigaction_args *));
-int ibcs2_sigprocmask __P((struct proc *, struct ibcs2_sigprocmask_args *));
-int ibcs2_sigpending __P((struct proc *, struct ibcs2_sigpending_args *));
-int ibcs2_sigsuspend __P((struct proc *, struct ibcs2_sigsuspend_args *));
-int ibcs2_getgroups __P((struct proc *, struct ibcs2_getgroups_args *));
-int ibcs2_setgroups __P((struct proc *, struct ibcs2_setgroups_args *));
-int ibcs2_sysconf __P((struct proc *, struct ibcs2_sysconf_args *));
-int ibcs2_pathconf __P((struct proc *, struct ibcs2_pathconf_args *));
-int ibcs2_fpathconf __P((struct proc *, struct ibcs2_fpathconf_args *));
-int ibcs2_rename __P((struct proc *, struct ibcs2_rename_args *));
-int xenix_utsname __P((struct proc *, struct xenix_utsname_args *));
+int xenix_rdchk __P((struct thread *, struct xenix_rdchk_args *));
+int xenix_chsize __P((struct thread *, struct xenix_chsize_args *));
+int xenix_ftime __P((struct thread *, struct xenix_ftime_args *));
+int xenix_nap __P((struct thread *, struct xenix_nap_args *));
+int xenix_scoinfo __P((struct thread *, struct xenix_scoinfo_args *));
+int xenix_eaccess __P((struct thread *, struct xenix_eaccess_args *));
+int ibcs2_sigaction __P((struct thread *, struct ibcs2_sigaction_args *));
+int ibcs2_sigprocmask __P((struct thread *, struct ibcs2_sigprocmask_args *));
+int ibcs2_sigpending __P((struct thread *, struct ibcs2_sigpending_args *));
+int ibcs2_sigsuspend __P((struct thread *, struct ibcs2_sigsuspend_args *));
+int ibcs2_getgroups __P((struct thread *, struct ibcs2_getgroups_args *));
+int ibcs2_setgroups __P((struct thread *, struct ibcs2_setgroups_args *));
+int ibcs2_sysconf __P((struct thread *, struct ibcs2_sysconf_args *));
+int ibcs2_pathconf __P((struct thread *, struct ibcs2_pathconf_args *));
+int ibcs2_fpathconf __P((struct thread *, struct ibcs2_fpathconf_args *));
+int ibcs2_rename __P((struct thread *, struct ibcs2_rename_args *));
+int xenix_utsname __P((struct thread *, struct xenix_utsname_args *));
#ifdef COMPAT_43
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c
index a2f624d..3ea816b 100644
--- a/sys/i386/ibcs2/imgact_coff.c
+++ b/sys/i386/ibcs2/imgact_coff.c
@@ -54,7 +54,7 @@ MODULE_DEPEND(coff, ibcs2, 1, 1, 1);
extern struct sysentvec ibcs2_svr3_sysvec;
-static int coff_load_file __P((struct proc *p, char *name));
+static int coff_load_file __P((struct thread *td, char *name));
static int exec_coff_imgact __P((struct image_params *imgp));
static int load_coff_section __P((struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot));
@@ -150,8 +150,9 @@ load_coff_section(struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset,
}
static int
-coff_load_file(struct proc *p, char *name)
+coff_load_file(struct thread *td, char *name)
{
+ struct proc *p = td->td_proc;
struct vmspace *vmspace = p->p_vmspace;
int error;
struct nameidata nd;
@@ -167,7 +168,7 @@ coff_load_file(struct proc *p, char *name)
unsigned long bss_size = 0;
int i;
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, name, p);
+ NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, name, td);
error = namei(&nd);
if (error)
@@ -182,7 +183,7 @@ coff_load_file(struct proc *p, char *name)
goto fail;
}
- if ((error = VOP_GETATTR(vp, &attr, p->p_ucred, p)) != 0)
+ if ((error = VOP_GETATTR(vp, &attr, p->p_ucred, td)) != 0)
goto fail;
if ((vp->v_mount->mnt_flag & MNT_NOEXEC)
@@ -195,17 +196,17 @@ coff_load_file(struct proc *p, char *name)
goto fail;
}
- if ((error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p)) != 0)
+ if ((error = VOP_ACCESS(vp, VEXEC, p->p_ucred, td)) != 0)
goto fail;
- if ((error = VOP_OPEN(vp, FREAD, p->p_ucred, p)) != 0)
+ if ((error = VOP_OPEN(vp, FREAD, p->p_ucred, td)) != 0)
goto fail;
/*
* Lose the lock on the vnode. It's no longer needed, and must not
* exist for the pagefault paging to work below.
*/
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
if ((error = vm_mmap(kernel_map,
(vm_offset_t *) &ptr,
@@ -278,7 +279,7 @@ coff_load_file(struct proc *p, char *name)
panic(__FUNCTION__ " vm_map_remove failed");
fail:
- VOP_UNLOCK(vp, 0, p);
+ VOP_UNLOCK(vp, 0, td);
unlocked_fail:
NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
@@ -393,9 +394,9 @@ exec_coff_imgact(imgp)
DPRINTF(("%s(%d): shared library %s\n",
__FILE__, __LINE__, libname));
strcpy(&libbuf[emul_path_len], libname);
- error = coff_load_file(imgp->proc, libbuf);
+/* XXXKSE only 1:1 in coff */ error = coff_load_file(&imgp->proc->p_thread, libbuf);
if (error)
- error = coff_load_file(imgp->proc,
+ error = coff_load_file(&imgp->proc->p_thread,
libname);
if (error)
break;
diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h
index 04ef7a0..a7783a0 100644
--- a/sys/i386/include/cpu.h
+++ b/sys/i386/include/cpu.h
@@ -56,8 +56,8 @@
#define cpu_exec(p) /* nothing */
#define cpu_swapin(p) /* nothing */
-#define cpu_getstack(p) ((p)->p_frame->tf_esp)
-#define cpu_setstack(p, ap) ((p)->p_frame->tf_esp = (ap))
+#define cpu_getstack(td) ((td)->td_frame->tf_esp)
+#define cpu_setstack(td, ap) ((td)->td_frame->tf_esp = (ap))
#define TRAPF_USERMODE(framep) \
((ISPL((framep)->tf_cs) == SEL_UPL) || ((framep)->tf_eflags & PSL_VM))
diff --git a/sys/i386/include/globaldata.h b/sys/i386/include/globaldata.h
index 37388aa..f02354d 100644
--- a/sys/i386/include/globaldata.h
+++ b/sys/i386/include/globaldata.h
@@ -52,19 +52,19 @@
* other processors"
*/
struct globaldata {
- struct globaldata *gd_prvspace; /* self-reference */
- struct proc *gd_curproc; /* current process */
- struct proc *gd_idleproc; /* idle process */
- struct proc *gd_npxproc;
- struct pcb *gd_curpcb; /* current pcb */
- struct timeval gd_switchtime;
- struct i386tss gd_common_tss;
- int gd_switchticks;
- struct segment_descriptor gd_common_tssd;
- struct segment_descriptor *gd_tss_gdt;
- int gd_currentldt;
- u_int gd_cpuid; /* this cpu number */
- u_int gd_other_cpus; /* all other cpus */
+ struct globaldata *gd_prvspace; /* self-reference */
+ struct thread *gd_curthread;
+ struct thread *gd_npxthread;
+ struct pcb *gd_curpcb;
+ struct thread *gd_idlethread;
+ struct timeval gd_switchtime;
+ struct i386tss gd_common_tss;
+ int gd_switchticks;
+ struct segment_descriptor gd_common_tssd;
+ struct segment_descriptor *gd_tss_gdt;
+ int gd_currentldt;
+ u_int gd_cpuid;
+ u_int gd_other_cpus;
SLIST_ENTRY(globaldata) gd_allcpu;
struct lock_list_entry *gd_spinlocks;
#ifdef KTR_PERCPU
diff --git a/sys/i386/include/globals.h b/sys/i386/include/globals.h
index 7613069..c3cc211 100644
--- a/sys/i386/include/globals.h
+++ b/sys/i386/include/globals.h
@@ -129,10 +129,12 @@
#define PCPU_PTR(member) __PCPU_PTR(gd_ ## member)
#define PCPU_SET(member, val) __PCPU_SET(gd_ ## member, val)
-#define CURPROC PCPU_GET(curproc)
-#define CURTHD PCPU_GET(curproc)
#define GLOBALDATA PCPU_GET(prvspace)
-#define curproc PCPU_GET(curproc)
+#define curthread PCPU_GET(curthread)
+#define CURPROC (curthread->td_proc)
+#define curproc (curthread->td_proc)
+#define curksegrp (curthread->td_ksegrp)
+#define curkse (curthread->td_kse)
#endif /* _KERNEL */
diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h
index bc9cb75..c3564c2 100644
--- a/sys/i386/include/md_var.h
+++ b/sys/i386/include/md_var.h
@@ -61,7 +61,7 @@ extern char sigcode[];
extern int szsigcode, szosigcode;
typedef void alias_for_inthand_t __P((u_int cs, u_int ef, u_int esp, u_int ss));
-struct proc;
+struct thread;
struct reg;
struct fpreg;
struct dbreg;
@@ -80,9 +80,9 @@ void doreti_popl_es __P((void)) __asm(__STRING(doreti_popl_es));
void doreti_popl_es_fault __P((void)) __asm(__STRING(doreti_popl_es_fault));
void doreti_popl_fs __P((void)) __asm(__STRING(doreti_popl_fs));
void doreti_popl_fs_fault __P((void)) __asm(__STRING(doreti_popl_fs_fault));
-int fill_fpregs __P((struct proc *, struct fpreg *));
-int fill_regs __P((struct proc *p, struct reg *regs));
-int fill_dbregs __P((struct proc *p, struct dbreg *dbregs));
+int fill_fpregs __P((struct thread *, struct fpreg *));
+int fill_regs __P((struct thread *p, struct reg *regs));
+int fill_dbregs __P((struct thread *p, struct dbreg *dbregs));
void fillw __P((int /*u_short*/ pat, void *base, size_t cnt));
void i486_bzero __P((void *buf, size_t len));
void i586_bcopy __P((const void *from, void *to, size_t len));
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index d912e0c..f558524 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -26,7 +26,7 @@
*/
#include "opt_cpu.h"
-#include "opt_upages.h"
+#include "opt_kstack_pages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -1960,8 +1960,8 @@ start_all_aps(u_int boot_addr)
SMPpt[pg] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd));
/* allocate and set up an idle stack data page */
- stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
- for (i = 0; i < UPAGES; i++)
+ stack = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE); /* XXXKSE */
+ for (i = 0; i < KSTACK_PAGES; i++)
SMPpt[pg + 1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
@@ -1977,7 +1977,7 @@ start_all_aps(u_int boot_addr)
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
#endif
- bootSTK = &SMP_prvspace[x].idlestack[UPAGES*PAGE_SIZE];
+ bootSTK = &SMP_prvspace[x].idlekstack[KSTACK_PAGES * PAGE_SIZE];
bootAP = x;
/* attempt to start the Application Processor */
@@ -2019,8 +2019,8 @@ start_all_aps(u_int boot_addr)
*/
/* Allocate and setup BSP idle stack */
- stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
- for (i = 0; i < UPAGES; i++)
+ stack = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE);
+ for (i = 0; i < KSTACK_PAGES; i++)
SMPpt[1 + i] = (pt_entry_t)
(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
@@ -2241,7 +2241,7 @@ ap_init(void)
* Set curproc to our per-cpu idleproc so that mutexes have
* something unique to lock with.
*/
- PCPU_SET(curproc, PCPU_GET(idleproc));
+ PCPU_SET(curthread, PCPU_GET(idlethread));
PCPU_SET(spinlocks, NULL);
/* lock against other AP's that are waking up */
@@ -2323,7 +2323,7 @@ forwarded_statclock(struct trapframe frame)
{
mtx_lock_spin(&sched_lock);
- statclock_process(curproc, TRAPF_PC(&frame), TRAPF_USERMODE(&frame));
+ statclock_process(curthread->td_kse, TRAPF_PC(&frame), TRAPF_USERMODE(&frame));
mtx_unlock_spin(&sched_lock);
}
@@ -2354,7 +2354,7 @@ forwarded_hardclock(struct trapframe frame)
{
mtx_lock_spin(&sched_lock);
- hardclock_process(curproc, TRAPF_USERMODE(&frame));
+ hardclock_process(curthread, TRAPF_USERMODE(&frame));
mtx_unlock_spin(&sched_lock);
}
diff --git a/sys/i386/include/mutex.h b/sys/i386/include/mutex.h
index b0fe512..ae37b23 100644
--- a/sys/i386/include/mutex.h
+++ b/sys/i386/include/mutex.h
@@ -250,7 +250,7 @@ extern struct mtx clock_lock;
pushl %ecx ; \
pushl %ebx ; \
movl $(MTX_UNOWNED) , %eax ; \
- movl PCPU(CURPROC), %ebx ; \
+ movl PCPU(CURTHREAD), %ebx ; \
pushfl ; \
popl %ecx ; \
cli ; \
diff --git a/sys/i386/include/npx.h b/sys/i386/include/npx.h
index 67ce661..589a4be 100644
--- a/sys/i386/include/npx.h
+++ b/sys/i386/include/npx.h
@@ -142,7 +142,7 @@ union savefpu {
#ifdef _KERNEL
int npxdna __P((void));
-void npxexit __P((struct proc *p));
+void npxexit __P((struct thread *td));
void npxinit __P((int control));
void npxsave __P((union savefpu *addr));
int npxtrap __P((void));
diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h
index 9f63c01..ba28cfb 100644
--- a/sys/i386/include/param.h
+++ b/sys/i386/include/param.h
@@ -111,9 +111,12 @@
#define IOPAGES 2 /* pages of i/o permission bitmap */
-#ifndef UPAGES
-#define UPAGES 2 /* pages of u-area */
+#ifndef KSTACK_PAGES
+#define KSTACK_PAGES 2 /* Includes pcb! */
#endif
+#define UAREA_PAGES 1 /* holds struct user WITHOUT PCB (see def.) */
+
+#define KSTACK_GUARD /* compile in the kstack guard page */
/*
* Ceiling on amount of swblock kva space.
diff --git a/sys/i386/include/pcb_ext.h b/sys/i386/include/pcb_ext.h
index 7d6fb08..c6f9fc0 100644
--- a/sys/i386/include/pcb_ext.h
+++ b/sys/i386/include/pcb_ext.h
@@ -53,7 +53,7 @@ struct pcb_ldt {
#ifdef _KERNEL
-int i386_extend_pcb __P((struct proc *));
+int i386_extend_pcb __P((struct thread *));
void set_user_ldt __P((struct pcb *));
struct pcb_ldt *user_ldt_alloc __P((struct pcb *, int));
void user_ldt_free __P((struct pcb *));
diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h
index 37388aa..f02354d 100644
--- a/sys/i386/include/pcpu.h
+++ b/sys/i386/include/pcpu.h
@@ -52,19 +52,19 @@
* other processors"
*/
struct globaldata {
- struct globaldata *gd_prvspace; /* self-reference */
- struct proc *gd_curproc; /* current process */
- struct proc *gd_idleproc; /* idle process */
- struct proc *gd_npxproc;
- struct pcb *gd_curpcb; /* current pcb */
- struct timeval gd_switchtime;
- struct i386tss gd_common_tss;
- int gd_switchticks;
- struct segment_descriptor gd_common_tssd;
- struct segment_descriptor *gd_tss_gdt;
- int gd_currentldt;
- u_int gd_cpuid; /* this cpu number */
- u_int gd_other_cpus; /* all other cpus */
+ struct globaldata *gd_prvspace; /* self-reference */
+ struct thread *gd_curthread;
+ struct thread *gd_npxthread;
+ struct pcb *gd_curpcb;
+ struct thread *gd_idlethread;
+ struct timeval gd_switchtime;
+ struct i386tss gd_common_tss;
+ int gd_switchticks;
+ struct segment_descriptor gd_common_tssd;
+ struct segment_descriptor *gd_tss_gdt;
+ int gd_currentldt;
+ u_int gd_cpuid;
+ u_int gd_other_cpus;
SLIST_ENTRY(globaldata) gd_allcpu;
struct lock_list_entry *gd_spinlocks;
#ifdef KTR_PERCPU
diff --git a/sys/i386/include/privatespace.h b/sys/i386/include/privatespace.h
index 496c4b6..83320cf 100644
--- a/sys/i386/include/privatespace.h
+++ b/sys/i386/include/privatespace.h
@@ -39,9 +39,9 @@ struct privatespace {
struct globaldata globaldata;
char __filler0[PAGE_SIZE - sizeof(struct globaldata)];
- /* page 1 - idle stack (UPAGES pages) */
- char idlestack[UPAGES * PAGE_SIZE];
- /* page 1+UPAGES... */
+ /* page 1 - idle stack (KSTACK_PAGES pages) */
+ char idlekstack[KSTACK_PAGES * PAGE_SIZE];
+ /* page 1+KSTACK_PAGES... */
};
extern struct privatespace SMP_prvspace[];
diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h
index 4217c4f..9e9e449 100644
--- a/sys/i386/include/proc.h
+++ b/sys/i386/include/proc.h
@@ -42,6 +42,9 @@
/*
* Machine-dependent part of the proc structure for i386.
*/
+struct mdthread {
+};
+
struct mdproc {
};
diff --git a/sys/i386/include/reg.h b/sys/i386/include/reg.h
index 47856a3..f4c6ae5 100644
--- a/sys/i386/include/reg.h
+++ b/sys/i386/include/reg.h
@@ -143,10 +143,10 @@ struct dbreg {
/*
* XXX these interfaces are MI, so they should be declared in a MI place.
*/
-int set_fpregs __P((struct proc *, struct fpreg *));
-int set_regs __P((struct proc *p, struct reg *regs));
-void setregs __P((struct proc *, u_long, u_long, u_long));
-int set_dbregs __P((struct proc *p, struct dbreg *dbregs));
+int set_fpregs __P((struct thread *, struct fpreg *));
+int set_regs __P((struct thread *p, struct reg *regs));
+void setregs __P((struct thread *, u_long, u_long, u_long));
+int set_dbregs __P((struct thread *p, struct dbreg *dbregs));
#endif
#endif /* !_MACHINE_REG_H_ */
diff --git a/sys/i386/include/vm86.h b/sys/i386/include/vm86.h
index 60c5615..fa77013 100644
--- a/sys/i386/include/vm86.h
+++ b/sys/i386/include/vm86.h
@@ -149,7 +149,7 @@ extern int vm86paddr;
struct proc;
extern int vm86_emulate __P((struct vm86frame *));
-extern int vm86_sysarch __P((struct proc *, char *));
+extern int vm86_sysarch __P((struct thread *, char *));
extern void vm86_trap __P((struct vm86frame *));
extern int vm86_intcall __P((int, struct vm86frame *));
extern int vm86_datacall __P((int, struct vm86frame *, struct vm86context *));
diff --git a/sys/i386/isa/apic_vector.s b/sys/i386/isa/apic_vector.s
index 5c68f81..8096d3c 100644
--- a/sys/i386/isa/apic_vector.s
+++ b/sys/i386/isa/apic_vector.s
@@ -48,10 +48,10 @@ IDTVEC(vec_name) ; \
movl $KPSEL,%eax ; \
mov %ax,%fs ; \
FAKE_MCOUNT(13*4(%esp)) ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
pushl intr_unit + (irq_num) * 4 ; \
- call *intr_handler + (irq_num) * 4 ; /* do the work ASAP */ \
+ call *intr_handler + (irq_num) * 4 ; /* do the work ASAP */ \
addl $4, %esp ; \
movl $0, lapic+LA_EOI ; \
lock ; \
@@ -59,7 +59,7 @@ IDTVEC(vec_name) ; \
movl intr_countp + (irq_num) * 4, %eax ; \
lock ; \
incl (%eax) ; \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
jmp doreti
@@ -152,8 +152,8 @@ IDTVEC(vec_name) ; \
MASK_LEVEL_IRQ(irq_num) ; \
EOI_IRQ(irq_num) ; \
0: ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
; \
/* entry point used by doreti_unpend for HWIs. */ \
__CONCAT(Xresume,irq_num): ; \
@@ -162,7 +162,7 @@ __CONCAT(Xresume,irq_num): ; \
call sched_ithd ; \
addl $4, %esp ; /* discard the parameter */ \
; \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
jmp doreti
@@ -227,10 +227,10 @@ Xhardclock:
movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
- movl PCPU(CURPROC),%ebx
- incl P_INTR_NESTING_LEVEL(%ebx)
+ movl PCPU(CURTHREAD),%ebx
+ incl TD_INTR_NESTING_LEVEL(%ebx)
call forwarded_hardclock
- decl P_INTR_NESTING_LEVEL(%ebx)
+ decl TD_INTR_NESTING_LEVEL(%ebx)
MEXITCOUNT
jmp doreti
@@ -252,10 +252,10 @@ Xstatclock:
movl $0, lapic+LA_EOI /* End Of Interrupt to APIC */
FAKE_MCOUNT(13*4(%esp))
- movl PCPU(CURPROC),%ebx
- incl P_INTR_NESTING_LEVEL(%ebx)
+ movl PCPU(CURTHREAD),%ebx
+ incl TD_INTR_NESTING_LEVEL(%ebx)
call forwarded_statclock
- decl P_INTR_NESTING_LEVEL(%ebx)
+ decl TD_INTR_NESTING_LEVEL(%ebx)
MEXITCOUNT
jmp doreti
diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c
index 2cc081e..9042fbc 100644
--- a/sys/i386/isa/asc.c
+++ b/sys/i386/isa/asc.c
@@ -552,7 +552,7 @@ ascintr(int unit)
***/
STATIC int
-ascopen(dev_t dev, int flags, int fmt, struct proc *p)
+ascopen(dev_t dev, int flags, int fmt, struct thread *td)
{
struct asc_unit *scu;
int unit;
@@ -647,7 +647,7 @@ asc_startread(struct asc_unit *scu)
***/
STATIC int
-ascclose(dev_t dev, int flags, int fmt, struct proc *p)
+ascclose(dev_t dev, int flags, int fmt, struct thread *td)
{
int unit = UNIT(minor(dev));
struct asc_unit *scu = unittab + unit;
@@ -794,7 +794,7 @@ ascread(dev_t dev, struct uio *uio, int ioflag)
***/
STATIC int
-ascioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
+ascioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td)
{
int unit = UNIT(minor(dev));
struct asc_unit *scu = unittab + unit;
@@ -859,7 +859,7 @@ ascioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
}
STATIC int
-ascpoll(dev_t dev, int events, struct proc *p)
+ascpoll(dev_t dev, int events, struct thread *td)
{
int unit = UNIT(minor(dev));
struct asc_unit *scu = unittab + unit;
@@ -875,7 +875,7 @@ ascpoll(dev_t dev, int events, struct proc *p)
if (!(scu->flags & DMA_ACTIVE))
dma_restart(scu);
- selrecord(p, &scu->selp);
+ selrecord(td, &scu->selp);
}
}
splx(sps);
diff --git a/sys/i386/isa/atpic_vector.s b/sys/i386/isa/atpic_vector.s
index 6b48737..3a42af4 100644
--- a/sys/i386/isa/atpic_vector.s
+++ b/sys/i386/isa/atpic_vector.s
@@ -61,8 +61,8 @@ IDTVEC(vec_name) ; \
mov $KPSEL,%ax ; \
mov %ax,%fs ; \
FAKE_MCOUNT((12+ACTUALLY_PUSHED)*4(%esp)) ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
pushl intr_unit + (irq_num) * 4 ; \
call *intr_handler + (irq_num) * 4 ; /* do the work ASAP */ \
enable_icus ; /* (re)enable ASAP (helps edge trigger?) */ \
@@ -70,7 +70,7 @@ IDTVEC(vec_name) ; \
incl cnt+V_INTR ; /* book-keeping can wait */ \
movl intr_countp + (irq_num) * 4,%eax ; \
incl (%eax) ; \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
jmp doreti
@@ -104,14 +104,14 @@ IDTVEC(vec_name) ; \
movb %al,imen + IRQ_BYTE(irq_num) ; \
outb %al,$icu+ICU_IMR_OFFSET ; \
enable_icus ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
__CONCAT(Xresume,irq_num): ; \
FAKE_MCOUNT(13*4(%esp)) ; /* XXX late to avoid double count */ \
pushl $irq_num; /* pass the IRQ */ \
call sched_ithd ; \
addl $4, %esp ; /* discard the parameter */ \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
/* We could usually avoid the following jmp by inlining some of */ \
/* doreti, but it's probably better to use less cache. */ \
diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c
index 9a387fc..c755004 100644
--- a/sys/i386/isa/ctx.c
+++ b/sys/i386/isa/ctx.c
@@ -218,7 +218,7 @@ ctxattach(struct isa_device * devp)
}
static int
-ctxopen(dev_t dev, int flags, int fmt, struct proc *p)
+ctxopen(dev_t dev, int flags, int fmt, struct thread *td)
{
struct ctx_soft_registers *sr;
u_char unit;
@@ -273,7 +273,7 @@ ctxopen(dev_t dev, int flags, int fmt, struct proc *p)
}
static int
-ctxclose(dev_t dev, int flags, int fmt, struct proc *p)
+ctxclose(dev_t dev, int flags, int fmt, struct thread *td)
{
int unit;
@@ -383,7 +383,7 @@ ctxread(dev_t dev, struct uio * uio, int ioflag)
}
static int
-ctxioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
+ctxioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td)
{
int error;
int unit, i;
diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c
index 1c473e9..e9817d0 100644
--- a/sys/i386/isa/cx.c
+++ b/sys/i386/isa/cx.c
@@ -111,7 +111,7 @@ static void cxoproc (struct tty *tp);
static void cxstop (struct tty *tp, int flag);
static int cxparam (struct tty *tp, struct termios *t);
-int cxopen (dev_t dev, int flag, int mode, struct proc *p)
+int cxopen (dev_t dev, int flag, int mode, struct thread *td)
{
int unit = UNIT (dev);
cx_chan_t *c = cxchan[unit];
@@ -162,7 +162,7 @@ int cxopen (dev_t dev, int flag, int mode, struct proc *p)
tp = c->ttyp;
tp->t_dev = dev;
if ((tp->t_state & TS_ISOPEN) && (tp->t_state & TS_XCLUDE) &&
- suser(p))
+ suser_td(td))
return (EBUSY);
if (! (tp->t_state & TS_ISOPEN)) {
ttychars (tp);
@@ -247,7 +247,7 @@ int cxopen (dev_t dev, int flag, int mode, struct proc *p)
return (error);
}
-int cxclose (dev_t dev, int flag, int mode, struct proc *p)
+int cxclose (dev_t dev, int flag, int mode, struct thread *td)
{
int unit = UNIT (dev);
cx_chan_t *c = cxchan[unit];
@@ -283,7 +283,7 @@ int cxclose (dev_t dev, int flag, int mode, struct proc *p)
return (0);
}
-int cxioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+int cxioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
int unit = UNIT (dev);
cx_chan_t *c, *m;
@@ -419,7 +419,7 @@ int cxioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if (! tp)
return (EINVAL);
#if __FreeBSD__ >= 2
- error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, data, flag, p);
+ error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, data, flag, td);
#else
error = (*linesw[tp->t_line].l_ioctl) (tp, cmd, data, flag);
#endif
diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c
index 9d6f2bb..728ea0a 100644
--- a/sys/i386/isa/cy.c
+++ b/sys/i386/isa/cy.c
@@ -662,11 +662,11 @@ cyattach_common(cy_iobase, cy_align)
}
static int
-sioopen(dev, flag, mode, p)
+sioopen(dev, flag, mode, td)
dev_t dev;
int flag;
int mode;
- struct proc *p;
+ struct thread *td;
{
struct com_s *com;
int error;
@@ -718,7 +718,7 @@ open_top:
}
}
if (tp->t_state & TS_XCLUDE &&
- suser(p)) {
+ suser_td(td)) {
error = EBUSY;
goto out;
}
@@ -847,11 +847,11 @@ out:
}
static int
-sioclose(dev, flag, mode, p)
+sioclose(dev, flag, mode, td)
dev_t dev;
int flag;
int mode;
- struct proc *p;
+ struct thread *td;
{
struct com_s *com;
int mynor;
@@ -1605,12 +1605,12 @@ siointr1(com)
#endif
static int
-sioioctl(dev, cmd, data, flag, p)
+sioioctl(dev, cmd, data, flag, td)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
- struct proc *p;
+ struct thread *td;
{
struct com_s *com;
int error;
@@ -1639,7 +1639,7 @@ sioioctl(dev, cmd, data, flag, p)
}
switch (cmd) {
case TIOCSETA:
- error = suser(p);
+ error = suser_td(td);
if (error != 0)
return (error);
*ct = *(struct termios *)data;
@@ -1689,7 +1689,7 @@ sioioctl(dev, cmd, data, flag, p)
if (lt->c_ospeed != 0)
dt->c_ospeed = tp->t_ospeed;
}
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
return (error);
s = spltty();
@@ -1738,7 +1738,7 @@ sioioctl(dev, cmd, data, flag, p)
break;
case TIOCMSDTRWAIT:
/* must be root since the wait applies to following logins */
- error = suser(p);
+ error = suser_td(td);
if (error != 0) {
splx(s);
return (error);
diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c
index 8792395..4b96605 100644
--- a/sys/i386/isa/gpib.c
+++ b/sys/i386/isa/gpib.c
@@ -163,11 +163,11 @@ gpattach(isdp)
* i.e. even if gpib5 is open, we can't open another minor device
*/
static int
-gpopen(dev, flags, fmt, p)
+gpopen(dev, flags, fmt, td)
dev_t dev;
int flags;
int fmt;
- struct proc *p;
+ struct thread *td;
{
struct gpib_softc *sc = &gpib_sc;
u_char unit;
@@ -241,11 +241,11 @@ enableremote(unit);
* Close gpib device.
*/
static int
-gpclose(dev, flags, fmt, p)
+gpclose(dev, flags, fmt, td)
dev_t dev;
int flags;
int fmt;
- struct proc *p;
+ struct thread *td;
{
struct gpib_softc *sc = &gpib_sc;
unsigned char unit;
@@ -397,7 +397,7 @@ gpwrite(dev, uio, ioflag)
write to using a minor device = its GPIB address */
static int
-gpioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
+gpioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td)
{
struct gpibdata *gd = (struct gpibdata *)data;
int error,result;
diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c
index 8d7ded3..29ad157 100644
--- a/sys/i386/isa/gsc.c
+++ b/sys/i386/isa/gsc.c
@@ -563,7 +563,7 @@ gscattach(struct isa_device *isdp)
*/
static int
-gscopen (dev_t dev, int flags, int fmt, struct proc *p)
+gscopen (dev_t dev, int flags, int fmt, struct thread *td)
{
struct gsc_unit *scu;
int unit;
@@ -630,7 +630,7 @@ gscopen (dev_t dev, int flags, int fmt, struct proc *p)
*/
static int
-gscclose (dev_t dev, int flags, int fmt, struct proc *p)
+gscclose (dev_t dev, int flags, int fmt, struct thread *td)
{
int unit = UNIT(minor(dev));
struct gsc_unit *scu = unittab + unit;
@@ -753,7 +753,7 @@ gscread (dev_t dev, struct uio *uio, int ioflag)
*/
static int
-gscioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+gscioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
int unit = UNIT(minor(dev));
struct gsc_unit *scu = unittab + unit;
diff --git a/sys/i386/isa/icu_vector.s b/sys/i386/isa/icu_vector.s
index 6b48737..3a42af4 100644
--- a/sys/i386/isa/icu_vector.s
+++ b/sys/i386/isa/icu_vector.s
@@ -61,8 +61,8 @@ IDTVEC(vec_name) ; \
mov $KPSEL,%ax ; \
mov %ax,%fs ; \
FAKE_MCOUNT((12+ACTUALLY_PUSHED)*4(%esp)) ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
pushl intr_unit + (irq_num) * 4 ; \
call *intr_handler + (irq_num) * 4 ; /* do the work ASAP */ \
enable_icus ; /* (re)enable ASAP (helps edge trigger?) */ \
@@ -70,7 +70,7 @@ IDTVEC(vec_name) ; \
incl cnt+V_INTR ; /* book-keeping can wait */ \
movl intr_countp + (irq_num) * 4,%eax ; \
incl (%eax) ; \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
jmp doreti
@@ -104,14 +104,14 @@ IDTVEC(vec_name) ; \
movb %al,imen + IRQ_BYTE(irq_num) ; \
outb %al,$icu+ICU_IMR_OFFSET ; \
enable_icus ; \
- movl PCPU(CURPROC),%ebx ; \
- incl P_INTR_NESTING_LEVEL(%ebx) ; \
+ movl PCPU(CURTHREAD),%ebx ; \
+ incl TD_INTR_NESTING_LEVEL(%ebx) ; \
__CONCAT(Xresume,irq_num): ; \
FAKE_MCOUNT(13*4(%esp)) ; /* XXX late to avoid double count */ \
pushl $irq_num; /* pass the IRQ */ \
call sched_ithd ; \
addl $4, %esp ; /* discard the parameter */ \
- decl P_INTR_NESTING_LEVEL(%ebx) ; \
+ decl TD_INTR_NESTING_LEVEL(%ebx) ; \
MEXITCOUNT ; \
/* We could usually avoid the following jmp by inlining some of */ \
/* doreti, but it's probably better to use less cache. */ \
diff --git a/sys/i386/isa/ipl.s b/sys/i386/isa/ipl.s
index d429f5a..c1b1d86 100644
--- a/sys/i386/isa/ipl.s
+++ b/sys/i386/isa/ipl.s
@@ -72,8 +72,9 @@ doreti_ast:
* since we will be informed of any new ASTs by an IPI.
*/
cli
- movl PCPU(CURPROC),%eax
- testl $PS_ASTPENDING | PS_NEEDRESCHED,P_SFLAG(%eax)
+ movl PCPU(CURTHREAD),%eax
+ movl TD_KSE(%eax), %eax
+ testl $KEF_ASTPENDING | KEF_NEEDRESCHED,KE_FLAGS(%eax)
je doreti_exit
sti
pushl %esp /* pass a pointer to the trapframe */
diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c
index b8ba4db..0b95211 100644
--- a/sys/i386/isa/istallion.c
+++ b/sys/i386/isa/istallion.c
@@ -573,7 +573,7 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp,
struct termios *tiosp);
static int stli_memrw(dev_t dev, struct uio *uiop, int flag);
static int stli_memioctl(dev_t dev, unsigned long cmd, caddr_t data,
- int flag, struct proc *p);
+ int flag, struct thread *td);
static int stli_getbrdstats(caddr_t data);
static int stli_getportstats(stliport_t *portp, caddr_t data);
static int stli_clrportstats(stliport_t *portp, caddr_t data);
@@ -925,7 +925,7 @@ static int stliattach(struct isa_device *idp)
/*****************************************************************************/
-STATIC int stliopen(dev_t dev, int flag, int mode, struct proc *p)
+STATIC int stliopen(dev_t dev, int flag, int mode, struct thread *td)
{
struct tty *tp;
stliport_t *portp;
@@ -933,7 +933,7 @@ STATIC int stliopen(dev_t dev, int flag, int mode, struct proc *p)
#if DEBUG
printf("stliopen(dev=%x,flag=%x,mode=%x,p=%x)\n", (int) dev, flag,
- mode, (int) p);
+ mode, (int) td);
#endif
/*
@@ -1010,7 +1010,7 @@ stliopen_restart:
}
}
if ((tp->t_state & TS_XCLUDE) &&
- suser(p)) {
+ suser_td(td)) {
error = EBUSY;
goto stliopen_end;
}
@@ -1054,7 +1054,7 @@ stliopen_end:
/*****************************************************************************/
-STATIC int stliclose(dev_t dev, int flag, int mode, struct proc *p)
+STATIC int stliclose(dev_t dev, int flag, int mode, struct thread *td)
{
struct tty *tp;
stliport_t *portp;
@@ -1062,7 +1062,7 @@ STATIC int stliclose(dev_t dev, int flag, int mode, struct proc *p)
#if DEBUG
printf("stliclose(dev=%s,flag=%x,mode=%x,p=%p)\n",
- devtoname(dev), flag, mode, (void *) p);
+ devtoname(dev), flag, mode, (void *) td);
#endif
if (minor(dev) & STL_MEMDEV)
@@ -1142,7 +1142,7 @@ STATIC int stliwrite(dev_t dev, struct uio *uiop, int flag)
/*****************************************************************************/
STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
- struct proc *p)
+ struct thread *td)
{
struct termios *newtios, *localtios;
struct tty *tp;
@@ -1153,11 +1153,11 @@ STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
#if DEBUG
printf("stliioctl(dev=%s,cmd=%lx,data=%p,flag=%x,p=%p)\n",
- devtoname(dev), cmd, (void *) data, flag, (void *) p);
+ devtoname(dev), cmd, (void *) data, flag, (void *) td);
#endif
if (minor(dev) & STL_MEMDEV)
- return(stli_memioctl(dev, cmd, data, flag, p));
+ return(stli_memioctl(dev, cmd, data, flag, td));
portp = stli_dev2port(dev);
if (portp == (stliport_t *) NULL)
@@ -1182,7 +1182,7 @@ STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
switch (cmd) {
case TIOCSETA:
- if ((error = suser(p)) == 0)
+ if ((error = suser_td(td)) == 0)
*localtios = *((struct termios *) data);
break;
case TIOCGETA:
@@ -1249,7 +1249,7 @@ STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
* Call the line discipline and the common command processing to
* process this command (if they can).
*/
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
return(error);
@@ -1318,7 +1318,7 @@ STATIC int stliioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
*((int *) data) = (portp->sigs | TIOCM_LE);
break;
case TIOCMSDTRWAIT:
- if ((error = suser(p)) == 0)
+ if ((error = suser_td(td)) == 0)
portp->dtrwait = *((int *) data) * hz / 100;
break;
case TIOCMGDTRWAIT:
@@ -3799,7 +3799,7 @@ STATIC int stli_memrw(dev_t dev, struct uio *uiop, int flag)
*/
static int stli_memioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
- struct proc *p)
+ struct thread *td)
{
stlibrd_t *brdp;
int brdnr, rc;
diff --git a/sys/i386/isa/loran.c b/sys/i386/isa/loran.c
index cedcd0f..9ad1a4a 100644
--- a/sys/i386/isa/loran.c
+++ b/sys/i386/isa/loran.c
@@ -328,7 +328,7 @@ loranattach(struct isa_device *isdp)
}
static int
-loranopen (dev_t dev, int flags, int fmt, struct proc *p)
+loranopen (dev_t dev, int flags, int fmt, struct thread *td)
{
int idx;
@@ -340,7 +340,7 @@ loranopen (dev_t dev, int flags, int fmt, struct proc *p)
}
static int
-loranclose(dev_t dev, int flags, int fmt, struct proc *p)
+loranclose(dev_t dev, int flags, int fmt, struct thread *td)
{
return(0);
}
diff --git a/sys/i386/isa/matcd/matcd.c b/sys/i386/isa/matcd/matcd.c
index 7c3e758..0ec1c2e 100644
--- a/sys/i386/isa/matcd/matcd.c
+++ b/sys/i386/isa/matcd/matcd.c
@@ -608,7 +608,7 @@ static int docmd(char * cmd, int ldrive, int cdrive,
<15> the drive to be locked while being accessed.
---------------------------------------------------------------------------*/
int matcdopen(dev_t dev, int flags, int fmt,
- struct proc *p)
+ struct thread *td)
{
int cdrive,ldrive,partition,controller,lock;
struct matcd_data *cd;
@@ -797,7 +797,7 @@ int matcdopen(dev_t dev, int flags, int fmt,
---------------------------------------------------------------------------*/
int matcdclose(dev_t dev, int flags, int fmt,
- struct proc *p)
+ struct thread *td)
{
int ldrive,cdrive,port,partition,controller,lock;
struct matcd_data *cd;
@@ -985,7 +985,7 @@ static void matcd_start(int controller)
---------------------------------------------------------------------------*/
int matcdioctl(dev_t dev, u_long command, caddr_t addr,
- int flags, struct proc *p)
+ int flags, struct thread *td)
{
struct matcd_data *cd;
int ldrive,cdrive,partition;
@@ -2062,7 +2062,7 @@ nextblock:
int docmd(char * cmd, int ldrive, int cdrive, int controller, int port)
{
- int retries,i,z;
+ int retries,i=0,z;
lockbus(controller, ldrive); /*Request bus*/
retries=3;
diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c
index 6f8c0f7..f295a43 100644
--- a/sys/i386/isa/mcd.c
+++ b/sys/i386/isa/mcd.c
@@ -270,7 +270,7 @@ int mcd_attach(struct isa_device *dev)
return 1;
}
-int mcdopen(dev_t dev, int flags, int fmt, struct proc *p)
+int mcdopen(dev_t dev, int flags, int fmt, struct thread *td)
{
int unit,part,phys,r,retry;
struct mcd_data *cd;
@@ -362,7 +362,7 @@ MCD_TRACE("open: partition=%d, disksize = %ld, blksize=%d\n",
return ENXIO;
}
-int mcdclose(dev_t dev, int flags, int fmt, struct proc *p)
+int mcdclose(dev_t dev, int flags, int fmt, struct thread *td)
{
int unit,part;
struct mcd_data *cd;
@@ -504,7 +504,7 @@ static void mcd_start(int unit)
return;
}
-int mcdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
+int mcdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
{
struct mcd_data *cd;
int unit,part,retry,r;
diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c
index 073ea7a..915bc3f 100644
--- a/sys/i386/isa/mse.c
+++ b/sys/i386/isa/mse.c
@@ -394,11 +394,11 @@ mse_detach(dev)
* Exclusive open the mouse, initialize it and enable interrupts.
*/
static int
-mseopen(dev, flags, fmt, p)
+mseopen(dev, flags, fmt, td)
dev_t dev;
int flags;
int fmt;
- struct proc *p;
+ struct thread *td;
{
mse_softc_t *sc;
int s;
@@ -434,11 +434,11 @@ mseopen(dev, flags, fmt, p)
* mseclose: just turn off mouse innterrupts.
*/
static int
-mseclose(dev, flags, fmt, p)
+mseclose(dev, flags, fmt, td)
dev_t dev;
int flags;
int fmt;
- struct proc *p;
+ struct thread *td;
{
mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
int s;
@@ -525,12 +525,12 @@ mseread(dev, uio, ioflag)
* mseioctl: process ioctl commands.
*/
static int
-mseioctl(dev, cmd, addr, flag, p)
+mseioctl(dev, cmd, addr, flag, td)
dev_t dev;
u_long cmd;
caddr_t addr;
int flag;
- struct proc *p;
+ struct thread *td;
{
mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
mousestatus_t status;
@@ -642,10 +642,10 @@ mseioctl(dev, cmd, addr, flag, p)
* msepoll: check for mouse input to be processed.
*/
static int
-msepoll(dev, events, p)
+msepoll(dev, events, td)
dev_t dev;
int events;
- struct proc *p;
+ struct thread *td;
{
mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
int s;
@@ -662,7 +662,7 @@ msepoll(dev, events, p)
* Since this is an exclusive open device, any previous
* proc pointer is trash now, so we can just assign it.
*/
- selrecord(p, &sc->sc_selp);
+ selrecord(td, &sc->sc_selp);
}
}
splx(s);
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index 4fe3d04..84534ea 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -128,23 +128,23 @@ void stop_emulating __P((void));
#endif /* __GNUC__ */
#ifdef CPU_ENABLE_SSE
-#define GET_FPU_CW(proc) \
+#define GET_FPU_CW(thread) \
(cpu_fxsr ? \
- (proc)->p_addr->u_pcb.pcb_save.sv_xmm.sv_env.en_cw : \
- (proc)->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_cw)
-#define GET_FPU_SW(proc) \
+ (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_cw : \
+ (thread)->td_pcb->pcb_save.sv_87.sv_env.en_cw)
+#define GET_FPU_SW(thread) \
(cpu_fxsr ? \
- (proc)->p_addr->u_pcb.pcb_save.sv_xmm.sv_env.en_sw : \
- (proc)->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_sw)
+ (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw : \
+ (thread)->td_pcb->pcb_save.sv_87.sv_env.en_sw)
#define GET_FPU_EXSW_PTR(pcb) \
(cpu_fxsr ? \
&(pcb)->pcb_save.sv_xmm.sv_ex_sw : \
&(pcb)->pcb_save.sv_87.sv_ex_sw)
#else /* CPU_ENABLE_SSE */
-#define GET_FPU_CW(proc) \
- (proc->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_cw)
-#define GET_FPU_SW(proc) \
- (proc->p_addr->u_pcb.pcb_save.sv_87.sv_env.en_sw)
+#define GET_FPU_CW(thread) \
+ (thread->td_pcb->pcb_save.sv_87.sv_env.en_cw)
+#define GET_FPU_SW(thread) \
+ (thread->td_pcb->pcb_save.sv_87.sv_env.en_sw)
#define GET_FPU_EXSW_PTR(pcb) \
(&(pcb)->pcb_save.sv_87.sv_ex_sw)
#endif /* CPU_ENABLE_SSE */
@@ -241,7 +241,7 @@ static void
npx_intr(dummy)
void *dummy;
{
- struct proc *p;
+ struct thread *td;
/*
* The BUSY# latch must be cleared in all cases so that the next
@@ -250,22 +250,22 @@ npx_intr(dummy)
outb(0xf0, 0);
/*
- * npxproc is normally non-null here. In that case, schedule an
+ * npxthread is normally non-null here. In that case, schedule an
* AST to finish the exception handling in the correct context
- * (this interrupt may occur after the process has entered the
+ * (this interrupt may occur after the thread has entered the
* kernel via a syscall or an interrupt). Otherwise, the npx
- * state of the process that caused this interrupt must have been
- * pushed to the process' pcb, and clearing of the busy latch
+ * state of the thread that caused this interrupt must have been
+ * pushed to the thread' pcb, and clearing of the busy latch
* above has finished the (essentially null) handling of this
* interrupt. Control will eventually return to the instruction
* that caused it and it will repeat. We will eventually (usually
* soon) win the race to handle the interrupt properly.
*/
- p = PCPU_GET(npxproc);
- if (p != NULL) {
- p->p_addr->u_pcb.pcb_flags |= PCB_NPXTRAP;
+ td = PCPU_GET(npxthread);
+ if (td != NULL) {
+ td->td_pcb->pcb_flags |= PCB_NPXTRAP;
mtx_lock_spin(&sched_lock);
- p->p_sflag |= PS_ASTPENDING;
+ td->td_kse->ke_flags |= KEF_ASTPENDING;
mtx_unlock_spin(&sched_lock);
}
}
@@ -570,7 +570,7 @@ npxinit(control)
/*
* fninit has the same h/w bugs as fnsave. Use the detoxified
* fnsave to throw away any junk in the fpu. npxsave() initializes
- * the fpu and sets npxproc = NULL as important side effects.
+ * the fpu and sets npxthread = NULL as important side effects.
*/
savecrit = critical_enter();
npxsave(&dummy);
@@ -586,13 +586,13 @@ npxinit(control)
* Free coprocessor (if we have it).
*/
void
-npxexit(p)
- struct proc *p;
+npxexit(td)
+ struct thread *td;
{
critical_t savecrit;
savecrit = critical_enter();
- if (p == PCPU_GET(npxproc))
+ if (td == PCPU_GET(npxthread))
npxsave(&PCPU_GET(curpcb)->pcb_save);
critical_exit(savecrit);
#ifdef NPX_DEBUG
@@ -607,8 +607,9 @@ npxexit(p)
*/
if (masked_exceptions & 0x0d)
log(LOG_ERR,
- "pid %d (%s) exited with masked floating point exceptions 0x%02x\n",
- p->p_pid, p->p_comm, masked_exceptions);
+ "pid %d (%s) exited with masked floating"
+ " point exceptions 0x%02x\n",
+ td->td_proc->p_pid, td->td_proc->p_comm, masked_exceptions);
}
#endif
}
@@ -809,8 +810,8 @@ npxtrap()
u_long *exstat;
if (!npx_exists) {
- printf("npxtrap: npxproc = %p, curproc = %p, npx_exists = %d\n",
- PCPU_GET(npxproc), curproc, npx_exists);
+ printf("npxtrap: npxthread = %p, curthread = %p, npx_exists = %d\n",
+ PCPU_GET(npxthread), curthread, npx_exists);
panic("npxtrap from nowhere");
}
savecrit = critical_enter();
@@ -820,18 +821,18 @@ npxtrap()
* state to memory. Fetch the relevant parts of the state from
* wherever they are.
*/
- if (PCPU_GET(npxproc) != curproc) {
- control = GET_FPU_CW(curproc);
- status = GET_FPU_SW(curproc);
+ if (PCPU_GET(npxthread) != curthread) {
+ control = GET_FPU_CW(curthread);
+ status = GET_FPU_SW(curthread);
} else {
fnstcw(&control);
fnstsw(&status);
}
- exstat = GET_FPU_EXSW_PTR(&curproc->p_addr->u_pcb);
+ exstat = GET_FPU_EXSW_PTR(curthread->td_pcb);
*exstat = status;
- if (PCPU_GET(npxproc) != curproc)
- GET_FPU_SW(curproc) &= ~0x80bf;
+ if (PCPU_GET(npxthread) != curthread)
+ GET_FPU_SW(curthread) &= ~0x80bf;
else
fnclex();
critical_exit(savecrit);
@@ -841,7 +842,7 @@ npxtrap()
/*
* Implement device not available (DNA) exception
*
- * It would be better to switch FP context here (if curproc != npxproc)
+ * It would be better to switch FP context here (if curthread != npxthread)
* and not necessarily for every context switch, but it is too hard to
* access foreign pcb's.
*/
@@ -853,9 +854,9 @@ npxdna()
if (!npx_exists)
return (0);
- if (PCPU_GET(npxproc) != NULL) {
- printf("npxdna: npxproc = %p, curproc = %p\n",
- PCPU_GET(npxproc), curproc);
+ if (PCPU_GET(npxthread) != NULL) {
+ printf("npxdna: npxthread = %p, curthread = %p\n",
+ PCPU_GET(npxthread), curthread);
panic("npxdna");
}
s = critical_enter();
@@ -863,7 +864,7 @@ npxdna()
/*
* Record new context early in case frstor causes an IRQ13.
*/
- PCPU_SET(npxproc, CURPROC);
+ PCPU_SET(npxthread, curthread);
exstat = GET_FPU_EXSW_PTR(PCPU_GET(curpcb));
*exstat = 0;
@@ -895,13 +896,13 @@ npxdna()
* after the process has entered the kernel. It may even be delivered after
* the fnsave here completes. A spurious IRQ13 for the fnsave is handled in
* the same way as a very-late-arriving non-spurious IRQ13 from user mode:
- * it is normally ignored at first because we set npxproc to NULL; it is
+ * it is normally ignored at first because we set npxthread to NULL; it is
* normally retriggered in npxdna() after return to user mode.
*
* npxsave() must be called with interrupts disabled, so that it clears
- * npxproc atomically with saving the state. We require callers to do the
+ * npxthread atomically with saving the state. We require callers to do the
* disabling, since most callers need to disable interrupts anyway to call
- * npxsave() atomically with checking npxproc.
+ * npxsave() atomically with checking npxthread.
*
* A previous version of npxsave() went to great lengths to excecute fnsave
* with interrupts enabled in case executing it froze the CPU. This case
@@ -917,7 +918,7 @@ npxsave(addr)
fpusave(addr);
start_emulating();
- PCPU_SET(npxproc, NULL);
+ PCPU_SET(npxthread, NULL);
}
static void
diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c
index ebfce44..8002fcc 100644
--- a/sys/i386/isa/pcaudio.c
+++ b/sys/i386/isa/pcaudio.c
@@ -361,7 +361,7 @@ DRIVER_MODULE(pca, isa, pca_driver, pca_devclass, 0, 0);
static int
-pcaopen(dev_t dev, int flags, int fmt, struct proc *p)
+pcaopen(dev_t dev, int flags, int fmt, struct thread *td)
{
/* audioctl device can always be opened */
if (minor(dev) == 128)
@@ -389,7 +389,7 @@ pcaopen(dev_t dev, int flags, int fmt, struct proc *p)
static int
-pcaclose(dev_t dev, int flags, int fmt, struct proc *p)
+pcaclose(dev_t dev, int flags, int fmt, struct thread *td)
{
/* audioctl device can always be closed */
if (minor(dev) == 128)
@@ -460,7 +460,7 @@ pcawrite(dev_t dev, struct uio *uio, int flag)
static int
-pcaioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+pcaioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
audio_info_t *auptr;
@@ -560,7 +560,7 @@ pcaintr(struct clockframe *frame)
static int
-pcapoll(dev_t dev, int events, struct proc *p)
+pcapoll(dev_t dev, int events, struct thread *td)
{
int s;
int revents = 0;
@@ -572,7 +572,7 @@ pcapoll(dev_t dev, int events, struct proc *p)
!pca_status.in_use[2])
revents |= events & (POLLOUT | POLLWRNORM);
else
- selrecord(p, &pca_status.wsel);
+ selrecord(td, &pca_status.wsel);
}
splx(s);
return (revents);
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c
index 3c1cdea..3b0a64f 100644
--- a/sys/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/i386/isa/pcvt/pcvt_drv.c
@@ -280,7 +280,7 @@ pcvt_attach(device_t dev)
* driver open
*---------------------------------------------------------------------------*/
static int
-pcvt_open(dev_t dev, int flag, int mode, struct proc *p)
+pcvt_open(dev_t dev, int flag, int mode, struct thread *td)
{
register struct tty *tp;
register struct video_state *vsx;
@@ -316,7 +316,7 @@ pcvt_open(dev_t dev, int flag, int mode, struct proc *p)
(*linesw[tp->t_line].l_modem)(tp, 1); /* fake connection */
winsz = 1; /* set winsize later */
}
- else if (tp->t_state & TS_XCLUDE && suser(p))
+ else if (tp->t_state & TS_XCLUDE && suser_td(td))
{
return (EBUSY);
}
@@ -348,7 +348,7 @@ pcvt_open(dev_t dev, int flag, int mode, struct proc *p)
* driver close
*---------------------------------------------------------------------------*/
static int
-pcvt_close(dev_t dev, int flag, int mode, struct proc *p)
+pcvt_close(dev_t dev, int flag, int mode, struct thread *td)
{
register struct tty *tp;
register struct video_state *vsx;
@@ -378,7 +378,7 @@ pcvt_close(dev_t dev, int flag, int mode, struct proc *p)
* driver ioctl
*---------------------------------------------------------------------------*/
static int
-pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
register int error;
register struct tty *tp;
@@ -396,7 +396,7 @@ pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
*/
#ifdef XSERVER
- if((error = usl_vt_ioctl(dev, cmd, data, flag, p)) >= 0)
+ if((error = usl_vt_ioctl(dev, cmd, data, flag, td)) >= 0)
return error;
#endif /* XSERVER */
@@ -406,7 +406,7 @@ pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if((error = vgaioctl(dev,cmd,data,flag)) >= 0)
return error;
- if((error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p))
+ if((error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td))
!= ENOIOCTL)
return (error);
diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c
index 967c928..7c9ed5f 100644
--- a/sys/i386/isa/pcvt/pcvt_ext.c
+++ b/sys/i386/isa/pcvt/pcvt_ext.c
@@ -2392,8 +2392,9 @@ vgapage(int new_screen)
* ioctl handling for VT_USL mode
*---------------------------------------------------------------------------*/
int
-usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
+usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
{
+ struct proc *p = td->td_proc;
int i, j, error, opri;
struct vt_mode newmode;
@@ -2613,9 +2614,9 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
/* grant the process IO access; only allowed if euid == 0 */
/* and insecure */
{
- struct trapframe *fp = p->p_frame;
+ struct trapframe *fp = td->td_frame;
- error = suser(p);
+ error = suser_td(td);
if (error != 0)
return (error);
if (securelevel > 0)
@@ -2629,7 +2630,7 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
case KDDISABIO:
/* abandon IO access permission */
{
- struct trapframe *fp = p->p_frame;
+ struct trapframe *fp = td->td_frame;
fp->tf_eflags &= ~PSL_IOPL;
return 0;
}
diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h
index 4c9f540..46ea500 100644
--- a/sys/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/i386/isa/pcvt/pcvt_hdr.h
@@ -994,7 +994,7 @@ void update_hp ( struct video_state *svsp );
void update_led ( void );
#ifdef XSERVER
-int usl_vt_ioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *);
+int usl_vt_ioctl (dev_t dev, int cmd, caddr_t data, int flag, struct thread *);
#endif
void vga10_vga10 ( u_char *invga, u_char *outvga );
diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c
index e4252e0..59e8dff 100644
--- a/sys/i386/isa/rc.c
+++ b/sys/i386/isa/rc.c
@@ -715,10 +715,10 @@ rc_stop(tp, rw)
}
static int
-rcopen(dev, flag, mode, p)
+rcopen(dev, flag, mode, td)
dev_t dev;
int flag, mode;
- struct proc *p;
+ struct thread *td;
{
register struct rc_chans *rc;
register struct tty *tp;
@@ -764,7 +764,7 @@ again:
}
}
if (tp->t_state & TS_XCLUDE &&
- suser(p)) {
+ suser_td(td)) {
error = EBUSY;
goto out;
}
@@ -810,10 +810,10 @@ out:
}
static int
-rcclose(dev, flag, mode, p)
+rcclose(dev, flag, mode, td)
dev_t dev;
int flag, mode;
- struct proc *p;
+ struct thread *td;
{
register struct rc_chans *rc;
register struct tty *tp;
@@ -1064,18 +1064,18 @@ struct rc_softc *rcb;
}
static int
-rcioctl(dev, cmd, data, flag, p)
+rcioctl(dev, cmd, data, flag, td)
dev_t dev;
u_long cmd;
int flag;
caddr_t data;
-struct proc *p;
+struct thread *td;
{
register struct rc_chans *rc = &rc_chans[GET_UNIT(dev)];
register int s, error;
struct tty *tp = rc->rc_tp;
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
return (error);
error = ttioctl(tp, cmd, data, flag);
@@ -1118,7 +1118,7 @@ struct proc *p;
break;
case TIOCMSDTRWAIT:
- error = suser(p);
+ error = suser_td(td);
if (error != 0) {
splx(s);
return (error);
diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c
index 1ab5afa..4561d90 100644
--- a/sys/i386/isa/scd.c
+++ b/sys/i386/isa/scd.c
@@ -232,7 +232,7 @@ scd_attach(struct isa_device *dev)
}
static int
-scdopen(dev_t dev, int flags, int fmt, struct proc *p)
+scdopen(dev_t dev, int flags, int fmt, struct thread *td)
{
int unit,part,phys;
int rc;
@@ -286,7 +286,7 @@ scdopen(dev_t dev, int flags, int fmt, struct proc *p)
}
static int
-scdclose(dev_t dev, int flags, int fmt, struct proc *p)
+scdclose(dev_t dev, int flags, int fmt, struct thread *td)
{
int unit,part,phys;
struct scd_data *cd;
@@ -418,7 +418,7 @@ scd_start(int unit)
}
static int
-scdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
+scdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
{
struct scd_data *cd;
int unit,part;
diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c
index 9593d73..a708658 100644
--- a/sys/i386/isa/spic.c
+++ b/sys/i386/isa/spic.c
@@ -362,7 +362,7 @@ spictimeout(void *arg)
}
static int
-spicopen(dev_t dev, int flag, int fmt, struct proc *p)
+spicopen(dev_t dev, int flag, int fmt, struct thread *td)
{
struct spic_softc *sc;
@@ -380,7 +380,7 @@ spicopen(dev_t dev, int flag, int fmt, struct proc *p)
}
static int
-spicclose(dev_t dev, int flag, int fmt, struct proc *p)
+spicclose(dev_t dev, int flag, int fmt, struct thread *td)
{
struct spic_softc *sc;
@@ -427,7 +427,7 @@ spicread(dev_t dev, struct uio *uio, int flag)
}
static int
-spicioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
+spicioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
{
struct spic_softc *sc;
@@ -437,7 +437,7 @@ spicioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
}
static int
-spicpoll(dev_t dev, int events, struct proc *p)
+spicpoll(dev_t dev, int events, struct thread *td)
{
struct spic_softc *sc;
int revents = 0, s;
@@ -448,7 +448,7 @@ spicpoll(dev_t dev, int events, struct proc *p)
if (sc->sc_count)
revents |= events & (POLLIN | POLLRDNORM);
else
- selrecord(p, &sc->sc_rsel); /* Who shall we wake? */
+ selrecord(td, &sc->sc_rsel); /* Who shall we wake? */
}
splx(s);
diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c
index db4a926..0bd87ff 100644
--- a/sys/i386/isa/spigot.c
+++ b/sys/i386/isa/spigot.c
@@ -161,7 +161,7 @@ spigot_attach(struct isa_device *devp)
}
static int
-spigot_open(dev_t dev, int flags, int fmt, struct proc *p)
+spigot_open(dev_t dev, int flags, int fmt, struct thread *td)
{
int error;
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
@@ -179,7 +179,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
* require sufficient privilege soon and nothing much can be done
* without them.
*/
- error = suser(p);
+ error = suser_td(td);
if (error != 0)
return error;
if (securelevel > 0)
@@ -194,7 +194,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
}
static int
-spigot_close(dev_t dev, int flags, int fmt, struct proc *p)
+spigot_close(dev_t dev, int flags, int fmt, struct thread *td)
{
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
@@ -221,7 +221,7 @@ spigot_read(dev_t dev, struct uio *uio, int ioflag)
static int
-spigot_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+spigot_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
int error;
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
@@ -230,21 +230,21 @@ struct spigot_info *info;
if(!data) return(EINVAL);
switch(cmd){
case SPIGOT_SETINT:
- ss->p = p;
+ ss->p = td->td_proc;
ss->signal_num = *((int *)data);
break;
case SPIGOT_IOPL_ON: /* allow access to the IO PAGE */
#if !defined(SPIGOT_UNSECURE)
- error = suser(p);
+ error = suser_td(td);
if (error != 0)
return error;
if (securelevel > 0)
return EPERM;
#endif
- p->p_frame->tf_eflags |= PSL_IOPL;
+ td->td_frame->tf_eflags |= PSL_IOPL;
break;
case SPIGOT_IOPL_OFF: /* deny access to the IO PAGE */
- p->p_frame->tf_eflags &= ~PSL_IOPL;
+ td->td_frame->tf_eflags &= ~PSL_IOPL;
break;
case SPIGOT_GET_INFO:
info = (struct spigot_info *)data;
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 0fadea8..e0986de 100644
--- a/sys/i386/isa/spkr.c
+++ b/sys/i386/isa/spkr.c
@@ -460,11 +460,11 @@ static int spkr_active = FALSE; /* exclusion flag */
static char *spkr_inbuf; /* incoming buf */
int
-spkropen(dev, flags, fmt, p)
+spkropen(dev, flags, fmt, td)
dev_t dev;
int flags;
int fmt;
- struct proc *p;
+ struct thread *td;
{
#ifdef DEBUG
(void) printf("spkropen: entering with dev = %s\n", devtoname(dev));
@@ -519,11 +519,11 @@ spkrwrite(dev, uio, ioflag)
}
int
-spkrclose(dev, flags, fmt, p)
+spkrclose(dev, flags, fmt, td)
dev_t dev;
int flags;
int fmt;
- struct proc *p;
+ struct thread *td;
{
#ifdef DEBUG
(void) printf("spkrclose: entering with dev = %s\n", devtoname(dev));
@@ -542,12 +542,12 @@ spkrclose(dev, flags, fmt, p)
}
int
-spkrioctl(dev, cmd, cmdarg, flags, p)
+spkrioctl(dev, cmd, cmdarg, flags, td)
dev_t dev;
unsigned long cmd;
caddr_t cmdarg;
int flags;
- struct proc *p;
+ struct thread *td;
{
#ifdef DEBUG
(void) printf("spkrioctl: entering with dev = %s, cmd = %lx\n",
diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c
index b77ec96..c9c0df5 100644
--- a/sys/i386/isa/stallion.c
+++ b/sys/i386/isa/stallion.c
@@ -484,7 +484,7 @@ static void stl_disableintrs(stlport_t *portp);
static void stl_sendbreak(stlport_t *portp, long len);
static void stl_flush(stlport_t *portp, int flag);
static int stl_memioctl(dev_t dev, unsigned long cmd, caddr_t data,
- int flag, struct proc *p);
+ int flag, struct thread *td);
static int stl_getbrdstats(caddr_t data);
static int stl_getportstats(stlport_t *portp, caddr_t data);
static int stl_clrportstats(stlport_t *portp, caddr_t data);
@@ -759,7 +759,7 @@ void stlpciattach(pcici_t tag, int unit)
/*****************************************************************************/
-STATIC int stlopen(dev_t dev, int flag, int mode, struct proc *p)
+STATIC int stlopen(dev_t dev, int flag, int mode, struct thread *td)
{
struct tty *tp;
stlport_t *portp;
@@ -767,7 +767,7 @@ STATIC int stlopen(dev_t dev, int flag, int mode, struct proc *p)
#if DEBUG
printf("stlopen(dev=%x,flag=%x,mode=%x,p=%x)\n", (int) dev, flag,
- mode, (int) p);
+ mode, (int) td);
#endif
/*
@@ -832,7 +832,7 @@ stlopen_restart:
}
}
if ((tp->t_state & TS_XCLUDE) &&
- suser(p)) {
+ suser_td(td)) {
error = EBUSY;
goto stlopen_end;
}
@@ -876,7 +876,7 @@ stlopen_end:
/*****************************************************************************/
-STATIC int stlclose(dev_t dev, int flag, int mode, struct proc *p)
+STATIC int stlclose(dev_t dev, int flag, int mode, struct thread *td)
{
struct tty *tp;
stlport_t *portp;
@@ -884,7 +884,7 @@ STATIC int stlclose(dev_t dev, int flag, int mode, struct proc *p)
#if DEBUG
printf("stlclose(dev=%s,flag=%x,mode=%x,p=%p)\n", devtoname(dev),
- flag, mode, (void *) p);
+ flag, mode, (void *) td);
#endif
if (minor(dev) & STL_MEMDEV)
@@ -934,7 +934,7 @@ STATIC int stlstop(struct tty *tp, int rw)
/*****************************************************************************/
STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
- struct proc *p)
+ struct thread *td)
{
struct termios *newtios, *localtios;
struct tty *tp;
@@ -943,11 +943,11 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
#if DEBUG
printf("stlioctl(dev=%s,cmd=%lx,data=%p,flag=%x,p=%p)\n",
- devtoname(dev), cmd, (void *) data, flag, (void *) p);
+ devtoname(dev), cmd, (void *) data, flag, (void *) td);
#endif
if (minor(dev) & STL_MEMDEV)
- return(stl_memioctl(dev, cmd, data, flag, p));
+ return(stl_memioctl(dev, cmd, data, flag, td));
portp = stl_dev2port(dev);
if (portp == (stlport_t *) NULL)
@@ -970,7 +970,7 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
switch (cmd) {
case TIOCSETA:
- if ((error = suser(p)) == 0)
+ if ((error = suser_td(td)) == 0)
*localtios = *((struct termios *) data);
break;
case TIOCGETA:
@@ -1037,7 +1037,7 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
* Call the line discipline and the common command processing to
* process this command (if they can).
*/
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td);
if (error != ENOIOCTL)
return(error);
@@ -1088,7 +1088,7 @@ STATIC int stlioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
*((int *) data) = (stl_getsignals(portp) | TIOCM_LE);
break;
case TIOCMSDTRWAIT:
- if ((error = suser(p)) == 0)
+ if ((error = suser_td(td)) == 0)
portp->dtrwait = *((int *) data) * hz / 100;
break;
case TIOCMGDTRWAIT:
@@ -3048,7 +3048,7 @@ static int stl_clrportstats(stlport_t *portp, caddr_t data)
*/
static int stl_memioctl(dev_t dev, unsigned long cmd, caddr_t data, int flag,
- struct proc *p)
+ struct thread *td)
{
stlbrd_t *brdp;
int brdnr, rc;
diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c
index 4bb509d..5d68678 100644
--- a/sys/i386/isa/tw.c
+++ b/sys/i386/isa/tw.c
@@ -418,11 +418,11 @@ static int twattach(idp)
return (1);
}
-int twopen(dev, flag, mode, p)
+int twopen(dev, flag, mode, td)
dev_t dev;
int flag;
int mode;
- struct proc *p;
+ struct thread *td;
{
struct tw_sc *sc = &tw_sc[TWUNIT(dev)];
int s;
@@ -438,11 +438,11 @@ int twopen(dev, flag, mode, p)
return(0);
}
-int twclose(dev, flag, mode, p)
+int twclose(dev, flag, mode, td)
dev_t dev;
int flag;
int mode;
- struct proc *p;
+ struct thread *td;
{
struct tw_sc *sc = &tw_sc[TWUNIT(dev)];
int s;
@@ -544,10 +544,10 @@ int twwrite(dev, uio, ioflag)
* Determine if there is data available for reading
*/
-int twpoll(dev, events, p)
+int twpoll(dev, events, td)
dev_t dev;
int events;
- struct proc *p;
+ struct thread *td;
{
struct tw_sc *sc;
int s;
@@ -560,7 +560,7 @@ int twpoll(dev, events, p)
if(sc->sc_nextin != sc->sc_nextout)
revents |= events & (POLLIN | POLLRDNORM);
else
- selrecord(p, &sc->sc_selp);
+ selrecord(td, &sc->sc_selp);
}
splx(s);
return(revents);
diff --git a/sys/i386/isa/vesa.c b/sys/i386/isa/vesa.c
index 0fa16b5..09d2a7d 100644
--- a/sys/i386/isa/vesa.c
+++ b/sys/i386/isa/vesa.c
@@ -672,6 +672,8 @@ vesa_bios_init(void)
continue;
/* reject unsupported modes */
+#define DOTHIS 1
+#ifdef DOTHIS
#if 0
if ((vmode.v_modeattr & (V_MODESUPP | V_MODEOPTINFO
| V_MODENONVGA))
@@ -689,6 +691,7 @@ vesa_bios_init(void)
continue;
}
#endif
+#endif /* DOTHIS */
/* expand the array if necessary */
if (modes >= vesa_vmode_max) {
diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c
index 0adf3c8..4dc9818 100644
--- a/sys/i386/isa/wt.c
+++ b/sys/i386/isa/wt.c
@@ -285,7 +285,7 @@ COMPAT_ISA_DRIVER(wt, wtdriver);
* Open routine, called on every device open.
*/
static int
-wtopen (dev_t dev, int flag, int fmt, struct proc *p)
+wtopen (dev_t dev, int flag, int fmt, struct thread *td)
{
int u = minor (dev) & T_UNIT;
wtinfo_t *t = wttab + u;
@@ -367,7 +367,7 @@ wtopen (dev_t dev, int flag, int fmt, struct proc *p)
* Close routine, called on last device close.
*/
static int
-wtclose (dev_t dev, int flags, int fmt, struct proc *p)
+wtclose (dev_t dev, int flags, int fmt, struct thread *td)
{
int u = minor (dev) & T_UNIT;
wtinfo_t *t = wttab + u;
@@ -416,7 +416,7 @@ done:
* ioctl (int fd, MTIOCTOP, struct mtop *buf) -- do BSD-like op
*/
static int
-wtioctl (dev_t dev, u_long cmd, caddr_t arg, int flags, struct proc *p)
+wtioctl (dev_t dev, u_long cmd, caddr_t arg, int flags, struct thread *td)
{
int u = minor (dev) & T_UNIT;
wtinfo_t *t = wttab + u;
diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h
index 594ebfc..2b2a916 100644
--- a/sys/i386/linux/linux.h
+++ b/sys/i386/linux/linux.h
@@ -40,8 +40,8 @@
*/
extern u_char linux_debug_map[];
#define ldebug(name) isclr(linux_debug_map, LINUX_SYS_linux_ ## name)
-#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)p->p_pid
-#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)p->p_pid
+#define ARGS(nm, fmt) "linux(%ld): "#nm"("fmt")\n", (long)td->td_proc->p_pid
+#define LMSG(fmt) "linux(%ld): "fmt"\n", (long)td->td_proc->p_pid
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_LINUX);
@@ -453,9 +453,9 @@ extern struct sysentvec elf_linux_sysvec;
* Pluggable ioctl handlers
*/
struct linux_ioctl_args;
-struct proc;
+struct thread;
-typedef int linux_ioctl_function_t(struct proc *, struct linux_ioctl_args *);
+typedef int linux_ioctl_function_t(struct thread *, struct linux_ioctl_args *);
struct linux_ioctl_handler {
linux_ioctl_function_t *func;
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index dfae7f4..ba443bb 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -99,13 +99,13 @@ bsd_to_linux_sigaltstack(int bsa)
}
int
-linux_execve(struct proc *p, struct linux_execve_args *args)
+linux_execve(struct thread *td, struct linux_execve_args *args)
{
struct execve_args bsd;
caddr_t sg;
sg = stackgap_init();
- CHECKALTEXIST(p, &sg, args->path);
+ CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(execve))
@@ -115,7 +115,7 @@ linux_execve(struct proc *p, struct linux_execve_args *args)
bsd.fname = args->path;
bsd.argv = args->argp;
bsd.envv = args->envp;
- return (execve(p, &bsd));
+ return (execve(td, &bsd));
}
struct l_ipc_kludge {
@@ -124,7 +124,7 @@ struct l_ipc_kludge {
};
int
-linux_ipc(struct proc *p, struct linux_ipc_args *args)
+linux_ipc(struct thread *td, struct linux_ipc_args *args)
{
switch (args->what & 0xFFFF) {
@@ -134,7 +134,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.semid = args->arg1;
a.tsops = args->ptr;
a.nsops = args->arg2;
- return (linux_semop(p, &a));
+ return (linux_semop(td, &a));
}
case LINUX_SEMGET: {
struct linux_semget_args a;
@@ -142,7 +142,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.key = args->arg1;
a.nsems = args->arg2;
a.semflg = args->arg3;
- return (linux_semget(p, &a));
+ return (linux_semget(td, &a));
}
case LINUX_SEMCTL: {
struct linux_semctl_args a;
@@ -154,7 +154,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
error = copyin((caddr_t)args->ptr, &a.arg, sizeof(a.arg));
if (error)
return (error);
- return (linux_semctl(p, &a));
+ return (linux_semctl(td, &a));
}
case LINUX_MSGSND: {
struct linux_msgsnd_args a;
@@ -163,7 +163,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.msgp = args->ptr;
a.msgsz = args->arg2;
a.msgflg = args->arg3;
- return (linux_msgsnd(p, &a));
+ return (linux_msgsnd(td, &a));
}
case LINUX_MSGRCV: {
struct linux_msgrcv_args a;
@@ -186,14 +186,14 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.msgp = args->ptr;
a.msgtyp = args->arg5;
}
- return (linux_msgrcv(p, &a));
+ return (linux_msgrcv(td, &a));
}
case LINUX_MSGGET: {
struct linux_msgget_args a;
a.key = args->arg1;
a.msgflg = args->arg2;
- return (linux_msgget(p, &a));
+ return (linux_msgget(td, &a));
}
case LINUX_MSGCTL: {
struct linux_msgctl_args a;
@@ -201,7 +201,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.msqid = args->arg1;
a.cmd = args->arg2;
a.buf = args->ptr;
- return (linux_msgctl(p, &a));
+ return (linux_msgctl(td, &a));
}
case LINUX_SHMAT: {
struct linux_shmat_args a;
@@ -210,13 +210,13 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.shmaddr = args->ptr;
a.shmflg = args->arg2;
a.raddr = (l_ulong *)args->arg3;
- return (linux_shmat(p, &a));
+ return (linux_shmat(td, &a));
}
case LINUX_SHMDT: {
struct linux_shmdt_args a;
a.shmaddr = args->ptr;
- return (linux_shmdt(p, &a));
+ return (linux_shmdt(td, &a));
}
case LINUX_SHMGET: {
struct linux_shmget_args a;
@@ -224,7 +224,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.key = args->arg1;
a.size = args->arg2;
a.shmflg = args->arg3;
- return (linux_shmget(p, &a));
+ return (linux_shmget(td, &a));
}
case LINUX_SHMCTL: {
struct linux_shmctl_args a;
@@ -232,7 +232,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
a.shmid = args->arg1;
a.cmd = args->arg2;
a.buf = args->ptr;
- return (linux_shmctl(p, &a));
+ return (linux_shmctl(td, &a));
}
default:
break;
@@ -242,7 +242,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args)
}
int
-linux_old_select(struct proc *p, struct linux_old_select_args *args)
+linux_old_select(struct thread *td, struct linux_old_select_args *args)
{
struct l_old_select_argv linux_args;
struct linux_select_args newsel;
@@ -262,11 +262,11 @@ linux_old_select(struct proc *p, struct linux_old_select_args *args)
newsel.writefds = linux_args.writefds;
newsel.exceptfds = linux_args.exceptfds;
newsel.timeout = linux_args.timeout;
- return (linux_select(p, &newsel));
+ return (linux_select(td, &newsel));
}
int
-linux_fork(struct proc *p, struct linux_fork_args *args)
+linux_fork(struct thread *td, struct linux_fork_args *args)
{
int error;
@@ -275,16 +275,16 @@ linux_fork(struct proc *p, struct linux_fork_args *args)
printf(ARGS(fork, ""));
#endif
- if ((error = fork(p, (struct fork_args *)args)) != 0)
+ if ((error = fork(td, (struct fork_args *)args)) != 0)
return (error);
- if (p->p_retval[1] == 1)
- p->p_retval[0] = 0;
+ if (td->td_retval[1] == 1)
+ td->td_retval[0] = 0;
return (0);
}
int
-linux_vfork(struct proc *p, struct linux_vfork_args *args)
+linux_vfork(struct thread *td, struct linux_vfork_args *args)
{
int error;
@@ -293,11 +293,11 @@ linux_vfork(struct proc *p, struct linux_vfork_args *args)
printf(ARGS(vfork, ""));
#endif
- if ((error = vfork(p, (struct vfork_args *)args)) != 0)
+ if ((error = vfork(td, (struct vfork_args *)args)) != 0)
return (error);
/* Are we the child? */
- if (p->p_retval[1] == 1)
- p->p_retval[0] = 0;
+ if (td->td_retval[1] == 1)
+ td->td_retval[0] = 0;
return (0);
}
@@ -308,7 +308,7 @@ linux_vfork(struct proc *p, struct linux_vfork_args *args)
#define CLONE_PID 0x1000
int
-linux_clone(struct proc *p, struct linux_clone_args *args)
+linux_clone(struct thread *td, struct linux_clone_args *args)
{
int error, ff = RFPROC | RFSTOPPED;
struct proc *p2;
@@ -341,14 +341,14 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
ff |= RFFDG;
mtx_lock(&Giant);
- error = fork1(p, ff, &p2);
+ error = fork1(td, ff, &p2);
if (error == 0) {
- p->p_retval[0] = p2->p_pid;
- p->p_retval[1] = 0;
+ td->td_retval[0] = p2->p_pid;
+ td->td_retval[1] = 0;
PROC_LOCK(p2);
p2->p_sigparent = exit_signal;
- p2->p_frame->tf_esp = (unsigned int)args->stack;
+ p2->p_thread.td_frame->tf_esp = (unsigned int)args->stack;
#ifdef DEBUG
if (ldebug(clone))
@@ -361,7 +361,7 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
*/
mtx_lock_spin(&sched_lock);
p2->p_stat = SRUN;
- setrunqueue(p2);
+ setrunqueue(&p2->p_thread);
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(p2);
}
@@ -384,8 +384,9 @@ struct l_mmap_argv {
#define GUARD_SIZE (4 * PAGE_SIZE)
int
-linux_mmap(struct proc *p, struct linux_mmap_args *args)
+linux_mmap(struct thread *td, struct linux_mmap_args *args)
{
+ struct proc *p = td->td_proc;
struct mmap_args /* {
caddr_t addr;
size_t len;
@@ -501,11 +502,11 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args)
bsd_args.flags, bsd_args.fd, (int)bsd_args.pos);
#endif
- return (mmap(p, &bsd_args));
+ return (mmap(td, &bsd_args));
}
int
-linux_pipe(struct proc *p, struct linux_pipe_args *args)
+linux_pipe(struct thread *td, struct linux_pipe_args *args)
{
int error;
int reg_edx;
@@ -515,26 +516,26 @@ linux_pipe(struct proc *p, struct linux_pipe_args *args)
printf(ARGS(pipe, "*"));
#endif
- reg_edx = p->p_retval[1];
- error = pipe(p, 0);
+ reg_edx = td->td_retval[1];
+ error = pipe(td, 0);
if (error) {
- p->p_retval[1] = reg_edx;
+ td->td_retval[1] = reg_edx;
return (error);
}
- error = copyout(p->p_retval, args->pipefds, 2*sizeof(int));
+ error = copyout(td->td_retval, args->pipefds, 2*sizeof(int));
if (error) {
- p->p_retval[1] = reg_edx;
+ td->td_retval[1] = reg_edx;
return (error);
}
- p->p_retval[1] = reg_edx;
- p->p_retval[0] = 0;
+ td->td_retval[1] = reg_edx;
+ td->td_retval[0] = 0;
return (0);
}
int
-linux_ioperm(struct proc *p, struct linux_ioperm_args *args)
+linux_ioperm(struct thread *td, struct linux_ioperm_args *args)
{
struct sysarch_args sa;
struct i386_ioperm_args *iia;
@@ -547,28 +548,28 @@ linux_ioperm(struct proc *p, struct linux_ioperm_args *args)
iia->enable = args->enable;
sa.op = I386_SET_IOPERM;
sa.parms = (char *)iia;
- return (sysarch(p, &sa));
+ return (sysarch(td, &sa));
}
int
-linux_iopl(struct proc *p, struct linux_iopl_args *args)
+linux_iopl(struct thread *td, struct linux_iopl_args *args)
{
int error;
if (args->level < 0 || args->level > 3)
return (EINVAL);
- if ((error = suser(p)) != 0)
+ if ((error = suser_td(td)) != 0)
return (error);
if (securelevel > 0)
return (EPERM);
- p->p_frame->tf_eflags = (p->p_frame->tf_eflags & ~PSL_IOPL) |
+ td->td_frame->tf_eflags = (td->td_frame->tf_eflags & ~PSL_IOPL) |
(args->level * (PSL_IOPL / 3));
return (0);
}
int
-linux_modify_ldt(p, uap)
- struct proc *p;
+linux_modify_ldt(td, uap)
+ struct thread *td;
struct linux_modify_ldt_args *uap;
{
int error;
@@ -591,8 +592,8 @@ linux_modify_ldt(p, uap)
ldt->num = uap->bytecount / sizeof(union descriptor);
args.op = I386_GET_LDT;
args.parms = (char*)ldt;
- error = sysarch(p, &args);
- p->p_retval[0] *= sizeof(union descriptor);
+ error = sysarch(td, &args);
+ td->td_retval[0] *= sizeof(union descriptor);
break;
case 0x01: /* write_ldt */
case 0x11: /* write_ldt */
@@ -621,7 +622,7 @@ linux_modify_ldt(p, uap)
desc->sd.sd_gran = ld.limit_in_pages;
args.op = I386_SET_LDT;
args.parms = (char*)ldt;
- error = sysarch(p, &args);
+ error = sysarch(td, &args);
break;
default:
error = EINVAL;
@@ -637,7 +638,7 @@ linux_modify_ldt(p, uap)
}
int
-linux_sigaction(struct proc *p, struct linux_sigaction_args *args)
+linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
{
l_osigaction_t osa;
l_sigaction_t act, oact;
@@ -661,7 +662,7 @@ linux_sigaction(struct proc *p, struct linux_sigaction_args *args)
act.lsa_mask.__bits[0] = osa.lsa_mask;
}
- error = linux_do_sigaction(p, args->sig, args->nsa ? &act : NULL,
+ error = linux_do_sigaction(td, args->sig, args->nsa ? &act : NULL,
args->osa ? &oact : NULL);
if (args->osa != NULL && !error) {
@@ -682,7 +683,7 @@ linux_sigaction(struct proc *p, struct linux_sigaction_args *args)
* enables the signal to happen with a different register set.
*/
int
-linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args)
+linux_sigsuspend(struct thread *td, struct linux_sigsuspend_args *args)
{
struct sigsuspend_args bsd;
sigset_t *sigmask;
@@ -699,12 +700,12 @@ linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args)
mask.__bits[0] = args->mask;
linux_to_bsd_sigset(&mask, sigmask);
bsd.sigmask = sigmask;
- return (sigsuspend(p, &bsd));
+ return (sigsuspend(td, &bsd));
}
int
-linux_rt_sigsuspend(p, uap)
- struct proc *p;
+linux_rt_sigsuspend(td, uap)
+ struct thread *td;
struct linux_rt_sigsuspend_args *uap;
{
l_sigset_t lmask;
@@ -729,12 +730,13 @@ linux_rt_sigsuspend(p, uap)
bmask = stackgap_alloc(&sg, sizeof(sigset_t));
linux_to_bsd_sigset(&lmask, bmask);
bsd.sigmask = bmask;
- return (sigsuspend(p, &bsd));
+ return (sigsuspend(td, &bsd));
}
int
-linux_pause(struct proc *p, struct linux_pause_args *args)
+linux_pause(struct thread *td, struct linux_pause_args *args)
{
+ struct proc *p = td->td_proc;
struct sigsuspend_args bsd;
sigset_t *sigmask;
caddr_t sg = stackgap_init();
@@ -749,13 +751,11 @@ linux_pause(struct proc *p, struct linux_pause_args *args)
*sigmask = p->p_sigmask;
PROC_UNLOCK(p);
bsd.sigmask = sigmask;
- return (sigsuspend(p, &bsd));
+ return (sigsuspend(td, &bsd));
}
int
-linux_sigaltstack(p, uap)
- struct proc *p;
- struct linux_sigaltstack_args *uap;
+linux_sigaltstack(struct thread *td, struct linux_sigaltstack_args *uap)
{
struct sigaltstack_args bsd;
stack_t *ss, *oss;
@@ -786,7 +786,7 @@ linux_sigaltstack(p, uap)
bsd.ss = ss;
bsd.oss = oss;
- error = sigaltstack(p, &bsd);
+ error = sigaltstack(td, &bsd);
if (!error && oss != NULL) {
lss.ss_sp = oss->ss_sp;
diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h
index 6105da1..12b52ff 100644
--- a/sys/i386/linux/linux_proto.h
+++ b/sys/i386/linux/linux_proto.h
@@ -15,6 +15,8 @@
struct proc;
+struct thread;
+
#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \
0 : sizeof(register_t) - sizeof(t))
@@ -643,161 +645,161 @@ struct linux_fcntl64_args {
char cmd_l_[PADL_(l_uint)]; l_uint cmd; char cmd_r_[PADR_(l_uint)];
char arg_l_[PADL_(l_ulong)]; l_ulong arg; char arg_r_[PADR_(l_ulong)];
};
-int linux_fork __P((struct proc *, struct linux_fork_args *));
-int linux_open __P((struct proc *, struct linux_open_args *));
-int linux_waitpid __P((struct proc *, struct linux_waitpid_args *));
-int linux_creat __P((struct proc *, struct linux_creat_args *));
-int linux_link __P((struct proc *, struct linux_link_args *));
-int linux_unlink __P((struct proc *, struct linux_unlink_args *));
-int linux_execve __P((struct proc *, struct linux_execve_args *));
-int linux_chdir __P((struct proc *, struct linux_chdir_args *));
-int linux_time __P((struct proc *, struct linux_time_args *));
-int linux_mknod __P((struct proc *, struct linux_mknod_args *));
-int linux_chmod __P((struct proc *, struct linux_chmod_args *));
-int linux_lchown16 __P((struct proc *, struct linux_lchown16_args *));
-int linux_stat __P((struct proc *, struct linux_stat_args *));
-int linux_lseek __P((struct proc *, struct linux_lseek_args *));
-int linux_getpid __P((struct proc *, struct linux_getpid_args *));
-int linux_mount __P((struct proc *, struct linux_mount_args *));
-int linux_oldumount __P((struct proc *, struct linux_oldumount_args *));
-int linux_setuid16 __P((struct proc *, struct linux_setuid16_args *));
-int linux_getuid16 __P((struct proc *, struct linux_getuid16_args *));
-int linux_stime __P((struct proc *, struct linux_stime_args *));
-int linux_ptrace __P((struct proc *, struct linux_ptrace_args *));
-int linux_alarm __P((struct proc *, struct linux_alarm_args *));
-int linux_fstat __P((struct proc *, struct linux_fstat_args *));
-int linux_pause __P((struct proc *, struct linux_pause_args *));
-int linux_utime __P((struct proc *, struct linux_utime_args *));
-int linux_access __P((struct proc *, struct linux_access_args *));
-int linux_nice __P((struct proc *, struct linux_nice_args *));
-int linux_kill __P((struct proc *, struct linux_kill_args *));
-int linux_rename __P((struct proc *, struct linux_rename_args *));
-int linux_mkdir __P((struct proc *, struct linux_mkdir_args *));
-int linux_rmdir __P((struct proc *, struct linux_rmdir_args *));
-int linux_pipe __P((struct proc *, struct linux_pipe_args *));
-int linux_times __P((struct proc *, struct linux_times_args *));
-int linux_brk __P((struct proc *, struct linux_brk_args *));
-int linux_setgid16 __P((struct proc *, struct linux_setgid16_args *));
-int linux_getgid16 __P((struct proc *, struct linux_getgid16_args *));
-int linux_signal __P((struct proc *, struct linux_signal_args *));
-int linux_geteuid16 __P((struct proc *, struct linux_geteuid16_args *));
-int linux_getegid16 __P((struct proc *, struct linux_getegid16_args *));
-int linux_umount __P((struct proc *, struct linux_umount_args *));
-int linux_ioctl __P((struct proc *, struct linux_ioctl_args *));
-int linux_fcntl __P((struct proc *, struct linux_fcntl_args *));
-int linux_olduname __P((struct proc *, struct linux_olduname_args *));
-int linux_ustat __P((struct proc *, struct linux_ustat_args *));
-int linux_sigaction __P((struct proc *, struct linux_sigaction_args *));
-int linux_sgetmask __P((struct proc *, struct linux_sgetmask_args *));
-int linux_ssetmask __P((struct proc *, struct linux_ssetmask_args *));
-int linux_setreuid16 __P((struct proc *, struct linux_setreuid16_args *));
-int linux_setregid16 __P((struct proc *, struct linux_setregid16_args *));
-int linux_sigsuspend __P((struct proc *, struct linux_sigsuspend_args *));
-int linux_sigpending __P((struct proc *, struct linux_sigpending_args *));
-int linux_setrlimit __P((struct proc *, struct linux_setrlimit_args *));
-int linux_old_getrlimit __P((struct proc *, struct linux_old_getrlimit_args *));
-int linux_getgroups16 __P((struct proc *, struct linux_getgroups16_args *));
-int linux_setgroups16 __P((struct proc *, struct linux_setgroups16_args *));
-int linux_old_select __P((struct proc *, struct linux_old_select_args *));
-int linux_symlink __P((struct proc *, struct linux_symlink_args *));
-int linux_readlink __P((struct proc *, struct linux_readlink_args *));
-int linux_uselib __P((struct proc *, struct linux_uselib_args *));
-int linux_reboot __P((struct proc *, struct linux_reboot_args *));
-int linux_readdir __P((struct proc *, struct linux_readdir_args *));
-int linux_mmap __P((struct proc *, struct linux_mmap_args *));
-int linux_truncate __P((struct proc *, struct linux_truncate_args *));
-int linux_statfs __P((struct proc *, struct linux_statfs_args *));
-int linux_fstatfs __P((struct proc *, struct linux_fstatfs_args *));
-int linux_ioperm __P((struct proc *, struct linux_ioperm_args *));
-int linux_socketcall __P((struct proc *, struct linux_socketcall_args *));
-int linux_syslog __P((struct proc *, struct linux_syslog_args *));
-int linux_setitimer __P((struct proc *, struct linux_setitimer_args *));
-int linux_getitimer __P((struct proc *, struct linux_getitimer_args *));
-int linux_newstat __P((struct proc *, struct linux_newstat_args *));
-int linux_newlstat __P((struct proc *, struct linux_newlstat_args *));
-int linux_newfstat __P((struct proc *, struct linux_newfstat_args *));
-int linux_uname __P((struct proc *, struct linux_uname_args *));
-int linux_iopl __P((struct proc *, struct linux_iopl_args *));
-int linux_vhangup __P((struct proc *, struct linux_vhangup_args *));
-int linux_vm86old __P((struct proc *, struct linux_vm86old_args *));
-int linux_wait4 __P((struct proc *, struct linux_wait4_args *));
-int linux_swapoff __P((struct proc *, struct linux_swapoff_args *));
-int linux_sysinfo __P((struct proc *, struct linux_sysinfo_args *));
-int linux_ipc __P((struct proc *, struct linux_ipc_args *));
-int linux_sigreturn __P((struct proc *, struct linux_sigreturn_args *));
-int linux_clone __P((struct proc *, struct linux_clone_args *));
-int linux_newuname __P((struct proc *, struct linux_newuname_args *));
-int linux_modify_ldt __P((struct proc *, struct linux_modify_ldt_args *));
-int linux_adjtimex __P((struct proc *, struct linux_adjtimex_args *));
-int linux_sigprocmask __P((struct proc *, struct linux_sigprocmask_args *));
-int linux_create_module __P((struct proc *, struct linux_create_module_args *));
-int linux_init_module __P((struct proc *, struct linux_init_module_args *));
-int linux_delete_module __P((struct proc *, struct linux_delete_module_args *));
-int linux_get_kernel_syms __P((struct proc *, struct linux_get_kernel_syms_args *));
-int linux_quotactl __P((struct proc *, struct linux_quotactl_args *));
-int linux_getpgid __P((struct proc *, struct linux_getpgid_args *));
-int linux_bdflush __P((struct proc *, struct linux_bdflush_args *));
-int linux_sysfs __P((struct proc *, struct linux_sysfs_args *));
-int linux_personality __P((struct proc *, struct linux_personality_args *));
-int linux_setfsuid16 __P((struct proc *, struct linux_setfsuid16_args *));
-int linux_setfsgid16 __P((struct proc *, struct linux_setfsgid16_args *));
-int linux_llseek __P((struct proc *, struct linux_llseek_args *));
-int linux_getdents __P((struct proc *, struct linux_getdents_args *));
-int linux_select __P((struct proc *, struct linux_select_args *));
-int linux_msync __P((struct proc *, struct linux_msync_args *));
-int linux_getsid __P((struct proc *, struct linux_getsid_args *));
-int linux_fdatasync __P((struct proc *, struct linux_fdatasync_args *));
-int linux_sysctl __P((struct proc *, struct linux_sysctl_args *));
-int linux_sched_setscheduler __P((struct proc *, struct linux_sched_setscheduler_args *));
-int linux_sched_getscheduler __P((struct proc *, struct linux_sched_getscheduler_args *));
-int linux_sched_get_priority_max __P((struct proc *, struct linux_sched_get_priority_max_args *));
-int linux_sched_get_priority_min __P((struct proc *, struct linux_sched_get_priority_min_args *));
-int linux_mremap __P((struct proc *, struct linux_mremap_args *));
-int linux_setresuid16 __P((struct proc *, struct linux_setresuid16_args *));
-int linux_getresuid16 __P((struct proc *, struct linux_getresuid16_args *));
-int linux_vm86 __P((struct proc *, struct linux_vm86_args *));
-int linux_query_module __P((struct proc *, struct linux_query_module_args *));
-int linux_nfsservctl __P((struct proc *, struct linux_nfsservctl_args *));
-int linux_setresgid16 __P((struct proc *, struct linux_setresgid16_args *));
-int linux_getresgid16 __P((struct proc *, struct linux_getresgid16_args *));
-int linux_prctl __P((struct proc *, struct linux_prctl_args *));
-int linux_rt_sigreturn __P((struct proc *, struct linux_rt_sigreturn_args *));
-int linux_rt_sigaction __P((struct proc *, struct linux_rt_sigaction_args *));
-int linux_rt_sigprocmask __P((struct proc *, struct linux_rt_sigprocmask_args *));
-int linux_rt_sigpending __P((struct proc *, struct linux_rt_sigpending_args *));
-int linux_rt_sigtimedwait __P((struct proc *, struct linux_rt_sigtimedwait_args *));
-int linux_rt_sigqueueinfo __P((struct proc *, struct linux_rt_sigqueueinfo_args *));
-int linux_rt_sigsuspend __P((struct proc *, struct linux_rt_sigsuspend_args *));
-int linux_pread __P((struct proc *, struct linux_pread_args *));
-int linux_pwrite __P((struct proc *, struct linux_pwrite_args *));
-int linux_chown16 __P((struct proc *, struct linux_chown16_args *));
-int linux_getcwd __P((struct proc *, struct linux_getcwd_args *));
-int linux_capget __P((struct proc *, struct linux_capget_args *));
-int linux_capset __P((struct proc *, struct linux_capset_args *));
-int linux_sigaltstack __P((struct proc *, struct linux_sigaltstack_args *));
-int linux_sendfile __P((struct proc *, struct linux_sendfile_args *));
-int linux_vfork __P((struct proc *, struct linux_vfork_args *));
-int linux_getrlimit __P((struct proc *, struct linux_getrlimit_args *));
-int linux_mmap2 __P((struct proc *, struct linux_mmap2_args *));
-int linux_truncate64 __P((struct proc *, struct linux_truncate64_args *));
-int linux_ftruncate64 __P((struct proc *, struct linux_ftruncate64_args *));
-int linux_stat64 __P((struct proc *, struct linux_stat64_args *));
-int linux_lstat64 __P((struct proc *, struct linux_lstat64_args *));
-int linux_fstat64 __P((struct proc *, struct linux_fstat64_args *));
-int linux_lchown __P((struct proc *, struct linux_lchown_args *));
-int linux_getuid __P((struct proc *, struct linux_getuid_args *));
-int linux_getgid __P((struct proc *, struct linux_getgid_args *));
-int linux_getgroups __P((struct proc *, struct linux_getgroups_args *));
-int linux_setgroups __P((struct proc *, struct linux_setgroups_args *));
-int linux_fchown __P((struct proc *, struct linux_fchown_args *));
-int linux_chown __P((struct proc *, struct linux_chown_args *));
-int linux_setfsuid __P((struct proc *, struct linux_setfsuid_args *));
-int linux_setfsgid __P((struct proc *, struct linux_setfsgid_args *));
-int linux_pivot_root __P((struct proc *, struct linux_pivot_root_args *));
-int linux_mincore __P((struct proc *, struct linux_mincore_args *));
-int linux_madvise __P((struct proc *, struct linux_madvise_args *));
-int linux_getdents64 __P((struct proc *, struct linux_getdents64_args *));
-int linux_fcntl64 __P((struct proc *, struct linux_fcntl64_args *));
+int linux_fork __P((struct thread *, struct linux_fork_args *));
+int linux_open __P((struct thread *, struct linux_open_args *));
+int linux_waitpid __P((struct thread *, struct linux_waitpid_args *));
+int linux_creat __P((struct thread *, struct linux_creat_args *));
+int linux_link __P((struct thread *, struct linux_link_args *));
+int linux_unlink __P((struct thread *, struct linux_unlink_args *));
+int linux_execve __P((struct thread *, struct linux_execve_args *));
+int linux_chdir __P((struct thread *, struct linux_chdir_args *));
+int linux_time __P((struct thread *, struct linux_time_args *));
+int linux_mknod __P((struct thread *, struct linux_mknod_args *));
+int linux_chmod __P((struct thread *, struct linux_chmod_args *));
+int linux_lchown16 __P((struct thread *, struct linux_lchown16_args *));
+int linux_stat __P((struct thread *, struct linux_stat_args *));
+int linux_lseek __P((struct thread *, struct linux_lseek_args *));
+int linux_getpid __P((struct thread *, struct linux_getpid_args *));
+int linux_mount __P((struct thread *, struct linux_mount_args *));
+int linux_oldumount __P((struct thread *, struct linux_oldumount_args *));
+int linux_setuid16 __P((struct thread *, struct linux_setuid16_args *));
+int linux_getuid16 __P((struct thread *, struct linux_getuid16_args *));
+int linux_stime __P((struct thread *, struct linux_stime_args *));
+int linux_ptrace __P((struct thread *, struct linux_ptrace_args *));
+int linux_alarm __P((struct thread *, struct linux_alarm_args *));
+int linux_fstat __P((struct thread *, struct linux_fstat_args *));
+int linux_pause __P((struct thread *, struct linux_pause_args *));
+int linux_utime __P((struct thread *, struct linux_utime_args *));
+int linux_access __P((struct thread *, struct linux_access_args *));
+int linux_nice __P((struct thread *, struct linux_nice_args *));
+int linux_kill __P((struct thread *, struct linux_kill_args *));
+int linux_rename __P((struct thread *, struct linux_rename_args *));
+int linux_mkdir __P((struct thread *, struct linux_mkdir_args *));
+int linux_rmdir __P((struct thread *, struct linux_rmdir_args *));
+int linux_pipe __P((struct thread *, struct linux_pipe_args *));
+int linux_times __P((struct thread *, struct linux_times_args *));
+int linux_brk __P((struct thread *, struct linux_brk_args *));
+int linux_setgid16 __P((struct thread *, struct linux_setgid16_args *));
+int linux_getgid16 __P((struct thread *, struct linux_getgid16_args *));
+int linux_signal __P((struct thread *, struct linux_signal_args *));
+int linux_geteuid16 __P((struct thread *, struct linux_geteuid16_args *));
+int linux_getegid16 __P((struct thread *, struct linux_getegid16_args *));
+int linux_umount __P((struct thread *, struct linux_umount_args *));
+int linux_ioctl __P((struct thread *, struct linux_ioctl_args *));
+int linux_fcntl __P((struct thread *, struct linux_fcntl_args *));
+int linux_olduname __P((struct thread *, struct linux_olduname_args *));
+int linux_ustat __P((struct thread *, struct linux_ustat_args *));
+int linux_sigaction __P((struct thread *, struct linux_sigaction_args *));
+int linux_sgetmask __P((struct thread *, struct linux_sgetmask_args *));
+int linux_ssetmask __P((struct thread *, struct linux_ssetmask_args *));
+int linux_setreuid16 __P((struct thread *, struct linux_setreuid16_args *));
+int linux_setregid16 __P((struct thread *, struct linux_setregid16_args *));
+int linux_sigsuspend __P((struct thread *, struct linux_sigsuspend_args *));
+int linux_sigpending __P((struct thread *, struct linux_sigpending_args *));
+int linux_setrlimit __P((struct thread *, struct linux_setrlimit_args *));
+int linux_old_getrlimit __P((struct thread *, struct linux_old_getrlimit_args *));
+int linux_getgroups16 __P((struct thread *, struct linux_getgroups16_args *));
+int linux_setgroups16 __P((struct thread *, struct linux_setgroups16_args *));
+int linux_old_select __P((struct thread *, struct linux_old_select_args *));
+int linux_symlink __P((struct thread *, struct linux_symlink_args *));
+int linux_readlink __P((struct thread *, struct linux_readlink_args *));
+int linux_uselib __P((struct thread *, struct linux_uselib_args *));
+int linux_reboot __P((struct thread *, struct linux_reboot_args *));
+int linux_readdir __P((struct thread *, struct linux_readdir_args *));
+int linux_mmap __P((struct thread *, struct linux_mmap_args *));
+int linux_truncate __P((struct thread *, struct linux_truncate_args *));
+int linux_statfs __P((struct thread *, struct linux_statfs_args *));
+int linux_fstatfs __P((struct thread *, struct linux_fstatfs_args *));
+int linux_ioperm __P((struct thread *, struct linux_ioperm_args *));
+int linux_socketcall __P((struct thread *, struct linux_socketcall_args *));
+int linux_syslog __P((struct thread *, struct linux_syslog_args *));
+int linux_setitimer __P((struct thread *, struct linux_setitimer_args *));
+int linux_getitimer __P((struct thread *, struct linux_getitimer_args *));
+int linux_newstat __P((struct thread *, struct linux_newstat_args *));
+int linux_newlstat __P((struct thread *, struct linux_newlstat_args *));
+int linux_newfstat __P((struct thread *, struct linux_newfstat_args *));
+int linux_uname __P((struct thread *, struct linux_uname_args *));
+int linux_iopl __P((struct thread *, struct linux_iopl_args *));
+int linux_vhangup __P((struct thread *, struct linux_vhangup_args *));
+int linux_vm86old __P((struct thread *, struct linux_vm86old_args *));
+int linux_wait4 __P((struct thread *, struct linux_wait4_args *));
+int linux_swapoff __P((struct thread *, struct linux_swapoff_args *));
+int linux_sysinfo __P((struct thread *, struct linux_sysinfo_args *));
+int linux_ipc __P((struct thread *, struct linux_ipc_args *));
+int linux_sigreturn __P((struct thread *, struct linux_sigreturn_args *));
+int linux_clone __P((struct thread *, struct linux_clone_args *));
+int linux_newuname __P((struct thread *, struct linux_newuname_args *));
+int linux_modify_ldt __P((struct thread *, struct linux_modify_ldt_args *));
+int linux_adjtimex __P((struct thread *, struct linux_adjtimex_args *));
+int linux_sigprocmask __P((struct thread *, struct linux_sigprocmask_args *));
+int linux_create_module __P((struct thread *, struct linux_create_module_args *));
+int linux_init_module __P((struct thread *, struct linux_init_module_args *));
+int linux_delete_module __P((struct thread *, struct linux_delete_module_args *));
+int linux_get_kernel_syms __P((struct thread *, struct linux_get_kernel_syms_args *));
+int linux_quotactl __P((struct thread *, struct linux_quotactl_args *));
+int linux_getpgid __P((struct thread *, struct linux_getpgid_args *));
+int linux_bdflush __P((struct thread *, struct linux_bdflush_args *));
+int linux_sysfs __P((struct thread *, struct linux_sysfs_args *));
+int linux_personality __P((struct thread *, struct linux_personality_args *));
+int linux_setfsuid16 __P((struct thread *, struct linux_setfsuid16_args *));
+int linux_setfsgid16 __P((struct thread *, struct linux_setfsgid16_args *));
+int linux_llseek __P((struct thread *, struct linux_llseek_args *));
+int linux_getdents __P((struct thread *, struct linux_getdents_args *));
+int linux_select __P((struct thread *, struct linux_select_args *));
+int linux_msync __P((struct thread *, struct linux_msync_args *));
+int linux_getsid __P((struct thread *, struct linux_getsid_args *));
+int linux_fdatasync __P((struct thread *, struct linux_fdatasync_args *));
+int linux_sysctl __P((struct thread *, struct linux_sysctl_args *));
+int linux_sched_setscheduler __P((struct thread *, struct linux_sched_setscheduler_args *));
+int linux_sched_getscheduler __P((struct thread *, struct linux_sched_getscheduler_args *));
+int linux_sched_get_priority_max __P((struct thread *, struct linux_sched_get_priority_max_args *));
+int linux_sched_get_priority_min __P((struct thread *, struct linux_sched_get_priority_min_args *));
+int linux_mremap __P((struct thread *, struct linux_mremap_args *));
+int linux_setresuid16 __P((struct thread *, struct linux_setresuid16_args *));
+int linux_getresuid16 __P((struct thread *, struct linux_getresuid16_args *));
+int linux_vm86 __P((struct thread *, struct linux_vm86_args *));
+int linux_query_module __P((struct thread *, struct linux_query_module_args *));
+int linux_nfsservctl __P((struct thread *, struct linux_nfsservctl_args *));
+int linux_setresgid16 __P((struct thread *, struct linux_setresgid16_args *));
+int linux_getresgid16 __P((struct thread *, struct linux_getresgid16_args *));
+int linux_prctl __P((struct thread *, struct linux_prctl_args *));
+int linux_rt_sigreturn __P((struct thread *, struct linux_rt_sigreturn_args *));
+int linux_rt_sigaction __P((struct thread *, struct linux_rt_sigaction_args *));
+int linux_rt_sigprocmask __P((struct thread *, struct linux_rt_sigprocmask_args *));
+int linux_rt_sigpending __P((struct thread *, struct linux_rt_sigpending_args *));
+int linux_rt_sigtimedwait __P((struct thread *, struct linux_rt_sigtimedwait_args *));
+int linux_rt_sigqueueinfo __P((struct thread *, struct linux_rt_sigqueueinfo_args *));
+int linux_rt_sigsuspend __P((struct thread *, struct linux_rt_sigsuspend_args *));
+int linux_pread __P((struct thread *, struct linux_pread_args *));
+int linux_pwrite __P((struct thread *, struct linux_pwrite_args *));
+int linux_chown16 __P((struct thread *, struct linux_chown16_args *));
+int linux_getcwd __P((struct thread *, struct linux_getcwd_args *));
+int linux_capget __P((struct thread *, struct linux_capget_args *));
+int linux_capset __P((struct thread *, struct linux_capset_args *));
+int linux_sigaltstack __P((struct thread *, struct linux_sigaltstack_args *));
+int linux_sendfile __P((struct thread *, struct linux_sendfile_args *));
+int linux_vfork __P((struct thread *, struct linux_vfork_args *));
+int linux_getrlimit __P((struct thread *, struct linux_getrlimit_args *));
+int linux_mmap2 __P((struct thread *, struct linux_mmap2_args *));
+int linux_truncate64 __P((struct thread *, struct linux_truncate64_args *));
+int linux_ftruncate64 __P((struct thread *, struct linux_ftruncate64_args *));
+int linux_stat64 __P((struct thread *, struct linux_stat64_args *));
+int linux_lstat64 __P((struct thread *, struct linux_lstat64_args *));
+int linux_fstat64 __P((struct thread *, struct linux_fstat64_args *));
+int linux_lchown __P((struct thread *, struct linux_lchown_args *));
+int linux_getuid __P((struct thread *, struct linux_getuid_args *));
+int linux_getgid __P((struct thread *, struct linux_getgid_args *));
+int linux_getgroups __P((struct thread *, struct linux_getgroups_args *));
+int linux_setgroups __P((struct thread *, struct linux_setgroups_args *));
+int linux_fchown __P((struct thread *, struct linux_fchown_args *));
+int linux_chown __P((struct thread *, struct linux_chown_args *));
+int linux_setfsuid __P((struct thread *, struct linux_setfsuid_args *));
+int linux_setfsgid __P((struct thread *, struct linux_setfsgid_args *));
+int linux_pivot_root __P((struct thread *, struct linux_pivot_root_args *));
+int linux_mincore __P((struct thread *, struct linux_mincore_args *));
+int linux_madvise __P((struct thread *, struct linux_madvise_args *));
+int linux_getdents64 __P((struct thread *, struct linux_getdents64_args *));
+int linux_fcntl64 __P((struct thread *, struct linux_fcntl64_args *));
#ifdef COMPAT_43
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index b90ea56..27e3649 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -219,13 +219,14 @@ extern unsigned long linux_sznonrtsigcode;
static void
linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
- register struct proc *p = curproc;
+ register struct thread *td = curthread;
+ register struct proc *p = td->td_proc;
register struct trapframe *regs;
struct l_rt_sigframe *fp, frame;
int oonstack;
PROC_LOCK_ASSERT(p, MA_OWNED);
- regs = p->p_frame;
+ regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
#ifdef DEBUG
@@ -335,7 +336,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
* instruction to halt it in its tracks.
*/
PROC_LOCK(p);
- sigexit(p, SIGILL);
+ sigexit(td, SIGILL);
/* NOTREACHED */
}
@@ -369,7 +370,8 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
static void
linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
- register struct proc *p = curproc;
+ register struct thread *td = curthread;
+ register struct proc *p = td->td_proc;
register struct trapframe *regs;
struct l_sigframe *fp, frame;
l_sigset_t lmask;
@@ -381,7 +383,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
return;
}
- regs = p->p_frame;
+ regs = td->td_frame;
oonstack = sigonstack(regs->tf_esp);
#ifdef DEBUG
@@ -468,7 +470,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
* instruction to halt it in its tracks.
*/
PROC_LOCK(p);
- sigexit(p, SIGILL);
+ sigexit(td, SIGILL);
/* NOTREACHED */
}
@@ -497,16 +499,17 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
* a machine fault.
*/
int
-linux_sigreturn(p, args)
- struct proc *p;
+linux_sigreturn(td, args)
+ struct thread *td;
struct linux_sigreturn_args *args;
{
+ struct proc *p = td->td_proc;
struct l_sigframe frame;
register struct trapframe *regs;
l_sigset_t lmask;
int eflags, i;
- regs = p->p_frame;
+ regs = td->td_frame;
#ifdef DEBUG
if (ldebug(sigreturn))
@@ -592,10 +595,11 @@ linux_sigreturn(p, args)
* a machine fault.
*/
int
-linux_rt_sigreturn(p, args)
- struct proc *p;
+linux_rt_sigreturn(td, args)
+ struct thread *td;
struct linux_rt_sigreturn_args *args;
{
+ struct proc *p = td->td_proc;
struct sigaltstack_args sasargs;
struct l_ucontext uc;
struct l_sigcontext *context;
@@ -605,7 +609,7 @@ linux_rt_sigreturn(p, args)
int eflags;
caddr_t sg = stackgap_init();
- regs = p->p_frame;
+ regs = td->td_frame;
#ifdef DEBUG
if (ldebug(rt_sigreturn))
@@ -692,7 +696,7 @@ linux_rt_sigreturn(p, args)
#endif
sasargs.ss = ss;
sasargs.oss = NULL;
- (void) sigaltstack(p, &sasargs);
+ (void) sigaltstack(td, &sasargs);
return (EJUSTRETURN);
}
@@ -740,7 +744,7 @@ exec_linux_imgact_try(imgp)
if ((error = exec_shell_imgact(imgp)) == 0) {
char *rpath = NULL;
- linux_emul_find(imgp->proc, NULL, linux_emul_path,
+ linux_emul_find(&imgp->proc->p_thread, NULL, linux_emul_path,
imgp->interpreter_name, &rpath, 0);
if (rpath != imgp->interpreter_name) {
int len = strlen(rpath) + 1;
diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c
index 7dc2d47..f1522f6 100644
--- a/sys/i386/svr4/svr4_machdep.c
+++ b/sys/i386/svr4/svr4_machdep.c
@@ -77,26 +77,27 @@ static void svr4_getsiginfo __P((union svr4_siginfo *, int, u_long, caddr_t));
#if defined(__NetBSD__)
void
-svr4_setregs(p, epp, stack)
- struct proc *p;
+svr4_setregs(td, epp, stack)
+ struct thread *td;
struct exec_package *epp;
u_long stack;
{
- register struct pcb *pcb = &p->p_addr->u_pcb;
+ register struct pcb *pcb = td->td_pcb;
pcb->pcb_savefpu.sv_env.en_cw = __SVR4_NPXCW__;
- setregs(p, epp, stack, 0UL);
+ setregs(td, epp, stack, 0UL);
}
#endif /* __NetBSD__ */
void
-svr4_getcontext(p, uc, mask, oonstack)
- struct proc *p;
+svr4_getcontext(td, uc, mask, oonstack)
+ struct thread *td;
struct svr4_ucontext *uc;
sigset_t *mask;
int oonstack;
{
- struct trapframe *tf = p->p_frame;
+ struct proc *p = td->td_proc;
+ struct trapframe *tf = td->td_frame;
svr4_greg_t *r = uc->uc_mcontext.greg;
struct svr4_sigaltstack *s = &uc->uc_stack;
#if defined(DONE_MORE_SIGALTSTACK_WORK)
@@ -104,7 +105,7 @@ svr4_getcontext(p, uc, mask, oonstack)
struct sigaltstack *sf;
#endif
- PROC_LOCK(p);
+ PROC_LOCK(td->td_proc);
#if defined(DONE_MORE_SIGALTSTACK_WORK)
psp = p->p_sigacts;
sf = &p->p_sigstk;
@@ -122,7 +123,7 @@ svr4_getcontext(p, uc, mask, oonstack)
r[SVR4_X86_FS] = tf->tf_vm86_fs;
r[SVR4_X86_ES] = tf->tf_vm86_es;
r[SVR4_X86_DS] = tf->tf_vm86_ds;
- r[SVR4_X86_EFL] = get_vflags(p);
+ r[SVR4_X86_EFL] = get_vflags(td);
} else
#endif
{
@@ -162,7 +163,7 @@ svr4_getcontext(p, uc, mask, oonstack)
s->ss_size = 16384;
s->ss_flags = 0;
#endif
- PROC_UNLOCK(p);
+ PROC_UNLOCK(td->td_proc);
/*
* Set the signal mask
@@ -186,24 +187,25 @@ svr4_getcontext(p, uc, mask, oonstack)
* a machine fault.
*/
int
-svr4_setcontext(p, uc)
- struct proc *p;
+svr4_setcontext(td, uc)
+ struct thread *td;
struct svr4_ucontext *uc;
{
#if defined(DONE_MORE_SIGALTSTACK_WORK)
struct sigacts *psp;
#endif
+ struct proc *p = td->td_proc;
register struct trapframe *tf;
svr4_greg_t *r = uc->uc_mcontext.greg;
struct svr4_sigaltstack *s = &uc->uc_stack;
struct sigaltstack *sf;
sigset_t mask;
- PROC_LOCK(p);
+ PROC_LOCK(td->td_proc);
#if defined(DONE_MORE_SIGALTSTACK_WORK)
- psp = p->p_sigacts;
+ psp = td->td_proc->p_sigacts;
#endif
- sf = &p->p_sigstk;
+ sf = &td->td_proc->p_sigstk;
/*
* XXX:
@@ -219,7 +221,7 @@ svr4_setcontext(p, uc)
DPRINTF(("svr4_setcontext(%d)\n", p->p_pid));
- tf = p->p_frame;
+ tf = td->td_frame;
/*
* Restore register context.
@@ -231,7 +233,7 @@ svr4_setcontext(p, uc)
tf->tf_vm86_fs = r[SVR4_X86_FS];
tf->tf_vm86_es = r[SVR4_X86_ES];
tf->tf_vm86_ds = r[SVR4_X86_DS];
- set_vflags(p, r[SVR4_X86_EFL]);
+ set_vflags(td, r[SVR4_X86_EFL]);
} else
#endif
{
@@ -293,7 +295,7 @@ svr4_setcontext(p, uc)
SIG_CANTMASK(mask);
p->p_sigmask = mask;
}
- PROC_UNLOCK(p);
+ PROC_UNLOCK(td->td_proc);
return 0; /*EJUSTRETURN;*/
}
@@ -409,7 +411,8 @@ svr4_sendsig(catcher, sig, mask, code)
sigset_t *mask;
u_long code;
{
- register struct proc *p = curproc;
+ register struct thread *td = curthread;
+ struct proc *p = td->td_proc;
register struct trapframe *tf;
struct svr4_sigframe *fp, frame;
struct sigacts *psp;
@@ -421,7 +424,7 @@ svr4_sendsig(catcher, sig, mask, code)
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
- tf = p->p_frame;
+ tf = td->td_frame;
oonstack = sigonstack(tf->tf_esp);
/*
@@ -435,7 +438,7 @@ svr4_sendsig(catcher, sig, mask, code)
} else {
fp = (struct svr4_sigframe *)tf->tf_esp - 1;
}
- PROC_UNLOCK(p);
+ PROC_UNLOCK(td->td_proc);
/*
* Build the argument list for the signal handler.
@@ -447,7 +450,7 @@ svr4_sendsig(catcher, sig, mask, code)
* modify many kernel files to enable that]
*/
- svr4_getcontext(p, &frame.sf_uc, mask, oonstack);
+ svr4_getcontext(td, &frame.sf_uc, mask, oonstack);
#if defined(DEBUG_SVR4)
printf("obtained ucontext\n");
#endif
@@ -469,8 +472,8 @@ svr4_sendsig(catcher, sig, mask, code)
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
- PROC_LOCK(p);
- sigexit(p, SIGILL);
+ PROC_LOCK(td->td_proc);
+ sigexit(td, SIGILL);
/* NOTREACHED */
}
#if defined(__NetBSD__)
@@ -502,8 +505,8 @@ svr4_sendsig(catcher, sig, mask, code)
int
-svr4_sys_sysarch(p, v)
- struct proc *p;
+svr4_sys_sysarch(td, v)
+ struct thread *td;
struct svr4_sys_sysarch_args *v;
{
struct svr4_sys_sysarch_args *uap = v;
@@ -583,7 +586,7 @@ svr4_sys_sysarch(p, v)
return error;
}
- return sys_sysarch(p, &ua, retval);
+ return sys_sysarch(td, &ua, retval);
}
#endif
diff --git a/sys/i386/svr4/svr4_machdep.h b/sys/i386/svr4/svr4_machdep.h
index fbbf05b..f6f58e3 100644
--- a/sys/i386/svr4/svr4_machdep.h
+++ b/sys/i386/svr4/svr4_machdep.h
@@ -71,12 +71,12 @@ typedef struct {
long f_weitek[33]; /* weitek */
} svr4_fregset_t;
-struct proc;
+struct thread;
struct svr4_ucontext;
-void svr4_getcontext __P((struct proc *, struct svr4_ucontext *,
+void svr4_getcontext __P((struct thread *, struct svr4_ucontext *,
sigset_t *, int));
-int svr4_setcontext __P((struct proc *p, struct svr4_ucontext *));
+int svr4_setcontext __P((struct thread *p, struct svr4_ucontext *));
typedef struct {
svr4_gregset_t greg;
OpenPOWER on IntegriCloud