lkml.org 
[lkml]   [2005]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH 17/21] i386 Ldt cleanups 1
From
Big cleanup of LDT code.  This code has very little type checking and is
not frequently used, so I audited the code, added type checking and size
optimizations to generate smaller assembly code.

First, just introduce some small definitions that will be used later.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.14-zach-work/arch/i386/kernel/entry.S
===================================================================
--- linux-2.6.14-zach-work.orig/arch/i386/kernel/entry.S 2005-10-27 17:02:08.000000000 -0700
+++ linux-2.6.14-zach-work/arch/i386/kernel/entry.S 2005-11-04 18:22:07.000000000 -0800
@@ -250,8 +250,8 @@ restore_all:
# See comments in process.c:copy_thread() for details.
movb OLDSS(%esp), %ah
movb CS(%esp), %al
- andl $(VM_MASK | (4 << 8) | 3), %eax
- cmpl $((4 << 8) | 3), %eax
+ andl $(VM_MASK | (LDT_SEGMENT << 8) | 3), %eax
+ cmpl $((LDT_SEGMENT << 8) | 3), %eax
je ldt_ss # returning to user-space with LDT SS
restore_nocheck:
RESTORE_REGS
Index: linux-2.6.14-zach-work/arch/i386/kernel/ptrace.c
===================================================================
--- linux-2.6.14-zach-work.orig/arch/i386/kernel/ptrace.c 2005-11-04 18:30:27.000000000 -0800
+++ linux-2.6.14-zach-work/arch/i386/kernel/ptrace.c 2005-11-05 00:28:04.000000000 -0800
@@ -146,8 +146,6 @@ static unsigned long getreg(struct task_
return retval;
}

-#define LDT_SEGMENT 4
-
static unsigned long convert_eip_to_linear(struct task_struct *child, struct pt_regs *regs)
{
unsigned long addr, seg;
Index: linux-2.6.14-zach-work/include/asm-i386/segment.h
===================================================================
--- linux-2.6.14-zach-work.orig/include/asm-i386/segment.h 2005-11-04 15:46:51.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/segment.h 2005-11-04 18:22:07.000000000 -0800
@@ -121,4 +121,9 @@
*/
#define IDT_ENTRIES 256

+/*
+ * This bit is set to indicate segment selectors are in the LDT
+ */
+#define LDT_SEGMENT 4
+
#endif
Index: linux-2.6.14-zach-work/include/asm-i386/ldt.h
===================================================================
--- linux-2.6.14-zach-work.orig/include/asm-i386/ldt.h 2005-10-27 17:02:08.000000000 -0700
+++ linux-2.6.14-zach-work/include/asm-i386/ldt.h 2005-11-04 18:22:07.000000000 -0800
@@ -10,6 +10,8 @@
#define LDT_ENTRIES 8192
/* The size of each LDT entry. */
#define LDT_ENTRY_SIZE 8
+/* The number of LDT entries per page */
+#define LDT_ENTRIES_PER_PAGE (PAGE_SIZE / LDT_ENTRY_SIZE)

#ifndef __ASSEMBLY__
struct user_desc {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-11-08 05:39    [W:0.031 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site