public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* "[PATCH
@ 2005-04-26 10:38 Vincent Hanquez
  2005-04-26 11:26 ` [PATCH 3/6][XEN][x86] Rename usermode macro Vincent Hanquez
  0 siblings, 1 reply; 4+ messages in thread
From: Vincent Hanquez @ 2005-04-26 10:38 UTC (permalink / raw)
  To: "3/6][XEN]", "[x86]", akpm, ", <ian.pratt,
	Andrew, Hanquez, linux-kernel, macro,
	", Morton, Pratt, rename, usermode, Vincent"
  Cc: Ian

Hi,

The following patch rename user_mode to user_mode_vm and add a user_mode macro
similar to the x86-64 one.

This is useful for Xen because the linux xen kernel does not runs on the same
priviledge that a vanilla linux kernel, and with this we just need to redefine
user_mode().

Please apply, or comments.

	Signed-off-by: Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk>

diff -Naur linux-2.6.12-rc3/arch/i386/kernel/apic.c linux-2.6.12-rc3.1/arch/i386/kernel/apic.c
--- linux-2.6.12-rc3/arch/i386/kernel/apic.c	2005-04-21 11:45:45.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/kernel/apic.c	2005-04-25 18:13:00.000000000 +0100
@@ -1133,7 +1133,7 @@
 		}
 
 #ifdef CONFIG_SMP
-		update_process_times(user_mode(regs));
+		update_process_times(user_mode_vm(regs));
 #endif
 	}
 
diff -Naur linux-2.6.12-rc3/arch/i386/kernel/ptrace.c linux-2.6.12-rc3.1/arch/i386/kernel/ptrace.c
--- linux-2.6.12-rc3/arch/i386/kernel/ptrace.c	2005-04-21 11:45:46.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/kernel/ptrace.c	2005-04-25 18:12:39.000000000 +0100
@@ -667,7 +667,7 @@
 	info.si_code = TRAP_BRKPT;
 
 	/* User-mode eip? */
-	info.si_addr = user_mode(regs) ? (void __user *) regs->eip : NULL;
+	info.si_addr = user_mode_vm(regs) ? (void __user *) regs->eip : NULL;
 
 	/* Send us the fakey SIGTRAP */
 	force_sig_info(SIGTRAP, &info, tsk);
diff -Naur linux-2.6.12-rc3/arch/i386/mach-voyager/voyager_smp.c linux-2.6.12-rc3.1/arch/i386/mach-voyager/voyager_smp.c
--- linux-2.6.12-rc3/arch/i386/mach-voyager/voyager_smp.c	2005-04-21 11:45:46.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/mach-voyager/voyager_smp.c	2005-04-25 18:13:12.000000000 +0100
@@ -1289,7 +1289,7 @@
 						per_cpu(prof_counter, cpu);
 		}
 
-		update_process_times(user_mode(regs));
+		update_process_times(user_mode_vm(regs));
 	}
 
 	if( ((1<<cpu) & voyager_extended_vic_processors) == 0)
diff -Naur linux-2.6.12-rc3/arch/i386/oprofile/backtrace.c linux-2.6.12-rc3.1/arch/i386/oprofile/backtrace.c
--- linux-2.6.12-rc3/arch/i386/oprofile/backtrace.c	2005-04-21 11:45:46.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/oprofile/backtrace.c	2005-04-25 18:13:21.000000000 +0100
@@ -91,7 +91,7 @@
 	head = (struct frame_head *)regs->ebp;
 #endif
 
-	if (!user_mode(regs)) {
+	if (!user_mode_vm(regs)) {
 		while (depth-- && valid_kernel_stack(head, regs))
 			head = dump_backtrace(head);
 		return;
diff -Naur linux-2.6.12-rc3/include/asm-i386/ptrace.h linux-2.6.12-rc3.1/include/asm-i386/ptrace.h
--- linux-2.6.12-rc3/include/asm-i386/ptrace.h	2005-03-02 07:37:48.000000000 +0000
+++ linux-2.6.12-rc3.1/include/asm-i386/ptrace.h	2005-04-25 17:05:54.000000000 +0100
@@ -57,7 +57,8 @@
 #ifdef __KERNEL__
 struct task_struct;
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
-#define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
+#define user_mode(regs)		(3 & (regs)->xcs)
+#define user_mode_vm(regs)	((VM_MASK & (regs)->eflags) || user_mode(regs))
 #define instruction_pointer(regs) ((regs)->eip)
 #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
 extern unsigned long profile_pc(struct pt_regs *regs);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/6][XEN][x86] Rename usermode macro
  2005-04-26 10:38 "[PATCH Vincent Hanquez
@ 2005-04-26 11:26 ` Vincent Hanquez
  2005-04-28  2:43   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Vincent Hanquez @ 2005-04-26 11:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: ian.pratt, akpm

