Make transfer of control to kernel work on Xbox

svn path=/trunk/; revision=11787
This commit is contained in:
Gé van Geldorp 2004-11-23 11:28:02 +00:00
parent 6de4a5c738
commit 0b66faaabd
10 changed files with 42 additions and 125 deletions

View file

@ -1,4 +1,4 @@
/* $Id: machpc.c,v 1.5 2004/11/14 22:04:38 gvg Exp $
/* $Id: machpc.c,v 1.6 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -46,6 +46,7 @@ PcMachInit(VOID)
MachVtbl.VideoSetPaletteColor = PcVideoSetPaletteColor;
MachVtbl.VideoGetPaletteColor = PcVideoGetPaletteColor;
MachVtbl.VideoSync = PcVideoSync;
MachVtbl.VideoPrepareForReactOS = PcVideoPrepareForReactOS;
MachVtbl.GetMemoryMap = PcMemGetMemoryMap;
MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry;

View file

@ -1,4 +1,4 @@
/* $Id: machpc.h,v 1.5 2004/11/14 22:04:38 gvg Exp $
/* $Id: machpc.h,v 1.6 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -44,6 +44,7 @@ BOOL PcVideoIsPaletteFixed(VOID);
VOID PcVideoSetPaletteColor(U8 Color, U8 Red, U8 Green, U8 Blue);
VOID PcVideoGetPaletteColor(U8 Color, U8* Red, U8* Green, U8* Blue);
VOID PcVideoSync(VOID);
VOID PcVideoPrepareForReactOS(VOID);
U32 PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);

View file

@ -1,4 +1,4 @@
/* $Id: machxbox.c,v 1.5 2004/11/14 22:04:38 gvg Exp $
/* $Id: machxbox.c,v 1.6 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -44,6 +44,7 @@ XboxMachInit(VOID)
MachVtbl.VideoSetPaletteColor = XboxVideoSetPaletteColor;
MachVtbl.VideoGetPaletteColor = XboxVideoGetPaletteColor;
MachVtbl.VideoSync = XboxVideoSync;
MachVtbl.VideoPrepareForReactOS = XboxVideoPrepareForReactOS;
MachVtbl.GetMemoryMap = XboxMemGetMemoryMap;
MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors;
MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;

View file

@ -1,4 +1,4 @@
/* $Id: machxbox.h,v 1.5 2004/11/14 22:04:38 gvg Exp $
/* $Id: machxbox.h,v 1.6 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -45,6 +45,7 @@ BOOL XboxVideoIsPaletteFixed(VOID);
VOID XboxVideoSetPaletteColor(U8 Color, U8 Red, U8 Green, U8 Blue);
VOID XboxVideoGetPaletteColor(U8 Color, U8* Red, U8* Green, U8* Blue);
VOID XboxVideoSync(VOID);
VOID XboxVideoPrepareForReactOS(VOID);
VOID XboxMemInit(VOID);
PVOID XboxMemReserveMemory(U32 MbToReserve);

View file

@ -25,117 +25,35 @@
#include <multiboot.h>
/*
* Here we assume the kernel is loaded at 1mb
* This boots the kernel
* Here we assume the kernel is loaded at 1mb
* This boots the kernel
*/
.code32
EXTERN(_boot_reactos)
call switch_to_real
.code16
/* Save cursor position */
movw $3,%ax //! Reset video mode
int $0x10
movb $10,%bl
movb $12,%ah
int $0x10
movw $0x1112,%ax // Use 8x8 font
xorb %bl,%bl
int $0x10
movw $0x1200,%ax // Use alternate print screen
movb $0x20,%bl
int $0x10
movb $1,%ah // Define cursor (scan lines 6 to 7)
movw $0x0607,%cx
int $0x10
movb $1,%ah
movw $0x600,%cx
int $0x10
movb $6,%ah // Scroll active page up
movb $0x32,%al // Clear 25 lines
movw $0,%cx // Upper left of scroll
movw $0x314F,%dx // Lower right of scroll
movb $(1*0x00+0),%bh // Use normal attribute on blanked line
int $0x10 // Video-IO
movw $0,%dx
movb $0,%dh
movb $2,%ah
movb $0,%bh
int $0x10
movw $0,%dx
movb $0,%dh
movb $2,%ah
movb $0,%bh
int $0x10
call _MachVideoPrepareForReactOS
call _multi_boot
// Should never get here
cli
bootloop:
hlt
jmp bootloop
/*
* After you have setup the _mb_header and _mb_info structures
* then call this routine to transfer control to the kernel.
* This routine must be entered in 16-bit mode.
*/
.code16
EXTERN(_multi_boot)
cli
/*
* Setup various variables
*/
movw %ds,%bx
movzwl %bx,%eax
shll $4,%eax
addl %eax,kernel_gdtbase
/*
* Load the absolute address of the multiboot information structure
*/
movl $_mb_info,%ebx
/*
* load gdt
*/
lgdt kernel_gdtptr
/*
* Enter pmode and clear prefetch queue
*/
movl %cr0,%eax
orl $0x10001,%eax
movl %eax,%cr0
jmp next
next:
/*
* NOTE: This must be position independant (no references to
* non absolute variables)
*/
/*
* Initalize segment registers
*/
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%ss
movw %ax,%es
movw %ax,%fs
movw %ax,%gs
/*
* Initalize eflags
*/
@ -155,33 +73,6 @@ next:
pushl _mb_entry_addr
lretl
//ljmpl $KERNEL_CS,$(0x0200000+0x1000)
//ljmpl $KERNEL_CS,(_mb_entry_addr)
//ljmpl $KERNEL_CS,$(KERNEL_BASE+0x1000)
.p2align 2 /* force 4-byte alignment */
kernel_gdt:
.word 0 // Zero descriptor
.word 0
.word 0
.word 0
.word 0xffff // Kernel code descriptor
.word 0x0000 //
.word 0x9a00 // base 0h limit 4gb
.word 0x00cf
.word 0xffff // Kernel data descriptor
.word 0x0000 //
.word 0x9200 // base 0h limit 4gb
.word 0x00cf
kernel_gdtptr:
.word (3*8)-1 /* Limit */
kernel_gdtbase:
.long kernel_gdt /* Base Address */
EXTERN(_mb_header)
_mb_magic:

View file

@ -1,4 +1,4 @@
/* $Id: pcvideo.c,v 1.1 2004/11/14 22:04:38 gvg Exp $
/* $Id: pcvideo.c,v 1.2 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -1106,4 +1106,11 @@ PcVideoSync(VOID)
}
}
VOID
PcVideoPrepareForReactOS(VOID)
{
PcVideoSetMode80x50_80x43();
PcVideoHideShowTextCursor(FALSE);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: xboxvideo.c,v 1.3 2004/11/14 22:04:38 gvg Exp $
/* $Id: xboxvideo.c,v 1.4 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -35,7 +35,7 @@ static U32 Delta;
#define CHAR_WIDTH 8
#define CHAR_HEIGHT 16
#define TOP_BOTTOM_LINES 40
#define TOP_BOTTOM_LINES 0
#define FB_SIZE_MB 4
@ -209,4 +209,10 @@ XboxVideoSync()
/* Not supported */
}
VOID
XboxVideoPrepareForReactOS(VOID)
{
XboxVideoClearScreenColor(MAKE_COLOR(0, 0, 0), TRUE);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: machine.h,v 1.5 2004/11/14 22:04:39 gvg Exp $
/* $Id: machine.h,v 1.6 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -52,6 +52,7 @@ typedef struct tagMACHVTBL
VOID (*VideoSetPaletteColor)(U8 Color, U8 Red, U8 Green, U8 Blue);
VOID (*VideoGetPaletteColor)(U8 Color, U8* Red, U8* Green, U8* Blue);
VOID (*VideoSync)(VOID);
VOID (*VideoPrepareForReactOS)(VOID);
U32 (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, U32 MaxMemoryMapSize);
@ -82,6 +83,7 @@ extern MACHVTBL MachVtbl;
#define MachVideoSetPaletteColor(Col, R, G, B) MachVtbl.VideoSetPaletteColor((Col), (R), (G), (B))
#define MachVideoGetPaletteColor(Col, R, G, B) MachVtbl.VideoGetPaletteColor((Col), (R), (G), (B))
#define MachVideoSync() MachVtbl.VideoSync()
#define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS()
#define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size))
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
#define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))

View file

@ -1,4 +1,4 @@
/* $Id: machine.c,v 1.5 2004/11/14 22:04:38 gvg Exp $
/* $Id: machine.c,v 1.6 2004/11/23 11:28:02 gvg Exp $
*
* FreeLoader
*
@ -35,6 +35,7 @@
#undef MachVideoSetPaletteColor
#undef MachVideoGetPaletteColor
#undef MachVideoSync
#undef MachVideoPrepareForReactOS
#undef MachGetMemoryMap
#undef MachDiskReadLogicalSectors
#undef MachDiskGetPartitionEntry
@ -131,7 +132,13 @@ MachVideoGetPaletteColor(U8 Color, U8 *Red, U8 *Green, U8 *Blue)
VOID
MachVideoSync(VOID)
{
return MachVtbl.VideoSync();
MachVtbl.VideoSync();
}
VOID
MachVideoPrepareForReactOS(VOID)
{
MachVtbl.VideoPrepareForReactOS();
}
U32

View file

@ -686,7 +686,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
rosPartition = 0;
while (1)
{
if (!DiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
if (!MachDiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
{
BootPartition = 0;
break;