]> git.hungrycats.org Git - linux/commitdiff
[PATCH] UML: Separate out signal reception
authorJeff Dike <jdike@addtoit.com>
Tue, 11 Jan 2005 11:13:13 +0000 (03:13 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 11 Jan 2005 11:13:13 +0000 (03:13 -0800)
This patch moves most of the signal handlers to os-Linux, adds an
arch-specific mechanism to get the address of the sigcontext structure,
and implements it for i386 and x86_64.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/include/sysdep-i386/signal.h [new file with mode: 0644]
arch/um/include/sysdep-x86_64/signal.h [new file with mode: 0644]
arch/um/kernel/trap_user.c
arch/um/os-Linux/Makefile
arch/um/os-Linux/signal.c [new file with mode: 0644]

diff --git a/arch/um/include/sysdep-i386/signal.h b/arch/um/include/sysdep-i386/signal.h
new file mode 100644 (file)
index 0000000..b1e1f7a
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2004 PathScale, Inc
+ * Licensed under the GPL
+ */
+
+#ifndef __I386_SIGNAL_H_
+#define __I386_SIGNAL_H_
+
+#include <signal.h>
+
+#define ARCH_GET_SIGCONTEXT(sc, sig) \
+       do sc = (struct sigcontext *) (&sig + 1); while(0)
+
+#endif
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only.  This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff --git a/arch/um/include/sysdep-x86_64/signal.h b/arch/um/include/sysdep-x86_64/signal.h
new file mode 100644 (file)
index 0000000..e5e5275
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2004 PathScale, Inc
+ * Licensed under the GPL
+ */
+
+#ifndef __X86_64_SIGNAL_H_
+#define __X86_64_SIGNAL_H_
+
+#define ARCH_GET_SIGCONTEXT(sc, sig_addr) \
+       do { \
+               struct ucontext *__uc; \
+               asm("movq %%rdx, %0" : "=r" (__uc)); \
+               sc = (struct sigcontext *) &__uc->uc_mcontext; \
+       } while(0)
+
+#endif
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only.  This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
index 73103c29aff71539816feb0bd9b94b31b9db4928..0a3d279ce64f0c9acc02050f138747105f2d9e70 100644 (file)
@@ -102,28 +102,6 @@ struct signal_info sig_info[] = {
                      .is_irq           = 0 },
 };
 
-void sig_handler(int sig, struct sigcontext sc)
-{
-       CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
-                        sig, &sc);
-}
-
-extern int timer_irq_inited;
-
-void alarm_handler(int sig, struct sigcontext sc)
-{
-       if(!timer_irq_inited) return;
-
-       if(sig == SIGALRM)
-               switch_timers(0);
-
-       CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
-                        sig, &sc);
-
-       if(sig == SIGALRM)
-               switch_timers(1);
-}
-
 void do_longjmp(void *b, int val)
 {
        sigjmp_buf *buf = b;
index af998df18c96c96828a0e01f240eb075c4657053..9d88f68977dfc692a5a6db739313dbc4d97d47f2 100644 (file)
@@ -3,10 +3,10 @@
 # Licensed under the GPL
 #
 
-obj-y = elf_aux.o file.o process.o time.o tty.o user_syms.o drivers/ \
+obj-y = elf_aux.o file.o process.o signal.o time.o tty.o user_syms.o drivers/ \
        sys-$(SUBARCH)/
 
-USER_OBJS := elf_aux.o file.o process.o time.o tty.o
+USER_OBJS := elf_aux.o file.o process.o signal.o time.o tty.o
 USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
 
 $(USER_OBJS) : %.o: %.c
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
new file mode 100644 (file)
index 0000000..7eac1ba
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2004 PathScale, Inc
+ * Licensed under the GPL
+ */
+
+#include <signal.h>
+#include "time_user.h"
+#include "mode.h"
+#include "sysdep/signal.h"
+
+void sig_handler(int sig)
+{
+       struct sigcontext *sc;
+
+       ARCH_GET_SIGCONTEXT(sc, sig);
+       CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
+                        sig, sc);
+}
+
+extern int timer_irq_inited;
+
+void alarm_handler(int sig)
+{
+       struct sigcontext *sc;
+
+       ARCH_GET_SIGCONTEXT(sc, sig);
+       if(!timer_irq_inited) return;
+
+       if(sig == SIGALRM)
+               switch_timers(0);
+
+       CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
+                        sig, sc);
+
+       if(sig == SIGALRM)
+               switch_timers(1);
+}
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only.  This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */