]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/BootSector/start.S
Make end of line consistent for DuetPkg. There is no other update.
[mirror_edk2.git] / DuetPkg / BootSector / start.S
index 4b65ff038e21a30a2e590fc6e1051bc673cd3529..706def4929b5c9df8f8e873bdf992d6120d551d0 100644 (file)
@@ -15,6 +15,9 @@
 #*\r
 #------------------------------------------------------------------------------\r
 \r
+        .stack: \r
+        .486p: \r
+        .code16\r
                \r
 .equ                        FAT_DIRECTORY_ENTRY_SIZE, 0x020\r
 .equ                        FAT_DIRECTORY_ENTRY_SHIFT, 5\r
 .equ                        BLOCK_SHIFT, 9\r
 \r
        .org 0x0\r
+\r
+.global _start\r
+_start:\r
+\r
 Ia32Jump: \r
   jmp   BootSectorEntryPoint  # JMP inst    - 3 bytes\r
   nop\r
@@ -70,7 +77,7 @@ BootSectorEntryPoint:
 NoVarStore: \r
         pushw   %es\r
 # Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl\r
-        movb    %al, %es:($4)\r
+        movb    %al, %es:(4)\r
         jmp     SaveVolumeId\r
 \r
 CheckVarStoreSize: \r
@@ -81,7 +88,7 @@ CheckVarStoreSize:
 \r
 LoadVarStore: \r
         movb    $0, %al\r
-        movb    %al, %es:($4)\r
+        movb    %al, %es:(4)\r
         movw    (%di), %cx\r
 #       ES:DI = 1500:0\r
         xorw    %di, %di\r
@@ -92,9 +99,9 @@ LoadVarStore:
 SaveVolumeId: \r
         popw    %es\r
         movw    VolId(%bp), %ax\r
-        movw    %ax, %es:($0)                       # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId\r
+        movw    %ax, %es:(0)                    # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId\r
         movw    VolId+2(%bp), %ax\r
-        movw    %ax, %es:($2)\r
+        movw    %ax, %es:(2)\r
 \r
 # Read Efildr\r
         popw    %cx\r
@@ -149,9 +156,9 @@ FatChainLoop:
         shrw    %ax                                 # FatOffset = ClusterNumber*3 / 2\r
         pushw   %si                                 # Save si\r
         movw    %ax, %si                            # si = FatOffset\r
-        shrw    %ax                                 # ax = FatOffset >> BLOCK_SHIFT\r
+        shrw    $BLOCK_SHIFT, %ax                   # ax = FatOffset >> BLOCK_SHIFT\r
         addw    ReservedSectors(%bp), %ax           # ax = FatSectorNumber = ReservedSectors + (FatOffset >> BLOCK_OFFSET)\r
-        andw    BLOCK_MASK,%si                      # si = FatOffset & BLOCK_MASK\r
+        andw    $BLOCK_MASK,%si                     # si = FatOffset & BLOCK_MASK\r
         cmpw    %dx, %ax                            # Compare FatSectorNumber to CachedFatSectorNumber\r
         je      SkipFatRead\r
         movw    $2, %bx\r
@@ -215,7 +222,7 @@ FoundLastCluster:
 \r
 ReadBlocks: \r
         pusha\r
-        addl    LBAOffsetForBootSector(%bp), %eax            # Add LBAOffsetForBootSector to Start LBA\r
+        addl    LBAOffsetForBootSector(%bp), %eax   # Add LBAOffsetForBootSector to Start LBA\r
         addl    HiddenSectors(%bp), %eax            # Add HiddenSectors to Start LBA\r
         movl    %eax, %esi                          # esi = Start LBA\r
         movw    %bx, %cx                            # cx = Number of blocks to read\r
@@ -236,7 +243,7 @@ ReadCylinderLoop:
 LimitTransfer: \r
         pushw   %ax                                 # save ax\r
         movw    %es, %ax                            # ax = es\r
