Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/linux/linux_machdep.c
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) | ||||
int error; | int error; | ||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr); | LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr); | ||||
switch (args->code) { | switch (args->code) { | ||||
case LINUX_ARCH_SET_GS: | case LINUX_ARCH_SET_GS: | ||||
if (args->addr < VM_MAXUSER_ADDRESS) { | if (args->addr < VM_MAXUSER_ADDRESS) { | ||||
set_pcb_flags(pcb, PCB_FULL_IRET); | update_pcb_bases(pcb); | ||||
pcb->pcb_gsbase = args->addr; | pcb->pcb_gsbase = args->addr; | ||||
td->td_frame->tf_gs = _ugssel; | td->td_frame->tf_gs = _ugssel; | ||||
error = 0; | error = 0; | ||||
} else | } else | ||||
error = EPERM; | error = EPERM; | ||||
break; | break; | ||||
case LINUX_ARCH_SET_FS: | case LINUX_ARCH_SET_FS: | ||||
if (args->addr < VM_MAXUSER_ADDRESS) { | if (args->addr < VM_MAXUSER_ADDRESS) { | ||||
set_pcb_flags(pcb, PCB_FULL_IRET); | update_pcb_bases(pcb); | ||||
pcb->pcb_fsbase = args->addr; | pcb->pcb_fsbase = args->addr; | ||||
td->td_frame->tf_fs = _ufssel; | td->td_frame->tf_fs = _ufssel; | ||||
error = 0; | error = 0; | ||||
} else | } else | ||||
error = EPERM; | error = EPERM; | ||||
break; | break; | ||||
case LINUX_ARCH_GET_FS: | case LINUX_ARCH_GET_FS: | ||||
error = copyout(&pcb->pcb_fsbase, PTRIN(args->addr), | error = copyout(&pcb->pcb_fsbase, PTRIN(args->addr), | ||||
Show All 13 Lines | |||||
linux_set_cloned_tls(struct thread *td, void *desc) | linux_set_cloned_tls(struct thread *td, void *desc) | ||||
{ | { | ||||
struct pcb *pcb; | struct pcb *pcb; | ||||
if ((uint64_t)desc >= VM_MAXUSER_ADDRESS) | if ((uint64_t)desc >= VM_MAXUSER_ADDRESS) | ||||
return (EPERM); | return (EPERM); | ||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
update_pcb_bases(pcb); | |||||
kib: why not update_pcb_bases() ? This name more cleanly reflects the intent there, IMO. | |||||
Done Inline Actions
Hmm, there are several other places that all use PCB_FULL_IRET already in the Linuxulator. Probably they should all switch to this? jhb: > why not update_pcb_bases() ? This name more cleanly reflects the intent there, IMO.
Hmm… | |||||
Not Done Inline ActionsI looked over them. I think that only two uses of PCB_FULL_IRET in linux_arch_prctl() are about handling fs/gsbases, and can be changed for clarity. All uses in linux_sysvec.c do want full register file reload because they modify all registers. kib: I looked over them.
I think that only two uses of PCB_FULL_IRET in linux_arch_prctl() are… | |||||
pcb->pcb_fsbase = (register_t)desc; | pcb->pcb_fsbase = (register_t)desc; | ||||
td->td_frame->tf_fs = _ufssel; | td->td_frame->tf_fs = _ufssel; | ||||
return (0); | return (0); | ||||
} | } | ||||
int futex_xchgl_nosmap(int oparg, uint32_t *uaddr, int *oldval); | int futex_xchgl_nosmap(int oparg, uint32_t *uaddr, int *oldval); | ||||
int futex_xchgl_smap(int oparg, uint32_t *uaddr, int *oldval); | int futex_xchgl_smap(int oparg, uint32_t *uaddr, int *oldval); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
why not update_pcb_bases() ? This name more cleanly reflects the intent there, IMO.