Hi,

The following patch rename user_mode to user_mode_vm and add a user_mode macro
similar to the x86-64 one.

This is useful for Xen because the linux xen kernel does not runs on the same
priviledge that a vanilla linux kernel, and with this we just need to redefine
user_mode().

ignore my previous mail, really sorry for the noise.

Please apply, or comments.

	Signed-off-by: Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk>

diff -Naur linux-2.6.12-rc3/arch/i386/kernel/apic.c linux-2.6.12-rc3.1/arch/i386/kernel/apic.c
--- linux-2.6.12-rc3/arch/i386/kernel/apic.c	2005-04-21 11:45:45.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/kernel/apic.c	2005-04-25 18:13:00.000000000 +0100
@@ -1133,7 +1133,7 @@
 		}
 
 #ifdef CONFIG_SMP
-		update_process_times(user_mode(regs));
+		update_process_times(user_mode_vm(regs));
 #endif
 	}
 
diff -Naur linux-2.6.12-rc3/arch/i386/kernel/ptrace.c linux-2.6.12-rc3.1/arch/i386/kernel/ptrace.c
--- linux-2.6.12-rc3/arch/i386/kernel/ptrace.c	2005-04-21 11:45:46.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/kernel/ptrace.c	2005-04-25 18:12:39.000000000 +0100
@@ -667,7 +667,7 @@
 	info.si_code = TRAP_BRKPT;
 
 	/* User-mode eip? */
-	info.si_addr = user_mode(regs) ? (void __user *) regs->eip : NULL;
+	info.si_addr = user_mode_vm(regs) ? (void __user *) regs->eip : NULL;
 
 	/* Send us the fakey SIGTRAP */
 	force_sig_info(SIGTRAP, &info, tsk);
diff -Naur linux-2.6.12-rc3/arch/i386/mach-voyager/voyager_smp.c linux-2.6.12-rc3.1/arch/i386/mach-voyager/voyager_smp.c
--- linux-2.6.12-rc3/arch/i386/mach-voyager/voyager_smp.c	2005-04-21 11:45:46.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/mach-voyager/voyager_smp.c	2005-04-25 18:13:12.000000000 +0100
@@ -1289,7 +1289,7 @@
 						per_cpu(prof_counter, cpu);
 		}
 
-		update_process_times(user_mode(regs));
+		update_process_times(user_mode_vm(regs));
 	}
 
 	if( ((1<<cpu) & voyager_extended_vic_processors) == 0)
diff -Naur linux-2.6.12-rc3/arch/i386/oprofile/backtrace.c linux-2.6.12-rc3.1/arch/i386/oprofile/backtrace.c
--- linux-2.6.12-rc3/arch/i386/oprofile/backtrace.c	2005-04-21 11:45:46.000000000 +0100
+++ linux-2.6.12-rc3.1/arch/i386/oprofile/backtrace.c	2005-04-25 18:13:21.000000000 +0100
@@ -91,7 +91,7 @@
 	head = (struct frame_head *)regs->ebp;
 #endif
 
