Xen-specific memory setup for FreeLdr Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c Modified: branches/xen/reactos/config Deleted: branches/xen/reactos/include/xen3/private/page.h Deleted: branches/xen/reactos/include/xen3/private/pgtable.h _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile --- branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-03-30 22:04:56 UTC (rev 14385) @@ -160,6 +160,7 @@
xboxrtc.o \ xboxvideo.o \ xencons.o \ + xenmem.o \ _alloca.o # For Mingw32 builds
ARCH_OBJS = $(addprefix i386/,$(ARCH_I386_OBJS)) _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-03-30 22:04:56 UTC (rev 14385) @@ -26,8 +26,6 @@
#include <rosxen.h> #include <xen.h> #include <hypervisor.h> -#include <page.h> -#include <pgtable.h>
BOOL XenActive = FALSE; ctrl_front_ring_t XenCtrlIfTxRing; @@ -64,71 +62,58 @@ MachVtbl.HwDetect = XenHwDetect; }
-start_info_t *HYPERVISOR_start_info; -extern char shared_info[PAGE_SIZE]; - /* _start is the default name ld will use as the entry point. When xen * loads the domain, it will start execution at the elf entry point. */
+void *dummy; void _start() { - pgd_t *pgd; - int ptetab_ma; - int idx; - int pte_ma; - mmu_update_t req; + extern void *start; /* Where is freeldr loaded? */ + start_info_t *StartInfo; control_if_t *CtrlIf; + void *OldStackPtr, *NewStackPtr; + void *OldStackPage, *NewStackPage;
/* * Grab start_info - */ - /* The linux build setup_guest() put a start_info_t* into %esi. + * + * The linux build setup_guest() put a start_info_t* into %esi. * =S is inline asm code for get output from reg %esi. */ - asm("":"=S" (HYPERVISOR_start_info)); + asm("":"=S" (StartInfo));
- /* To write to the xen virtual console, we need to map in the - * shared page used by the the domain controller interface. The - * HYPERVISOR_start_info struct identifies the page table and - * shared_info pages. - * - * The following code maps the shared_info mfn (machine frame number) - * into this domains address space over the shared_info[] page. - */ - - /* - * map shared_info page + * Set up memory */ - /* The pgd page (page global directory - level 2 page table) is - * constructed by setup_guest() in tools/libxc/xc_linux_build.c - * Lookup the machine address of ptetab in pgd to construct the - * machine address of the pte entry for shared_info, - * and then call mmu_update to change mapping. - */ - pgd = (pgd_t*)HYPERVISOR_start_info->pt_base; - ptetab_ma = pgd_val(pgd[pgd_index((unsigned long)shared_info)]) - & (PAGE_MASK); - idx = pte_index((unsigned long)shared_info); - pte_ma = ptetab_ma + (idx*sizeof(pte_t)); + XenMemInit(StartInfo);
- req.ptr = pte_ma; - req.val = HYPERVISOR_start_info->shared_info|7; - HYPERVISOR_mmu_update(&req, 1, NULL); - /* * Setup control interface */ - XenCtrlIfEvtchn = HYPERVISOR_start_info->domain_controller_evtchn; - CtrlIf = ((control_if_t *)((char *)shared_info + 2048)); + XenCtrlIfEvtchn = XenStartInfo->domain_controller_evtchn; + CtrlIf = ((control_if_t *)((char *)XenSharedInfo + 2048));
/* Sync up with shared indexes. */ FRONT_RING_ATTACH(&XenCtrlIfTxRing, &CtrlIf->tx_ring); BACK_RING_ATTACH(&XenCtrlIfRxRing, &CtrlIf->rx_ring);
+ /* Now move the stack to low mem */ + /* Copy the stack page */ + __asm__ __volatile__("mov %%esp,%%eax\n" : "=a" (OldStackPtr)); + OldStackPage = (void *) ROUND_DOWN((unsigned long) OldStackPtr, PAGE_SIZE); + NewStackPage = (void *)((char *) &start - PAGE_SIZE); + memcpy(NewStackPage, OldStackPage, PAGE_SIZE); + /* Switch the stack around. */ + NewStackPtr = (void *)((char *) NewStackPage + (OldStackPtr - OldStackPage)); + __asm__ __volatile__("mov %%eax,%%esp\n" : : "a"(NewStackPtr)); + /* Don't use stack based variables after this */ + /* Start freeldr */ XenActive = TRUE; - BootMain(NULL); + BootMain(XenStartInfo->cmd_line); + + /* Shouldn't get here */ + HYPERVISOR_shutdown(); }
#define XEN_UNIMPLEMENTED(routine) \ @@ -230,13 +215,6 @@ XEN_UNIMPLEMENTED("XenVideoPrepareForReactOS"); }
-ULONG -XenMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize) - { - XEN_UNIMPLEMENTED("XenMemGetMemoryMap"); - return 0; - } - BOOL XenDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) @@ -280,12 +258,6 @@ XEN_UNIMPLEMENTED("XenHwDetect"); }
-/* Create shared_info page. This page is mapped over by the real shared - * info page - */ -asm(".align 0x1000; shared_info:;.skip 0x1000;"); - - /* emit the elf segment Xen builder expects in kernel image */ asm(".section __xen_guest;" ".ascii "GUEST_OS=linux,GUEST_VER=2.6,XEN_VER=3.0,VIRT_BASE=0x00008000";" ".ascii ",LOADER=generic";" _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-03-30 22:04:56 UTC (rev 14385) @@ -33,8 +33,11 @@
extern ctrl_front_ring_t XenCtrlIfTxRing; extern ctrl_back_ring_t XenCtrlIfRxRing; extern int XenCtrlIfEvtchn; +extern start_info_t *XenStartInfo; +extern shared_info_t *XenSharedInfo;
VOID XenMachInit(VOID); +VOID XenMemInit(start_info_t *StartInfo);
VOID XenConsPutChar(int Ch); BOOL XenConsKbHit(); _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c 2005-03-30 22:04:56 UTC (rev 14385) @@ -25,6 +25,15 @@
#include <ctrl_if.h> #include <evtchn.h>
+/* + * Extra ring macros to sync a consumer index up to the public producer index. + * Generally UNSAFE, but we use it for recovery and shutdown in some cases. + */ +#define RING_DROP_PENDING_RESPONSES(_r) \ + do { \ + (_r)->rsp_cons = (_r)->sring->rsp_prod; \ + } while (0) + #define OUTPUT_BUFFER_SIZE 128 static char OutputBuffer[OUTPUT_BUFFER_SIZE]; static unsigned OutputPtr = 0; @@ -34,23 +43,31 @@ { ctrl_msg_t *msg;
- /* - * Put message on the control interface ring and trigger virtual - * console writer. - */ - msg = RING_GET_REQUEST(&XenCtrlIfTxRing, XenCtrlIfTxRing.req_prod_pvt); + while (0 != OutputPtr) + { + RING_DROP_PENDING_RESPONSES(&XenCtrlIfTxRing);
- msg->type = CMSG_CONSOLE; - msg->subtype = CMSG_CONSOLE_DATA; - msg->length = OutputPtr + 1; - memcpy(msg->msg, OutputBuffer, OutputPtr); - msg->msg[OutputPtr + 1] = '\0'; - msg->id = 0xff; - XenCtrlIfTxRing.req_prod_pvt++; - RING_PUSH_REQUESTS(&XenCtrlIfTxRing); - notify_via_evtchn(XenCtrlIfEvtchn); + if (! RING_FULL(&XenCtrlIfTxRing)) + { + /* + * Put message on the control interface ring and trigger virtual + * console writer. + */ + msg = RING_GET_REQUEST(&XenCtrlIfTxRing, + XenCtrlIfTxRing.req_prod_pvt);
- OutputPtr = 0; + msg->type = CMSG_CONSOLE; + msg->subtype = CMSG_CONSOLE_DATA; + msg->length = OutputPtr; + memcpy(msg->msg, OutputBuffer, OutputPtr); + msg->id = 0xff; + XenCtrlIfTxRing.req_prod_pvt++; + RING_PUSH_REQUESTS(&XenCtrlIfTxRing); + notify_via_evtchn(XenCtrlIfEvtchn); + + OutputPtr = 0; + } + } }
static VOID _____
Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c 2005-03-30 22:04:56 UTC (rev 14385) @@ -0,0 +1,303 @@
+/* + * FreeLoader + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "freeldr.h" +#include "machxen.h" + +#include <rosxen.h> +#include <xen.h> +#include <hypervisor.h> + +/* Page Directory Entry */ +typedef struct _PDE +{ + unsigned long Pde; +} PDE, *PPDE; + +/* Page Table Entry */ +typedef struct _PTE +{ + unsigned long Pte; +} PTE, *PPTE; + +#define PGDIR_SHIFT 22 +#define PTRS_PER_PD (PAGE_SIZE / sizeof(PDE)) +#define PTRS_PER_PT (PAGE_SIZE / sizeof(PTE)) + +/* Page Directory Index of a given virtual address */ +#define PD_IDX(Va) (((Va) >> PGDIR_SHIFT) & (PTRS_PER_PD - 1)) +/* Page Table Index of a give virtual address */ +#define PT_IDX(Va) (((Va) >> PAGE_SHIFT) & (PTRS_PER_PT - 1)) +/* Convert a Page Directory or Page Table entry to a (machine) address */ +#define PAGE_MASK (~(PAGE_SIZE-1)) + +/* The PA_* definitions below were copied from ntoskrnl/mm/i386/page.c, maybe + we need a public header for them?? */ +#define PA_BIT_PRESENT (0) +#define PA_BIT_READWRITE (1) +#define PA_BIT_USER (2) +#define PA_BIT_WT (3) +#define PA_BIT_CD (4) +#define PA_BIT_ACCESSED (5) +#define PA_BIT_DIRTY (6) +#define PA_BIT_GLOBAL (8) + +#define PA_PRESENT (1 << PA_BIT_PRESENT) +#define PA_READWRITE (1 << PA_BIT_READWRITE) +#define PA_USER (1 << PA_BIT_USER) +#define PA_DIRTY (1 << PA_BIT_DIRTY) +#define PA_WT (1 << PA_BIT_WT) +#define PA_CD (1 << PA_BIT_CD) +#define PA_ACCESSED (1 << PA_BIT_ACCESSED) +#define PA_GLOBAL (1 << PA_BIT_GLOBAL) + +start_info_t *XenStartInfo; +shared_info_t *XenSharedInfo; + +static PPDE XenPageDir; + +ULONG +XenMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize) +{ + ULONG EntryCount; + + /* Don't give the memory manager a hard time, just tell it we have contiguous + * memory starting at address 0 and handle machine/physical stuff here */ + if (2 <= MaxMemoryMapSize) + { + BiosMemoryMap[0].BaseAddress = 0; + BiosMemoryMap[0].Length = (unsigned long) XenStartInfo; + BiosMemoryMap[0].Type = MEMTYPE_USABLE; + BiosMemoryMap[1].BaseAddress = (unsigned long) XenStartInfo; + BiosMemoryMap[1].Length = XenStartInfo->nr_pages * PAGE_SIZE + - (unsigned long) XenStartInfo; + BiosMemoryMap[1].Type = MEMTYPE_RESERVED; + EntryCount = 2; + } + else + { + EntryCount = 0; + } + + return EntryCount; +} + +/* + * This is an example (virtual) memory layout as presented to us by Xen: + * + * +--------------------+ 0xffffffff + * | Xen private | + * +--------------------+ 0xfc000000 + * | Unmapped | + * +--------------------+ 0x00400000 + * | Mapped unused | + * +--------------------+ 0x0004d000 + * | Stack | + * +--------------------+ 0x0004c000 + * | Start info | + * +--------------------+ 0x0004b000 StartInfo + * | Page dir/tables | + * +--------------------+ 0x00049000 StartInfo->pt_base + * | Machine frame list | + * +--------------------+ 0x00041000 StartInfo->mfn_list + * | FreeLdr image | + * +--------------------+ 0x00008000 + * | Unmapped | + * +--------------------+ 0x00000000 + * + * And this is how we would like it: + * + * +--------------------+ 0xffffffff + * | Xen private | + * +--------------------+ 0xfc000000 + * | Unmapped | + * +--------------------+ 0x02001000 + * | Shared page | + * +--------------------+ 0x02000000 XenSharedPage + * | Page dir/tables | + * +--------------------+ 0x01ff7000 XenPageDir + * | Start info | + * +--------------------+ 0x01ff6000 XenStartInfo + * | Mapped unused | + * +--------------------+ 0x00041000 + * | FreeLdr image | + * +--------------------+ 0x00008000 + * | Stack | + * +--------------------+ 0x00000000 + * + * This way, we can let the FreeLdr memory manager handle the address space + * between the end of the FreeLdr image and the information near the end of + * the physical memory (starting at XenStartInfo). + * XenMemInit sets up the memory the way we like it, except for switching the + * stack. That is done by our caller. + */ +void +XenMemInit(start_info_t *StartInfo) +{ + extern void *start; /* Where is freeldr loaded? */ + static char ErrMsg[] = "XenMemInit failed\n"; + unsigned long StartPfn; /* (Virtual) page frame number of beginning + of freeldr */ + PPDE PageDir; /* Virtual address of page directory */ + PPTE PageTableForPageDir; /* Virtual address of page table which + contains entry for the page directory */ + unsigned long PageDirMachineAddr; /* Machine address of page directory */ + unsigned PageTablesRequired; /* Number of page tables we require */ + unsigned PageTableNumber; /* Index of current page table */ + mmu_update_t MmuReq; /* Request info for mmu update */ + unsigned long MfnIndex; /* Index into mfn_list */ + unsigned long HighAddr; /* Virtual address after reloc to high + memory */ + unsigned long PageNumber; /* Index of current page */ + PPTE PageTable; /* Page table containing current page */ + + PageDir = (PPDE) StartInfo->pt_base; + PageTableForPageDir = (PPTE)((char *) StartInfo->pt_base + + PAGE_SIZE * (PD_IDX(StartInfo->pt_base) + 1)); + PageDirMachineAddr = PageTableForPageDir[PT_IDX(StartInfo->pt_base)].Pte + & PAGE_MASK; + + /* Determine pfn of first allocated memory */ + StartPfn = ROUND_DOWN((unsigned long) &start, PAGE_SIZE) / PAGE_SIZE; + + /* First, lets connect all our page tables */ + PageTablesRequired = ROUND_UP(StartInfo->nr_pages + 1, PTRS_PER_PT) + / PTRS_PER_PT; + for (PageTableNumber = 0; PageTableNumber < PageTablesRequired; + PageTableNumber++) + { + MfnIndex = StartInfo->nr_pages - (StartPfn + PageTablesRequired) + + PageTableNumber; + if (0 == PageDir[PageTableNumber].Pde) + { + MmuReq.ptr = PageDirMachineAddr + PageTableNumber * sizeof(PTE); + } + else + { + /* There's already a page table connected at this position. That + * means that it's also mapped in the area following pt_base. We + * don't want it there, so let's map another page at that pos. + * This page table will be mapped near the top of memory later */ + PageTable = (PPTE)((char *) PageDir + + (PageTableNumber + 1) * PAGE_SIZE); + MmuReq.ptr = (PageDir[PD_IDX((unsigned long) PageTable)].Pde + & PAGE_MASK) + + PT_IDX((unsigned long) PageTable) * sizeof(PTE); + } + MmuReq.val = (((u32*)StartInfo->mfn_list)[MfnIndex] << PAGE_SHIFT) + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + } + + /* Now, let's make the page directory visible near the top of mem */ + HighAddr = (StartInfo->nr_pages - (PageTablesRequired + 1)) * PAGE_SIZE; + MmuReq.ptr = (PageDir[PD_IDX(HighAddr)].Pde & PAGE_MASK) + + PT_IDX(HighAddr) * sizeof(PTE); + MmuReq.val = PageDirMachineAddr + | (PA_PRESENT | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + XenPageDir = (PPDE) HighAddr; + + /* We don't need the page directory mapped at the low address (pt_base) + * anymore, so we'll map another page there */ + MmuReq.ptr = (PageDir[PD_IDX((unsigned long) PageDir)].Pde & PAGE_MASK) + + PT_IDX((unsigned long) PageDir) * sizeof(PTE); + MfnIndex = StartInfo->nr_pages - (StartPfn + PageTablesRequired + 1); + MmuReq.val = (((u32*)StartInfo->mfn_list)[MfnIndex] << PAGE_SHIFT) + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + + /* Map the page tables near the top of mem */ + for (PageTableNumber = 0; PageTableNumber < PageTablesRequired; + PageTableNumber++) + { + HighAddr = (StartInfo->nr_pages - PageTablesRequired + PageTableNumber) + * PAGE_SIZE; + MmuReq.ptr = (XenPageDir[PD_IDX(HighAddr)].Pde & PAGE_MASK) + + PT_IDX(HighAddr) * sizeof(PTE); + MmuReq.val = (XenPageDir[PageTableNumber].Pde & PAGE_MASK) + | (PA_PRESENT | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + } + + /* Fill in gaps */ + for (PageNumber = 0; + PageNumber < StartInfo->nr_pages - (PageTablesRequired + 1); + PageNumber++) + { + PageTable = (PPTE)((char *) XenPageDir + + (PD_IDX(PageNumber * PAGE_SIZE) + 1) * PAGE_SIZE); + if (0 == PageTable[PT_IDX(PageNumber * PAGE_SIZE)].Pte) + { + if (PageNumber < StartPfn) + { + MfnIndex = StartInfo->nr_pages - StartPfn + PageNumber; + } + else + { + MfnIndex = PageNumber - StartPfn; + } + MmuReq.ptr = (XenPageDir[PD_IDX(PageNumber * PAGE_SIZE)].Pde + & PAGE_MASK) + + PT_IDX(PageNumber * PAGE_SIZE) * sizeof(PTE); + MmuReq.val = (((u32 *) StartInfo->mfn_list)[MfnIndex] << PAGE_SHIFT) + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } + } + } + + /* Need to move the start info out of the way */ + XenStartInfo = (start_info_t *)((char *) XenPageDir - PAGE_SIZE); + memcpy(XenStartInfo, StartInfo, PAGE_SIZE); + + /* We don't own the shared_info page, map it as an extra page just after + * our "normal" memory */ + XenSharedInfo = (shared_info_t *)(XenStartInfo->nr_pages * PAGE_SIZE); + MmuReq.ptr = (XenPageDir[PD_IDX(XenStartInfo->nr_pages * PAGE_SIZE)].Pde + & PAGE_MASK) + + PT_IDX(XenStartInfo->nr_pages * PAGE_SIZE) * sizeof(PTE); + MmuReq.val = XenStartInfo->shared_info + | (PA_PRESENT | PA_READWRITE | PA_USER); + if (0 != HYPERVISOR_mmu_update(&MmuReq, 1, NULL)) + { + HYPERVISOR_console_io(CONSOLEIO_write, sizeof(ErrMsg), ErrMsg); + HYPERVISOR_shutdown(); + } +} + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xenmem.c ___________________________________________________________________ Name: svn:eol-style + native _____
Modified: branches/xen/reactos/config --- branches/xen/reactos/config 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/config 2005-03-30 22:04:56 UTC (rev 14385) @@ -24,7 +24,7 @@
# # Whether to compile for debugging # -DBG := 0 +DBG := 1
# # Whether to compile a multiprocessor or single processor version @@ -36,3 +36,7 @@ # #NDISVERSION=NDIS50
+# +# Whether to compile for Xen, and, if so, which version +# +XEN := 3 _____
Deleted: branches/xen/reactos/include/xen3/private/page.h --- branches/xen/reactos/include/xen3/private/page.h 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/include/xen3/private/page.h 2005-03-30 22:04:56 UTC (rev 14385) @@ -1,12 +0,0 @@
-#ifndef XEN_PAGE_H_INCLUDED -#define XEN_PAGE_H_INCLUDED - -#include <ddk/winddk.h> - -#define PAGE_MASK (~(PAGE_SIZE-1)) - -#define pgd_val(x) ((x).pgd) - -#endif /* XEN_PAGE_H_INCLUDED */ - -/* EOF */ _____
Deleted: branches/xen/reactos/include/xen3/private/pgtable.h --- branches/xen/reactos/include/xen3/private/pgtable.h 2005-03-30 20:19:47 UTC (rev 14384) +++ branches/xen/reactos/include/xen3/private/pgtable.h 2005-03-30 22:04:56 UTC (rev 14385) @@ -1,25 +0,0 @@
-#ifndef XEN_PGTABLE_H_INCLUDED -#define XEN_PGTABLE_H_INCLUDED - -#define PGDIR_SHIFT 22 -#define PTRS_PER_PGD 1024 -#define PTRS_PER_PTE 1024 - -/* - * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] - * - * this macro returns the index of the entry in the pgd page which would - * control the given virtual address - */ -#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) - -/* - * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] - * - * this macro returns the index of the entry in the pte page which would - * control the given virtual address - */ -#define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) - -#endif /* XEN_PGTABLE_H_INCLUDED */