From 2f32a8085286aaed3d81c5ca17bb6cad9a2a32a7 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Fri, 21 Jan 2005 18:43:08 +0000 Subject: [PATCH] bitkeeper revision 1.1159.223.12 (41f14d3cE4GADmEAEr6XE9nXX4dyGw) Common-code cleanups. Moved arch-specific code out into arch/x86 and asm-x86. --- xen/arch/x86/dom0_ops.c | 158 +++++++++++++++++++++++++++++++ xen/arch/x86/domain.c | 42 ++++++++ xen/arch/x86/memory.c | 4 +- xen/common/Makefile | 2 + xen/common/dom0_ops.c | 158 ------------------------------- xen/common/domain.c | 14 +-- xen/common/elf.c | 34 +++++-- xen/common/keyhandler.c | 18 +--- xen/common/schedule.c | 11 +-- xen/common/softirq.c | 2 + xen/drivers/char/console.c | 5 +- xen/drivers/char/serial.c | 13 ++- xen/include/asm-x86/mm.h | 7 +- xen/include/public/arch-x86_32.h | 5 + xen/include/public/arch-x86_64.h | 5 + xen/include/public/xen.h | 5 - xen/include/xen/domain.h | 10 +- xen/include/xen/grant_table.h | 1 - xen/include/xen/slab.h | 10 ++ 19 files changed, 285 insertions(+), 219 deletions(-) diff --git a/xen/arch/x86/dom0_ops.c b/xen/arch/x86/dom0_ops.c index 86479f1d17..d212324260 100644 --- a/xen/arch/x86/dom0_ops.c +++ b/xen/arch/x86/dom0_ops.c @@ -137,6 +137,164 @@ long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op) } break; + case DOM0_IOPL: + { + extern long do_iopl(domid_t, unsigned int); + ret = do_iopl(op->u.iopl.domain, op->u.iopl.iopl); + } + break; + + case DOM0_PHYSINFO: + { + dom0_physinfo_t *pi = &op->u.physinfo; + + pi->ht_per_core = opt_noht ? 1 : ht_per_core; + pi->cores = smp_num_cpus / pi->ht_per_core; + pi->total_pages = max_page; + pi->free_pages = avail_domheap_pages(); + pi->cpu_khz = cpu_khz; + + copy_to_user(u_dom0_op, op, sizeof(*op)); + ret = 0; + } + break; + + case DOM0_GETPAGEFRAMEINFO: + { + struct pfn_info *page; + unsigned long pfn = op->u.getpageframeinfo.pfn; + domid_t dom = op->u.getpageframeinfo.domain; + struct domain *d; + + ret = -EINVAL; + + if ( unlikely(pfn >= max_page) || + unlikely((d = find_domain_by_id(dom)) == NULL) ) + break; + + page = &frame_table[pfn]; + + if ( likely(get_page(page, d)) ) + { + ret = 0; + + op->u.getpageframeinfo.type = NOTAB; + + if ( (page->u.inuse.type_info & PGT_count_mask) != 0 ) + { + switch ( page->u.inuse.type_info & PGT_type_mask ) + { + case PGT_l1_page_table: + op->u.getpageframeinfo.type = L1TAB; + break; + case PGT_l2_page_table: + op->u.getpageframeinfo.type = L2TAB; + break; + case PGT_l3_page_table: + op->u.getpageframeinfo.type = L3TAB; + break; + case PGT_l4_page_table: + op->u.getpageframeinfo.type = L4TAB; + break; + } + } + + put_page(page); + } + + put_domain(d); + + copy_to_user(u_dom0_op, op, sizeof(*op)); + } + break; + + case DOM0_GETPAGEFRAMEINFO2: + { +#define GPF2_BATCH 128 + int n,j; + int num = op->u.getpageframeinfo2.num; + domid_t dom = op->u.getpageframeinfo2.domain; + unsigned long *s_ptr = (unsigned long*) op->u.getpageframeinfo2.array; + struct domain *d; + unsigned long l_arr[GPF2_BATCH]; + ret = -ESRCH; + + if ( unlikely((d = find_domain_by_id(dom)) == NULL) ) + break; + + if ( unlikely(num > 1024) ) + { + ret = -E2BIG; + break; + } + + ret = 0; + for( n = 0; n < num; ) + { + int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n); + + if ( copy_from_user(l_arr, &s_ptr[n], k*sizeof(unsigned long)) ) + { + ret = -EINVAL; + break; + } + + for( j = 0; j < k; j++ ) + { + struct pfn_info *page; + unsigned long mfn = l_arr[j]; + + if ( unlikely(mfn >= max_page) ) + goto e2_err; + + page = &frame_table[mfn]; + + if ( likely(get_page(page, d)) ) + { + unsigned long type = 0; + + switch( page->u.inuse.type_info & PGT_type_mask ) + { + case PGT_l1_page_table: + type = L1TAB; + break; + case PGT_l2_page_table: + type = L2TAB; + break; + case PGT_l3_page_table: + type = L3TAB; + break; + case PGT_l4_page_table: + type = L4TAB; + break; + } + + if ( page->u.inuse.type_info & PGT_pinned ) + type |= LPINTAB; + l_arr[j] |= type; + put_page(page); + } + else + { + e2_err: + l_arr[j] |= XTAB; + } + + } + + if ( copy_to_user(&s_ptr[n], l_arr, k*sizeof(unsigned long)) ) + { + ret = -EINVAL; + break; + } + + n += j; + } + + put_domain(d); + } + break; + default: ret = -ENOSYS; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index fa73e458ef..2ba535a3ac 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -196,6 +196,48 @@ void machine_halt(void) __machine_halt(NULL); } +void dump_pageframe_info(struct domain *d) +{ + struct pfn_info *page; + struct list_head *ent; + + if ( d->tot_pages < 10 ) + { + list_for_each ( ent, &d->page_list ) + { + page = list_entry(ent, struct pfn_info, list); + printk("Page %08x: caf=%08x, taf=%08x\n", + page_to_phys(page), page->count_info, + page->u.inuse.type_info); + } + } + + page = virt_to_page(d->shared_info); + printk("Shared_info@%08x: caf=%08x, taf=%08x\n", + page_to_phys(page), page->count_info, + page->u.inuse.type_info); +} + +xmem_cache_t *domain_struct_cachep; +void __init domain_startofday(void) +{ + domain_struct_cachep = xmem_cache_create( + "domain_cache", sizeof(struct domain), + 0, SLAB_HWCACHE_ALIGN, NULL, NULL); + if ( domain_struct_cachep == NULL ) + panic("No slab cache for domain structs."); +} + +struct domain *arch_alloc_domain_struct(void) +{ + return xmem_cache_alloc(domain_struct_cachep); +} + +void arch_free_domain_struct(struct domain *d) +{ + xmem_cache_free(domain_struct_cachep, d); +} + void free_perdomain_pt(struct domain *d) { free_xenheap_page((unsigned long)d->mm.perdomain_pt); diff --git a/xen/arch/x86/memory.c b/xen/arch/x86/memory.c index e51ae6235f..486d6ba407 100644 --- a/xen/arch/x86/memory.c +++ b/xen/arch/x86/memory.c @@ -1325,7 +1325,7 @@ int do_mmu_update( u32 type_info; domid_t domid; - cleanup_writable_pagetable(d, PTWR_CLEANUP_ACTIVE | PTWR_CLEANUP_INACTIVE); + cleanup_writable_pagetable(d); /* * If we are resuming after preemption, read how much work we have already @@ -1552,7 +1552,7 @@ int do_update_va_mapping(unsigned long page_nr, if ( unlikely(page_nr >= (HYPERVISOR_VIRT_START >> PAGE_SHIFT)) ) return -EINVAL; - cleanup_writable_pagetable(d, PTWR_CLEANUP_ACTIVE | PTWR_CLEANUP_INACTIVE); + cleanup_writable_pagetable(d); /* * XXX When we make this support 4MB superpages we should also deal with diff --git a/xen/common/Makefile b/xen/common/Makefile index 84e3a1292f..b764c1598a 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -2,6 +2,8 @@ include $(BASEDIR)/Rules.mk ifeq ($(TARGET_ARCH),ia64) +OBJS := $(subst dom_mem_ops.o,,$(OBJS)) +OBJS := $(subst grant_table.o,,$(OBJS)) OBJS := $(subst page_alloc.o,,$(OBJS)) OBJS := $(subst slab.o,,$(OBJS)) endif diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 4af61010df..e5b9f1d1e7 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -390,62 +390,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } break; - case DOM0_GETPAGEFRAMEINFO: - { - struct pfn_info *page; - unsigned long pfn = op->u.getpageframeinfo.pfn; - domid_t dom = op->u.getpageframeinfo.domain; - struct domain *d; - - ret = -EINVAL; - - if ( unlikely(pfn >= max_page) || - unlikely((d = find_domain_by_id(dom)) == NULL) ) - break; - - page = &frame_table[pfn]; - - if ( likely(get_page(page, d)) ) - { - ret = 0; - - op->u.getpageframeinfo.type = NOTAB; - - if ( (page->u.inuse.type_info & PGT_count_mask) != 0 ) - { - switch ( page->u.inuse.type_info & PGT_type_mask ) - { - case PGT_l1_page_table: - op->u.getpageframeinfo.type = L1TAB; - break; - case PGT_l2_page_table: - op->u.getpageframeinfo.type = L2TAB; - break; - case PGT_l3_page_table: - op->u.getpageframeinfo.type = L3TAB; - break; - case PGT_l4_page_table: - op->u.getpageframeinfo.type = L4TAB; - break; - } - } - - put_page(page); - } - - put_domain(d); - - copy_to_user(u_dom0_op, op, sizeof(*op)); - } - break; - - case DOM0_IOPL: - { - extern long do_iopl(domid_t, unsigned int); - ret = do_iopl(op->u.iopl.domain, op->u.iopl.iopl); - } - break; - #ifdef XEN_DEBUGGER case DOM0_DEBUG: { @@ -482,21 +426,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } break; - case DOM0_PHYSINFO: - { - dom0_physinfo_t *pi = &op->u.physinfo; - - pi->ht_per_core = opt_noht ? 1 : ht_per_core; - pi->cores = smp_num_cpus / pi->ht_per_core; - pi->total_pages = max_page; - pi->free_pages = avail_domheap_pages(); - pi->cpu_khz = cpu_khz; - - copy_to_user(u_dom0_op, op, sizeof(*op)); - ret = 0; - } - break; - case DOM0_PCIDEV_ACCESS: { extern int physdev_pci_access_modify(domid_t, int, int, int, int); @@ -549,93 +478,6 @@ long do_dom0_op(dom0_op_t *u_dom0_op) } break; - case DOM0_GETPAGEFRAMEINFO2: - { -#define GPF2_BATCH 128 - int n,j; - int num = op->u.getpageframeinfo2.num; - domid_t dom = op->u.getpageframeinfo2.domain; - unsigned long *s_ptr = (unsigned long*) op->u.getpageframeinfo2.array; - struct domain *d; - unsigned long l_arr[GPF2_BATCH]; - ret = -ESRCH; - - if ( unlikely((d = find_domain_by_id(dom)) == NULL) ) - break; - - if ( unlikely(num > 1024) ) - { - ret = -E2BIG; - break; - } - - ret = 0; - for( n = 0; n < num; ) - { - int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n); - - if ( copy_from_user(l_arr, &s_ptr[n], k*sizeof(unsigned long)) ) - { - ret = -EINVAL; - break; - } - - for( j = 0; j < k; j++ ) - { - struct pfn_info *page; - unsigned long mfn = l_arr[j]; - - if ( unlikely(mfn >= max_page) ) - goto e2_err; - - page = &frame_table[mfn]; - - if ( likely(get_page(page, d)) ) - { - unsigned long type = 0; - - switch( page->u.inuse.type_info & PGT_type_mask ) - { - case PGT_l1_page_table: - type = L1TAB; - break; - case PGT_l2_page_table: - type = L2TAB; - break; - case PGT_l3_page_table: - type = L3TAB; - break; - case PGT_l4_page_table: - type = L4TAB; - break; - } - - if ( page->u.inuse.type_info & PGT_pinned ) - type |= LPINTAB; - l_arr[j] |= type; - put_page(page); - } - else - { - e2_err: - l_arr[j] |= XTAB; - } - - } - - if ( copy_to_user(&s_ptr[n], l_arr, k*sizeof(unsigned long)) ) - { - ret = -EINVAL; - break; - } - - n += j; - } - - put_domain(d); - } - break; - case DOM0_SETDOMAINVMASSIST: { struct domain *d; diff --git a/xen/common/domain.c b/xen/common/domain.c index 42979c2fad..c2fe184267 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -22,18 +22,8 @@ rwlock_t domlist_lock = RW_LOCK_UNLOCKED; struct domain *domain_hash[DOMAIN_HASH_SIZE]; struct domain *domain_list; -xmem_cache_t *domain_struct_cachep; struct domain *dom0; -void __init domain_startofday(void) -{ - domain_struct_cachep = xmem_cache_create( - "domain_cache", sizeof(struct domain), - 0, SLAB_HWCACHE_ALIGN, NULL, NULL); - if ( domain_struct_cachep == NULL ) - panic("No slab cache for domain structs."); -} - struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) { struct domain *d, **pd; @@ -203,8 +193,8 @@ unsigned int alloc_new_dom_mem(struct domain *d, unsigned int kbytes) return -ENOMEM; } - /* initialise to machine_to_phys_mapping table to likely pfn */ - machine_to_phys_mapping[page-frame_table] = alloc_pfns; + /* Initialise the machine-to-phys mapping for this page. */ + set_machinetophys(page_to_pfn(page), alloc_pfns); } return 0; diff --git a/xen/common/elf.c b/xen/common/elf.c index 7f5a11e351..eae1c8fa10 100644 --- a/xen/common/elf.c +++ b/xen/common/elf.c @@ -10,6 +10,14 @@ #include #include +#ifdef CONFIG_X86 +#define FORCE_XENELF_IMAGE 1 +#define ELF_ADDR p_vaddr +#elif defined(__ia64__) +#define FORCE_XENELF_IMAGE 0 +#define ELF_ADDR p_paddr +#endif + static inline int is_loadable_phdr(Elf_Phdr *phdr) { return ((phdr->p_type == PT_LOAD) && @@ -84,7 +92,9 @@ int parseelfimage(char *elfbase, if ( guestinfo == NULL ) { printk("Not a Xen-ELF image: '__xen_guest' section not found.\n"); +#ifndef FORCE_XENELF_IMAGE return -EINVAL; +#endif } for ( h = 0; h < ehdr->e_phnum; h++ ) @@ -92,10 +102,10 @@ int parseelfimage(char *elfbase, phdr = (Elf_Phdr *)(elfbase + ehdr->e_phoff + (h*ehdr->e_phentsize)); if ( !is_loadable_phdr(phdr) ) continue; - if ( phdr->p_vaddr < kernstart ) - kernstart = phdr->p_vaddr; - if ( (phdr->p_vaddr + phdr->p_memsz) > kernend ) - kernend = phdr->p_vaddr + phdr->p_memsz; + if ( phdr->ELF_ADDR < kernstart ) + kernstart = phdr->ELF_ADDR; + if ( (phdr->ELF_ADDR + phdr->p_memsz) > kernend ) + kernend = phdr->ELF_ADDR + phdr->p_memsz; } if ( (kernstart > kernend) || @@ -107,11 +117,15 @@ int parseelfimage(char *elfbase, } dsi->v_start = kernstart; - if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) - dsi->v_start = simple_strtoul(p+10, &p, 0); - if ( (p = strstr(guestinfo, "PT_MODE_WRITABLE")) != NULL ) - dsi->use_writable_pagetables = 1; + if ( guestinfo != NULL ) + { + if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL ) + dsi->v_start = simple_strtoul(p+10, &p, 0); + + if ( (p = strstr(guestinfo, "PT_MODE_WRITABLE")) != NULL ) + dsi->use_writable_pagetables = 1; + } dsi->v_kernstart = kernstart; dsi->v_kernend = kernend; @@ -132,10 +146,10 @@ int loadelfimage(char *elfbase) if ( !is_loadable_phdr(phdr) ) continue; if ( phdr->p_filesz != 0 ) - memcpy((char *)phdr->p_vaddr, elfbase + phdr->p_offset, + memcpy((char *)phdr->ELF_ADDR, elfbase + phdr->p_offset, phdr->p_filesz); if ( phdr->p_memsz > phdr->p_filesz ) - memset((char *)phdr->p_vaddr + phdr->p_filesz, 0, + memset((char *)phdr->ELF_ADDR + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); } diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 8a9231e317..ef62fc4a5a 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -97,8 +97,6 @@ void do_task_queues(unsigned char key) { struct domain *d; s_time_t now = NOW(); - struct list_head *ent; - struct pfn_info *page; printk("'%c' pressed -> dumping task queues (now=0x%X:%08X)\n", key, (u32)(now>>32), (u32)now); @@ -113,21 +111,7 @@ void do_task_queues(unsigned char key) test_bit(DF_RUNNING, &d->flags) ? 'T':'F', d->flags, atomic_read(&d->refcnt), d->tot_pages, d->xenheap_pages); - if ( d->tot_pages < 10 ) - { - list_for_each ( ent, &d->page_list ) - { - page = list_entry(ent, struct pfn_info, list); - printk("Page %08x: caf=%08x, taf=%08x\n", - page_to_phys(page), page->count_info, - page->u.inuse.type_info); - } - } - - page = virt_to_page(d->shared_info); - printk("Shared_info@%08x: caf=%08x, taf=%08x\n", - page_to_phys(page), page->count_info, - page->u.inuse.type_info); + dump_pageframe_info(d); printk("Guest: upcall_pend = %02x, upcall_mask = %02x\n", d->shared_info->vcpu_data[0].evtchn_upcall_pending, diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 8639e51465..5be947dc5a 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -89,26 +89,24 @@ static struct scheduler ops; /* Per-CPU periodic timer sends an event to the currently-executing domain. */ static struct ac_timer t_timer[NR_CPUS]; -extern xmem_cache_t *domain_struct_cachep; - void free_domain_struct(struct domain *d) { SCHED_OP(free_task, d); - xmem_cache_free(domain_struct_cachep, d); + arch_free_domain_struct(d); } struct domain *alloc_domain_struct(void) { struct domain *d; - if ( (d = xmem_cache_alloc(domain_struct_cachep)) == NULL ) + if ( (d = arch_alloc_domain_struct()) == NULL ) return NULL; memset(d, 0, sizeof(*d)); if ( SCHED_OP(alloc_task, d) < 0 ) { - xmem_cache_free(domain_struct_cachep, d); + arch_free_domain_struct(d); return NULL; } @@ -320,8 +318,7 @@ void __enter_scheduler(void) task_slice_t next_slice; s32 r_time; /* time for new dom to run */ - cleanup_writable_pagetable( - prev, PTWR_CLEANUP_ACTIVE | PTWR_CLEANUP_INACTIVE); + cleanup_writable_pagetable(prev); perfc_incrc(sched_run); diff --git a/xen/common/softirq.c b/xen/common/softirq.c index 2a59925a07..17e850b3f6 100644 --- a/xen/common/softirq.c +++ b/xen/common/softirq.c @@ -15,7 +15,9 @@ #include #include +#ifndef __ARCH_IRQ_STAT irq_cpustat_t irq_stat[NR_CPUS]; +#endif static softirq_handler softirq_handlers[NR_SOFTIRQS]; diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index baa7adb496..75713575f4 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -18,6 +18,7 @@ #include #include #include +#include /* opt_console: comma-separated list of console outputs. */ static unsigned char opt_console[30] = "com1,vga"; @@ -31,7 +32,7 @@ static unsigned char opt_conswitch[5] = "a"; string_param("conswitch", opt_conswitch); static int xpos, ypos; -static unsigned char *video = __va(0xB8000); +static unsigned char *video; #define CONSOLE_RING_SIZE 16392 typedef struct console_ring_st @@ -137,6 +138,8 @@ static void init_vga(void) return; } + video = __va(0xB8000); + tmp = inb(0x3da); outb(0x00, 0x3c0); diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c index 43bae0b1a3..2c6fc895b4 100644 --- a/xen/drivers/char/serial.c +++ b/xen/drivers/char/serial.c @@ -100,6 +100,16 @@ static uart_t com[2] = { #define UART_ENABLED(_u) ((_u)->baud != 0) #define DISABLE_UART(_u) ((_u)->baud = 0) +#ifdef CONFIG_X86 +static inline int arch_serial_putc(uart_t *uart, unsigned char c) +{ + int space; + if ( (space = (inb(uart->io_base + LSR) & LSR_THRE)) ) + outb(c, uart->io_base + THR); + return space; +} +#endif + /*********************** * PRIVATE FUNCTIONS @@ -151,8 +161,7 @@ static inline void __serial_putc(uart_t *uart, int handle, unsigned char c) do { spin_lock_irqsave(&uart->lock, flags); - if ( (space = (inb(uart->io_base + LSR) & LSR_THRE)) ) - outb(c, uart->io_base + THR); + space = arch_serial_putc(uart, c); spin_unlock_irqrestore(&uart->lock, flags); } while ( !space ); diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index a37f9f2544..2af462e37d 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -224,6 +224,8 @@ extern unsigned long *machine_to_phys_mapping; extern unsigned long m2p_start_mfn; #endif +#define set_machinetophys(_mfn, _pfn) machine_to_phys_mapping[(_mfn)] = (_pfn) + #define DEFAULT_GDT_ENTRIES (LAST_RESERVED_GDT_ENTRY+1) #define DEFAULT_GDT_ADDRESS ((unsigned long)gdt_table) @@ -285,10 +287,11 @@ do { \ ptwr_flush(PTWR_PT_INACTIVE); \ } while ( 0 ) -#define cleanup_writable_pagetable(_d, _w) \ +#define cleanup_writable_pagetable(_d) \ do { \ if ( unlikely(VM_ASSIST((_d), VMASST_TYPE_writable_pagetables)) ) \ - __cleanup_writable_pagetable(_w); \ + __cleanup_writable_pagetable(PTWR_CLEANUP_ACTIVE | \ + PTWR_CLEANUP_INACTIVE); \ } while ( 0 ) #ifndef NDEBUG diff --git a/xen/include/public/arch-x86_32.h b/xen/include/public/arch-x86_32.h index b7210fc1b5..f3d402d2b3 100644 --- a/xen/include/public/arch-x86_32.h +++ b/xen/include/public/arch-x86_32.h @@ -9,6 +9,11 @@ #ifndef __XEN_PUBLIC_ARCH_X86_32_H__ #define __XEN_PUBLIC_ARCH_X86_32_H__ +#ifndef PACKED +/* GCC-specific way to pack structure definitions (no implicit padding). */ +#define PACKED __attribute__ ((packed)) +#endif + /* * Pointers and other address fields inside interface structures are padded to * 64 bits. This means that field alignments aren't different between 32- and diff --git a/xen/include/public/arch-x86_64.h b/xen/include/public/arch-x86_64.h index 2144b0d63b..abba7bdf12 100644 --- a/xen/include/public/arch-x86_64.h +++ b/xen/include/public/arch-x86_64.h @@ -9,6 +9,11 @@ #ifndef __XEN_PUBLIC_ARCH_X86_64_H__ #define __XEN_PUBLIC_ARCH_X86_64_H__ +#ifndef PACKED +/* GCC-specific way to pack structure definitions (no implicit padding). */ +#define PACKED __attribute__ ((packed)) +#endif + /* Pointers are naturally 64 bits in this architecture; no padding needed. */ #define _MEMORY_PADDING(_X) #define MEMORY_PADDING diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 9817b1a9e8..ff13c0fb20 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -9,11 +9,6 @@ #ifndef __XEN_PUBLIC_XEN_H__ #define __XEN_PUBLIC_XEN_H__ -#ifndef PACKED -/* GCC-specific way to pack structure definitions (no implicit padding). */ -#define PACKED __attribute__ ((packed)) -#endif - #if defined(__i386__) #include "arch-x86_32.h" #elif defined(__x86_64__) diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 956e38087c..94d1e01635 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -2,12 +2,16 @@ #ifndef __XEN_DOMAIN_H__ #define __XEN_DOMAIN_H__ -extern void domain_startofday(void); - /* * Arch-specifics. */ +extern void domain_startofday(void); + +extern struct domain *arch_alloc_domain_struct(void); + +extern void arch_free_domain_struct(struct domain *d); + extern void arch_do_createdomain(struct domain *d); extern int arch_final_setup_guestos( @@ -17,4 +21,6 @@ extern void free_perdomain_pt(struct domain *d); extern void domain_relinquish_memory(struct domain *d); +extern void dump_pageframe_info(struct domain *d); + #endif /* __XEN_DOMAIN_H__ */ diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h index eb9d8c15af..c161667cdf 100644 --- a/xen/include/xen/grant_table.h +++ b/xen/include/xen/grant_table.h @@ -25,7 +25,6 @@ #define __XEN_GRANT_H__ #include -#include #include /* Active grant entry - used for shadowing GTF_permit_access grants. */ diff --git a/xen/include/xen/slab.h b/xen/include/xen/slab.h index 81f43e8b47..692b3b63f3 100644 --- a/xen/include/xen/slab.h +++ b/xen/include/xen/slab.h @@ -6,6 +6,14 @@ #ifndef __SLAB_H__ #define __SLAB_H__ +#include + +#ifdef __ARCH_HAS_SLAB_ALLOCATOR + +#include + +#else + typedef struct xmem_cache_s xmem_cache_t; #include @@ -44,4 +52,6 @@ extern int xmem_cache_reap(void); extern void dump_slabinfo(); +#endif /* __ARCH_HAS_SLAB_ALLOCATOR */ + #endif /* __SLAB_H__ */ -- 2.39.5