From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grzegorz Milos Subject: Re: Mini-OS in dom0 - virtual memory problems Date: Tue, 30 Jan 2007 21:48:26 +0000 Message-ID: <45BFBD2A.5060509@cam.ac.uk> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020206000603050100030604" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Julian Stecklina Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020206000603050100030604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mini-OS assumes that the start of the text section is also the beginning of virtual address space[1]. However, it is generally bad idea not to start virtual address space at 4Mb boundary. The easiest way to fix your problem is to move text to 0xc0000000 or 0xc0400000. More extensive fix, which decouples VIRT_START from &_text is also possible, but I don't see a reason why it would be needed. Instead I've included a runtime check. Keir could you apply the patch? Thanks Gregor [1] include/x86/arch_mm.h line 209: #define VIRT_START ((unsigned long)&_text) Julian Stecklina wrote: > Hello, > > I am trying to port Mini-OS (from xen-3.0.4-testing) to the domain 0 > environment. Setting the right flags in x86_32.S and changing the start > of the text section to 0xC0100000 enabled it to boot. I expected that > most of the Mini-OS's functionality to be working except everything that > relied on the Xenbus. > > To my surprise there was an error setting up the virtual memory. Here is > the console log: > > Bootstrapping... > Xen Minimal OS! > start_info: c0135000 > nr_pages: 26700 shared_inf: 00bed000 > pt_base: c0136000 mod_start: 0x0 > mod_len: 0 > flags: 0x3 > cmd_line: > stack: c0117040-c0119040 > MM: Init > _text: c0100000 > _etext: c010a3b4 > _edata: c010b760 > stack start: c0117040 > _end: c0119494 > start_pfn: 3b > max_pfn: 684c > Mapping memory range 0xc0500000 - 0xc694c000 > (XEN) mm.c:1664:d0 Bad type (saw e8000001 != exp 20000000) for mfn 1c3b > (pfn 3b) > (XEN) mm.c:1960:d0 Error while pinning mfn 1c3b > ERROR: pinning failed > Do_exit called! > > The first message from the hypervisor seems very strange. I would be > very thankful, if anyone can point to the source of the problem. > > Regards, > Julian > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel --------------020206000603050100030604 Content-Type: text/plain; name="mini-os.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mini-os.patch" diff -r 34ab61cd89bb extras/mini-os/arch/x86/setup.c --- a/extras/mini-os/arch/x86/setup.c Tue Jan 30 21:26:45 2007 +0000 +++ b/extras/mini-os/arch/x86/setup.c Tue Jan 30 21:45:46 2007 +0000 @@ -75,6 +75,13 @@ void void arch_init(start_info_t *si) { + if(VIRT_START & (L1_PAGETABLE_ENTRIES * PAGE_SIZE - 1)) + { + printk("Virt address space has to start on 4Mb(2Mb for PAE) boundary. " + "\nPlease adjust start of the text section. Exiting\n"); + do_exit(); + } + /* Copy the start_info struct to a globally-accessible area. */ /* WARN: don't do printk before here, it uses information from shared_info. Use xprintk instead. */ --------------020206000603050100030604 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------020206000603050100030604--