Implement 32-bit compatable fsbase/gsbase methods so that we can run

(newer) unmodified static i386 binaries again.
This commit is contained in:
Peter Wemm 2005-04-14 16:57:58 +00:00
parent c92163dcad
commit fe8b8bf778
2 changed files with 26 additions and 0 deletions

View File

@ -56,8 +56,29 @@ sysarch(td, uap)
{
int error = 0;
struct pcb *pcb = curthread->td_pcb;
uint32_t i386base;
switch(uap->op) {
case I386_GET_FSBASE:
i386base = pcb->pcb_fsbase;
error = copyout(&i386base, uap->parms, sizeof(i386base));
break;
case I386_SET_FSBASE:
error = copyin(uap->parms, &i386base, sizeof(i386base));
pcb->pcb_fsbase = i386base;
if (!error)
wrmsr(MSR_FSBASE, pcb->pcb_fsbase);
break;
case I386_GET_GSBASE:
i386base = pcb->pcb_gsbase;
error = copyout(&i386base, uap->parms, sizeof(i386base));
break;
case I386_SET_GSBASE:
error = copyin(uap->parms, &i386base, sizeof(i386base));
pcb->pcb_gsbase = i386base;
if (!error)
wrmsr(MSR_KGSBASE, pcb->pcb_gsbase);
break;
case AMD64_GET_FSBASE:
error = copyout(&pcb->pcb_fsbase, uap->parms, sizeof(pcb->pcb_fsbase));
break;

View File

@ -35,6 +35,11 @@
#ifndef _MACHINE_SYSARCH_H_
#define _MACHINE_SYSARCH_H_
#define I386_GET_FSBASE 7
#define I386_SET_FSBASE 8
#define I386_GET_GSBASE 9
#define I386_SET_GSBASE 10
/* Leave space for 0-127 for to avoid translating syscalls */
#define AMD64_GET_FSBASE 128
#define AMD64_SET_FSBASE 129