For example, here: https://github.com/seL4/seL4/blob/master/libsel4/arch_include/x86/sel4/arch/... What use is the label? Does it align the instruction or do other ABI-important things? -- /cmr
Hi Corey, I didn't write this code, so someone else may wish to correct me with a more accurate answer, but my understanding was that this was related to how the sysenter and sysexit instructions work. The sysexit instruction restores your instruction pointer from edx, not directly from eip. This means edx has to contain the userspace address we want to return to when executing sysexit in the kernel. Instead of having the kernel do this, the userspace stub takes care of it instead. You'll notice just prior to the label, it is used to load the address of the sysenter instruction into edx. This way, provided the kernel preserves the user's edx, the syscall returns to the correct location in userspace. Matt On 16/09/15 08:58, Corey Richardson wrote:
For example, here: https://github.com/seL4/seL4/blob/master/libsel4/arch_include/x86/sel4/arch/...
What use is the label? Does it align the instruction or do other ABI-important things?
________________________________ The information in this e-mail may be confidential and subject to legal professional privilege and/or copyright. National ICT Australia Limited accepts no liability for any damage caused by this email or its attachments.
Ah, excellent observation: makes complete sense, I hadn't noticed that that wasn't a numeric constant. On Tue, Sep 15, 2015, at 19:13, Matthew Fernandez wrote:
Hi Corey,
I didn't write this code, so someone else may wish to correct me with a more accurate answer, but my understanding was that this was related to how the sysenter and sysexit instructions work. The sysexit instruction restores your instruction pointer from edx, not directly from eip. This means edx has to contain the userspace address we want to return to when executing sysexit in the kernel. Instead of having the kernel do this, the userspace stub takes care of it instead. You'll notice just prior to the label, it is used to load the address of the sysenter instruction into edx. This way, provided the kernel preserves the user's edx, the syscall returns to the correct location in userspace.
Matt
On 16/09/15 08:58, Corey Richardson wrote:
For example, here: https://github.com/seL4/seL4/blob/master/libsel4/arch_include/x86/sel4/arch/...
What use is the label? Does it align the instruction or do other ABI-important things?
________________________________
The information in this e-mail may be confidential and subject to legal professional privilege and/or copyright. National ICT Australia Limited accepts no liability for any damage caused by this email or its attachments.
-- /cmr
participants (2)
-
Corey Richardson
-
Matthew Fernandez