Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 May 2003 00:10:24 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        David Xu <davidxu@freebsd.org>
Cc:        Daniel Eischen <eischen@pcnet1.pcnet.com>
Subject:   Re: kern_threads.c..  upcall question..
Message-ID:  <Pine.BSF.4.21.0305052345410.4662-100000@InterJet.elischer.org>
In-Reply-To: <04ec01c3139a$579093d0$f001a8c0@davidw2k>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 6 May 2003, David Xu wrote:

> I think the following patch is enough:

I agree that this seems enough from what I was reading.
(I like patches that have most lines starting with '-' :-)


> 
> Index: kern_thread.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v
> retrieving revision 1.129
> diff -u -r1.129 kern_thread.c
> --- kern_thread.c 1 May 2003 12:16:06 -0000 1.129
> +++ kern_thread.c 6 May 2003 06:32:10 -0000
> @@ -721,41 +721,6 @@
[...]
>  void
> @@ -962,27 +927,25 @@
>   uintptr_t mbx;
>   void *addr;
>   int error,temp;
> - ucontext_t uc;
> + mcontext_t mc;
>  
>   p = td->td_proc;
>   kg = td->td_ksegrp;
>  
>   /* Export the user/machine context. */
> - addr = (void *)(&td->td_mailbox->tm_context);
> - error = copyin(addr, &uc, sizeof(ucontext_t));
> - if (error) 
> -  goto bad;
> -
> - thread_getcontext(td, &uc);
> - error = copyout(&uc, addr, sizeof(ucontext_t));
> - if (error) 
> + get_mcontext(td, &mc, 0);

I think this could be optimised even more.
(why copy the FP regs if they are not valid) (etc).
but it is an improvement..

> + addr = (void *)(&td->td_mailbox->tm_context.uc_mcontext);
> + error = copyout(&mc, addr, sizeof(mcontext_t));
> + if (error)
>    goto bad;
>  
>   /* Exports clock ticks in kernel mode */
>   addr = (caddr_t)(&td->td_mailbox->tm_sticks);
>   temp = fuword(addr) + td->td_usticks;
> - if (suword(addr, temp))
> + if (suword(addr, temp)) {
> +  error = EFAULT;
>    goto bad;
> + }
>  
>   /* Get address in latest mbox of list pointer */
>   addr = (void *)(&td->td_mailbox->tm_next);
> 
> 
> And should we disable single threading testing or do
> double checking in thread_user_enter()? I think per-syscall
> PROC_LOCK is too expensive for us.

I am not sure which one you refer too.. Which single_threading
test?

BTW, I am a little unsure about the calling of thread_user_enter()
from thread_userret().



> 
> David Xu
> 
> 
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0305052345410.4662-100000>