Date: Wed, 19 Sep 2001 23:03:11 -0700 From: Peter Wemm <peter@wemm.org> To: "Andrew R. Reiter" <arr@watson.org> Cc: Julian Elischer <julian@elischer.org>, John Baldwin <jhb@FreeBSD.ORG>, hackers@FreeBSD.ORG Subject: Re: JKH Project: x86: pcb_ext Message-ID: <20010920060311.C6E9B380A@overcee.netplex.com.au> In-Reply-To: <Pine.NEB.3.96L.1010919234920.4312C-100000@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
"Andrew R. Reiter" wrote: > On Wed, 19 Sep 2001, Julian Elischer wrote: > > :> > :> We still would need to sync LDT reloads.. > : > :that's more of a worry for me. > :Do we still have separate a LDT for threads? > : > > LDT is per process therefore, in the patch I made, I moved pcb_ldt out > of struct pcb and into mdproc (which is in struct proc). > > I've asked Peter to take a look at it and jhb, however, it is located at: > http://www.watson.org/~arr/fbsd-patches/ldt-2-mdproc.diff One comment: - cmpl $0, PCB_USERLDT(%edx) /* if there is one */ + movl TD_PROC(%ecx), %eax /* load struct proc from CURTHREAD */ + leal P_MD(%eax), %eax /* get mdproc from proc */ + cmpl $0, MD_LDT(%eax) /* if there is one */ This can be written as: movl TD_PROC(%ecx), %eax cmpl $0, P_MD+MD_LDT(%eax) This is evaluated at assemble time. And this change: movl %eax,PCPU(CURRENTLDT) /* store what we have */ jmp 2f -1: pushl %edx /* call a non-trusting routine */ +1: pushl %eax /* call a non-trusting routine */ call set_user_ldt /* to check and load the ldt */ - popl %edx + popl %eax 2: is not good.. you still need to save %edx since set_user_ldt is free to trash it (%edx is the secondary return value from a C function). eg: 0xc02e75c4 <set_user_ldt+36>: mov 0x10(%ebx),%edx 0xc02e75c7 <set_user_ldt+39>: mov %edx,(%eax,%ecx,1) 0xc02e75ca <set_user_ldt+42>: mov 0x14(%ebx),%edx 0xc02e75cd <set_user_ldt+45>: mov %edx,0x4(%eax,%ecx,1) The code after this in swtch.s depends on %edx being preserved. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010920060311.C6E9B380A>