* [PATCH 5/6][XEN][x86_64] Add macro for debugreg
@ 2005-04-26 11:31 Vincent Hanquez
2005-04-26 13:17 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Hanquez @ 2005-04-26 11:31 UTC (permalink / raw)
To: linux-kernel; +Cc: ian.pratt, akpm, ak
Hi,
The following patch add 2 macros to set and get debugreg on x86_64.
This is useful for Xen because it will need only to redefine each macro
to a hypervisor call.
Please apply, or comments.
Signed-off-by: Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk>
diff -Naur linux-2.6.12-rc3.1/arch/x86_64/kernel/signal.c linux-2.6.12-rc3.2/arch/x86_64/kernel/signal.c
--- linux-2.6.12-rc3.1/arch/x86_64/kernel/signal.c 2005-04-25 14:19:05.000000000 +0100
+++ linux-2.6.12-rc3.2/arch/x86_64/kernel/signal.c 2005-04-25 14:59:09.950079957 +0100
@@ -433,7 +433,7 @@
* inside the kernel.
*/
if (current->thread.debugreg7)
- asm volatile("movq %0,%%db7" : : "r" (current->thread.debugreg7));
+ cpu_set_debugreg(current->thread.debugreg7, 7);
/* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, oldset, regs);
diff -Naur linux-2.6.12-rc3.1/arch/x86_64/kernel/traps.c linux-2.6.12-rc3.2/arch/x86_64/kernel/traps.c
--- linux-2.6.12-rc3.1/arch/x86_64/kernel/traps.c 2005-04-25 12:01:25.000000000 +0100
+++ linux-2.6.12-rc3.2/arch/x86_64/kernel/traps.c 2005-04-25 14:58:17.006385409 +0100
@@ -667,7 +667,7 @@
}
#endif
- asm("movq %%db6,%0" : "=r" (condition));
+ cpu_get_debugreg(condition, 6);
if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
SIGTRAP) == NOTIFY_STOP)
@@ -719,7 +719,7 @@
info.si_addr = (void __user *)regs->rip;
force_sig_info(SIGTRAP, &info, tsk);
clear_dr7:
- asm volatile("movq %0,%%db7"::"r"(0UL));
+ cpu_set_debugreg(0UL, 7);
return;
clear_TF_reenable:
diff -Naur linux-2.6.12-rc3.1/include/asm-x86_64/processor.h linux-2.6.12-rc3.2/include/asm-x86_64/processor.h
--- linux-2.6.12-rc3.1/include/asm-x86_64/processor.h 2005-04-25 15:37:51.000000000 +0100
+++ linux-2.6.12-rc3.2/include/asm-x86_64/processor.h 2005-04-25 15:38:13.750221554 +0100
@@ -280,6 +280,14 @@
set_fs(USER_DS); \
} while(0)
+#define cpu_get_debugreg(var, register) \
+ __asm__("movq %%db" #register ", %0" \
+ :"=r" (var))
+#define cpu_set_debugreg(value, register) \
+ __asm__("movq %0,%%db" #register \
+ : /* no output */ \
+ :"r" (value))
+
struct task_struct;
struct mm_struct;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6][XEN][x86_64] Add macro for debugreg
2005-04-26 11:31 [PATCH 5/6][XEN][x86_64] Add macro for debugreg Vincent Hanquez
@ 2005-04-26 13:17 ` Andi Kleen
2005-04-26 15:26 ` Vincent Hanquez
0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2005-04-26 13:17 UTC (permalink / raw)
To: linux-kernel, ian.pratt, akpm, ak
On Tue, Apr 26, 2005 at 01:31:49PM +0200, Vincent Hanquez wrote:
> Hi,
>
> The following patch add 2 macros to set and get debugreg on x86_64.
> This is useful for Xen because it will need only to redefine each macro
> to a hypervisor call.
>
> Please apply, or comments.
Thanks,
It looks good, except that the name of the macro is too long.
I will queue it and fix the name up when I apply.
If you plan to add a lot more of these I would recommend
to create a new header first, processor.h is already quite crowded.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6][XEN][x86_64] Add macro for debugreg
2005-04-26 13:17 ` Andi Kleen
@ 2005-04-26 15:26 ` Vincent Hanquez
2005-04-27 13:04 ` Andi Kleen
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Hanquez @ 2005-04-26 15:26 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, ian.pratt, akpm
On Tue, Apr 26, 2005 at 03:17:07PM +0200, Andi Kleen wrote:
> It looks good, except that the name of the macro is too long.
> I will queue it and fix the name up when I apply.
fine. let me know the new name, I'll regenerate a new set of patch for
x86 too. It's probably better to have the same name between the 2 archs.
> If you plan to add a lot more of these I would recommend
> to create a new header first, processor.h is already quite crowded.
Right. Although I think that's all (at least at the moment).
I'll consider that anyway, if more shows up.
Thanks,
--
Vincent Hanquez
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6][XEN][x86_64] Add macro for debugreg
2005-04-26 15:26 ` Vincent Hanquez
@ 2005-04-27 13:04 ` Andi Kleen
2005-04-27 18:42 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2005-04-27 13:04 UTC (permalink / raw)
To: Vincent Hanquez; +Cc: Andi Kleen, linux-kernel, ian.pratt, akpm
On Tue, Apr 26, 2005 at 05:26:38PM +0200, Vincent Hanquez wrote:
> On Tue, Apr 26, 2005 at 03:17:07PM +0200, Andi Kleen wrote:
> > It looks good, except that the name of the macro is too long.
> > I will queue it and fix the name up when I apply.
>
> fine. let me know the new name, I'll regenerate a new set of patch for
> x86 too. It's probably better to have the same name between the 2 archs.
Just dropping the cpu_ should be enough.
-Andi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6][XEN][x86_64] Add macro for debugreg
2005-04-27 13:04 ` Andi Kleen
@ 2005-04-27 18:42 ` Andrew Morton
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2005-04-27 18:42 UTC (permalink / raw)
To: Andi Kleen; +Cc: tab, ak, linux-kernel, ian.pratt
Andi Kleen <ak@suse.de> wrote:
>
> On Tue, Apr 26, 2005 at 05:26:38PM +0200, Vincent Hanquez wrote:
> > On Tue, Apr 26, 2005 at 03:17:07PM +0200, Andi Kleen wrote:
> > > It looks good, except that the name of the macro is too long.
> > > I will queue it and fix the name up when I apply.
> >
> > fine. let me know the new name, I'll regenerate a new set of patch for
> > x86 too. It's probably better to have the same name between the 2 archs.
>
> Just dropping the cpu_ should be enough.
I've edited the six diffs to remove the cpu_.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-27 18:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-26 11:31 [PATCH 5/6][XEN][x86_64] Add macro for debugreg Vincent Hanquez
2005-04-26 13:17 ` Andi Kleen
2005-04-26 15:26 ` Vincent Hanquez
2005-04-27 13:04 ` Andi Kleen
2005-04-27 18:42 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox