]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/BootSector/bootsect.S
1. Remove .extern from GCC assembly.
[mirror_edk2.git] / DuetPkg / BootSector / bootsect.S
index edf941bcb36175e6d0af0047ea1b1c3191d48411..336c82bcb6f834725f081f8eb9e8ef1b16e17484 100644 (file)
@@ -9,16 +9,28 @@
 #*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
 #*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 #*   \r
-#*    bootsect.asm\r
+#*   bootsect.S\r
 #*  \r
-#*   Abstract:\r
+#*   bootsect.S is built as 16-bit binary file in 512 bytes and patched to disk/partition's \r
+#*   first section - boot sector. \r
+#*\r
+#*   The startup sequence for DUET disk boot sector is:\r
+#*\r
+#*   1, LegacyBios check 0xAA55 signature at boot sectore offset 0x1FE to judget \r
+#*      whether disk/partition is bootable.\r
+#*   2, LegacyBios will load boot sector to 0x7c00 in real mode, pass BPB data and\r
+#*      hand off control to 0x7c00 code.\r
+#*   3, boot sector code simply parse FAT format in boot disk and find EfiLdr binary file \r
+#*      and EfiVar.bin if exists. For first boot, EfiVar.bin does not exist.\r
+#*   4, boot sector load the first sector of EfiLdr binary which is start.com to\r
+#*      0x2000:0x0000 address.\r
+#*   5, boot sector handoff control to 0x2000:0x0000 for start.com binary.\r
 #*\r
 #------------------------------------------------------------------------------\r
 \r
-        #.MODEL small\r
         .stack: \r
         .486p: \r
-        .code\r
+        .code16\r
 \r
 .equ                      FAT_DIRECTORY_ENTRY_SIZE, 0x020\r
 .equ                      FAT_DIRECTORY_ENTRY_SHIFT, 5\r
@@ -31,6 +43,8 @@
 .equ                      LOADER_FILENAME_PART3, 0x020202020    # "____"\r
 \r
         .org 0x0\r
+ASM_GLOBAL _start\r
+_start:\r
 Ia32Jump: \r
   jmp   BootSectorEntryPoint  # JMP inst                  - 3 bytes\r
   nop\r
@@ -63,7 +77,7 @@ BootSectorEntryPoint:
 # ****************************************************************************\r
 # Start Print\r
 # ****************************************************************************\r
-  leaw %cs:StartString, %si\r
+  movw $StartString, %si\r
   call PrintString\r
 \r
 # ****************************************************************************\r
@@ -259,7 +273,7 @@ NotFoundAll:
   jne  FoundEFILDR\r
 BadBootSector: \r
 DiskError: \r
-  leaw %cs:ErrorString, %si\r
+  movw $ErrorString, %si\r
   call PrintString\r
 Halt: \r
   jmp   Halt\r
@@ -273,7 +287,7 @@ ErrorString:
 # LBA Offset for BootSector, need patched by tool for HD boot.\r
 # ****************************************************************************\r
 \r
-  .org 0x01fa   # Comment it for pass build. Should optimise code size. \r
+  .org 0x01fa   # Comment it for pass build. Should optimise code size. \r
 LBAOffsetForBootSector: \r
   .long     0x0\r
 \r
@@ -281,7 +295,7 @@ LBAOffsetForBootSector:
 # Sector Signature\r
 # ****************************************************************************\r
 \r
-  .org 0x01fe    # Comment it for pass build.\r
+  .org 0x01fe    # Comment it for pass build.\r
 SectorSignature: \r
   .word     0xaa55      # Boot Sector Signature\r
 \r