This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Setting up page directories and tables

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Setting up page directories and tables
From: "Dave Pacheco" <dap@xxxxxxxxxxxx>
Date: Fri, 27 Apr 2007 16:11:50 -0400
Cc: Joel Weinberger <joel@xxxxxxxxxxxx>
Delivery-date: Fri, 27 Apr 2007 13:10:21 -0700
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:mime-version:content-type:x-google-sender-auth; b=U4fh/Efwlafb6hqlm2lCD78EEUgKIyqSwNND4WZkp3FX90rl6y+RIvCGQG4rwKMdqb38aKvdqJZ+X9/ViXQpK7j2Z95CUBUeyYYwpjlMT4C49jSAsAg5BlG215uhzvxMkJhlUqTy59wqVpk0gJMYzfx2TTCaQ4ZgxPh4vE795sE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:mime-version:content-type:x-google-sender-auth; b=rraBBESt3I3HC4dpqtGL8qTjwTPum5HgI/adm5OuyMFXM9lkdc5ce1EqZgCxYtZKVTuIwXEfkq8K9KLvmg4Jc0mY9jSltwO4Rbut9Q6wfo72+xe8yAFkbxfxLsTCJtkO1Ozo8JrQGXZJ03gF5y9VWpfetsyUjhUeFgm4xgRDY5A=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
I'm working on a small OS which is similar in many ways to the Mini-OS (and I've borrowed much code for the time being). One important difference is that it supports multiple processes, each with its own address space. I'm having problems setting this up under Xen.

This OS is designed for 32-bit x86 (no PAE), so I intend to use a two-level paging system. Each process has a page directory - one page with entries which point to page tables, whose entries describe actual pages. As far as I can tell, this is what's done in the Mini-OS source, with page directories referred to as L1 page tables, and what I'm calling page tables referred to as L2 page tables.

So when creating a process, I do the following:
    allocate a page P for the process's page directory
    fill P with zeros
    update the existing page table mapping for P (previously set up by what is essentially the build_pagetable() code from Mini-OS) to give it L1_PROT & ~_PAGE_RW
        (using HYPERVISOR_mmu_update(...))
    pin the page (using HYPERVISOR_mmuext_op({MMUEXT_PIN_L1_TABLE, ...}...))

All of these steps succeed (the hypercall returns 0, and the argument indicating how many updates succeeded is 1 in both cases). But later, when switching into the context of this process, I try to update the user base pointer with

 HYPERVISOR_mmuext_op({MMUEXT_NEW_USER_BASEPTR, mfn of P}...).

This call fails (returns -1, and indicates that 0 operations succeeded). Why might that be? As I've established, the page is zero'd out (so it's not invalid), and it seems to be mapped properly (not writable, pinned L1 page table). So why would this operation fail?

Thanks in advance,
Dave Pacheco
Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>