-	if (!user_mode(regs)) {
+	if (!user_mode_vm(regs)) {
 		while (depth-- && valid_kernel_stack(head, regs))
 			head = dump_backtrace(head);
 		return;
diff -Naur linux-2.6.12-rc3/include/asm-i386/ptrace.h linux-2.6.12-rc3.1/include/asm-i386/ptrace.h
--- linux-2.6.12-rc3/include/asm-i386/ptrace.h	2005-03-02 07:37:48.000000000 +0000
+++ linux-2.6.12-rc3.1/include/asm-i386/ptrace.h	2005-04-25 17:05:54.000000000 +0100
@@ -57,7 +57,8 @@
 #ifdef __KERNEL__
 struct task_struct;
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
-#define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
+#define user_mode(regs)		(3 & (regs)->xcs)
+#define user_mode_vm(regs)	((VM_MASK & (regs)->eflags) || user_mode(regs))
 #define instruction_pointer(regs) ((regs)->eip)
 #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
 extern unsigned long profile_pc(struct pt_regs *regs);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/6][XEN][x86] Rename usermode macro
  2005-04-26 11:26 ` [PATCH 3/6][XEN][x86] Rename usermode macro Vincent Hanquez
@ 2005-04-28  2:43   ` Andrew Morton
  2005-04-28 14:39     ` Vincent Hanquez
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2005-04-28  2:43 UTC (permalink / raw)
  To: Vincent Hanquez; +Cc: linux-kernel, ian.pratt

Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk> wrote:
>
> The following patch rename user_mode to user_mode_vm and add a user_mode macro
>  similar to the x86-64 one.

Why didn't your testing pick up the x86_64 build error?

arch/x86_64/oprofile/built-in.o(.text+0x1d09): In function `x86_backtrace':
arch/x86_64/oprofile/../../i386/oprofile/backtrace.c:94: undefined reference to `user_mode_vm'


Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/asm-x86_64/ptrace.h |    1 +
 1 files changed, 1 insertion(+)

diff -puN include/asm-x86_64/ptrace.h~xen-x86-rename-usermode-macro-fix include/asm-x86_64/ptrace.h
--- 25/include/asm-x86_64/ptrace.h~xen-x86-rename-usermode-macro-fix	2005-04-27 18:22:12.000000000 -0700
+++ 25-akpm/include/asm-x86_64/ptrace.h	2005-04-27 18:22:12.000000000 -0700
@@ -82,6 +82,7 @@ struct pt_regs {
 
 #if defined(__KERNEL__) && !defined(__ASSEMBLY__) 
 #define user_mode(regs) (!!((regs)->cs & 3))
+#define user_mode_vm(regs) user_mode(regs)
 #define instruction_pointer(regs) ((regs)->rip)
 extern unsigned long profile_pc(struct pt_regs *regs);
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
_


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/6][XEN][x86] Rename usermode macro
  2005-04-28  2:43   ` Andrew Morton
@ 2005-04-28 14:39     ` Vincent Hanquez
  0 siblings, 0 replies; 4+ messages in thread
From: Vincent Hanquez @ 2005-04-28 14:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Vincent Hanquez, linux-kernel, ian.pratt

On Wed, Apr 27, 2005 at 07:43:43PM -0700, Andrew Morton wrote:
> Why didn't your testing pick up the x86_64 build error?
> 
> arch/x86_64/oprofile/built-in.o(.text+0x1d09): In function `x86_backtrace':
> arch/x86_64/oprofile/../../i386/oprofile/backtrace.c:94: undefined reference to `user_mode_vm'

ouch, sorry about that.

the x86 and x86-64 patches has been compiled separately, which obviously
was a wrong thing to do...
I will do a full test on x86-64 next time I'm doing such thing.

-- 
Vincent Hanquez

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-04-28 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-26 10:38 "[PATCH Vincent Hanquez
2005-04-26 11:26 ` [PATCH 3/6][XEN][x86] Rename usermode macro Vincent Hanquez
2005-04-28  2:43   ` Andrew Morton
2005-04-28 14:39     ` Vincent Hanquez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox