Build freeldr as elf executable, initial Xen support Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/arch.S Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/archmach.c Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/boot.S Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/drvmap.S Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386cpu.S Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/int386.S Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/linux.S Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/mb.S Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/xencons.c Modified: branches/xen/reactos/boot/freeldr/freeldr/fs/ntfs.c Modified: branches/xen/reactos/boot/freeldr/freeldr/include/rtl.h Modified: branches/xen/reactos/boot/freeldr/freeldr/reactos/reactos.c Added: branches/xen/reactos/include/xen3/ Added: branches/xen/reactos/include/xen3/private/ Added: branches/xen/reactos/include/xen3/private/ctrl_if.h Added: branches/xen/reactos/include/xen3/private/evtchn.h Added: branches/xen/reactos/include/xen3/private/hypervisor.h Added: branches/xen/reactos/include/xen3/private/page.h Added: branches/xen/reactos/include/xen3/private/pgtable.h Added: branches/xen/reactos/include/xen3/public/ Added: branches/xen/reactos/include/xen3/public/COPYING Added: branches/xen/reactos/include/xen3/public/arch-ia64.h Added: branches/xen/reactos/include/xen3/public/arch-x86_32.h Added: branches/xen/reactos/include/xen3/public/arch-x86_64.h Added: branches/xen/reactos/include/xen3/public/dom0_ops.h Added: branches/xen/reactos/include/xen3/public/event_channel.h Added: branches/xen/reactos/include/xen3/public/grant_table.h Added: branches/xen/reactos/include/xen3/public/io/ Added: branches/xen/reactos/include/xen3/public/io/blkif.h Added: branches/xen/reactos/include/xen3/public/io/domain_controller.h Added: branches/xen/reactos/include/xen3/public/io/ioreq.h Added: branches/xen/reactos/include/xen3/public/io/netif.h Added: branches/xen/reactos/include/xen3/public/io/ring.h Added: branches/xen/reactos/include/xen3/public/io/usbif.h Added: branches/xen/reactos/include/xen3/public/physdev.h Added: branches/xen/reactos/include/xen3/public/sched_ctl.h Added: branches/xen/reactos/include/xen3/public/trace.h Added: branches/xen/reactos/include/xen3/public/xen.h Added: branches/xen/reactos/include/xen3/rosxen.h _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/Makefile --- branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/Makefile 2005-03-24 15:53:13 UTC (rev 14302) @@ -21,6 +21,9 @@
include ../rules.mak
+CC = gcc +LD = ld + TARGET = i386 ifeq ($(DEBUG),) # Debugging information on (bigger binary) @@ -95,7 +98,13 @@
COMPILER_DEFINES = -D__$(TARGET)__ $(COMPILER_DEBUG_DEFINES)
-COMPILER_INCLUDES = -I$(SRCDIR)/include -I$(PATH_TO_TOP)/w32api/include -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include +COMPILER_INCLUDES = -I$(SRCDIR)/include \ + -I$(PATH_TO_TOP)/w32api/include \ + -I$(PATH_TO_TOP)/include \ + -I$(PATH_TO_TOP)/ntoskrnl/include \ + -I$(PATH_TO_TOP)/include/xen3 \ + -I$(PATH_TO_TOP)/include/xen3/public \ + -I$(PATH_TO_TOP)/include/xen3/private
CFLAGS = $(COMPILER_OPTIONS) \ $(COMPILER_DEFINES) \ @@ -106,7 +115,7 @@ LFLAGS = $(LINKER_OPTIONS)
ifeq ($(HOST),mingw32-linux) - NASMFLAGS = -f win32 + NASMFLAGS = -f elf else NASMFLAGS = -f elf endif @@ -136,6 +145,7 @@ archmach.o \ machpc.o \ machxbox.o \ + machxen.o \ pccons.o \ pcdisk.o \ pcmem.o \ @@ -148,6 +158,7 @@ xboxmem.o \ xboxrtc.o \ xboxvideo.o \ + xencons.o \ _alloca.o # For Mingw32 builds
ARCH_OBJS = $(addprefix i386/,$(ARCH_I386_OBJS)) @@ -264,13 +275,13 @@
freeldr.sys : $(ALL_OBJS) $(PATH_TO_TOP)/dk/w32/lib/librossym.a @echo freeldr: LINKING $@ - @$(LD) $(LFLAGS) -o freeldr.exe $(F_OBJS) $(PATH_TO_TOP)/dk/w32/lib/librossym.a + @$(LD) $(LFLAGS) -o freeldr.elf $(F_OBJS) $(PATH_TO_TOP)/dk/w32/lib/librossym.a ifeq ($(FULL_MAP),yes) - @$(OBJDUMP) -d -S freeldr.exe > freeldr.map + @$(OBJDUMP) -d -S freeldr.elf > freeldr.map else - @$(NM) --numeric-sort freeldr.exe > freeldr.map + @$(NM) --numeric-sort freeldr.elf > freeldr.map endif - @$(OBJCOPY) -O binary freeldr.exe freeldr.sys + @$(OBJCOPY) -O binary freeldr.elf freeldr.sys
setupldr.sys : $(ALL_OBJS) _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/arch.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/arch.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/arch.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -47,15 +47,15 @@
.code32
/* Store the boot drive */ - movb %dl,(_BootDrive) + movb %dl,(BootDrive)
/* Store the boot partition */ - movb %dh,(_BootPartition) + movb %dh,(BootPartition)
/* GO! */ xorl %eax,%eax pushl %eax - call _BootMain + call BootMain
call switch_to_real .code16 @@ -222,7 +222,7 @@ /* * Enable the A20 address line (to allow access to over 1mb) */ -EXTERN(_EnableA20) +EXTERN(EnableA20) .code32
pushal @@ -247,7 +247,7 @@ /* * Disable the A20 address line */ -EXTERN(_DisableA20) +EXTERN(DisableA20) .code32
pushal @@ -304,12 +304,14 @@ .long INITIAL_BASE + MultibootHeader - FREELDR_BASE /* load_addr */ .long INITIAL_BASE +#ifdef TODO /* load_end_addr */ .long INITIAL_BASE + __bss_start__ - FREELDR_BASE /* bss_end_addr */ .long INITIAL_BASE + __bss_end__ - FREELDR_BASE /* entry_addr */ .long INITIAL_BASE + MultibootEntry - FREELDR_BASE +#endif
MultibootEntry: cli /* Even after setting up the our IDT below we are @@ -331,7 +333,9 @@ /* Copy to low mem */ movl $INITIAL_BASE,%esi movl $FREELDR_BASE,%edi +#ifdef TODO movl $(__bss_end__ - FREELDR_BASE),%ecx +#endif addl $3,%ecx shrl $2,%ecx rep movsl @@ -365,12 +369,12 @@ movl MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax shrl $16,%eax incb %al - movb %al,_BootPartition - movb %ah,_BootDrive + movb %al,BootPartition + movb %ah,BootDrive jmp mb4 mb3: /* No boot device known, assume first partition of first harddisk */ - movb $0x80,_BootDrive - movb $1,_BootPartition + movb $0x80,BootDrive + movb $1,BootPartition mb4:
/* Check for a command line */ @@ -389,7 +393,7 @@
/* GO! */ pushl %eax - call _BootMain + call BootMain
mbfail: call switch_to_real .code16 @@ -462,8 +466,8 @@ .word 0x3ff /* Limit */ .long 0 /* Base Address */
-EXTERN(_BootDrive) +EXTERN(BootDrive) .long 0
-EXTERN(_BootPartition) +EXTERN(BootPartition) .long 0 _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/archmach.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/archmach.c 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/archmach.c 2005-03-24 15:53:13 UTC (rev 14302) @@ -22,6 +22,7 @@
#include "machine.h" #include "machpc.h" #include "machxbox.h" +#include "machxen.h" #include "portio.h" #include "hardware.h" #include "rtl.h" @@ -33,20 +34,28 @@
memset(&MachVtbl, 0, sizeof(MACHVTBL));
- /* Check for Xbox by identifying device at PCI 0:0:0, if it's - * 0x10de/0x02a5 then we're running on an Xbox */ - WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0)); - PciId = READ_PORT_ULONG((ULONG*) 0xcfc); - if (0x02a510de == PciId) + /* First check if we were launched by Xen */ + if (XenActive) { - XboxMachInit(); + XenMachInit(); } else { - PcMachInit(); + /* Check for Xbox by identifying device at PCI 0:0:0, if it's + * 0x10de/0x02a5 then we're running on an Xbox */ + WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0)); + PciId = READ_PORT_ULONG((ULONG*) 0xcfc); + if (0x02a510de == PciId) + { + XboxMachInit(); + } + else + { + PcMachInit(); + } }
- HalpCalibrateStallExecution(); +// HalpCalibrateStallExecution(); }
/* EOF */ _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/boot.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/boot.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/boot.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -24,14 +24,14 @@
#include <arch.h>
-EXTERN(_ChainLoadBiosBootSectorCode) +EXTERN(ChainLoadBiosBootSectorCode) .code32
call switch_to_real .code16
/* Set the boot drive */ - movb (_BootDrive),%dl + movb (BootDrive),%dl
/* Load segment registers */ cli @@ -45,7 +45,7 @@
ljmpl $0x0000,$0x7C00
-EXTERN(_SoftReboot) +EXTERN(SoftReboot) .code32
call switch_to_real _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/drvmap.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/drvmap.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/drvmap.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -24,7 +24,7 @@
#include <arch.h>
-EXTERN(_DriveMapInt13HandlerStart) +EXTERN(DriveMapInt13HandlerStart) Int13Handler:
pushw %bp @@ -82,7 +82,7 @@
/* Call old int 13h handler with new drive number */ .byte 0x9a /* lcall */ -EXTERN(_DriveMapOldInt13HandlerAddress) +EXTERN(DriveMapOldInt13HandlerAddress) .word 0 .word 0
@@ -105,7 +105,7 @@ PassedInDriveNumber: .byte 0
-EXTERN(_DriveMapInt13HandlerMapList) +EXTERN(DriveMapInt13HandlerMapList) Int13HandlerMapCount: .byte 0
@@ -129,4 +129,4 @@ Int13HandlerDriveNew4: .byte 0
-EXTERN(_DriveMapInt13HandlerEnd) +EXTERN(DriveMapInt13HandlerEnd) _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386cpu.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386cpu.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386cpu.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -33,7 +33,7 @@
* 0x00000400: Found 80486 CPU without CPUID support */
-EXTERN(_CpuidSupported) +EXTERN(CpuidSupported) .code32
pushl %ecx /* save ECX */ @@ -80,7 +80,7 @@ * VOID GetCpuid(U32 Level, U32 *eax, U32 *ebx, U32 *ecx, U32 *edx); */
-EXTERN(_GetCpuid) +EXTERN(GetCpuid) .code32
pushl %ebp @@ -123,7 +123,7 @@ * U64 RDTSC(VOID); */
-EXTERN(_RDTSC) +EXTERN(RDTSC) .code32 rdtsc ret _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -35,7 +35,7 @@
_pnp_bios_data_segment: .word 0
-EXTERN(_PnpBiosSupported) +EXTERN(PnpBiosSupported) .code32
pushl %edi @@ -113,7 +113,7 @@ _pnp_node_count: .word 0
-EXTERN(_PnpBiosGetDeviceNodeCount) +EXTERN(PnpBiosGetDeviceNodeCount) .code32
pushl %ebp @@ -182,7 +182,7 @@ _pnp_node_number: .byte 0
-EXTERN(_PnpBiosGetDeviceNode) +EXTERN(PnpBiosGetDeviceNode) .code32
pushl %ebp _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/i386trap.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -273,7 +273,7 @@
SAVE_CPU_REGS
pushl $SCREEN_ATTR - call _MachVideoClearScreen + call MachVideoClearScreen add $4,%esp
movl $i386ExceptionHandlerText,%esi @@ -485,7 +485,7 @@ pushl $SCREEN_ATTR andl $0xff,%eax pushl %eax - call _MachVideoPutChar + call MachVideoPutChar addl $16,%esp
ret @@ -737,7 +737,7 @@
/*********************************************************************** * * DEBUGGING SUPPORT FUNCTIONS
************************************************************************ / -EXTERN(_INSTRUCTION_BREAKPOINT1) +EXTERN(INSTRUCTION_BREAKPOINT1) .code32
pushl %eax @@ -754,7 +754,7 @@
ret
-EXTERN(_MEMORY_READWRITE_BREAKPOINT1) +EXTERN(MEMORY_READWRITE_BREAKPOINT1) .code32
pushl %eax @@ -771,7 +771,7 @@
ret
-EXTERN(_MEMORY_WRITE_BREAKPOINT1) +EXTERN(MEMORY_WRITE_BREAKPOINT1) .code32
pushl %eax @@ -788,7 +788,7 @@
ret
-EXTERN(_INSTRUCTION_BREAKPOINT2) +EXTERN(INSTRUCTION_BREAKPOINT2) .code32
pushl %eax @@ -805,7 +805,7 @@
ret
-EXTERN(_MEMORY_READWRITE_BREAKPOINT2) +EXTERN(MEMORY_READWRITE_BREAKPOINT2) .code32
pushl %eax @@ -822,7 +822,7 @@
ret
-EXTERN(_MEMORY_WRITE_BREAKPOINT2) +EXTERN(MEMORY_WRITE_BREAKPOINT2) .code32
pushl %eax @@ -839,7 +839,7 @@
ret
-EXTERN(_INSTRUCTION_BREAKPOINT3) +EXTERN(INSTRUCTION_BREAKPOINT3) .code32
pushl %eax @@ -856,7 +856,7 @@
ret
-EXTERN(_MEMORY_READWRITE_BREAKPOINT3) +EXTERN(MEMORY_READWRITE_BREAKPOINT3) .code32
pushl %eax @@ -873,7 +873,7 @@
ret
-EXTERN(_MEMORY_WRITE_BREAKPOINT3) +EXTERN(MEMORY_WRITE_BREAKPOINT3) .code32
pushl %eax @@ -890,7 +890,7 @@
ret
-EXTERN(_INSTRUCTION_BREAKPOINT4) +EXTERN(INSTRUCTION_BREAKPOINT4) .code32
pushl %eax @@ -907,7 +907,7 @@
ret
-EXTERN(_MEMORY_READWRITE_BREAKPOINT4) +EXTERN(MEMORY_READWRITE_BREAKPOINT4) .code32
pushl %eax @@ -924,7 +924,7 @@
ret
-EXTERN(_MEMORY_WRITE_BREAKPOINT4) +EXTERN(MEMORY_WRITE_BREAKPOINT4) .code32
pushl %eax _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/int386.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/int386.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/int386.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -62,7 +62,7 @@
/* * int Int386(int ivec, REGS* in, REGS* out); */ -EXTERN(_Int386) +EXTERN(Int386) .code32
/* Get the function parameters */ _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/linux.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/linux.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/linux.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -25,12 +25,12 @@
.code32 -EXTERN(_BootNewLinuxKernel) +EXTERN(BootNewLinuxKernel) call switch_to_real .code16
/* Set the boot drive */ - movb (_BootDrive),%dl + movb (BootDrive),%dl
/* Load segment registers */ cli @@ -49,7 +49,7 @@ /* * VOID BootOldLinuxKernel(ULONG KernelSize); */ -EXTERN(_BootOldLinuxKernel) +EXTERN(BootOldLinuxKernel)
/* First we have to copy the kernel down from 0x100000 to 0x10000 */ /* The reason we can overwrite low memory is because this code */ @@ -66,7 +66,7 @@ .code16
/* Set the boot drive */ - movb (_BootDrive),%dl + movb (BootDrive),%dl
/* Load segment registers */ cli _____
Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c 2005-03-24 15:53:13 UTC (rev 14302) @@ -0,0 +1,296 @@
+/* $Id: machpc.c 12672 2005-01-01 00:42:18Z chorns $ + * + * 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. + * + * Based on code posted by David Becker becker@cs.duke.edu to the + * xen-devel mailing list. + */ + +#include "freeldr.h" +#include "machxen.h" + +#include <rosxen.h> +#include <xen.h> +#include <hypervisor.h> +#include <page.h> +#include <pgtable.h> + +BOOL XenActive = FALSE; +ctrl_front_ring_t XenCtrlIfTxRing; +ctrl_back_ring_t XenCtrlIfRxRing; +int XenCtrlIfEvtchn; + +VOID +XenMachInit(VOID) +{ + /* Setup vtbl */ + MachVtbl.ConsPutChar = XenConsPutChar; + MachVtbl.ConsKbHit = XenConsKbHit; + MachVtbl.ConsGetCh = XenConsGetCh; + MachVtbl.VideoClearScreen = XenVideoClearScreen; + MachVtbl.VideoSetDisplayMode = XenVideoSetDisplayMode; + MachVtbl.VideoGetDisplaySize = XenVideoGetDisplaySize; + MachVtbl.VideoGetBufferSize = XenVideoGetBufferSize; + MachVtbl.VideoSetTextCursorPosition = XenVideoSetTextCursorPosition; + MachVtbl.VideoSetTextCursorPosition = XenVideoSetTextCursorPosition; + MachVtbl.VideoHideShowTextCursor = XenVideoHideShowTextCursor; + MachVtbl.VideoPutChar = XenVideoPutChar; + MachVtbl.VideoCopyOffScreenBufferToVRAM = XenVideoCopyOffScreenBufferToVRAM; + MachVtbl.VideoIsPaletteFixed = XenVideoIsPaletteFixed; + MachVtbl.VideoSetPaletteColor = XenVideoSetPaletteColor; + MachVtbl.VideoGetPaletteColor = XenVideoGetPaletteColor; + MachVtbl.VideoSync = XenVideoSync; + MachVtbl.VideoPrepareForReactOS = XenVideoPrepareForReactOS; + MachVtbl.GetMemoryMap = XenMemGetMemoryMap; + MachVtbl.DiskReadLogicalSectors = XenDiskReadLogicalSectors; + MachVtbl.DiskGetPartitionEntry = XenDiskGetPartitionEntry; + MachVtbl.DiskGetDriveGeometry = XenDiskGetDriveGeometry; + MachVtbl.DiskGetCacheableBlockCount = XenDiskGetCacheableBlockCount; + MachVtbl.RTCGetCurrentDateTime = XenRTCGetCurrentDateTime; + 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 _start() +{ + pgd_t *pgd; + int ptetab_ma; + int idx; + int pte_ma; + mmu_update_t req; + control_if_t *CtrlIf; + + /* + * Grab start_info + */ + /* 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)); + + /* 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 + */ + /* 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)); + + 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)); + + /* Sync up with shared indexes. */ + FRONT_RING_ATTACH(&XenCtrlIfTxRing, &CtrlIf->tx_ring); + BACK_RING_ATTACH(&XenCtrlIfRxRing, &CtrlIf->rx_ring); + + /* Start freeldr */ + XenActive = TRUE; + BootMain(NULL); +} + +#define XEN_UNIMPLEMENTED(routine) \ + printf(routine " unimplemented. Shutting down\n"); \ + HYPERVISOR_shutdown() + +BOOL +XenConsKbHit() + { + XEN_UNIMPLEMENTED("XenConsKbHit"); + return FALSE; + } + +int +XenConsGetCh() + { + XEN_UNIMPLEMENTED("XenConsGetCh"); + return 0; + } + +VOID +XenVideoClearScreen(UCHAR Attr) + { + XEN_UNIMPLEMENTED("XenVideoClearScreen"); + } + +VIDEODISPLAYMODE +XenVideoSetDisplayMode(char *DisplayMode, BOOL Init) + { + XEN_UNIMPLEMENTED("XenVideoSetDisplayMode"); + return VideoTextMode; + } + +VOID +XenVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth) + { + XEN_UNIMPLEMENTED("XenVideoGetDisplaySize"); + } + +ULONG +XenVideoGetBufferSize(VOID) + { + XEN_UNIMPLEMENTED("XenVideoGetBufferSize"); + return 0; + } + +VOID +XenVideoSetTextCursorPosition(ULONG X, ULONG Y) + { + XEN_UNIMPLEMENTED("XenVideoSetTextCursorPosition"); + } + +VOID +XenVideoHideShowTextCursor(BOOL Show) + { + XEN_UNIMPLEMENTED("XenVideoHideShowTextCursor"); + } + +VOID +XenVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y) + { + XEN_UNIMPLEMENTED("XenVideoPutChar"); + } + +VOID +XenVideoCopyOffScreenBufferToVRAM(PVOID Buffer) + { + XEN_UNIMPLEMENTED("XenVideoCopyOffScreenBufferToVRAM"); + } + +BOOL +XenVideoIsPaletteFixed(VOID) + { + XEN_UNIMPLEMENTED("XenVideoIsPaletteFixed"); + return TRUE; + } + +VOID +XenVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue) + { + XEN_UNIMPLEMENTED("XenVideoSetPaletteColor"); + } + +VOID +XenVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue) + { + XEN_UNIMPLEMENTED("XenVideoGetPaletteColor"); + } + +VOID +XenVideoSync(VOID) + { + XEN_UNIMPLEMENTED("XenVideoSync"); + } + +VOID +XenVideoPrepareForReactOS(VOID) + { + 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) + { + XEN_UNIMPLEMENTED("XenDiskReadLogicalSectors"); + return FALSE; + } + +BOOL +XenDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, + PPARTITION_TABLE_ENTRY PartitionTableEntry) + { + XEN_UNIMPLEMENTED("XenDiskGetPartitionEntry"); + return FALSE; + } + +BOOL +XenDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry) + { + XEN_UNIMPLEMENTED("XenDiskGetDriveGeometry"); + return FALSE; + } + +ULONG +XenDiskGetCacheableBlockCount(ULONG DriveNumber) + { + XEN_UNIMPLEMENTED("XenDiskGetCacheableBlockCount"); + return FALSE; + } + +VOID +XenRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, + PULONG Hour, PULONG Minute, PULONG Second) + { + XEN_UNIMPLEMENTED("XenRTCGetCurrentDateTime"); + } + +VOID +XenHwDetect(VOID) + { + 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";" + ".ascii ",PT_MODE_WRITABLE";" + ".byte 0;" + ); + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.c ___________________________________________________________________ Name: svn:eol-style + native _____
Added: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h 2005-03-24 15:53:13 UTC (rev 14302) @@ -0,0 +1,70 @@
+/* + * FreeLoader + * + * Copyright (C) 2003 Eric Kohl + * + * 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. + */ + +#ifndef __I386_MACHXEN_H_ +#define __I386_MACHXEN_H_ + +#ifndef __MEMORY_H +#include "mm.h" +#endif + +#include <rosxen.h> +#include <xen.h> +#include <io/domain_controller.h> + +extern BOOL XenActive; +extern ctrl_front_ring_t XenCtrlIfTxRing; +extern ctrl_back_ring_t XenCtrlIfRxRing; +extern int XenCtrlIfEvtchn; + +VOID XenMachInit(VOID); + +VOID XenConsPutChar(int Ch); +BOOL XenConsKbHit(); +int XenConsGetCh(); + +VOID XenVideoClearScreen(UCHAR Attr); +VIDEODISPLAYMODE XenVideoSetDisplayMode(char *DisplayMode, BOOL Init); +VOID XenVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); +ULONG XenVideoGetBufferSize(VOID); +VOID XenVideoSetTextCursorPosition(ULONG X, ULONG Y); +VOID XenVideoHideShowTextCursor(BOOL Show); +VOID XenVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); +VOID XenVideoCopyOffScreenBufferToVRAM(PVOID Buffer); +BOOL XenVideoIsPaletteFixed(VOID); +VOID XenVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue); +VOID XenVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue); +VOID XenVideoSync(VOID); +VOID XenVideoPrepareForReactOS(VOID); + +ULONG XenMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); + +BOOL XenDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); +BOOL XenDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); +BOOL XenDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); +ULONG XenDiskGetCacheableBlockCount(ULONG DriveNumber); + +VOID XenRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second); + +VOID XenHwDetect(VOID); + +#endif /* __I386_MACHPC_H_ */ + +/* EOF */ Property changes on: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/machxen.h ___________________________________________________________________ Name: svn:eol-style + native _____
Modified: branches/xen/reactos/boot/freeldr/freeldr/arch/i386/mb.S --- branches/xen/reactos/boot/freeldr/freeldr/arch/i386/mb.S 2005-03-24 15:41:06 UTC (rev 14301) +++ branches/xen/reactos/boot/freeldr/freeldr/arch/i386/mb.S 2005-03-24 15:53:13 UTC (rev 14302) @@ -29,75 +29,75 @@
* This boots the kernel */ .code32 - .globl _PageDirectoryStart + .globl PageDirectoryStart
- .globl _startup_pagedirectory - .globl _lowmem_pagetable - .globl _kernel_pagetable - .globl _hyperspace_pagetable - .globl _apic_pagetable - .globl _kpcr_pagetable + .globl startup_pagedirectory + .globl lowmem_pagetable + .globl kernel_pagetable + .globl hyperspace_pagetable + .globl apic_pagetable + .globl kpcr_pagetable
- .globl _startup_pagedirectorytable_pae - .globl _startup_pagedirectory_pae - .globl _lowmem_pagetable_pae - .globl _kernel_pagetable_pae - .globl _hyperspace_pagetable_pae - .globl _apic_pagetable_pae - .globl _kpcr_pagetable_pae + .globl startup_pagedirectorytable_pae + .globl startup_pagedirectory_pae + .globl lowmem_pagetable_pae + .globl kernel_pagetable_pae + .globl hyperspace_pagetable_pae + .globl apic_pagetable_pae + .globl kpcr_pagetable_pae
- .globl _PageDirectoryEnd + .globl PageDirectoryEnd
// // Boot information structure //
-EXTERN(_multiboot_memory_map_descriptor_size) +EXTERN(multiboot_memory_map_descriptor_size) .long 0
-EXTERN(_multiboot_memory_map) +EXTERN(multiboot_memory_map) .rept (32 * /*sizeof(memory_map_t)*/24) .byte 0 .endr
.bss -_PageDirectoryStart: -_startup_pagedirectory: +PageDirectoryStart: +startup_pagedirectory: .fill 4096, 1, 0
-_lowmem_pagetable: +lowmem_pagetable: .fill 4096, 1, 0
-_kernel_pagetable: +kernel_pagetable: .fill 2*4096, 1, 0
-_hyperspace_pagetable: +hyperspace_pagetable: .fill 4096, 1, 0 -_apic_pagetable: +apic_pagetable: .fill 4096, 1, 0
-_kpcr_pagetable: +kpcr_pagetable: .fill 4096, 1, 0
[truncated at 1000 lines; 4635 more skipped]