search for: segment_index

Displaying 10 results from an estimated 10 matches for "segment_index".

2007 Apr 18
0
[PATCH 9/14] i386 / Typecheck and optimize base and limit accessors
...ios_desc, __va((unsigned long)0x40 << 4)); + _set_limit(&bad_bios_desc, 4095 - (0x40 << 4)); apm_bios_entry.offset = apm_info.bios.offset; apm_bios_entry.segment = APM_CS; for (i = 0; i < NR_CPUS; i++) { struct desc_struct *gdt = get_cpu_gdt_table(i); - set_base(gdt[segment_index(APM_CS)], + set_base(&gdt[segment_index(APM_CS)], __va((unsigned long)apm_info.bios.cseg << 4)); - set_base(gdt[segment_index(APM_CS_16)], + set_base(&gdt[segment_index(APM_CS_16)], __va((unsigned long)apm_info.bios.cseg_16 << 4)); - set_base(gdt[segment_index(APM_...
2007 Apr 18
0
[PATCH 9/14] i386 / Typecheck and optimize base and limit accessors
...ios_desc, __va((unsigned long)0x40 << 4)); + _set_limit(&bad_bios_desc, 4095 - (0x40 << 4)); apm_bios_entry.offset = apm_info.bios.offset; apm_bios_entry.segment = APM_CS; for (i = 0; i < NR_CPUS; i++) { struct desc_struct *gdt = get_cpu_gdt_table(i); - set_base(gdt[segment_index(APM_CS)], + set_base(&gdt[segment_index(APM_CS)], __va((unsigned long)apm_info.bios.cseg << 4)); - set_base(gdt[segment_index(APM_CS_16)], + set_base(&gdt[segment_index(APM_CS_16)], __va((unsigned long)apm_info.bios.cseg_16 << 4)); - set_base(gdt[segment_index(APM_...
2007 Apr 18
2
[PATCH 8/14] i386 / Add a per cpu gdt accessor
...t cpus; int cpu; struct desc_struct save_desc_40; + struct desc_struct *gdt; cpus = apm_save_cpus(); cpu = get_cpu(); - save_desc_40 = per_cpu(cpu_gdt_table, cpu)[0x40 / 8]; - per_cpu(cpu_gdt_table, cpu)[0x40 / 8] = bad_bios_desc; + gdt = get_cpu_gdt_table(cpu); + save_desc_40 = gdt[segment_index(0x40)]; + gdt[segment_index(0x40)] = bad_bios_desc; local_save_flags(flags); APM_DO_CLI; @@ -610,7 +612,7 @@ apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi); APM_DO_RESTORE_SEGS; local_irq_restore(flags); - per_cpu(cpu_gdt_table, cpu)[0x40 / 8] = save_desc_40; + gdt[seg...
2007 Apr 18
2
[PATCH 8/14] i386 / Add a per cpu gdt accessor
...t cpus; int cpu; struct desc_struct save_desc_40; + struct desc_struct *gdt; cpus = apm_save_cpus(); cpu = get_cpu(); - save_desc_40 = per_cpu(cpu_gdt_table, cpu)[0x40 / 8]; - per_cpu(cpu_gdt_table, cpu)[0x40 / 8] = bad_bios_desc; + gdt = get_cpu_gdt_table(cpu); + save_desc_40 = gdt[segment_index(0x40)]; + gdt[segment_index(0x40)] = bad_bios_desc; local_save_flags(flags); APM_DO_CLI; @@ -610,7 +612,7 @@ apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi); APM_DO_RESTORE_SEGS; local_irq_restore(flags); - per_cpu(cpu_gdt_table, cpu)[0x40 / 8] = save_desc_40; + gdt[seg...
2007 Apr 18
1
[PATCH 6/14] i386 / Add some segment convenience functions
....h 2005-08-09 19:36:36.000000000 -0700 +++ linux-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 ++...
2007 Apr 18
1
[PATCH 6/14] i386 / Add some segment convenience functions
....h 2005-08-09 19:36:36.000000000 -0700 +++ linux-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 ++...
2007 Apr 18
1
[PATCH 7/14] i386 / Add some descriptor convenience functions
...* We're in an interrupt, but this is clear and BUG()-safe. */ preempt_disable(); @@ -164,9 +163,10 @@ * calculate the address by reading the base address from the LDT entry. */ if (segment_from_ldt(regs->xcs) && (current->mm)) { - lp = (unsigned long *) ((unsigned long)(segment_index(regs->xcs) * 8) - + (char *) current->mm->context.ldt); - addr = (kprobe_opcode_t *) (get_desc_base(lp) + regs->eip - + struct desc_struct *desc; + desc = (struct desc_struct *) ((char *) current->mm->context.ldt + + (segment_index(regs->xcs) * 8)); + addr = (kpro...
2007 Apr 18
1
[PATCH 7/14] i386 / Add some descriptor convenience functions
...* We're in an interrupt, but this is clear and BUG()-safe. */ preempt_disable(); @@ -164,9 +163,10 @@ * calculate the address by reading the base address from the LDT entry. */ if (segment_from_ldt(regs->xcs) && (current->mm)) { - lp = (unsigned long *) ((unsigned long)(segment_index(regs->xcs) * 8) - + (char *) current->mm->context.ldt); - addr = (kprobe_opcode_t *) (get_desc_base(lp) + regs->eip - + struct desc_struct *desc; + desc = (struct desc_struct *) ((char *) current->mm->context.ldt + + (segment_index(regs->xcs) * 8)); + addr = (kpro...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...ontext.sem); > - desc = child->mm->context.ldt + (seg & ~7); > - base = (desc[0] >> 16) | ((desc[1] & 0xff) << 16) | (desc[1] & 0xff000000); > + context = &child->mm->context; > + down(&context->sem); > + desc = &context->ldt[segment_index(seg)]; > + base = get_desc_base(desc); > > /* 16-bit code segment? */ > - if (!((desc[1] >> 22) & 1)) > + if (!get_desc_32bit(desc)) > addr &= 0xffff; > addr += base; > - up(&child->mm->context.sem); > + up(&context->sem); &...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...ontext.sem); > - desc = child->mm->context.ldt + (seg & ~7); > - base = (desc[0] >> 16) | ((desc[1] & 0xff) << 16) | (desc[1] & 0xff000000); > + context = &child->mm->context; > + down(&context->sem); > + desc = &context->ldt[segment_index(seg)]; > + base = get_desc_base(desc); > > /* 16-bit code segment? */ > - if (!((desc[1] >> 22) & 1)) > + if (!get_desc_32bit(desc)) > addr &= 0xffff; > addr += base; > - up(&child->mm->context.sem); > + up(&context->sem); &...