search for: ldt_entry_size

Displaying 18 results from an estimated 18 matches for "ldt_entry_size".

2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...i386/desc.h 2005-08-15 11:16:59.000000000 -0700 > +++ linux-2.6.13/include/asm-i386/desc.h 2005-08-15 11:19:49.000000000 -0700 > @@ -6,6 +6,9 @@ > > #define CPU_16BIT_STACK_SIZE 1024 > > +/* The number of LDT entries per page */ > +#define LDT_ENTRIES_PER_PAGE (PAGE_SIZE / LDT_ENTRY_SIZE) > + > #ifndef __ASSEMBLY__ > > #include <linux/preempt.h> > @@ -30,7 +33,7 @@ > static inline unsigned long get_desc_base(struct desc_struct *desc) > { > unsigned long base; > - base = ((desc->a >> 16) & 0x0000ffff) | > + base = (desc->a...
2007 Apr 18
2
[PATCH 3/6] i386 virtualization - Make ldt a desc struct
...i386/desc.h 2005-08-15 11:16:59.000000000 -0700 > +++ linux-2.6.13/include/asm-i386/desc.h 2005-08-15 11:19:49.000000000 -0700 > @@ -6,6 +6,9 @@ > > #define CPU_16BIT_STACK_SIZE 1024 > > +/* The number of LDT entries per page */ > +#define LDT_ENTRIES_PER_PAGE (PAGE_SIZE / LDT_ENTRY_SIZE) > + > #ifndef __ASSEMBLY__ > > #include <linux/preempt.h> > @@ -30,7 +33,7 @@ > static inline unsigned long get_desc_base(struct desc_struct *desc) > { > unsigned long base; > - base = ((desc->a >> 16) & 0x0000ffff) | > + base = (desc->a...
2007 Apr 18
0
[PATCH 12/14] i386 / Move context switch inline
...mincount, int reload) +static inline int alloc_ldt(mm_context_t *pc, const int oldsize, int mincount, const int reload) { void *oldldt; void *newldt; - int oldsize; - if (mincount <= pc->size) - return 0; - oldsize = pc->size; mincount = (mincount+511)&(~511); if (mincount*LDT_ENTRY_SIZE > PAGE_SIZE) newldt = vmalloc(mincount*LDT_ENTRY_SIZE); @@ -48,12 +44,17 @@ if (oldsize) memcpy(newldt, pc->ldt, oldsize*LDT_ENTRY_SIZE); oldldt = pc->ldt; - memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE); + if (reload) + memset(newldt+oldsize*LDT_EN...
2007 Apr 18
0
[PATCH 12/14] i386 / Move context switch inline
...mincount, int reload) +static inline int alloc_ldt(mm_context_t *pc, const int oldsize, int mincount, const int reload) { void *oldldt; void *newldt; - int oldsize; - if (mincount <= pc->size) - return 0; - oldsize = pc->size; mincount = (mincount+511)&(~511); if (mincount*LDT_ENTRY_SIZE > PAGE_SIZE) newldt = vmalloc(mincount*LDT_ENTRY_SIZE); @@ -48,12 +44,17 @@ if (oldsize) memcpy(newldt, pc->ldt, oldsize*LDT_ENTRY_SIZE); oldldt = pc->ldt; - memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE); + if (reload) + memset(newldt+oldsize*LDT_EN...
2007 Apr 18
0
[PATCH 20/21] i386 Ldt cleanups 3
...t *pc, const int old_pages, int new_pages, const int reload) { - void *oldldt; - void *newldt; - int oldsize; + struct desc_struct *oldldt; + struct desc_struct *newldt; - if (mincount <= pc->size) - return 0; - oldsize = pc->size; - mincount = (mincount+511)&(~511); - if (mincount*LDT_ENTRY_SIZE > PAGE_SIZE) - newldt = vmalloc(mincount*LDT_ENTRY_SIZE); + if (new_pages > 1) + newldt = vmalloc(new_pages*PAGE_SIZE); else - newldt = kmalloc(mincount*LDT_ENTRY_SIZE, GFP_KERNEL); + newldt = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!newldt) return -ENOMEM; - if (oldsize) - memcpy...
2007 Apr 18
0
[PATCH 20/21] i386 Ldt cleanups 3
...t *pc, const int old_pages, int new_pages, const int reload) { - void *oldldt; - void *newldt; - int oldsize; + struct desc_struct *oldldt; + struct desc_struct *newldt; - if (mincount <= pc->size) - return 0; - oldsize = pc->size; - mincount = (mincount+511)&(~511); - if (mincount*LDT_ENTRY_SIZE > PAGE_SIZE) - newldt = vmalloc(mincount*LDT_ENTRY_SIZE); + if (new_pages > 1) + newldt = vmalloc(new_pages*PAGE_SIZE); else - newldt = kmalloc(mincount*LDT_ENTRY_SIZE, GFP_KERNEL); + newldt = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!newldt) return -ENOMEM; - if (oldsize) - memcpy...
2007 Apr 18
0
[PATCH 13/14] i386 / Introduce hypervisor ldt hooks
...h> #include <asm/desc.h> +#include <mach_pgalloc.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warning */ static void flush_ldt(void *null) @@ -59,16 +60,19 @@ #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); + SetPagesLDT(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / PAGE_SIZE); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) smp_call_function(flush_ldt, NULL, 1, 1); preempt_enable(); #else + SetPagesLDT(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / PAGE_SIZE); load_LDT(pc);...
2007 Apr 18
0
[PATCH 13/14] i386 / Introduce hypervisor ldt hooks
...h> #include <asm/desc.h> +#include <mach_pgalloc.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warning */ static void flush_ldt(void *null) @@ -59,16 +60,19 @@ #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); + SetPagesLDT(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / PAGE_SIZE); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) smp_call_function(flush_ldt, NULL, 1, 1); preempt_enable(); #else + SetPagesLDT(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / PAGE_SIZE); load_LDT(pc);...
2007 Apr 18
2
[PATCH 12/12; UPDATED] xen-ldt
...lude <asm/desc.h> +#include <hypervisor_hooks.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ static void flush_ldt(void *null) @@ -58,16 +59,22 @@ #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) smp_call_function(flush_ldt, NULL, 1, 1); preempt_enable(); #else + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + P...
2007 Apr 18
2
[PATCH 12/12; UPDATED] xen-ldt
...lude <asm/desc.h> +#include <hypervisor_hooks.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ static void flush_ldt(void *null) @@ -58,16 +59,22 @@ #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) smp_call_function(flush_ldt, NULL, 1, 1); preempt_enable(); #else + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + P...
2007 Apr 18
0
[PATCH 12/12] xen-ldt
...lude <asm/desc.h> +#include <hypervisor_hooks.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ static void flush_ldt(void *null) @@ -58,16 +59,22 @@ #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) smp_call_function(flush_ldt, NULL, 1, 1); preempt_enable(); #else + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + P...
2007 Apr 18
0
[PATCH 12/12] xen-ldt
...lude <asm/desc.h> +#include <hypervisor_hooks.h> #ifdef CONFIG_SMP /* avoids "defined but not used" warnig */ static void flush_ldt(void *null) @@ -58,16 +59,22 @@ #ifdef CONFIG_SMP cpumask_t mask; preempt_disable(); + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + PAGE_SIZE); load_LDT(pc); mask = cpumask_of_cpu(smp_processor_id()); if (!cpus_equal(current->mm->cpu_vm_mask, mask)) smp_call_function(flush_ldt, NULL, 1, 1); preempt_enable(); #else + make_pages_readonly(pc->ldt, (pc->size * LDT_ENTRY_SIZE) / + P...
2007 Apr 18
0
[PATCH 17/21] i386 Ldt cleanups 1
...================================== --- 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 {
2007 Apr 18
0
[PATCH 17/21] i386 Ldt cleanups 1
...================================== --- 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 {
2013 Oct 10
10
[PATCH 0/4] x86: XSA-67 follow-up
1: correct LDT checks 2: add address validity check to guest_map_l1e() 3: use {rd,wr}{fs,gs}base when available 4: check for canonical address before doing page walks Signed-off-by: Jan Beulich <jbeulich@suse.com>
2019 Mar 30
1
[PATCH 2/5] x86: Convert some slow-path static_cpu_has() callers to boot_cpu_has()
.../* @@ -271,7 +271,7 @@ static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt) return; /* LDT map/unmap is only required for PTI */ - if (!static_cpu_has(X86_FEATURE_PTI)) + if (!boot_cpu_has(X86_FEATURE_PTI)) return; nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE); @@ -311,7 +311,7 @@ static void free_ldt_pgtables(struct mm_struct *mm) unsigned long start = LDT_BASE_ADDR; unsigned long end = LDT_END_ADDR; - if (!static_cpu_has(X86_FEATURE_PTI)) + if (!boot_cpu_has(X86_FEATURE_PTI)) return; tlb_gather_mmu(&tlb, mm, start, end); di...
2007 Apr 18
1
[PATCH 2/12] ldt-accessors
Introduce a write acessor for updating the current LDT. This is required for hypervisors like Xen that do not allow LDT pages to be directly written. Testing - here's a fun little LDT test that can be trivially modified to test limits as well. /* * Copyright (c) 2005, Zachary Amsden (zach@vmware.com) * This is licensed under the GPL. */ #include <stdio.h> #include <signal.h>
2007 Apr 18
1
[PATCH 2/12] ldt-accessors
Introduce a write acessor for updating the current LDT. This is required for hypervisors like Xen that do not allow LDT pages to be directly written. Testing - here's a fun little LDT test that can be trivially modified to test limits as well. /* * Copyright (c) 2005, Zachary Amsden (zach@vmware.com) * This is licensed under the GPL. */ #include <stdio.h> #include <signal.h>