* [PATCH 1/3] x86: ia32_signal: remove unused debug code
@ 2009-02-21 2:57 Hiroshi Shimamoto
2009-02-21 3:00 ` [PATCH 2/3] x86: ia32_signal: introduce GET_SEG() macro Hiroshi Shimamoto
2009-02-21 3:00 ` [PATCH 3/3] x86: ia32_signal: introduce {get|set}_user_seg() Hiroshi Shimamoto
0 siblings, 2 replies; 4+ messages in thread
From: Hiroshi Shimamoto @ 2009-02-21 2:57 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Impact: cleanup
DEBUG_SIG will not be used.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
arch/x86/ia32/ia32_signal.c | 18 ------------------
1 files changed, 0 insertions(+), 18 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index dd77ac0..adc63f8 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -33,8 +33,6 @@
#include <asm/sigframe.h>
#include <asm/sys_ia32.h>
-#define DEBUG_SIG 0
-
#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
#define FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \
@@ -220,12 +218,6 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
/* Always make any pending restarted system calls return -EINTR */
current_thread_info()->restart_block.fn = do_no_restart_syscall;
-#if DEBUG_SIG
- printk(KERN_DEBUG "SIG restore_sigcontext: "
- "sc=%p err(%x) eip(%x) cs(%x) flg(%x)\n",
- sc, sc->err, sc->ip, sc->cs, sc->flags);
-#endif
-
get_user_try {
/*
* Reload fs and gs if they have changed in the signal
@@ -488,11 +480,6 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
regs->cs = __USER32_CS;
regs->ss = __USER32_DS;
-#if DEBUG_SIG
- printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n",
- current->comm, current->pid, frame, regs->ip, frame->pretcode);
-#endif
-
return 0;
}
@@ -574,10 +561,5 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
regs->cs = __USER32_CS;
regs->ss = __USER32_DS;
-#if DEBUG_SIG
- printk(KERN_DEBUG "SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n",
- current->comm, current->pid, frame, regs->ip, frame->pretcode);
-#endif
-
return 0;
}
--
1.6.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] x86: ia32_signal: introduce GET_SEG() macro
2009-02-21 2:57 [PATCH 1/3] x86: ia32_signal: remove unused debug code Hiroshi Shimamoto
@ 2009-02-21 3:00 ` Hiroshi Shimamoto
2009-02-21 3:00 ` [PATCH 3/3] x86: ia32_signal: introduce {get|set}_user_seg() Hiroshi Shimamoto
1 sibling, 0 replies; 4+ messages in thread
From: Hiroshi Shimamoto @ 2009-02-21 3:00 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Impact: cleanup
introduce GET_SEG() macro like arch/x86/kernel/signal.c.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
arch/x86/ia32/ia32_signal.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index adc63f8..8dd0903 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -192,11 +192,15 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
get_user_ex(regs->x, &sc->x); \
}
-#define COPY_SEG_CPL3(seg) { \
- unsigned short tmp; \
- get_user_ex(tmp, &sc->seg); \
- regs->seg = tmp | 3; \
-}
+#define GET_SEG(seg) ({ \
+ unsigned short tmp; \
+ get_user_ex(tmp, &sc->seg); \
+ tmp; \
+})
+
+#define COPY_SEG_CPL3(seg) do { \
+ regs->seg = GET_SEG(seg) | 3; \
+} while (0)
#define RELOAD_SEG(seg) { \
unsigned int cur, pre; \
--
1.6.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] x86: ia32_signal: introduce {get|set}_user_seg()
2009-02-21 2:57 [PATCH 1/3] x86: ia32_signal: remove unused debug code Hiroshi Shimamoto
2009-02-21 3:00 ` [PATCH 2/3] x86: ia32_signal: introduce GET_SEG() macro Hiroshi Shimamoto
@ 2009-02-21 3:00 ` Hiroshi Shimamoto
2009-02-22 16:55 ` Ingo Molnar
1 sibling, 1 reply; 4+ messages in thread
From: Hiroshi Shimamoto @ 2009-02-21 3:00 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Impact: cleanup
Introduce {get|set}_user_seg() and loadsegment_xx() macros to make code clean.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
arch/x86/ia32/ia32_signal.c | 38 ++++++++++++++++++--------------------
1 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index 8dd0903..588a7aa 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -188,6 +188,14 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
/*
* Do a signal return; undo the signal stack.
*/
+#define loadsegment_gs(v) load_gs_index(v)
+#define loadsegment_fs(v) loadsegment(fs, v)
+#define loadsegment_ds(v) loadsegment(ds, v)
+#define loadsegment_es(v) loadsegment(es, v)
+
+#define get_user_seg(seg) ({ unsigned int v; savesegment(seg, v); v; })
+#define set_user_seg(seg, v) loadsegment_##seg(v)
+
#define COPY(x) { \
get_user_ex(regs->x, &sc->x); \
}
@@ -203,19 +211,18 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
} while (0)
#define RELOAD_SEG(seg) { \
- unsigned int cur, pre; \
- get_user_ex(pre, &sc->seg); \
- savesegment(seg, cur); \
+ unsigned int pre = GET_SEG(seg); \
+ unsigned int cur = get_user_seg(seg); \
pre |= 3; \
if (pre != cur) \
- loadsegment(seg, pre); \
+ set_user_seg(seg, pre); \
}
static int ia32_restore_sigcontext(struct pt_regs *regs,
struct sigcontext_ia32 __user *sc,
unsigned int *pax)
{
- unsigned int tmpflags, gs, oldgs, err = 0;
+ unsigned int tmpflags, err = 0;
void __user *buf;
u32 tmp;
@@ -229,12 +236,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
* the handler, but does not clobber them at least in the
* normal case.
*/
- get_user_ex(gs, &sc->gs);
- gs |= 3;
- savesegment(gs, oldgs);
- if (gs != oldgs)
- load_gs_index(gs);
-
+ RELOAD_SEG(gs);
RELOAD_SEG(fs);
RELOAD_SEG(ds);
RELOAD_SEG(es);
@@ -333,17 +335,13 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
void __user *fpstate,
struct pt_regs *regs, unsigned int mask)
{
- int tmp, err = 0;
+ int err = 0;
put_user_try {
- savesegment(gs, tmp);
- put_user_ex(tmp, (unsigned int __user *)&sc->gs);
- savesegment(fs, tmp);
- put_user_ex(tmp, (unsigned int __user *)&sc->fs);
- savesegment(ds, tmp);
- put_user_ex(tmp, (unsigned int __user *)&sc->ds);
- savesegment(es, tmp);
- put_user_ex(tmp, (unsigned int __user *)&sc->es);
+ put_user_ex(get_user_seg(gs), (unsigned int __user *)&sc->gs);
+ put_user_ex(get_user_seg(fs), (unsigned int __user *)&sc->fs);
+ put_user_ex(get_user_seg(ds), (unsigned int __user *)&sc->ds);
+ put_user_ex(get_user_seg(es), (unsigned int __user *)&sc->es);
put_user_ex(regs->di, &sc->di);
put_user_ex(regs->si, &sc->si);
--
1.6.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] x86: ia32_signal: introduce {get|set}_user_seg()
2009-02-21 3:00 ` [PATCH 3/3] x86: ia32_signal: introduce {get|set}_user_seg() Hiroshi Shimamoto
@ 2009-02-22 16:55 ` Ingo Molnar
0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-02-22 16:55 UTC (permalink / raw)
To: Hiroshi Shimamoto; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel
* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> Impact: cleanup
>
> Introduce {get|set}_user_seg() and loadsegment_xx() macros to make code clean.
>
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> ---
> arch/x86/ia32/ia32_signal.c | 38 ++++++++++++++++++--------------------
> 1 files changed, 18 insertions(+), 20 deletions(-)
I have applied your three patches to tip:x86/signal, thanks
Hiroshi!
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-22 16:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-21 2:57 [PATCH 1/3] x86: ia32_signal: remove unused debug code Hiroshi Shimamoto
2009-02-21 3:00 ` [PATCH 2/3] x86: ia32_signal: introduce GET_SEG() macro Hiroshi Shimamoto
2009-02-21 3:00 ` [PATCH 3/3] x86: ia32_signal: introduce {get|set}_user_seg() Hiroshi Shimamoto
2009-02-22 16:55 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).