Author: tkreuzer
Date: Tue Apr 13 00:28:22 2010
New Revision: 46856
URL:
http://svn.reactos.org/svn/reactos?rev=46856&view=rev
Log:
[FREELDR]
- Don't prefix amd64 symbol names with underscores
- Cleanup unused amd64 functions
- Fix amd64 GDT entries
- Fix amd64 APIC_BASE
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S
trunk/reactos/boot/freeldr/freeldr/arch/amd64/boot.S
trunk/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S
trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S
trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S
trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S
trunk/reactos/boot/freeldr/freeldr/arch/amd64/int386.S
trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c
trunk/reactos/boot/freeldr/freeldr/arch/amd64/mb.S
trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h
trunk/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/arch.S [iso-8859-1] Tue Apr 13 00:28:22
2010
@@ -21,22 +21,22 @@
mov ss, ax
/* checkPoint Charlie - where it all began... */
- mov si, offset _CheckPoint0
+ mov si, offset CheckPoint0
call writestr
-
+
/* Setup a real mode stack */
mov sp, stack16
/* Zero BootDrive and BootPartition */
xor eax, eax
- mov _BootDrive, eax
- mov _BootPartition, eax
+ mov BootDrive, eax
+ mov BootPartition, eax
/* Store the boot drive */
- mov _BootDrive, dl
+ mov BootDrive, dl
/* Store the boot partition */
- mov _BootPartition, dh
+ mov BootPartition, dh
/* Load the GDT */
lgdt gdtptr
@@ -46,13 +46,13 @@
call x86_16_EnableA20
/* checkPoint Charlie - where it all began... */
- mov si, offset _CheckPoint1
+ mov si, offset CheckPoint1
call writestr
call x86_16_BuildPageTables
/* checkPoint Charlie - where it all began... */
- mov si, offset _CheckPoint2
+ mov si, offset CheckPoint2
call writestr
/* Check if CPU supports CPUID */
@@ -89,26 +89,26 @@
/* X64 Processor */
/* checkPoint Charlie - where it all began... */
- mov si, offset _CheckPoint3
+ mov si, offset CheckPoint3
call writestr
- jmp _switch64
+ jmp switch64
NO_X64_SUPPORT_DETECTED:
- mov si, offset _NotAnX64Processor // Loading message
+ mov si, offset NotAnX64Processor // Loading message
call writestr
- jmp _fail
+ jmp fail
NO_CPUID_SUPPORT_DETECTED:
- mov si, offset _NoCPUIDSupport // Loading message
- call writestr
-
-_fail:
- jmp _fail
+ mov si, offset NoCPUIDSupport // Loading message
+ call writestr
+
+fail:
+ jmp fail
nop
nop
-_switch64:
+switch64:
call x86_16_SwitchToLong
.code64
@@ -119,7 +119,7 @@
/* GO! */
xor rcx, rcx
- call _BootMain
+ call BootMain
/* Checkpoint */
// mov ax, LMODE_DS
@@ -174,14 +174,14 @@
push es
/* Get segment of pml4 */
- mov eax, offset _pml4_startup
+ mov eax, offset pml4_startup
shr eax, 4
mov es, ax
cld
xor di, di
/* One entry in the PML4 pointing to PDP */
- mov eax, offset _pdp_startup
+ mov eax, offset pdp_startup
or eax, 0x00f
stosd
/* clear rest */
@@ -190,7 +190,7 @@
rep stosd
/* One entry in the PDP pointing to PD */
- mov eax, offset _pd_startup
+ mov eax, offset pd_startup
or eax, 0x00f
stosd
/* clear rest */
@@ -268,7 +268,7 @@
mov eax, 0x00a0 // Set PAE and PGE: 10100000b
mov cr4, eax
- mov edx, offset _pml4_startup // Point cr3 at PML4
+ mov edx, offset pml4_startup // Point cr3 at PML4
mov cr3, edx
mov ecx, 0xC0000080 // Specify EFER MSR
@@ -405,42 +405,42 @@
.long gdt /* Base Address */
-.global _BootDrive
-_BootDrive:
+.global BootDrive
+BootDrive:
.long 0
-.global _BootPartition
-_BootPartition:
+.global BootPartition
+BootPartition:
.long 0
-.global _NotAnX64Processor
-_NotAnX64Processor:
+.global NotAnX64Processor
+NotAnX64Processor:
.ascii "FreeLoader: No x64-compatible CPU detected! Exiting..."
.byte 0x0d, 0x0a, 0
-.global _NoCPUIDSupport
-_NoCPUIDSupport:
+.global NoCPUIDSupport
+NoCPUIDSupport:
.ascii "FreeLoader: No CPUID instruction support detected! Exiting..."
.byte 0x0d, 0x0a, 0
/////////////////////////// Checkpoint messages ///////////////////////////////
-.global _CheckPoint0
-_CheckPoint0:
+.global CheckPoint0
+CheckPoint0:
.ascii "Starting FreeLoader..."
.byte 0x0d, 0x0a, 0
-.global _CheckPoint1
-_CheckPoint1:
+.global CheckPoint1
+CheckPoint1:
.ascii "FreeLoader[16-bit]: building page tables..."
.byte 0x0d, 0x0a, 0
-.global _CheckPoint2
-_CheckPoint2:
+.global CheckPoint2
+CheckPoint2:
.ascii "FreeLoader[16-bit]: checking CPU for x64 long mode..."
.byte 0x0d, 0x0a, 0
-.global _CheckPoint3
-_CheckPoint3:
+.global CheckPoint3
+CheckPoint3:
.ascii "FreeLoader: Switching to x64 long mode..."
.byte 0x0d, 0x0a, 0
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/boot.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/boot.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/boot.S [iso-8859-1] Tue Apr 13 00:28:22
2010
@@ -24,14 +24,14 @@
#include <arch.h>
-EXTERN(_ChainLoadBiosBootSectorCode)
+EXTERN(ChainLoadBiosBootSectorCode)
.code64
call x86_64_SwitchToReal
.code16
/* Set the boot drive */
- mov dl, _BootDrive
+ mov dl, BootDrive
/* Load segment registers */
cli
@@ -46,7 +46,7 @@
// ljmpl $0x0000,$0x7C00
jmp 0x7c00:0x0000
-EXTERN(_SoftReboot)
+EXTERN(SoftReboot)
.code64
call x86_64_SwitchToReal
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/drvmap.S [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -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: trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386cpu.S [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -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: trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386pnp.S [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -35,7 +35,7 @@
_pnp_bios_data_segment:
.word 0
-EXTERN(_PnpBiosSupported)
+EXTERN(PnpBiosSupported)
.code64
push rdi
@@ -113,7 +113,7 @@
_pnp_node_count:
.word 0
-EXTERN(_PnpBiosGetDeviceNodeCount)
+EXTERN(PnpBiosGetDeviceNodeCount)
.code64
push rbp
@@ -182,7 +182,7 @@
_pnp_node_number:
.byte 0
-EXTERN(_PnpBiosGetDeviceNode)
+EXTERN(PnpBiosGetDeviceNode)
.code64
push rbp
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/i386trap.S [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -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
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/int386.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/int386.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/int386.S [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -63,7 +63,7 @@
/*
* int Int386(int ivec, REGS* in, REGS* out);
*/
-EXTERN(_Int386)
+EXTERN(Int386)
.code64
/* Get the function parameters */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/loader.c [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -39,33 +39,6 @@
/* Already done */
}
-void
-DumpLoaderBlock()
-{
- DbgPrint("LoaderBlock @ %p.\n", &LoaderBlock);
- DbgPrint("Flags = 0x%x.\n", LoaderBlock.Flags);
- DbgPrint("MemLower = 0x%p.\n", (PVOID)LoaderBlock.MemLower);
- DbgPrint("MemHigher = 0x%p.\n", (PVOID)LoaderBlock.MemHigher);
- DbgPrint("BootDevice = 0x%x.\n", LoaderBlock.BootDevice);
- DbgPrint("CommandLine = %s.\n", LoaderBlock.CommandLine);
- DbgPrint("ModsCount = 0x%x.\n", LoaderBlock.ModsCount);
- DbgPrint("ModsAddr = 0x%p.\n", LoaderBlock.ModsAddr);
- DbgPrint("Syms = 0x%s.\n", LoaderBlock.Syms);
- DbgPrint("MmapLength = 0x%x.\n", LoaderBlock.MmapLength);
- DbgPrint("MmapAddr = 0x%p.\n", (PVOID)LoaderBlock.MmapAddr);
- DbgPrint("RdLength = 0x%x.\n", LoaderBlock.RdLength);
- DbgPrint("RdAddr = 0x%p.\n", (PVOID)LoaderBlock.RdAddr);
- DbgPrint("DrivesCount = 0x%x.\n", LoaderBlock.DrivesCount);
- DbgPrint("DrivesAddr = 0x%p.\n", (PVOID)LoaderBlock.DrivesAddr);
- DbgPrint("ConfigTable = 0x%x.\n", LoaderBlock.ConfigTable);
- DbgPrint("BootLoaderName = 0x%x.\n", LoaderBlock.BootLoaderName);
- DbgPrint("PageDirectoryStart = 0x%p.\n",
(PVOID)LoaderBlock.PageDirectoryStart);
- DbgPrint("PageDirectoryEnd = 0x%p.\n", (PVOID)LoaderBlock.PageDirectoryEnd);
- DbgPrint("KernelBase = 0x%p.\n", (PVOID)LoaderBlock.KernelBase);
- DbgPrint("ArchExtra = 0x%p.\n", (PVOID)LoaderBlock.ArchExtra);
-
-}
-
/*++
* FrLdrStartup
* INTERNAL
@@ -86,222 +59,7 @@
NTAPI
FrLdrStartup(ULONG Magic)
{
- /* Disable Interrupts */
- _disable();
-
- /* Re-initalize EFLAGS */
- __writeeflags(0);
-
- /* Initialize the page directory */
- FrLdrSetupPageDirectory();
-
- /* Set the new PML4 */
- __writecr3((ULONGLONG)pPML4);
-
- FrLdrSetupGdtIdt();
-
- LoaderBlock.FrLdrDbgPrint = DbgPrint;
-
-// DumpLoaderBlock();
-
- DbgPrint("Jumping to kernel @ %p.\n", KernelEntryPoint);
-
- /* Jump to Kernel */
- (*KernelEntryPoint)(Magic, &LoaderBlock);
-
+ DbgPrint("ReactOS loader is unsupported! Halting.\n", KernelEntryPoint);
+ for(;;);
}
-PPAGE_DIRECTORY_AMD64
-FrLdrGetOrCreatePageDir(PPAGE_DIRECTORY_AMD64 pDir, ULONG Index)
-{
- PPAGE_DIRECTORY_AMD64 pSubDir;
-
- if (!pDir)
- return NULL;
-
- if (!pDir->Pde[Index].Valid)
- {
- pSubDir = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
- if (!pSubDir)
- return NULL;
- RtlZeroMemory(pSubDir, PAGE_SIZE);
- pDir->Pde[Index].PageFrameNumber = PtrToPfn(pSubDir);
- pDir->Pde[Index].Valid = 1;
- pDir->Pde[Index].Write = 1;
- }
- else
- {
- pSubDir = (PPAGE_DIRECTORY_AMD64)((ULONGLONG)(pDir->Pde[Index].PageFrameNumber) *
PAGE_SIZE);
- }
- return pSubDir;
-}
-
-BOOLEAN
-FrLdrMapSinglePage(ULONGLONG VirtualAddress, ULONGLONG PhysicalAddress)
-{
- PPAGE_DIRECTORY_AMD64 pDir3, pDir2, pDir1;
- ULONG Index;
-
- pDir3 = FrLdrGetOrCreatePageDir(pPML4, VAtoPXI(VirtualAddress));
- pDir2 = FrLdrGetOrCreatePageDir(pDir3, VAtoPPI(VirtualAddress));
- pDir1 = FrLdrGetOrCreatePageDir(pDir2, VAtoPDI(VirtualAddress));
-
- if (!pDir1)
- return FALSE;
-
- Index = VAtoPTI(VirtualAddress);
- if (pDir1->Pde[Index].Valid)
- {
- return FALSE;
- }
-
- pDir1->Pde[Index].Valid = 1;
- pDir1->Pde[Index].Write = 1;
- pDir1->Pde[Index].PageFrameNumber = PhysicalAddress / PAGE_SIZE;
-
- return TRUE;
-}
-
-ULONG
-FrLdrMapRangeOfPages(ULONGLONG VirtualAddress, ULONGLONG PhysicalAddress, ULONG cPages)
-{
- ULONG i;
-
- for (i = 0; i < cPages; i++)
- {
- if (!FrLdrMapSinglePage(VirtualAddress, PhysicalAddress))
- {
- return i;
- }
- VirtualAddress += PAGE_SIZE;
- PhysicalAddress += PAGE_SIZE;
- }
- return i;
-}
-
-
-/*++
- * FrLdrSetupPageDirectory
- * INTERNAL
- *
- * Sets up the ReactOS Startup Page Directory.
- *
- * Params:
- * None.
- *
- * Returns:
- * None.
- *--*/
-VOID
-FASTCALL
-FrLdrSetupPageDirectory(VOID)
-{
- ULONG KernelPages;
- PVOID UserSharedData;
-
- /* Allocate a Page for the PML4 */
- pPML4 = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
-
- ASSERT(pPML4);
-
- /* The page tables are located at 0xfffff68000000000
- * We create a recursive self mapping through all 4 levels at
- * virtual address 0xfffff6fb7dbedf68 */
- pPML4->Pde[VAtoPXI(PXE_BASE)].Valid = 1;
- pPML4->Pde[VAtoPXI(PXE_BASE)].Write = 1;
- pPML4->Pde[VAtoPXI(PXE_BASE)].PageFrameNumber = PtrToPfn(pPML4);
-
- /* Setup low memory pages */
- if (FrLdrMapRangeOfPages(0, 0, 1024) < 1024)
- {
- DbgPrint("Could not map low memory pages.\n");
- }
-
- /* Setup kernel pages */
- KernelPages = (ROUND_TO_PAGES(NextModuleBase - KERNEL_BASE_PHYS) / PAGE_SIZE);
- if (FrLdrMapRangeOfPages(KernelBase, KERNEL_BASE_PHYS, KernelPages) != KernelPages)
- {
- DbgPrint("Could not map %d kernel pages.\n", KernelPages);
- }
-
- /* Setup a page for the idt */
- pIdt = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
- IdtBase = KernelBase + KernelPages * PAGE_SIZE;
- if (!FrLdrMapSinglePage(IdtBase, (ULONGLONG)pIdt))
- {
- DbgPrint("Could not map idt page.\n", KernelPages);
- }
-
- /* Setup a page for the gdt & tss */
- pGdt = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
- GdtBase = IdtBase + PAGE_SIZE;
- TssBase = GdtBase + 20 * sizeof(ULONG64); // FIXME: don't hardcode
- if (!FrLdrMapSinglePage(GdtBase, (ULONGLONG)pGdt))
- {
- DbgPrint("Could not map gdt page.\n", KernelPages);
- }
-
- /* Setup KUSER_SHARED_DATA page */
- UserSharedData = MmAllocateMemoryWithType(PAGE_SIZE, LoaderSpecialMemory);
- if (!FrLdrMapSinglePage(KI_USER_SHARED_DATA, (ULONG64)UserSharedData))
- {
- DbgPrint("Could not map KUSER_SHARED_DATA page.\n", KernelPages);
- }
-
- /* Map APIC page */
- if (!FrLdrMapSinglePage(APIC_BASE, APIC_PHYS_BASE))
- {
- DbgPrint("Could not map APIC page.\n");
- }
-
-}
-
-VOID
-FrLdrSetupGdtIdt()
-{
- PKGDTENTRY64 Entry;
- KDESCRIPTOR Desc;
-
- RtlZeroMemory(pGdt, PAGE_SIZE);
-
- /* Setup KGDT_64_R0_CODE */
- Entry = KiGetGdtEntry(pGdt, KGDT_64_R0_CODE);
- *(PULONG64)Entry = 0x00209b0000000000ULL;
-
- /* Setup KGDT_64_R0_SS */
- Entry = KiGetGdtEntry(pGdt, KGDT_64_R0_SS);
- *(PULONG64)Entry = 0x00cf93000000ffffULL;
-
- /* Setup KGDT_64_DATA */
- Entry = KiGetGdtEntry(pGdt, KGDT_64_DATA);
- *(PULONG64)Entry = 0x00cff3000000ffffULL;
-
- /* Setup KGDT_64_R3_CODE */
- Entry = KiGetGdtEntry(pGdt, KGDT_64_R3_CODE);
- *(PULONG64)Entry = 0x0020fb0000000000ULL;
-
- /* Setup KGDT_32_R3_TEB */
- Entry = KiGetGdtEntry(pGdt, KGDT_32_R3_TEB);
- *(PULONG64)Entry = 0xff40f3fd50003c00ULL;
-
- /* Setup TSS entry */
- Entry = KiGetGdtEntry(pGdt, KGDT_TSS);
- KiInitGdtEntry(Entry, TssBase, sizeof(KTSS), I386_TSS, 0);
-
- /* Setup the gdt descriptor */
- Desc.Limit = 12 * sizeof(ULONG64) - 1;
- Desc.Base = (PVOID)GdtBase;
-
- /* Set the new Gdt */
- __lgdt(&Desc.Limit);
- DbgPrint("Gdtr.Base = %p\n", Desc.Base);
-
- /* Setup the idt descriptor */
- Desc.Limit = 12 * sizeof(ULONG64) - 1;
- Desc.Base = (PVOID)IdtBase;
-
- /* Set the new Idt */
- __lidt(&Desc.Limit);
- DbgPrint("Idtr.Base = %p\n", Desc.Base);
-
-}
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/mb.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/mb.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/mb.S [iso-8859-1] Tue Apr 13 00:28:22
2010
@@ -29,35 +29,35 @@
* This boots the kernel
*/
.code64
- .globl _PageDirectoryStart
+ .globl PageDirectoryStart
- .globl _pml4_startup
- .globl _pdp_startup
- .globl _pd_startup
+ .globl pml4_startup
+ .globl pdp_startup
+ .globl pd_startup
- .globl _PageDirectoryEnd
+ .globl PageDirectoryEnd
//
// Boot information structure
//
-EXTERN(_reactos_memory_map_descriptor_size)
+EXTERN(reactos_memory_map_descriptor_size)
.long 0
-EXTERN(_reactos_memory_map)
+EXTERN(reactos_memory_map)
.rept (32 * /*sizeof(memory_map_t)*/24)
.byte 0
.endr
.bss
-_PageDirectoryStart:
-_pml4_startup:
+PageDirectoryStart:
+pml4_startup:
.fill 4096, 1, 0
-_pdp_startup:
+pdp_startup:
.fill 4096, 1, 0
-_pd_startup:
+pd_startup:
.fill 4096, 1, 0
-_PageDirectoryEnd:
+PageDirectoryEnd:
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/amd64.h [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -45,7 +45,7 @@
#define HYPERSPACE_BASE 0xfffff70000000000ULL
#define HAL_BASE 0xffffffff80000000ULL
-#define APIC_BASE 0xfffffffffee00000ULL // FIXME
+#define APIC_BASE 0xFFFFFFFFFFFE0000ULL
#define APIC_PHYS_BASE 0xfee00000
Modified: trunk/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/amd64/wlmemory.c [iso-8859-1] Tue Apr 13
00:28:22 2010
@@ -252,28 +252,36 @@
PKGDTENTRY64 Entry;
KDESCRIPTOR GdtDesc;
- /* Setup KGDT_64_R0_CODE */
- Entry = KiGetGdtEntry(GdtBase, KGDT_64_R0_CODE);
+ /* Setup KGDT64_NULL */
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_NULL);
+ *(PULONG64)Entry = 0x0000000000000000ULL;
+
+ /* Setup KGDT64_R0_CODE */
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_R0_CODE);
*(PULONG64)Entry = 0x00209b0000000000ULL;
- /* Setup KGDT_64_R0_SS */
- Entry = KiGetGdtEntry(GdtBase, KGDT_64_R0_SS);
+ /* Setup KGDT64_R0_DATA */
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_R0_DATA);
*(PULONG64)Entry = 0x00cf93000000ffffULL;
- /* Setup KGDT_64_DATA */
- Entry = KiGetGdtEntry(GdtBase, KGDT_64_DATA);
+ /* Setup KGDT64_R3_CMCODE */
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_CMCODE);
+ *(PULONG64)Entry = 0x00cffb000000ffffULL;
+
+ /* Setup KGDT64_R3_DATA */
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_DATA);
*(PULONG64)Entry = 0x00cff3000000ffffULL;
- /* Setup KGDT_64_R3_CODE */
- Entry = KiGetGdtEntry(GdtBase, KGDT_64_R3_CODE);
+ /* Setup KGDT64_R3_CODE */
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_CODE);
*(PULONG64)Entry = 0x0020fb0000000000ULL;
- /* Setup KGDT_32_R3_TEB */
- Entry = KiGetGdtEntry(GdtBase, KGDT_32_R3_TEB);
+ /* Setup KGDT64_R3_CMTEB */
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_R3_CMTEB);
*(PULONG64)Entry = 0xff40f3fd50003c00ULL;
/* Setup TSS entry */
- Entry = KiGetGdtEntry(GdtBase, KGDT_TSS);
+ Entry = KiGetGdtEntry(GdtBase, KGDT64_SYS_TSS);
KiInitGdtEntry(Entry, TssBase, sizeof(KTSS), I386_TSS, 0);
/* Setup GDT descriptor */
@@ -333,15 +341,8 @@
/* LDT is unused */
// __lldt(0);
- /* Load selectors for DS/ES/FS/GS/SS */
- Ke386SetDs(KGDT_64_DATA | RPL_MASK); // 0x2b
- Ke386SetEs(KGDT_64_DATA | RPL_MASK); // 0x2b
- Ke386SetFs(KGDT_32_R3_TEB | RPL_MASK); // 0x53
- Ke386SetGs(KGDT_64_DATA | RPL_MASK); // 0x2b
- Ke386SetSs(KGDT_64_R0_SS); // 0x18
-
/* Load TSR */
- __ltr(KGDT_TSS);
+ __ltr(KGDT64_SYS_TSS);
DPRINTM(DPRINT_WINDOWS, "leave WinLdrSetProcessorContext\n");
}