aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/stub_segv.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/sys-i386/stub_segv.c')
-rw-r--r--arch/um/sys-i386/stub_segv.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
new file mode 100644
index 000000000000..b251442ad0b1
--- /dev/null
+++ b/arch/um/sys-i386/stub_segv.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7#include <asm/sigcontext.h>
8#include <asm/unistd.h>
9#include "uml-config.h"
10#include "sysdep/sigcontext.h"
11#include "sysdep/faultinfo.h"
12
13void __attribute__ ((__section__ (".__syscall_stub")))
14stub_segv_handler(int sig)
15{
16 struct sigcontext *sc = (struct sigcontext *) (&sig + 1);
17
18 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
19 sc);
20
21 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid));
22 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;"
23 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1));
24 /* Pop the frame pointer and return address since we need to leave
25 * the stack in its original form when we do the sigreturn here, by
26 * hand.
27 */
28 __asm__("popl %%eax ; popl %%eax ; popl %%eax ; movl %0, %%eax ; "
29 "int $0x80" : : "g" (__NR_sigreturn));
30}