From owner-p4-projects@FreeBSD.ORG Wed Dec 5 06:50:36 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7A76D16A473; Wed, 5 Dec 2007 06:50:36 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2887516A46B for ; Wed, 5 Dec 2007 06:50:36 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 07E2213C442 for ; Wed, 5 Dec 2007 06:50:36 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lB56oZZ9041301 for ; Wed, 5 Dec 2007 06:50:35 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lB56oZEh041298 for perforce@freebsd.org; Wed, 5 Dec 2007 06:50:35 GMT (envelope-from kmacy@freebsd.org) Date: Wed, 5 Dec 2007 06:50:35 GMT Message-Id: <200712050650.lB56oZEh041298@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 130248 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2007 06:50:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=130248 Change 130248 by kmacy@entropy_kmacy_xen31 on 2007/12/05 06:49:52 import missing header files for xen_machdep.c make neccessary changes to get xen_machdep.c to build Affected files ... .. //depot/projects/xen31/sys/i386/include/cpufunc.h#2 edit .. //depot/projects/xen31/sys/i386/include/pmap.h#4 edit .. //depot/projects/xen31/sys/i386/include/xen/evtchn.h#1 add .. //depot/projects/xen31/sys/i386/include/xen/synch_bitops.h#1 add .. //depot/projects/xen31/sys/i386/include/xen/xen-os.h#2 edit .. //depot/projects/xen31/sys/i386/include/xen/xen-public/grant_table.h#2 edit .. //depot/projects/xen31/sys/i386/include/xen/xen-public/xen.h#2 edit .. //depot/projects/xen31/sys/i386/xen/xen_machdep.c#2 edit Differences ... ==== //depot/projects/xen31/sys/i386/include/cpufunc.h#2 (text+ko) ==== @@ -42,6 +42,18 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#ifdef XEN +#include +#define NO_EXCHANGE +#include +#include +#include +#include +#include +#include +struct thread; +#endif + struct region_descriptor; #define readb(va) (*(volatile u_int8_t *) (va)) ==== //depot/projects/xen31/sys/i386/include/pmap.h#4 (text+ko) ==== @@ -192,6 +192,7 @@ #ifdef XEN +#include #include #include #include @@ -202,6 +203,8 @@ #define FALSE 0 #endif +#define PG_KERNEL (PG_V | PG_A | PG_RW | PG_M) + static __inline vm_paddr_t pmap_kextract_ma(vm_offset_t va) { @@ -227,6 +230,26 @@ void pmap_map_readonly(struct pmap *pmap, vm_offset_t va, int len); void pmap_map_readwrite(struct pmap *pmap, vm_offset_t va, int len); +static __inline pt_entry_t +pte_load_clear(pt_entry_t *ptep) +{ + pt_entry_t r; + + r = PT_GET(ptep); + PT_CLEAR_VA(ptep, TRUE); + return (r); +} +static __inline pt_entry_t +pte_load_store(pt_entry_t *ptep, pt_entry_t v) +{ + pt_entry_t r; + r = PT_GET(ptep); + PT_SET_VA(ptep, v, TRUE); + return (r); +} + +#define pte_store(ptep, pte) pte_load_store((ptep), (pt_entry_t)pte) + #else /* * Routine: pmap_kextract @@ -338,7 +361,7 @@ *ptep = pte; } -#endif /* PAE */ +#endif /* !PAE */ #define pte_clear(ptep) pte_store((ptep), (pt_entry_t)0ULL) ==== //depot/projects/xen31/sys/i386/include/xen/xen-os.h#2 (text+ko) ==== @@ -12,7 +12,9 @@ #define NULL (void *)0 #endif +#ifndef PANIC_IF #define PANIC_IF(exp) if (unlikely(exp)) {printk("panic - %s: %s:%d\n",#exp, __FILE__, __LINE__); panic("%s: %s:%d", #exp, __FILE__, __LINE__);} +#endif /* Somewhere in the middle of the GCC 2.96 development cycle, we implemented a mechanism by which the user can annotate likely branch directions and @@ -146,9 +148,15 @@ #define spin_unlock_irqrestore mtx_unlock_irqrestore +#ifndef mb #define mb() __asm__ __volatile__("lock; addl $0, 0(%%esp)": : :"memory") +#endif +#ifndef rmb #define rmb() mb() +#endif +#ifndef wmb #define wmb() barrier() +#endif #ifdef SMP #define smp_mb() mb() #define smp_rmb() rmb() @@ -217,7 +225,7 @@ * This operation is atomic and cannot be reordered. * It also implies a memory barrier. */ -static __inline__ int test_and_clear_bit(int nr, volatile void * addr) +static __inline int test_and_clear_bit(int nr, volatile void * addr) { int oldbit; @@ -228,12 +236,12 @@ return oldbit; } -static __inline__ int constant_test_bit(int nr, const volatile void * addr) +static __inline int constant_test_bit(int nr, const volatile void * addr) { return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0; } -static __inline__ int variable_test_bit(int nr, volatile void * addr) +static __inline int variable_test_bit(int nr, volatile void * addr) { int oldbit; ==== //depot/projects/xen31/sys/i386/include/xen/xen-public/grant_table.h#2 (text+ko) ==== @@ -235,11 +235,11 @@ #define GNTTABOP_transfer 4 typedef struct gnttab_transfer { /* IN parameters. */ - unsigned long mfn; - domid_t domid; - grant_ref_t ref; + xen_pfn_t mfn; + domid_t domid; + grant_ref_t ref; /* OUT parameters. */ - int16_t status; + int16_t status; } gnttab_transfer_t; DEFINE_GUEST_HANDLE(gnttab_transfer_t); ==== //depot/projects/xen31/sys/i386/include/xen/xen-public/xen.h#2 (text+ko) ==== @@ -19,6 +19,8 @@ #error "Unsupported architecture" #endif +typedef unsigned long xen_pfn_t; + /* * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS). */ @@ -406,8 +408,16 @@ uint32_t flags; /* SIF_xxx flags. */ unsigned long store_mfn; /* MACHINE page number of shared page. */ uint32_t store_evtchn; /* Event channel for store communication. */ - unsigned long console_mfn; /* MACHINE address of console page. */ - uint32_t console_evtchn; /* Event channel for console messages. */ + union { + struct { + xen_pfn_t mfn; /* MACHINE page number of console page. */ + uint32_t evtchn; /* Event channel for console page. */ + } domU; + struct { + uint32_t info_off; /* Offset of console_info struct. */ + uint32_t info_size; /* Size of console_info struct from start.*/ + } dom0; + } console; /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */ unsigned long pt_base; /* VIRTUAL address of page directory. */ unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames. */ ==== //depot/projects/xen31/sys/i386/xen/xen_machdep.c#2 (text+ko) ==== @@ -59,6 +59,10 @@ #include #include +#ifdef SMP +#include +#endif + #define IDTVEC(name) __CONCAT(X,name) extern inthand_t @@ -787,18 +791,19 @@ cur_space += PAGE_SIZE; console_page = (char *)cur_space; PT_SET_MA(console_page, - (xen_start_info->console_mfn << PAGE_SHIFT)| PG_KERNEL); + (xen_start_info->console.domU.mfn << PAGE_SHIFT)| PG_KERNEL); cur_space += PAGE_SIZE; printk("#5\n"); HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list = (unsigned long)xen_phys_machine; -#ifdef SMP +#if 0 && defined(SMP) for (i = 0; i < ncpus; i++) { - int npages = (sizeof(struct privatespace) + 1)/PAGE_SIZE; + int j, npages = (sizeof(struct privatespace) + 1)/PAGE_SIZE; + for (j = 0; j < npages; j++) { - vm_paddr_t ma = xpmap_ptom(tmpindex << PAGE_SHIFT); - tmpindex++; + vm_paddr_t ma = xpmap_ptom(cur_space); + cur_space += PAGE_SIZE; PT_SET_VA_MA(SMPpt + i*npages + j, ma | PG_KERNEL, FALSE); } } @@ -1007,7 +1012,7 @@ pmap_kremove(HYPERVISOR_shared_info); xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); - xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn); + xen_start_info->console.domU.mfn = mfn_to_pfn(xen_start_info->console.domU.mfn); /* * We'll stop somewhere inside this hypercall. When it returns,