Author: tkreuzer
Date: Fri Aug 26 20:00:17 2011
New Revision: 53459

URL: http://svn.reactos.org/svn/reactos?rev=53459&view=rev
Log:
[FREELDR]
- fix a bug in x86 PnpBiosGetDeviceNodeCount
- enable pxe for amd64 (not yet implemented though)
- store boot drive and boot partition in shared memory isnetad of relying on a 
register, which seems to be erased on switch to long mode
64 bit freeldr is back on track!

Modified:
    trunk/reactos/boot/freeldr/freeldr/arch/amd64/entry.S
    trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S
    trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S
    trunk/reactos/boot/freeldr/freeldr/fs/fs.c
    trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h

Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/entry.S
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/amd64/entry.S?rev=53459&r1=53458&r2=53459&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/entry.S [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/entry.S [iso-8859-1] Fri Aug 
26 20:00:17 2011
@@ -31,9 +31,10 @@
 FrldrStartup:
 
     /* Store BootDrive and BootPartition */
-    mov byte ptr [FrldrBootDrive], dl
+    mov al, byte ptr [BSS_BootDrive]
+    mov byte ptr [FrldrBootDrive], al
     xor eax, eax
-    mov al, dh
+    mov al, byte ptr [BSS_BootPartition]
     mov dword ptr [FrldrBootPartition], eax
 
     /* Patch long jump with real mode entry point */

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S?rev=53459&r1=53458&r2=53459&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S [iso-8859-1] 
Fri Aug 26 20:00:17 2011
@@ -120,7 +120,7 @@
        mov esi, [ebp + 12]
        mov ax, [BSS_PnpNodeCount]
        movzx ecx, ax
-       mov [esi], eax
+       mov [esi], ecx
 
        pop es
        popa
@@ -140,7 +140,6 @@
  */
 PUBLIC _PnpBiosGetDeviceNode
 _PnpBiosGetDeviceNode:
-       .code32
 
        push ebp
        mov ebp, esp

Modified: trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S?rev=53459&r1=53458&r2=53459&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/realmode/amd64.S [iso-8859-1] Fri 
Aug 26 20:00:17 2011
@@ -24,6 +24,10 @@
        mov fs, ax
        mov     gs, ax
        mov ss, ax
+
+    /* Save the boot drive and partition */
+    mov byte ptr ds:[BSS_BootDrive], dl
+    mov byte ptr ds:[BSS_BootPartition], dh
 
        /* Setup a real mode stack */
     mov sp, word ptr ds:[stack16]
@@ -118,6 +122,7 @@
 
 CheckFor64BitSupport:
        /* Check if CPU supports CPUID */
+       pushad
        pushfd
        pop eax
        mov ebx, eax
@@ -131,6 +136,7 @@
 
     mov si, offset .Msg_NoCpuidSupport
        call writestr
+    popad
     xor al, al
     ret
 
@@ -147,6 +153,7 @@
 
     mov si, offset .Msg_NoPAE
        call writestr
+    popad
     xor al, al
     ret
 
@@ -163,6 +170,7 @@
 
     mov si, offset .Msg_NoLongMode
        call writestr
+    popad
     xor al, al
     ret
 
@@ -170,6 +178,7 @@
     .ascii "Long mode is not supported.", CR, LF, NUL
 
 .Success:
+    popad
     xor al, al
     inc al
     ret
@@ -291,8 +300,8 @@
        mov cr4, eax
 
     /* Point cr3 at the PML4 */
-       mov edx, PML4_ADDRESS
-       mov cr3, edx
+       mov eax, PML4_ADDRESS
+       mov cr3, eax
 
     /* Enable long mode */
        mov ecx, MSR_EFER
@@ -302,9 +311,9 @@
 
     /* Activate long mode by enabling paging and protection simultaneously,
        skipping protected mode entirely */
-       mov ebx, cr0
-       or ebx, HEX(80000001)
-       mov cr0, ebx
+       mov eax, cr0
+       or eax, HEX(80000001)
+       mov cr0, eax
 
     /* Clear prefetch queue & correct CS */
     ljmp16 LMODE_CS, InLongMode

Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fs.c?rev=53459&r1=53458&r2=53459&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/fs/fs.c [iso-8859-1] Fri Aug 26 20:00:17 
2011
@@ -339,7 +339,7 @@
                 if (!FileData[DeviceId].FileFuncTable)
                     FileData[DeviceId].FileFuncTable = Ext2Mount(DeviceId);
 #endif
-#ifdef _M_IX86
+#if defined(_M_IX86) || defined(_M_AMD64)
                 if (!FileData[DeviceId].FileFuncTable)
                     FileData[DeviceId].FileFuncTable = PxeMount(DeviceId);
 #endif

Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h?rev=53459&r1=53458&r2=53459&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] 
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] 
Fri Aug 26 20:00:17 2011
@@ -56,6 +56,8 @@
 #define BSS_PnpNodeCount         (BSS_START + 96)
 #define BSS_PnpNodeNumber        (BSS_START + 100)
 #define BSS_PnpResult            (BSS_START + 104)
+#define BSS_BootDrive            (BSS_START + 108) // 1 byte
+#define BSS_BootPartition        (BSS_START + 109) // 1 byte
 
 
 /* Realmode function IDs */


Reply via email to