From d1e353d08b6e4b176afe013fd46ba02ddb251532 Mon Sep 17 00:00:00 2001 From: cognet Date: Tue, 24 May 2005 23:05:26 +0000 Subject: [PATCH] Correctly setup the UND stack in cpu_set_upcall(), and the trapframe in cpu_thread_setup(), as done in cpu_fork(). --- sys/arm/arm/vm_machdep.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index a4c69379b165..10d779841cad 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -106,6 +107,8 @@ cpu_fork(register struct thread *td1, register struct proc *p2, struct switchframe *sf; struct mdproc *mdp2; + if ((flags & RFPROC) == 0) + return; pcb1 = td1->td_pcb; pcb2 = (struct pcb *)(td2->td_kstack + td2->td_kstack_pages * PAGE_SIZE) - 1; #ifdef __XSCALE__ @@ -267,8 +270,7 @@ cpu_set_upcall(struct thread *td, struct thread *td0) tf->tf_spsr &= ~PSR_C_bit; tf->tf_r0 = 0; td->td_pcb->un_32.pcb32_sp = (u_int)sf; - td->td_pcb->un_32.pcb32_und_sp = td->td_kstack + td->td_kstack_pages - * PAGE_SIZE + USPACE_UNDEF_STACK_TOP; + td->td_pcb->un_32.pcb32_und_sp = td->td_kstack + USPACE_UNDEF_STACK_TOP; /* Setup to release sched_lock in fork_exit(). */ td->td_md.md_spinlock_count = 1; @@ -317,8 +319,7 @@ cpu_thread_setup(struct thread *td) td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; td->td_frame = (struct trapframe *) - ((u_int)td->td_kstack + td->td_kstack_pages * PAGE_SIZE + - USPACE_SVC_STACK_TOP - sizeof(struct pcb)) - 1; + ((u_int)td->td_kstack + USPACE_SVC_STACK_TOP - sizeof(struct pcb)) - 1; #ifdef __XSCALE__ pmap_use_minicache(td->td_kstack, td->td_kstack_pages * PAGE_SIZE); #endif