mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 20:23:57 +08:00
9f0b4807a4
The userspace stacks mostly have a stack (and in the case of the syscall stub we can just set their stack pointer) that points to the location of the stub data page already. Rework the stubs to use the stack pointer to derive the start of the data page, rather than requiring it to be hard-coded. In the clone stub, also integrate the int3 into the stack remap, since we really must not use the stack while we remap it. This prepares for putting the stub at a variable location that's not part of the normal address space of the userspace processes running inside the UML machine. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Richard Weinberger <richard@nod.at>
57 lines
918 B
ArmAsm
57 lines
918 B
ArmAsm
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#include <as-layout.h>
|
|
|
|
.section .__syscall_stub, "ax"
|
|
|
|
.globl batch_syscall_stub
|
|
batch_syscall_stub:
|
|
/* %esp comes in as "top of page" */
|
|
mov %esp, %ecx
|
|
/* %esp has pointer to first operation */
|
|
add $8, %esp
|
|
again:
|
|
/* load length of additional data */
|
|
mov 0x0(%esp), %eax
|
|
|
|
/* if(length == 0) : end of list */
|
|
/* write possible 0 to header */
|
|
mov %eax, 0x4(%ecx)
|
|
cmpl $0, %eax
|
|
jz done
|
|
|
|
/* save current pointer */
|
|
mov %esp, 0x4(%ecx)
|
|
|
|
/* skip additional data */
|
|
add %eax, %esp
|
|
|
|
/* load syscall-# */
|
|
pop %eax
|
|
|
|
/* load syscall params */
|
|
pop %ebx
|
|
pop %ecx
|
|
pop %edx
|
|
pop %esi
|
|
pop %edi
|
|
pop %ebp
|
|
|
|
/* execute syscall */
|
|
int $0x80
|
|
|
|
/* restore top of page pointer in %ecx */
|
|
mov %esp, %ecx
|
|
andl $(~UM_KERN_PAGE_SIZE) + 1, %ecx
|
|
|
|
/* check return value */
|
|
pop %ebx
|
|
cmp %ebx, %eax
|
|
je again
|
|
|
|
done:
|
|
/* save return value */
|
|
mov %eax, (%ecx)
|
|
|
|
/* stop */
|
|
int3
|