-        shrw    %ax                                 # ax = Number of blocks into mem system\r
+        shrw    $(BLOCK_SHIFT-4), %ax               # ax = Number of blocks into mem system\r
         andw    $0x7f, %ax                          # ax = Number of blocks into current seg\r
         addw    %bx, %ax                            # ax = End Block number of transfer\r
         cmpw    $0x80, %ax                          # See if it crosses a 64K boundry\r
@@ -268,7 +275,7 @@ NotCrossing64KBoundry:
         addl    %ebx, %esi                          # StartLBA = StartLBA + NumberOfBlocks\r
         subw    %bx, %cx                            # Blocks = Blocks - NumberOfBlocks\r
         movw    %es, %ax\r
-        shlw    %bx\r
+        shlw    $(BLOCK_SHIFT-4), %bx\r
         addw    %bx, %ax\r
         movw    %ax, %es                            # es:di = es:di + NumberOfBlocks*BLOCK_SIZE\r
         cmpw    $0, %cx\r
@@ -279,7 +286,7 @@ NotCrossing64KBoundry:
 DiskError: \r
         pushw %cs\r
         popw %ds\r
-        leaw %cs:ErrorString, %si\r
+        leaw ErrorString, %si\r
         movw $7, %cx\r
         jmp  PrintStringAndHalt\r
 \r
@@ -295,11 +302,11 @@ Halt:
 ErrorString: \r
         .byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!',0x0c\r
 \r
-        #.org     0x0242 # For Code size overflow, Modified this just for pass build\r
+        .org     0x01fa\r
 LBAOffsetForBootSector: \r
         .long   0x0\r
 \r
-        #.org    0x0227  # For Code size overflow, Modified this just for pass build\r
+        .org    0x01fe\r
         .word   0xaa55\r
 \r
 #******************************************************************************\r
@@ -312,7 +319,7 @@ LBAOffsetForBootSector:
 .equ                 WRITE_DATA_PORT_CMD, 0x0d1  # 8042 command to write the data port\r
 .equ                 ENABLE_A20_CMD, 0x0df       # 8042 command to enable A20\r
 \r
-        #.org     0x200\r
+        .org     0x200\r
         jmp start\r
 Em64String: \r
         .byte 'E', 0x0c, 'm', 0x0c, '6', 0x0c, '4', 0x0c, 'T', 0x0c, ' ', 0x0c, 'U', 0x0c, 'n', 0x0c, 's', 0x0c, 'u', 0x0c, 'p', 0x0c, 'p', 0x0c, 'o', 0x0c, 'r', 0x0c, 't', 0x0c, 'e', 0x0c, 'd', 0x0c, '!', 0x0c\r
@@ -335,7 +342,7 @@ start:
 MemMapLoop: \r
         movl $0xe820, %eax\r
         movl $20, %ecx\r
-        movl 0x534d4150, %edx  # SMAP\r
+        movl $0x534d4150, %edx  # SMAP\r
         int $0x15\r
         jc  MemMapDone\r
         addl $20, %edi\r
@@ -350,11 +357,11 @@ MemMapDone:
         xorl    %ebx, %ebx\r
         movw    %cs, %bx                    # BX=segment\r
         shll    $4, %ebx                    # BX="linear" address of segment base\r
-        leal    GDT_BASE(%ebx), %eax        #\r
-        movl    %eax, (gdtr + 2)            #\r
-        leal    IDT_BASE(%ebx), %eax        #\r
-        movl    %eax, (idtr + 2)            #\r
-        leal    MemoryMapSize(%ebx), %edx   #\r
+        leal    GDT_BASE(%ebx), %eax        # EAX=PHYSICAL address of gdt\r
+        movl    %eax, (gdtr + 2)            # Put address of gdt into the gdtr\r
+        leal    IDT_BASE(%ebx), %eax        # EAX=PHYSICAL address of idt\r
+        movl    %eax, (idtr + 2)            # Put address of idt into the idtr\r
+        leal    MemoryMapSize(%ebx), %edx   # Physical base address of the memory map\r
 \r
         addl $0x1000, %ebx                  # Source of EFI32\r
         movl %ebx, JUMP+2\r