blob: 1e88b275edacea8dede15209a158c2b4ad279cc4 [file] [log] [blame]
Jeff Diked67b5692005-07-07 17:56:49 -07001/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
Al Viro30f7dab2005-09-03 15:57:43 -07006#include <asm/signal.h>
Jeff Diked67b5692005-07-07 17:56:49 -07007#include <asm/unistd.h>
8#include "uml-config.h"
9#include "sysdep/sigcontext.h"
10#include "sysdep/faultinfo.h"
11
12void __attribute__ ((__section__ (".__syscall_stub")))
13stub_segv_handler(int sig)
14{
15 struct sigcontext *sc = (struct sigcontext *) (&sig + 1);
16
17 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
18 sc);
19
20 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid));
21 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;"
22 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1));
Bodo Stroesser9057e9d2005-07-28 21:16:06 -070023 /* Load pointer to sigcontext into esp, since we need to leave
Jeff Diked67b5692005-07-07 17:56:49 -070024 * the stack in its original form when we do the sigreturn here, by
25 * hand.
26 */
Bodo Stroesser9057e9d2005-07-28 21:16:06 -070027 __asm__("mov %0,%%esp ; movl %1, %%eax ; "
28 "int $0x80" : : "a" (sc), "g" (__NR_sigreturn));
Jeff Diked67b5692005-07-07 17:56:49 -070029}