summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-02-07 20:58:47 +0000
committerjulian <julian@FreeBSD.org>2002-02-07 20:58:47 +0000
commitb5eb64d6f0fccb72419da5552deee22cb6117fac (patch)
treeb267ad497d8d81c2c79c107443dabe850da2126b /sys/alpha
parentfce570367d0faf3002916a499e684172e61d8b9b (diff)
downloadFreeBSD-src-b5eb64d6f0fccb72419da5552deee22cb6117fac.zip
FreeBSD-src-b5eb64d6f0fccb72419da5552deee22cb6117fac.tar.gz
Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/db_trace.c2
-rw-r--r--sys/alpha/alpha/locore.s2
-rw-r--r--sys/alpha/alpha/machdep.c25
-rw-r--r--sys/alpha/alpha/pmap.c4
-rw-r--r--sys/alpha/alpha/prom.c4
-rw-r--r--sys/alpha/alpha/sys_machdep.c6
-rw-r--r--sys/alpha/alpha/vm_machdep.c5
-rw-r--r--sys/alpha/linux/linux_machdep.c4
-rw-r--r--sys/alpha/linux/linux_sysvec.c2
-rw-r--r--sys/alpha/osf1/imgact_osf1.c6
10 files changed, 29 insertions, 31 deletions
diff --git a/sys/alpha/alpha/db_trace.c b/sys/alpha/alpha/db_trace.c
index f99e5a0..2844da4 100644
--- a/sys/alpha/alpha/db_trace.c
+++ b/sys/alpha/alpha/db_trace.c
@@ -254,7 +254,7 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *m
db_printf("pid %d swapped out\n", pid);
return;
}
- pcbp = p->p_thread.td_pcb; /* XXXKSE */
+ pcbp = FIRST_THREAD_IN_PROC(p)->td_pcb; /* XXXKSE */
addr = (db_expr_t)pcbp->pcb_hw.apcb_ksp;
callpc = pcbp->pcb_context[7];
frame = addr;
diff --git a/sys/alpha/alpha/locore.s b/sys/alpha/alpha/locore.s
index e560d84..5d1cdce 100644
--- a/sys/alpha/alpha/locore.s
+++ b/sys/alpha/alpha/locore.s
@@ -119,7 +119,7 @@
/*
* Switch to proc0's PCB.
*/
- ldq t0,thread0 /* get phys addr of pcb */
+ lda t0,thread0 /* get phys addr of pcb */
ldq a0,TD_MD_PCBPADDR(t0)
SWITCH_CONTEXT
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 9ac2824..f05de44 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -894,17 +894,16 @@ alpha_init(pfn, ptb, bim, bip, biv)
}
- proc_linkup(&proc0);
+ proc_linkup(&proc0,&proc0.p_ksegrp,&proc0.p_kse,&thread0);
/*
* Init mapping for u page(s) for proc 0
*/
proc0uarea = (struct user *)pmap_steal_memory(UAREA_PAGES * PAGE_SIZE);
proc0kstack = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE);
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;
+ thread0.td_kstack = proc0kstack;
+ thread0.td_pcb = (struct pcb *)
+ (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
/*
* Setup the per-CPU data for the bootstrap cpu.
@@ -917,7 +916,7 @@ alpha_init(pfn, ptb, bim, bip, biv)
alpha_pal_wrval((u_int64_t) pcpup);
PCPU_GET(next_asn) = 1; /* 0 used for proc0 pmap */
#ifdef SMP
- thread0->td_md.md_kernnest = 1;
+ thread0.td_md.md_kernnest = 1;
#endif
}
@@ -935,20 +934,20 @@ alpha_init(pfn, ptb, bim, bip, biv)
* Initialize the rest of proc 0's PCB, and cache its physical
* address.
*/
- thread0->td_md.md_pcbpaddr =
- (struct pcb *)ALPHA_K0SEG_TO_PHYS((vm_offset_t)thread0->td_pcb);
+ thread0.td_md.md_pcbpaddr =
+ (struct pcb *)ALPHA_K0SEG_TO_PHYS((vm_offset_t)thread0.td_pcb);
/*
* Set the kernel sp, reserving space for an (empty) trapframe,
* and make proc0's trapframe pointer point to it for sanity.
*/
- thread0->td_frame = (struct trapframe *)thread0->td_pcb - 1;
- thread0->td_pcb->pcb_hw.apcb_ksp = (u_int64_t)thread0->td_frame;
+ thread0.td_frame = (struct trapframe *)thread0.td_pcb - 1;
+ thread0.td_pcb->pcb_hw.apcb_ksp = (u_int64_t)thread0.td_frame;
/* Setup curthread so that mutexes work */
- PCPU_SET(curthread, thread0);
+ PCPU_SET(curthread, &thread0);
- LIST_INIT(&thread0->td_contested);
+ LIST_INIT(&thread0.td_contested);
/*
* Initialise mutexes.
@@ -2166,6 +2165,6 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz)
pcpu->pc_idlepcbphys = vtophys((vm_offset_t) &pcpu->pc_idlepcb);
pcpu->pc_idlepcb.apcb_ksp = (u_int64_t)
((caddr_t) pcpu + sz - sizeof(struct trapframe));
- pcpu->pc_idlepcb.apcb_ptbr = thread0->td_pcb->pcb_hw.apcb_ptbr;
+ pcpu->pc_idlepcb.apcb_ptbr = thread0.td_pcb->pcb_hw.apcb_ptbr;
pcpu->pc_current_asngen = 1;
}
diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c
index 059a268..e628d14 100644
--- a/sys/alpha/alpha/pmap.c
+++ b/sys/alpha/alpha/pmap.c
@@ -557,9 +557,9 @@ pmap_bootstrap(vm_offset_t ptaddr, u_int maxasn)
* Set up proc0's PCB such that the ptbr points to the right place
* and has the kernel pmap's.
*/
- thread0->td_pcb->pcb_hw.apcb_ptbr =
+ thread0.td_pcb->pcb_hw.apcb_ptbr =
ALPHA_K0SEG_TO_PHYS((vm_offset_t)Lev1map) >> PAGE_SHIFT;
- thread0->td_pcb->pcb_hw.apcb_asn = 0;
+ thread0.td_pcb->pcb_hw.apcb_asn = 0;
}
int
diff --git a/sys/alpha/alpha/prom.c b/sys/alpha/alpha/prom.c
index d4dd267..b7449eb 100644
--- a/sys/alpha/alpha/prom.c
+++ b/sys/alpha/alpha/prom.c
@@ -315,8 +315,8 @@ hwrpb_restart_setup()
p = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off);
p->pcs_flags &= ~PCS_BIP;
- bcopy(&thread0->td_pcb->pcb_hw, p->pcs_hwpcb,
- sizeof thread0->td_pcb->pcb_hw);
+ bcopy(&thread0.td_pcb->pcb_hw, p->pcs_hwpcb,
+ sizeof thread0.td_pcb->pcb_hw);
hwrpb->rpb_vptb = VPTBASE;
/* when 'c'ontinuing from console halt, do a dump */
diff --git a/sys/alpha/alpha/sys_machdep.c b/sys/alpha/alpha/sys_machdep.c
index 939289a..47dae7b 100644
--- a/sys/alpha/alpha/sys_machdep.c
+++ b/sys/alpha/alpha/sys_machdep.c
@@ -180,8 +180,8 @@ alpha_set_uac(struct thread *td, char *args)
if (p->p_pptr) {
PROC_LOCK(p->p_pptr);
/* XXXKSE which threads? */
- p->p_pptr->p_thread.td_md.md_flags &= ~MDP_UAC_MASK;
- p->p_pptr->p_thread.td_md.md_flags |= uac & MDP_UAC_MASK;
+ FIRST_THREAD_IN_PROC(p->p_pptr)->td_md.md_flags &= ~MDP_UAC_MASK;
+ FIRST_THREAD_IN_PROC(p->p_pptr)->td_md.md_flags |= uac & MDP_UAC_MASK;
PROC_UNLOCK(p->p_pptr);
}
PROC_UNLOCK(p);
@@ -201,7 +201,7 @@ alpha_get_uac(struct thread *td, char *args)
if (p->p_pptr) {
PROC_LOCK(p->p_pptr);
/* XXXKSE which threads? */
- uac = p->p_pptr->p_thread.td_md.md_flags & MDP_UAC_MASK;
+ uac = FIRST_THREAD_IN_PROC(p->p_pptr)->td_md.md_flags & MDP_UAC_MASK;
PROC_UNLOCK(p->p_pptr);
PROC_UNLOCK(p);
error = copyout(&uac, args, sizeof(uac));
diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c
index 076139d..e12267d 100644
--- a/sys/alpha/alpha/vm_machdep.c
+++ b/sys/alpha/alpha/vm_machdep.c
@@ -118,20 +118,19 @@ vm_fault_quick(v, prot)
* ready to run and return to user mode.
*/
void
-cpu_fork(td1, p2, flags)
+cpu_fork(td1, p2, td2, flags)
register struct thread *td1;
register struct proc *p2;
+ register struct thread *td2;
int flags;
{
struct proc *p1;
- struct thread *td2;
struct trapframe *p2tf;
if ((flags & RFPROC) == 0)
return;
p1 = td1->td_proc;
- td2 = &p2->p_thread;
td2->td_pcb = (struct pcb *)
(td2->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
td2->td_md.md_flags = td1->td_md.md_flags & (MDP_FPUSED | MDP_UAC_MASK);
diff --git a/sys/alpha/linux/linux_machdep.c b/sys/alpha/linux/linux_machdep.c
index 3a6e840..97674f5 100644
--- a/sys/alpha/linux/linux_machdep.c
+++ b/sys/alpha/linux/linux_machdep.c
@@ -166,7 +166,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
PROC_LOCK(p2);
p2->p_sigparent = exit_signal;
PROC_UNLOCK(p2);
- p2->p_thread.td_pcb->pcb_hw.apcb_usp = (unsigned long)args->stack;
+ FIRST_THREAD_IN_PROC(p2)->td_pcb->pcb_hw.apcb_usp = (unsigned long)args->stack;
#ifdef DEBUG
if (ldebug(clone))
@@ -179,7 +179,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args)
*/
mtx_lock_spin(&sched_lock);
p2->p_stat = SRUN;
- setrunqueue(&p2->p_thread);
+ setrunqueue(FIRST_THREAD_IN_PROC(p2));
mtx_unlock_spin(&sched_lock);
td->td_retval[0] = p2->p_pid;
diff --git a/sys/alpha/linux/linux_sysvec.c b/sys/alpha/linux/linux_sysvec.c
index 6dd3ee5..0380d7d 100644
--- a/sys/alpha/linux/linux_sysvec.c
+++ b/sys/alpha/linux/linux_sysvec.c
@@ -153,7 +153,7 @@ exec_linux_imgact_try(imgp)
if ((error = exec_shell_imgact(imgp)) == 0) {
char *rpath = NULL;
- linux_emul_find(&imgp->proc->p_thread, NULL,
+ linux_emul_find(FIRST_THREAD_IN_PROC(imgp->proc), NULL,
imgp->interpreter_name, &rpath, 0);
if (rpath != imgp->interpreter_name) {
int len = strlen(rpath) + 1;
diff --git a/sys/alpha/osf1/imgact_osf1.c b/sys/alpha/osf1/imgact_osf1.c
index 9aae801..9eebe77 100644
--- a/sys/alpha/osf1/imgact_osf1.c
+++ b/sys/alpha/osf1/imgact_osf1.c
@@ -137,7 +137,7 @@ exec_osf1_imgact(struct image_params *imgp)
ndp = (struct nameidata *)malloc(sizeof(struct nameidata),
M_TEMP, M_WAITOK);
NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE,
- "/compat/osf1/sbin/loader", &imgp->proc->p_thread);
+ "/compat/osf1/sbin/loader", FIRST_THREAD_IN_PROC(imgp->proc));
error = namei(ndp);
if (error) {
uprintf("imgact_osf1: can't read /compat/osf1/sbin/loader\n");
@@ -150,7 +150,7 @@ exec_osf1_imgact(struct image_params *imgp)
}
imgp->vp = ndp->ni_vp;
error = exec_map_first_page(imgp);
- VOP_UNLOCK(imgp->vp, 0, &imgp->proc->p_thread);
+ VOP_UNLOCK(imgp->vp, 0, FIRST_THREAD_IN_PROC(imgp->proc));
osf_auxargs->loader = "/compat/osf1/sbin/loader";
}
@@ -249,7 +249,7 @@ exec_osf1_imgact(struct image_params *imgp)
free(imgp->auxargs, M_TEMP);
if (ndp) {
VOP_CLOSE(ndp->ni_vp, FREAD, imgp->proc->p_ucred,
- &imgp->proc->p_thread);
+ FIRST_THREAD_IN_PROC(imgp->proc));
vrele(ndp->ni_vp);
}
return(error);
OpenPOWER on IntegriCloud