From 23ed873c248cfa05c214b9c778c59eaa8b2040c4 Mon Sep 17 00:00:00 2001 From: stefan Date: Tue, 8 Feb 2011 19:47:49 +0000 Subject: [PATCH] - define jump_to_user_code as line function git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@395 315a16e6-25f9-4109-90ae-ca3045a26c18 --- arch/x86/include/asm/tasks.h | 10 +++++++++- arch/x86/kernel/gdt.c | 9 --------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/tasks.h b/arch/x86/include/asm/tasks.h index f866836e..0480fb72 100644 --- a/arch/x86/include/asm/tasks.h +++ b/arch/x86/include/asm/tasks.h @@ -26,7 +26,15 @@ int create_default_frame(task_t* task, entry_point_t ep, void* arg); int register_task(task_t* task); -int jump_to_user_code(uint32_t ep, uint32_t stack); void reschedule(void); +static inline int jump_to_user_code(uint32_t ep, uint32_t stack) +{ + asm volatile ("mov %0, %%ds; mov %0, %%fs; mov %0, %%gs; mov %0, %%es" :: "r"(0x23)); + asm volatile ("push $0x23; push %0; push $0x1B; push %1" :: "r"(stack), "r"(ep)); + asm volatile ("lret"); + + return 0; +} + #endif diff --git a/arch/x86/kernel/gdt.c b/arch/x86/kernel/gdt.c index cafe56f7..a68079aa 100644 --- a/arch/x86/kernel/gdt.c +++ b/arch/x86/kernel/gdt.c @@ -94,15 +94,6 @@ int create_default_frame(task_t* task, entry_point_t ep, void* arg) return 0; } -int jump_to_user_code(uint32_t ep, uint32_t stack) -{ - asm volatile ("mov %0, %%ds; mov %0, %%fs; mov %0, %%gs; mov %0, %%es" :: "r"(0x23)); - asm volatile ("push $0x23; push %0; push $0x1B; push %1" :: "r"(stack), "r"(ep)); - asm volatile ("lret"); - - return 0; -} - /* Setup a descriptor in the Global Descriptor Table */ static void gdt_set_gate(int num, unsigned long base, unsigned long limit, unsigned char access, unsigned char gran)