patch-2.4.21 linux-2.4.21/arch/x86_64/kernel/signal.c
Next file: linux-2.4.21/arch/x86_64/kernel/smp.c
Previous file: linux-2.4.21/arch/x86_64/kernel/setup64.c
Back to the patch index
Back to the overall index
- Lines: 131
- Date:
2003-06-13 07:51:32.000000000 -0700
- Orig file:
linux-2.4.20/arch/x86_64/kernel/signal.c
- Orig date:
2002-11-28 15:53:12.000000000 -0800
diff -urN linux-2.4.20/arch/x86_64/kernel/signal.c linux-2.4.21/arch/x86_64/kernel/signal.c
@@ -8,7 +8,7 @@
* 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes
* 2000-2001 x86-64 support by Andi Kleen
*
- * $Id: signal.c,v 1.35 2002/07/29 10:34:03 ak Exp $
+ * $Id: signal.c,v 1.42 2003/02/24 21:06:02 ak Exp $
*/
#include <linux/sched.h>
@@ -29,6 +29,7 @@
#include <asm/ucontext.h>
#include <asm/uaccess.h>
#include <asm/i387.h>
+#include <asm/proto.h>
#define DEBUG_SIG 0
@@ -63,8 +64,6 @@
/* First 32bits of unions are always present. */
err |= __put_user(from->si_pid, &to->si_pid);
switch (from->si_code >> 16) {
- case __SI_FAULT >> 16:
- break;
case __SI_CHLD >> 16:
err |= __put_user(from->si_utime, &to->si_utime);
err |= __put_user(from->si_stime, &to->si_stime);
@@ -139,13 +138,7 @@
if ((regs->x >> 48) != 0 && (regs->x >> 48) != 0xffff) \
regs->x = 0;
- {
- unsigned int seg;
- err |= __get_user(seg, &sc->gs);
- load_gs_index(seg);
- err |= __get_user(seg, &sc->fs);
- loadsegment(fs,seg);
- }
+ /* fs and gs are ignored because we cannot handle the 64bit base easily */
COPY(rdi); COPY(rsi); COPY(rbp); COPY_CANON(rsp); COPY(rbx);
COPY(rdx); COPY(rcx); COPY_CANON(rip);
@@ -232,10 +225,8 @@
struct task_struct *me = current;
tmp = 0;
- __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
- err |= __put_user(tmp, (unsigned int *)&sc->gs);
- __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
- err |= __put_user(tmp, (unsigned int *)&sc->fs);
+ err |= __put_user(0, &sc->gs);
+ err |= __put_user(0, &sc->fs);
err |= __put_user(regs->rdi, &sc->rdi);
err |= __put_user(regs->rsi, &sc->rsi);
@@ -264,12 +255,6 @@
return err;
}
-/*
- * Determine which stack to use..
- */
-#define round_down(p, r) ((void *) ((unsigned long)((p) - (r) + 1) & ~((r)-1)))
-
-
static void *
get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
{
@@ -279,34 +264,35 @@
rsp = regs->rsp - 128;
/* This is the X/Open sanctioned signal stack switching. */
+ /* may need to subtract redzone there too */
if (ka->sa.sa_flags & SA_ONSTACK) {
- if (! sas_ss_flags(rsp) == 0)
+ if (sas_ss_flags(rsp) == 0)
rsp = current->sas_ss_sp + current->sas_ss_size;
}
- return round_down(rsp - size, 16);
+ return (void *)round_down(rsp - size, 16);
}
static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
sigset_t *set, struct pt_regs * regs)
{
- struct rt_sigframe *frame = NULL;
- struct _fpstate *fp = NULL;
+ struct rt_sigframe *frame;
+ struct _fpstate *fp;
int err = 0;
if (current->used_math) {
fp = get_stack(ka, regs, sizeof(struct _fpstate));
- frame = round_down((char *)fp - sizeof(struct rt_sigframe), 16) - 8;
+ frame = (void *)round_down((unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) {
goto give_sigsegv;
}
if (save_i387(fp) < 0)
err |= -1;
- }
-
- if (!frame)
+ } else {
frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8;
+ fp = NULL;
+ }
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) {
goto give_sigsegv;
@@ -400,7 +386,7 @@
#endif
/* Are we from a system call? */
- if (regs->orig_rax >= 0) {
+ if ((long)regs->orig_rax >= 0) {
/* If so, check system call restarting.. */
switch (regs->rax) {
case -ERESTARTNOHAND:
@@ -563,8 +549,8 @@
* have been cleared if the watchpoint triggered
* inside the kernel.
*/
- __asm__("movq %0,%%db7" : : "r" (current->thread.debugreg[7]));
-
+ if (current->thread.debugreg[7])
+ asm volatile("movq %0,%%db7" :: "r" (current->thread.debugreg[7]));
/* Whee! Actually deliver the signal. */
handle_signal(signr, ka, &info, oldset, regs);
return 1;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)