mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +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>
22 lines
512 B
C
22 lines
512 B
C
/*
|
|
* Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#include <sysdep/stub.h>
|
|
#include <sysdep/faultinfo.h>
|
|
#include <sysdep/mcontext.h>
|
|
#include <sys/ucontext.h>
|
|
|
|
void __attribute__ ((__section__ (".__syscall_stub")))
|
|
stub_segv_handler(int sig, siginfo_t *info, void *p)
|
|
{
|
|
int stack;
|
|
ucontext_t *uc = p;
|
|
struct faultinfo *f = (void *)(((unsigned long)&stack) & ~(UM_KERN_PAGE_SIZE - 1));
|
|
|
|
GET_FAULTINFO_FROM_MC(*f, &uc->uc_mcontext);
|
|
trap_myself();
|
|
}
|
|
|