aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xen/arch/x86/Makefile14
-rw-r--r--xen/arch/x86/Rules.mk11
-rw-r--r--xen/arch/x86/entry.S6
-rw-r--r--xen/arch/x86/mm.c2
-rw-r--r--xen/arch/x86/trampoline.S2
-rw-r--r--xen/arch/x86/traps.c23
-rw-r--r--xen/common/domain.c178
-rw-r--r--xen/common/kernel.c6
-rw-r--r--xen/common/memory.c53
-rw-r--r--xen/include/acpi/platform/aclinux.h2
-rw-r--r--xen/include/asm-x86/acpi.h5
-rw-r--r--xen/include/asm-x86/config.h18
-rw-r--r--xen/include/asm-x86/string.h16
-rw-r--r--xen/include/asm-x86/x86_32/ptrace.h4
-rw-r--r--xen/include/asm-x86/x86_64/ptrace.h4
-rw-r--r--xen/include/hypervisor-ifs/trace.h9
-rw-r--r--xen/include/xen/mm.h20
-rw-r--r--xen/include/xen/pci.h3
-rw-r--r--xen/include/xen/string.h6
-rw-r--r--xen/tools/elf-reloc.c3
20 files changed, 135 insertions, 250 deletions
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 512fc212fc..7a6d659d0b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -6,18 +6,20 @@ OBJS := $(subst pdb-linux.o,,$(OBJS))
OBJS := $(subst pdb-stub.o,,$(OBJS))
endif
-# What happens here? We link monitor object files together, starting
-# at MONITOR_BASE (a very high address). But bootloader cannot put
-# things there, so we initially load at LOAD_BASE. A hacky little
-# tool called `elf-reloc' is used to modify segment offsets from
-# MONITOR_BASE-relative to LOAD_BASE-relative.
+LINK_BASE := 0xFC500000 # Xen is linked here
+LOAD_BASE := 0x00100000 # Xen is loaded here
+
+# What happens here? We link object files together, starting at LINK_BASE
+# (a very high address). But the bootloader cannot put things there, so we
+# initially load at LOAD_BASE. A tool called `elf-reloc' is used to modify
+# segment offsets from LINK_BASE-relative to LOAD_BASE-relative.
# (NB. Linux gets round this by turning its image into raw binary, then
# wrapping that with a low-memory bootstrapper.)
default: boot/boot.o $(OBJS)
$(LD) -r -o arch.o $(OBJS)
$(LD) $(LDFLAGS) boot/boot.o $(ALL_OBJS) -o $(TARGET)-syms
objcopy -R .note -R .comment -S $(TARGET)-syms $(TARGET)
- $(BASEDIR)/tools/elf-reloc $(MONITOR_BASE) $(LOAD_BASE) $(TARGET)
+ $(BASEDIR)/tools/elf-reloc $(LINK_BASE) $(LOAD_BASE) $(TARGET)
clean:
rm -f *.o *~ core boot/*.o boot/*~ boot/core
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 744ce6da26..5963e99d80 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -4,16 +4,9 @@
CC := gcc
LD := ld
-# Linker should relocate monitor to this address
-MONITOR_BASE := 0xFC500000
-
-# Bootloader should load monitor to this real address
-LOAD_BASE := 0x00100000
-
CFLAGS := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing -O3
-CFLAGS += -iwithprefix include -Wall -Werror -DMONITOR_BASE=$(MONITOR_BASE)
-CFLAGS += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__
-CFLAGS += -Wno-pointer-arith -Wredundant-decls
+CFLAGS += -iwithprefix include -Wall -Werror -fomit-frame-pointer
+CFLAGS += -I$(BASEDIR)/include -Wno-pointer-arith -Wredundant-decls
LDFLAGS := -T xen.lds -N
diff --git a/xen/arch/x86/entry.S b/xen/arch/x86/entry.S
index a6c0d40448..f3b6885d5a 100644
--- a/xen/arch/x86/entry.S
+++ b/xen/arch/x86/entry.S
@@ -6,8 +6,8 @@
*/
/*
- * The idea for callbacks from monitor -> guest OS
- * ===============================================
+ * The idea for callbacks to guest OSes
+ * ====================================
*
* First, we require that all callbacks (either via a supplied
* interrupt-descriptor-table, or via the special event or failsafe callbacks
@@ -23,7 +23,7 @@
* If not, we load incorrect SS/ESP values from the TSS (for ring 1 rather
* than the correct ring) and bad things are bound to ensue -- IRET is
* likely to fault, and we may end up killing the domain (no harm can
- * come to the hypervisor itself, though).
+ * come to Xen, though).
*
* When doing a callback, we check if the return CS is in ring 0. If so,
* callback is delayed until next return to ring != 0.
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 8556b57d45..d61df0d9a1 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -347,7 +347,7 @@ void *memguard_init(void *heap_start)
PAGE_MASK);
/* Memory guarding is incompatible with super pages. */
- for ( i = 0; i < (MAX_MONITOR_ADDRESS >> L2_PAGETABLE_SHIFT); i++ )
+ for ( i = 0; i < (MAX_XENHEAP_ADDRESS >> L2_PAGETABLE_SHIFT); i++ )
{
l1 = (l1_pgentry_t *)heap_start;
heap_start = (void *)((unsigned long)heap_start + PAGE_SIZE);
diff --git a/xen/arch/x86/trampoline.S b/xen/arch/x86/trampoline.S
index d9a1cb6888..064159046d 100644
--- a/xen/arch/x86/trampoline.S
+++ b/xen/arch/x86/trampoline.S
@@ -43,7 +43,7 @@ r_base = .
lmsw %ax # into protected mode
jmp flush_instr
flush_instr:
- ljmpl $__HYPERVISOR_CS, $(MONITOR_BASE)-__PAGE_OFFSET
+ ljmpl $__HYPERVISOR_CS, $0x100000 # 1MB
idt_48:
.word 0 # idt limit = 0
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 31bf801e45..59d0e320d6 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -171,14 +171,14 @@ void show_registers(struct pt_regs *regs)
spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
-void die(const char * str, struct pt_regs * regs, long err)
+void die(const char *str, struct pt_regs * regs, long err)
{
unsigned long flags;
spin_lock_irqsave(&die_lock, flags);
printk("%s: %04lx,%04lx\n", str, err >> 16, err & 0xffff);
show_registers(regs);
spin_unlock_irqrestore(&die_lock, flags);
- panic("HYPERVISOR DEATH!!\n");
+ panic("Fatal crash within Xen.\n");
}
@@ -192,7 +192,7 @@ static inline void do_trap(int trapnr, char *str,
unsigned long fixup;
if (!(regs->xcs & 3))
- goto fault_in_hypervisor;
+ goto xen_fault;
ti = current->thread.traps + trapnr;
gtb->flags = use_error_code ? GTBF_TRAP : GTBF_TRAP_NOCODE;
@@ -203,7 +203,7 @@ static inline void do_trap(int trapnr, char *str,
p->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
return;
- fault_in_hypervisor:
+ xen_fault:
if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
{
@@ -338,7 +338,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, long error_code)
return; /* Returns TRUE if fault was handled. */
if ( unlikely(!(regs->xcs & 3)) )
- goto fault_in_hypervisor;
+ goto xen_fault;
ti = p->thread.traps + 14;
gtb->flags = GTBF_TRAP_CR2; /* page fault pushes %cr2 */
@@ -350,7 +350,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, long error_code)
p->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
return;
- fault_in_hypervisor:
+ xen_fault:
if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
{
@@ -589,11 +589,10 @@ asmlinkage void do_debug(struct pt_regs *regs, long error_code)
/* Clear TF just for absolute sanity. */
regs->eflags &= ~EF_TF;
/*
- * Basically, we ignore watchpoints when they trigger in
- * the hypervisor. This may happen when a buffer is passed
- * to us which previously had a watchpoint set on it.
- * No need to bump EIP; the only faulting trap is an
- * instruction breakpoint, which can't happen to us.
+ * We ignore watchpoints when they trigger within Xen. This may happen
+ * when a buffer is passed to us which previously had a watchpoint set
+ * on it. No need to bump EIP; the only faulting trap is an instruction
+ * breakpoint, which can't happen to us.
*/
return;
}
@@ -717,7 +716,7 @@ void __init trap_init(void)
set_intr_gate(18,&machine_check);
set_intr_gate(19,&simd_coprocessor_error);
- /* Only ring 1 can access monitor services. */
+ /* Only ring 1 can access Xen services. */
_set_gate(idt_table+HYPERCALL_VECTOR,14,1,&hypercall);
/* CPU0 uses the master IDT. */
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 02ae4c42c4..f85b744304 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -48,124 +48,123 @@ struct domain *task_list;
struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
{
char buf[100];
- struct domain *p, **pp;
+ struct domain *d, **pd;
unsigned long flags;
- if ( (p = alloc_domain_struct()) == NULL )
+ if ( (d = alloc_domain_struct()) == NULL )
return NULL;
- atomic_set(&p->refcnt, 1);
- atomic_set(&p->pausecnt, 0);
+ atomic_set(&d->refcnt, 1);
+ atomic_set(&d->pausecnt, 0);
- spin_lock_init(&p->mm.shadow_lock);
+ spin_lock_init(&d->mm.shadow_lock);
- p->domain = dom_id;
- p->processor = cpu;
- p->create_time = NOW();
+ d->domain = dom_id;
+ d->processor = cpu;
+ d->create_time = NOW();
- memcpy(&p->thread, &idle0_task.thread, sizeof(p->thread));
+ memcpy(&d->thread, &idle0_task.thread, sizeof(d->thread));
- if ( p->domain != IDLE_DOMAIN_ID )
+ if ( d->domain != IDLE_DOMAIN_ID )
{
- if ( init_event_channels(p) != 0 )
+ if ( init_event_channels(d) != 0 )
{
- free_domain_struct(p);
+ free_domain_struct(d);
return NULL;
}
/* We use a large intermediate to avoid overflow in sprintf. */
sprintf(buf, "Domain-%u", dom_id);
- strncpy(p->name, buf, MAX_DOMAIN_NAME);
- p->name[MAX_DOMAIN_NAME-1] = '\0';
+ strncpy(d->name, buf, MAX_DOMAIN_NAME);
+ d->name[MAX_DOMAIN_NAME-1] = '\0';
- p->addr_limit = USER_DS;
+ d->addr_limit = USER_DS;
- spin_lock_init(&p->page_list_lock);
- INIT_LIST_HEAD(&p->page_list);
- p->max_pages = p->tot_pages = 0;
-
- p->shared_info = (void *)get_free_page();
- memset(p->shared_info, 0, PAGE_SIZE);
- SHARE_PFN_WITH_DOMAIN(virt_to_page(p->shared_info), p);
- machine_to_phys_mapping[virt_to_phys(p->shared_info) >>
+ spin_lock_init(&d->page_list_lock);
+ INIT_LIST_HEAD(&d->page_list);
+ d->max_pages = d->tot_pages = 0;
+
+ d->shared_info = (void *)get_free_page();
+ memset(d->shared_info, 0, PAGE_SIZE);
+ SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
+ machine_to_phys_mapping[virt_to_phys(d->shared_info) >>
PAGE_SHIFT] = 0x80000000UL; /* debug */
- p->mm.perdomain_pt = (l1_pgentry_t *)get_free_page();
- memset(p->mm.perdomain_pt, 0, PAGE_SIZE);
- machine_to_phys_mapping[virt_to_phys(p->mm.perdomain_pt) >>
+ d->mm.perdomain_pt = (l1_pgentry_t *)get_free_page();
+ memset(d->mm.perdomain_pt, 0, PAGE_SIZE);
+ machine_to_phys_mapping[virt_to_phys(d->mm.perdomain_pt) >>
PAGE_SHIFT] = 0x0fffdeadUL; /* debug */
/* Per-domain PCI-device list. */
- spin_lock_init(&p->pcidev_lock);
- INIT_LIST_HEAD(&p->pcidev_list);
+ spin_lock_init(&d->pcidev_lock);
+ INIT_LIST_HEAD(&d->pcidev_list);
- sched_add_domain(p);
+ sched_add_domain(d);
write_lock_irqsave(&tasklist_lock, flags);
- pp = &task_list; /* NB. task_list is maintained in order of dom_id. */
- for ( pp = &task_list; *pp != NULL; pp = &(*pp)->next_list )
- if ( (*pp)->domain > p->domain )
+ pd = &task_list; /* NB. task_list is maintained in order of dom_id. */
+ for ( pd = &task_list; *pd != NULL; pd = &(*pd)->next_list )
+ if ( (*pd)->domain > d->domain )
break;
- p->next_list = *pp;
- *pp = p;
- p->next_hash = task_hash[TASK_HASH(dom_id)];
- task_hash[TASK_HASH(dom_id)] = p;
+ d->next_list = *pd;
+ *pd = d;
+ d->next_hash = task_hash[TASK_HASH(dom_id)];
+ task_hash[TASK_HASH(dom_id)] = d;
write_unlock_irqrestore(&tasklist_lock, flags);
}
else
{
- sprintf(p->name, "Idle-%d", cpu);
- sched_add_domain(p);
+ sprintf(d->name, "Idle-%d", cpu);
+ sched_add_domain(d);
}
-
- return p;
+ return d;
}
struct domain *find_domain_by_id(domid_t dom)
{
- struct domain *p;
+ struct domain *d;
unsigned long flags;
read_lock_irqsave(&tasklist_lock, flags);
- p = task_hash[TASK_HASH(dom)];
- while ( p != NULL )
+ d = task_hash[TASK_HASH(dom)];
+ while ( d != NULL )
{
- if ( p->domain == dom )
+ if ( d->domain == dom )
{
- if ( unlikely(!get_domain(p)) )
- p = NULL;
+ if ( unlikely(!get_domain(d)) )
+ d = NULL;
break;
}
- p = p->next_hash;
+ d = d->next_hash;
}
read_unlock_irqrestore(&tasklist_lock, flags);
- return p;
+ return d;
}
-/* return the most recent domain created */
+/* Return the most recently created domain. */
struct domain *find_last_domain(void)
{
- struct domain *p, *plast;
+ struct domain *d, *dlast;
unsigned long flags;
read_lock_irqsave(&tasklist_lock, flags);
- plast = task_list;
- p = plast->next_list;
- while ( p != NULL )
+ dlast = task_list;
+ d = dlast->next_list;
+ while ( d != NULL )
{
- if ( p->create_time > plast->create_time )
- plast = p;
- p = p->next_list;
+ if ( d->create_time > dlast->create_time )
+ dlast = d;
+ d = d->next_list;
}
- if ( !get_domain(plast) )
- plast = NULL;
+ if ( !get_domain(dlast) )
+ dlast = NULL;
read_unlock_irqrestore(&tasklist_lock, flags);
- return plast;
+ return dlast;
}
@@ -288,50 +287,31 @@ struct pfn_info *alloc_domain_page(struct domain *d)
void free_domain_page(struct pfn_info *page)
{
- unsigned long flags;
+ unsigned long flags;
+ int drop_dom_ref;
struct domain *d = page->u.domain;
- ASSERT(!in_irq());
+ /* Deallocation of such pages is handled out of band. */
+ if ( unlikely(IS_XEN_HEAP_FRAME(page)) )
+ return;
- if ( likely(!IS_XEN_HEAP_FRAME(page)) )
- {
- page->u.cpu_mask = 0;
- page->tlbflush_timestamp = tlbflush_clock;
- if ( likely(d != NULL) )
- {
- page->u.cpu_mask = 1 << d->processor;
- /* NB. May recursively lock from domain_relinquish_memory(). */
- spin_lock_recursive(&d->page_list_lock);
- list_del(&page->list);
- if ( unlikely(--d->tot_pages == 0) )
- {
- spin_unlock_recursive(&d->page_list_lock);
- put_domain(d); /* Domain 'd' can disappear now. */
- }
- else
- {
- spin_unlock_recursive(&d->page_list_lock);
- }
- }
+ page->tlbflush_timestamp = tlbflush_clock;
+ page->u.cpu_mask = 1 << d->processor;
- page->count_and_flags = 0;
+ /* NB. May recursively lock from domain_relinquish_memory(). */
+ spin_lock_recursive(&d->page_list_lock);
+ list_del(&page->list);
+ drop_dom_ref = (--d->tot_pages == 0);
+ spin_unlock_recursive(&d->page_list_lock);
+ if ( drop_dom_ref )
+ put_domain(d);
- spin_lock_irqsave(&free_list_lock, flags);
- list_add(&page->list, &free_list);
- free_pfns++;
- spin_unlock_irqrestore(&free_list_lock, flags);
- }
- else
- {
- /*
- * No need for a TLB flush. Non-domain pages are always co-held by Xen,
- * and the Xen reference is not dropped until the domain is dead.
- * DOM0 may hold references, but it's trusted so no need to flush.
- */
- page->u.cpu_mask = 0;
- page->count_and_flags = 0;
- free_page((unsigned long)page_to_virt(page));
- }
+ page->count_and_flags = 0;
+
+ spin_lock_irqsave(&free_list_lock, flags);
+ list_add(&page->list, &free_list);
+ free_pfns++;
+ spin_unlock_irqrestore(&free_list_lock, flags);
}
@@ -457,7 +437,7 @@ void domain_destruct(struct domain *d)
destroy_event_channels(d);
free_page((unsigned long)d->mm.perdomain_pt);
- UNSHARE_PFN(virt_to_page(d->shared_info));
+ free_page((unsigned long)d->shared_info);
free_domain_struct(d);
}
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index a4d3fa75df..c38fa6b7e5 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -217,15 +217,15 @@ void cmain(unsigned long magic, multiboot_info_t *mbi)
heap_start = memguard_init(&_end);
printk("Xen heap size is %luKB\n",
- (MAX_MONITOR_ADDRESS-__pa(heap_start))/1024 );
+ (MAX_XENHEAP_ADDRESS-__pa(heap_start))/1024 );
- if ( ((MAX_MONITOR_ADDRESS-__pa(heap_start))/1024) <= 4096 )
+ if ( ((MAX_XENHEAP_ADDRESS-__pa(heap_start))/1024) <= 4096 )
{
printk("Xen heap size is too small to safely continue!\n");
for ( ; ; ) ;
}
- init_page_allocator(__pa(heap_start), MAX_MONITOR_ADDRESS);
+ init_page_allocator(__pa(heap_start), MAX_XENHEAP_ADDRESS);
/* Initialise the slab allocator. */
kmem_cache_init();
diff --git a/xen/common/memory.c b/xen/common/memory.c
index c8a38f9035..08e0b05285 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -32,8 +32,8 @@
* TOT_COUNT is the obvious reference count. It counts all uses of a
* physical page frame by a domain, including uses as a page directory,
* a page table, or simple mappings via a PTE. This count prevents a
- * domain from releasing a frame back to the hypervisor's free pool when
- * it still holds a reference to it.
+ * domain from releasing a frame back to the free pool when it still holds
+ * a reference to it.
*
* TYPE_COUNT is more subtle. A frame can be put to one of three
* mutually-exclusive uses: it might be used as a page directory, or a
@@ -83,48 +83,6 @@
* an application-supplied buffer).
*/
-
-/*
- * THE FOLLOWING ARE ISSUES IF GUEST OPERATING SYSTEMS BECOME SMP-CAPABLE.
- * -----------------------------------------------------------------------
- *
- * *********
- * UPDATE 15/7/02: Interface has changed --updates now specify physical
- * address of page-table entry, rather than specifying a virtual address,
- * so hypervisor no longer "walks" the page tables. Therefore the
- * solution below cannot work. Another possibility is to add a new entry
- * to our "struct page" which says to which top-level page table each
- * lower-level page table or writeable mapping belongs. If it belongs to more
- * than one, we'd probably just flush on all processors running the domain.
- * *********
- *
- * The problem involves creating new page tables which might be mapped
- * writeable in the TLB of another processor. As an example, a domain might be
- * running in two contexts (ie. on two processors) simultaneously, using the
- * same top-level page table in both contexts. Now, if context 1 sends an
- * update request [make page P read-only, add a reference to page P as a page
- * table], that will succeed if there was only one writeable mapping of P.
- * However, that mapping may persist in the TLB of context 2.
- *
- * Solution: when installing a new page table, we must flush foreign TLBs as
- * necessary. Naive solution is to flush on any processor running our domain.
- * Cleverer solution is to flush on any processor running same top-level page
- * table, but this will sometimes fail (consider two different top-level page
- * tables which have a shared lower-level page table).
- *
- * A better solution: when squashing a write reference, check how many times
- * that lowest-level table entry is referenced by ORing refcounts of tables
- * down the page-table hierarchy. If results is != 1, we require flushing all
- * instances of current domain if a new table is installed (because the
- * lowest-level entry may be referenced by many top-level page tables).
- * However, common case will be that result == 1, so we only need to flush
- * processors with the same top-level page table. Make choice at
- * table-installation time based on a `flush_level' flag, which is
- * FLUSH_NONE, FLUSH_PAGETABLE, FLUSH_DOMAIN. A flush reduces this
- * to FLUSH_NONE, while squashed write mappings can only promote up
- * to more aggressive flush types.
- */
-
#include <xen/config.h>
#include <xen/init.h>
#include <xen/lib.h>
@@ -186,11 +144,6 @@ static struct {
#define GPS (percpu_info[smp_processor_id()].gps ? : current)
-/*
- * init_frametable:
- * Initialise per-frame memory information. This goes directly after
- * MAX_MONITOR_ADDRESS in physical memory.
- */
void __init init_frametable(unsigned long nr_pages)
{
unsigned long mfn;
@@ -619,7 +572,7 @@ static int mod_l2_entry(l2_pgentry_t *pl2e,
if ( unlikely((((unsigned long)pl2e & (PAGE_SIZE-1)) >> 2) >=
DOMAIN_ENTRIES_PER_L2_PAGETABLE) )
{
- MEM_LOG("Illegal L2 update attempt in hypervisor area %p", pl2e);
+ MEM_LOG("Illegal L2 update attempt in Xen-private area %p", pl2e);
return 0;
}
diff --git a/xen/include/acpi/platform/aclinux.h b/xen/include/acpi/platform/aclinux.h
index 241385e8b2..eecd6c888c 100644
--- a/xen/include/acpi/platform/aclinux.h
+++ b/xen/include/acpi/platform/aclinux.h
@@ -49,7 +49,7 @@
#define ACPI_USE_SYSTEM_CLIBRARY
#define ACPI_USE_DO_WHILE_0
-#ifdef __KERNEL__
+#if 1 /*def __KERNEL__*/
#include <xen/config.h>
#include <xen/string.h>
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index 4d750d486f..35d45f4151 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -26,8 +26,6 @@
#ifndef _ASM_ACPI_H
#define _ASM_ACPI_H
-#ifdef __KERNEL__
-
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
@@ -164,7 +162,4 @@ extern void acpi_reserve_bootmem(void);
#endif /*CONFIG_ACPI_SLEEP*/
-
-#endif /*__KERNEL__*/
-
#endif /*_ASM_ACPI_H*/
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 053b0ef56c..c38304ab8b 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -158,6 +158,10 @@ extern void __out_of_line_bug(int line) __attribute__((noreturn));
#elif defined(__i386__)
+/* The following are machine addresses. */
+#define MAX_XENHEAP_ADDRESS (12*1024*1024)
+#define MAX_DIRECTMAP_ADDRESS (40*1024*1024)
+
/* Hypervisor owns top 64MB of virtual address space. */
#define HYPERVISOR_VIRT_START (0xFC000000UL)
@@ -167,18 +171,12 @@ extern void __out_of_line_bug(int line) __attribute__((noreturn));
*/
#define RO_MPT_VIRT_START (HYPERVISOR_VIRT_START)
#define RO_MPT_VIRT_END (RO_MPT_VIRT_START + (4*1024*1024))
-/*
- * Next 12MB is fixed monitor space, which is part of a 40MB direct-mapped
- * memory region. The following are machine addresses.
- */
-#define MAX_MONITOR_ADDRESS (12*1024*1024)
-#define MAX_DIRECTMAP_ADDRESS (40*1024*1024)
-/* And the virtual addresses for the direct-map region... */
+/* The virtual addresses for the 40MB direct-map region. */
#define DIRECTMAP_VIRT_START (RO_MPT_VIRT_END)
#define DIRECTMAP_VIRT_END (DIRECTMAP_VIRT_START + MAX_DIRECTMAP_ADDRESS)
-#define MONITOR_VIRT_START (DIRECTMAP_VIRT_START)
-#define MONITOR_VIRT_END (MONITOR_VIRT_START + MAX_MONITOR_ADDRESS)
-#define RDWR_MPT_VIRT_START (MONITOR_VIRT_END)
+#define XENHEAP_VIRT_START (DIRECTMAP_VIRT_START)
+#define XENHEAP_VIRT_END (XENHEAP_VIRT_START + MAX_XENHEAP_ADDRESS)
+#define RDWR_MPT_VIRT_START (XENHEAP_VIRT_END)
#define RDWR_MPT_VIRT_END (RDWR_MPT_VIRT_START + (4*1024*1024))
#define FRAMETABLE_VIRT_START (RDWR_MPT_VIRT_END)
#define FRAMETABLE_VIRT_END (DIRECTMAP_VIRT_END)
diff --git a/xen/include/asm-x86/string.h b/xen/include/asm-x86/string.h
index 3944789251..27fbb4d035 100644
--- a/xen/include/asm-x86/string.h
+++ b/xen/include/asm-x86/string.h
@@ -1,20 +1,7 @@
#ifndef _I386_STRING_H_
#define _I386_STRING_H_
-#ifdef __KERNEL__
#include <xen/config.h>
-/*
- * On a 486 or Pentium, we are better off not using the
- * byte string operations. But on a 386 or a PPro the
- * byte string ops are faster than doing it by hand
- * (MUCH faster on a Pentium).
- *
- * Also, the byte strings actually work correctly. Forget
- * the i486 routines for now as they may be broken..
- */
-#if FIXED_486_STRING && defined(CONFIG_X86_USE_STRING_486)
-#include <asm/string-486.h>
-#else
/*
* This string-include defines all string functions as inline
@@ -495,7 +482,4 @@ static inline void * memscan(void * addr, int c, size_t size)
return addr;
}
-#endif /* CONFIG_X86_USE_STRING_486 */
-#endif /* __KERNEL__ */
-
#endif
diff --git a/xen/include/asm-x86/x86_32/ptrace.h b/xen/include/asm-x86/x86_32/ptrace.h
index 26269afcb0..7e3e0cfa8c 100644
--- a/xen/include/asm-x86/x86_32/ptrace.h
+++ b/xen/include/asm-x86/x86_32/ptrace.h
@@ -44,8 +44,4 @@ enum EFLAGS {
EF_ID = 0x00200000, /* id */
};
-#ifdef __KERNEL__
-#define user_mode(regs) ((3 & (regs)->xcs))
-#endif
-
#endif
diff --git a/xen/include/asm-x86/x86_64/ptrace.h b/xen/include/asm-x86/x86_64/ptrace.h
index 983a71ae16..398f8a4e87 100644
--- a/xen/include/asm-x86/x86_64/ptrace.h
+++ b/xen/include/asm-x86/x86_64/ptrace.h
@@ -81,8 +81,8 @@ struct pt_regs {
#define PTRACE_GETFPXREGS 18
#define PTRACE_SETFPXREGS 19
-#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
-#define user_mode(regs) (!!((regs)->cs & 3))
+#if !defined(__ASSEMBLY__)
+
#define instruction_pointer(regs) ((regs)->rip)
extern void show_regs(struct pt_regs *);
diff --git a/xen/include/hypervisor-ifs/trace.h b/xen/include/hypervisor-ifs/trace.h
index d201eceb88..b5458b9f71 100644
--- a/xen/include/hypervisor-ifs/trace.h
+++ b/xen/include/hypervisor-ifs/trace.h
@@ -20,15 +20,12 @@ struct t_buf {
struct t_rec *data; /* pointer to data area. physical address
* for convenience in user space code */
- unsigned long size; /* size of the data area, in t_recs */
- unsigned long head; /* array index of the most recent record */
+ unsigned long size; /* size of the data area, in t_recs */
+ unsigned long head; /* array index of the most recent record */
-#ifdef __KERNEL__
+ /* Kernel-private elements follow... */
struct t_rec *head_ptr; /* pointer to the head record */
struct t_rec *vdata; /* virtual address pointer to data */
-#endif
-
- /* never add anything here - the kernel stuff must be the last elements */
};
#endif /* __HYPERVISOR_IFS_TRACE_H__ */
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index ae6e66817d..26721e8240 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -86,18 +86,18 @@ struct pfn_info
#define PageSetSlab(page) ((void)0)
#define PageClearSlab(page) ((void)0)
-#define IS_XEN_HEAP_FRAME(_pfn) (page_to_phys(_pfn) < MAX_MONITOR_ADDRESS)
-
-#define SHARE_PFN_WITH_DOMAIN(_pfn, _dom) \
- do { \
- (_pfn)->u.domain = (_dom); \
- wmb(); /* install valid domain ptr before updating refcnt. */ \
- (_pfn)->count_and_flags = 1; /* Xen holds a writeable reference */ \
- (_pfn)->type_and_flags = PGT_writeable_page | PGT_validated | 1; \
+#define IS_XEN_HEAP_FRAME(_pfn) (page_to_phys(_pfn) < MAX_XENHEAP_ADDRESS)
+
+#define SHARE_PFN_WITH_DOMAIN(_pfn, _dom) \
+ do { \
+ (_pfn)->u.domain = (_dom); \
+ wmb(); /* install valid domain ptr before updating refcnt. */ \
+ /* _dom holds an allocation reference */ \
+ (_pfn)->count_and_flags = PGC_allocated | 1; \
+ /* The incremented type count is intended to pin to 'writeable'. */ \
+ (_pfn)->type_and_flags = PGT_writeable_page | PGT_validated | 1; \
} while ( 0 )
-#define UNSHARE_PFN(_pfn) put_page_and_type(_pfn)
-
extern struct pfn_info *frame_table;
extern unsigned long frame_table_size;
extern struct list_head free_list;
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 53fdedb32a..f4d9d72f9c 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -326,8 +326,6 @@
#define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) /* Set mmap state to MEM space. */
#define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) /* Enable/disable write-combining. */
-#ifdef __KERNEL__
-
#include <xen/types.h>
#include <xen/config.h>
#include <xen/ioport.h>
@@ -833,5 +831,4 @@ extern int pci_pci_problems;
#define PCIPCI_VSFX 16
#define PCIPCI_ALIMAGIK 32
-#endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */
diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h
index df11ff8f87..384ee2cfce 100644
--- a/xen/include/xen/string.h
+++ b/xen/include/xen/string.h
@@ -1,12 +1,7 @@
#ifndef _LINUX_STRING_H_
#define _LINUX_STRING_H_
-/* We don't want strings.h stuff being user by user stuff by accident */
-
-#ifdef __KERNEL__
-
#include <xen/types.h> /* for size_t */
-//#include <xen/stddef.h> /* for NULL */
#ifdef __cplusplus
extern "C" {
@@ -86,5 +81,4 @@ extern void * memchr(const void *,int,__kernel_size_t);
}
#endif
-#endif
#endif /* _LINUX_STRING_H_ */
diff --git a/xen/tools/elf-reloc.c b/xen/tools/elf-reloc.c
index 80e926f29e..e2a5860e27 100644
--- a/xen/tools/elf-reloc.c
+++ b/xen/tools/elf-reloc.c
@@ -80,9 +80,6 @@ int main(int argc, char **argv)
new_base = strtoul(argv[2], NULL, 16);
image_name = argv[3];
- printf("Relocating `%s' from 0x%08lX to 0x%08lX\n",
- image_name, old_base, new_base);
-
fp = fopen(image_name, "rb+");
if ( !fp )
{