]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/BootSector/start16.S
IntelFrameworkModulePkg: Refine casting expression result to bigger size
[mirror_edk2.git] / DuetPkg / BootSector / start16.S
index de845215d14ada0903d3da482f70fa41ed95cf0d..a4cb151c77007dbe2f63b59cda994b09b8a2b23a 100644 (file)
@@ -1,7 +1,7 @@
 #------------------------------------------------------------------------------\r
 #*\r
-#*   Copyright 2006 - 2007, Intel Corporation                                                         \r
-#*   All rights reserved. This program and the accompanying materials                          \r
+#*   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+#*   This program and the accompanying materials                          \r
 #*   are licensed and made available under the terms and conditions of the BSD License         \r
 #*   which accompanies this distribution.  The full text of the license may be found at        \r
 #*   http://opensource.org/licenses/bsd-license.php                                            \r
@@ -18,7 +18,7 @@
         #.MODEL small\r
         .stack: \r
         .486p: \r
-        .code: \r
+        .code16 \r
 \r
 .equ                        FAT_DIRECTORY_ENTRY_SIZE,   0x0020\r
 .equ                        FAT_DIRECTORY_ENTRY_SHIFT,  5\r
 .equ                        BLOCK_SHIFT,                9\r
 \r
         .org 0x00\r
+\r
+.global _start\r
+_start:\r
+\r
 Ia32Jump: \r
   jmp   BootSectorEntryPoint  # JMP inst    - 3 bytes\r
   nop\r
@@ -74,7 +78,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
@@ -85,7 +89,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
@@ -96,9 +100,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
@@ -292,11 +296,11 @@ Halt:
 ErrorString: \r
         .byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!', 0x0c\r
 \r
-        .org     0x01fa\r
+        # .org     0x01fa # Just for passing build.\r
 LBAOffsetForBootSector: \r
         .long   0x0\r
 \r
-        .org     0x01fe\r
+        # .org     0x01fe # Just for passing build.\r
         .word   0xaa55\r
 \r
 #******************************************************************************\r
@@ -309,7 +313,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     0x0200\r
+        # .org     0x0200 # Just for passing build.\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
@@ -394,7 +398,7 @@ Timeout8042:
 \r
 \r
 A20GateEnabled: \r
-\r
+        movw    $0x0008, %bx                # Flat data descriptor\r
 #\r
 # DISABLE INTERRUPTS - Entering Protected Mode\r
 #\r
@@ -415,11 +419,6 @@ A20GateEnabled:
         movl    %cr0, %eax\r
         orb     $1, %al\r
         movl    %eax, %cr0\r
-\r
-        movl $0x008, %eax                   # Flat data descriptor\r
-        movl $0x00400000, %ebp              # Destination of EFILDR32\r
-        movl $0x00070000, %ebx              # Length of copy\r
-\r
 JUMP: \r
 # jmp far 0010:00020000\r
         .byte 0x66\r
@@ -440,7 +439,7 @@ Empty8042Loop:
 # data\r
 ##############################################################################\r
 \r
-        .align 0x2\r
+        .p2align 1\r
 \r
 gdtr:   .word  GDT_END - GDT_BASE - 1       # GDT limit\r
         .long 0                             # (GDT base gets set above)\r
@@ -448,9 +447,8 @@ gdtr:   .word  GDT_END - GDT_BASE - 1       # GDT limit
 #   global descriptor table (GDT)\r
 ##############################################################################\r
 \r
-        .align 0x2\r
+        .p2align 1\r
 \r
-.global GDT_BASE\r
 GDT_BASE: \r
 # null descriptor\r
 .equ                NULL_SEL, .-GDT_BASE\r
@@ -526,7 +524,7 @@ GDT_BASE:
 \r
 GDT_END: \r
 \r
-        .align 0x2\r
+        .p2align 1\r
 \r
 \r
 \r
@@ -542,9 +540,8 @@ idtr:   .word IDT_END - IDT_BASE - 1  # IDT limit
 ##############################################################################\r
 \r
 #idt_tag db "IDT",0     \r
-        .align 0x2\r
+        .p2align 1\r
 \r
-.global IDT_BASE\r
 IDT_BASE: \r
 # divide by zero (INT 0)\r
 .equ                DIV_ZERO_SEL, .-IDT_BASE\r
@@ -839,7 +836,7 @@ IDT_BASE:
 \r
 IDT_END: \r
 \r
-        .align 0x2\r
+        .p2align 1\r
 \r
 MemoryMapSize:  .long 0\r
 MemoryMap:  .long 0,0,0,0,0,0,0,0\r