Displaying 10 results from an estimated 10 matches for "segment_from_ldt".
2007 Apr 18
1
[PATCH 6/14] i386 / Add some segment convenience functions
...x-2.6.13/include/asm-i386/segment.h 2005-08-09 19:43:47.000000000 -0700
@@ -98,4 +98,14 @@
*/
#define IDT_ENTRIES 256
+/*
+ * This bit is set to indicate segment selectors are in the LDT
+ */
+#define LDT_SEGMENT 4
+
+#ifndef __ASSEMBLY__
+#define segment_index(seg) ((seg) >> 3)
+#define segment_from_ldt(seg) ((seg) & LDT_SEGMENT)
+#endif
+
#endif
Index: linux-2.6.13/arch/i386/kernel/ptrace.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/ptrace.c 2005-08-09 19:36:36.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/ptrace.c 2005-08-1...
2007 Apr 18
1
[PATCH 6/14] i386 / Add some segment convenience functions
...x-2.6.13/include/asm-i386/segment.h 2005-08-09 19:43:47.000000000 -0700
@@ -98,4 +98,14 @@
*/
#define IDT_ENTRIES 256
+/*
+ * This bit is set to indicate segment selectors are in the LDT
+ */
+#define LDT_SEGMENT 4
+
+#ifndef __ASSEMBLY__
+#define segment_index(seg) ((seg) >> 3)
+#define segment_from_ldt(seg) ((seg) & LDT_SEGMENT)
+#endif
+
#endif
Index: linux-2.6.13/arch/i386/kernel/ptrace.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/ptrace.c 2005-08-09 19:36:36.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/ptrace.c 2005-08-1...
2007 Apr 18
1
[PATCH 7/14] i386 / Add some descriptor convenience functions
...GDT. */
- desc = (u32 *)&per_cpu(cpu_gdt_table, get_cpu());
+ desc = per_cpu(cpu_gdt_table, get_cpu());
desc = (void *)desc + (seg & ~7);
}
/* Decode the code segment base from the descriptor */
- base = get_desc_base((unsigned long *)desc);
+ base = get_desc_base(desc);
if (segment_from_ldt(seg)) {
up(¤t->mm->context.sem);
Index: linux-2.6.13/arch/i386/kernel/kprobes.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/kprobes.c 2005-08-09 19:43:47.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/kprobes.c 20...
2007 Apr 18
1
[PATCH 7/14] i386 / Add some descriptor convenience functions
...GDT. */
- desc = (u32 *)&per_cpu(cpu_gdt_table, get_cpu());
+ desc = per_cpu(cpu_gdt_table, get_cpu());
desc = (void *)desc + (seg & ~7);
}
/* Decode the code segment base from the descriptor */
- base = get_desc_base((unsigned long *)desc);
+ base = get_desc_base(desc);
if (segment_from_ldt(seg)) {
up(¤t->mm->context.sem);
Index: linux-2.6.13/arch/i386/kernel/kprobes.c
===================================================================
--- linux-2.6.13.orig/arch/i386/kernel/kprobes.c 2005-08-09 19:43:47.000000000 -0700
+++ linux-2.6.13/arch/i386/kernel/kprobes.c 20...
2007 Apr 18
0
[PATCH 18/21] i386 Ldt cleanups 2
.../include/asm-i386/desc.h 2005-11-04 18:10:53.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/desc.h 2005-11-05 00:28:03.000000000 -0800
@@ -30,7 +30,24 @@ static inline struct desc_struct *get_cp
{
return ((struct desc_struct *)cpu_gdt_descr[cpu].address);
}
-
+
+static inline int segment_from_ldt(unsigned int segment)
+{
+ return segment & LDT_SEGMENT;
+}
+
+static inline struct desc_struct *get_gdt_desc(int cpu, unsigned int segment)
+{
+ char *gdt = (char *)get_cpu_gdt_table(cpu);
+ return (struct desc_struct *)&gdt[segment & ~7];
+}
+
+static inline struct desc_struct *get_ld...
2007 Apr 18
0
[PATCH 18/21] i386 Ldt cleanups 2
.../include/asm-i386/desc.h 2005-11-04 18:10:53.000000000 -0800
+++ linux-2.6.14-zach-work/include/asm-i386/desc.h 2005-11-05 00:28:03.000000000 -0800
@@ -30,7 +30,24 @@ static inline struct desc_struct *get_cp
{
return ((struct desc_struct *)cpu_gdt_descr[cpu].address);
}
-
+
+static inline int segment_from_ldt(unsigned int segment)
+{
+ return segment & LDT_SEGMENT;
+}
+
+static inline struct desc_struct *get_gdt_desc(int cpu, unsigned int segment)
+{
+ char *gdt = (char *)get_cpu_gdt_table(cpu);
+ return (struct desc_struct *)&gdt[segment & ~7];
+}
+
+static inline struct desc_struct *get_ld...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...============================
> --- linux-2.6.13.orig/arch/i386/kernel/ptrace.c 2005-08-15 11:16:59.000000000 -0700
> +++ linux-2.6.13/arch/i386/kernel/ptrace.c 2005-08-15 11:19:49.000000000 -0700
> @@ -164,18 +164,20 @@
> * and APM bios ones we just ignore here.
> */
> if (segment_from_ldt(seg)) {
> - u32 *desc;
> + mm_context_t *context;
> + struct desc_struct *desc;
> unsigned long base;
>
> - down(&child->mm->context.sem);
> - desc = child->mm->context.ldt + (seg & ~7);
> - base = (desc[0] >> 16) | ((desc[1] & 0xff)...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...============================
> --- linux-2.6.13.orig/arch/i386/kernel/ptrace.c 2005-08-15 11:16:59.000000000 -0700
> +++ linux-2.6.13/arch/i386/kernel/ptrace.c 2005-08-15 11:19:49.000000000 -0700
> @@ -164,18 +164,20 @@
> * and APM bios ones we just ignore here.
> */
> if (segment_from_ldt(seg)) {
> - u32 *desc;
> + mm_context_t *context;
> + struct desc_struct *desc;
> unsigned long base;
>
> - down(&child->mm->context.sem);
> - desc = child->mm->context.ldt + (seg & ~7);
> - base = (desc[0] >> 16) | ((desc[1] & 0xff)...
2007 Apr 18
2
[PATCH 19/21] i386 Kprobes semaphore fix
...{
- unsigned long addr, seg;
+ unsigned long base, seg_limit;
+ u32 seg_ar;
+ struct desc_struct *desc;
+ unsigned long flags;
- addr = regs->eip;
- seg = regs->xcs & 0xffff;
- if (regs->eflags & VM_MASK) {
- addr = (addr & 0xffff) + (seg << 4);
- return addr;
+ if (segment_from_ldt(seg)) {
+ /*
+ * Horrors abound. Must enable IRQs to take the LDT
+ * semaphore. Ok, since LDT from a faulting CS can only
+ * be from userspace, or this is from ptrace operating
+ * on a child context directly from a system call.
+ * This unfortunate mess is needed to deal with int3
+...
2007 Apr 18
2
[PATCH 19/21] i386 Kprobes semaphore fix
...{
- unsigned long addr, seg;
+ unsigned long base, seg_limit;
+ u32 seg_ar;
+ struct desc_struct *desc;
+ unsigned long flags;
- addr = regs->eip;
- seg = regs->xcs & 0xffff;
- if (regs->eflags & VM_MASK) {
- addr = (addr & 0xffff) + (seg << 4);
- return addr;
+ if (segment_from_ldt(seg)) {
+ /*
+ * Horrors abound. Must enable IRQs to take the LDT
+ * semaphore. Ok, since LDT from a faulting CS can only
+ * be from userspace, or this is from ptrace operating
+ * on a child context directly from a system call.
+ * This unfortunate mess is needed to deal with int3
+...