[BOOTSECTORS]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 26 Dec 2015 16:57:41 +0000 (16:57 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 26 Dec 2015 16:57:41 +0000 (16:57 +0000)
- Use the old fat.S source for compiling the FAT12 boot sector, until FATX.S is completely implemented.
- Fix an assembly error in FATX.S
- In comments I added experimental FAT12/16/32 targets based on Timo's FATX.S.

svn path=/trunk/; revision=70423

reactos/boot/freeldr/bootsect/CMakeLists.txt
reactos/boot/freeldr/bootsect/fatx.S

index df17b90..7356a37 100644 (file)
@@ -3,8 +3,21 @@ if(ARCH STREQUAL "i386" OR ARCH STREQUAL "amd64")
 
     CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 7c00)
     CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.S ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0)
-    CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
+
+    CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
     CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00)
+
+    ## New versions using FATX.S (experimental)
+    # add_definitions(-DFAT12)
+    # CreateBootSectorTarget(fat_new ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat_new.bin 7c00)
+    # remove_definitions(-DFAT12)
+    # add_definitions(-DFAT16)
+    # CreateBootSectorTarget(fat16_new ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat16_new.bin 7c00)
+    # remove_definitions(-DFAT16)
+    # add_definitions(-DFAT32)
+    # CreateBootSectorTarget(fat32_new ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat32_new.bin 7c00)
+    # remove_definitions(-DFAT32)
+
     CreateBootSectorTarget(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.S ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 7000)
     CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 7000)
 
index e51598d..018160b 100644 (file)
@@ -64,7 +64,8 @@ PutCharsOffset        = BootSectorStackTop + 20 /* word */
  ******************************************************************************/
 /* We have 3 bytes at the entry point to jump over the data area */
 start:
-    jmp short main
+    jmp short main // FIXME: When compiling FAT32, assembler will complain
+                   // that the label is too far... Need investigation!
     nop
 
 /* Here starts the BIOS Parameter Block (BPB) data.
@@ -233,8 +234,8 @@ main:
     add eax, dword ptr BP_REL(HiddenSectors)
 
     /* Load sector count into ecx */
-#if FAT32
-    mov ecx, BP_REL(SectorsPerFatBig)
+#ifdef FAT32
+    mov ecx, dword ptr BP_REL(SectorsPerFatBig)
 #else
     movzx ecx, word ptr BP_REL(SectorsPerFat)
 #endif
@@ -350,7 +351,7 @@ main:
     dec dx
     jnz .CheckDirEntry
 
-#if FAT32
+#ifdef FAT32
     /* Check to see if this was the last cluster in the chain */
     cmp eax, HEX(0ffffff8)
     jnb BootFailure
@@ -367,7 +368,7 @@ main:
 .FoundFreeLoader:
 
     /* Load the cluster number of freeldr into eax */
-#if FAT32
+#ifdef FAT32
 #error unsupported
 #else
     movzx eax, word ptr es:[bx + HEX(1A)]
@@ -384,9 +385,9 @@ main:
     call ReadCluster
 
     /* Check if this is the last cluster in the chain */
-#if FAT32
+#if defined(FAT32)
     cmp eax, HEX(0ffffff8)
-#elif FAT12
+#elif defined(FAT12)
     cmp ax, HEX(0ff8)
 #else
     cmp ax, HEX(0fff8)
@@ -453,9 +454,9 @@ ReadCluster:
     /* Save ES */
     push es
 
-#if FAT32
-#error FAT23 not implemented
-#elif FAT12
+#if defined(FAT32)
+#error FAT32 not implemented
+#elif defined(FAT12)
 #error FAT12 not implemented
 #else
     /* DX:AX = AX * 2 (since FAT16 entries are 2 bytes) */