X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=DuetPkg%2FBootSector%2Fstart.S;h=f96d06e14491326dc6767f37f9240a2906dce5d2;hb=3a4b9eba07e5cd1866842b0173fac93ffdb931e9;hp=d558652a9ad9d7ff0608525acc0e9d1fb7ec8279;hpb=ccec4c39691f3e2bc3108ef82f744b278b59fda3;p=mirror_edk2.git diff --git a/DuetPkg/BootSector/start.S b/DuetPkg/BootSector/start.S index d558652a9a..f96d06e144 100644 --- a/DuetPkg/BootSector/start.S +++ b/DuetPkg/BootSector/start.S @@ -1,7 +1,7 @@ #------------------------------------------------------------------------------ #* -#* Copyright 2006 - 2007, Intel Corporation -#* All rights reserved. This program and the accompanying materials +#* Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+#* This program and the accompanying materials #* are licensed and made available under the terms and conditions of the BSD License #* which accompanies this distribution. The full text of the license may be found at #* http://opensource.org/licenses/bsd-license.php @@ -15,11 +15,10 @@ #* #------------------------------------------------------------------------------ - - - - - + .stack: + .486p: + .code16 + .equ FAT_DIRECTORY_ENTRY_SIZE, 0x020 .equ FAT_DIRECTORY_ENTRY_SHIFT, 5 .equ BLOCK_SIZE, 0x0200 @@ -27,6 +26,10 @@ .equ BLOCK_SHIFT, 9 .org 0x0 + +.global _start +_start: + Ia32Jump: jmp BootSectorEntryPoint # JMP inst - 3 bytes nop @@ -74,7 +77,7 @@ BootSectorEntryPoint: NoVarStore: pushw %es # Set the 5th byte start @ 0:19000 to non-zero indicating we should init var store header in DxeIpl - movb %al, %es:($4) + movb %al, %es:(4) jmp SaveVolumeId CheckVarStoreSize: @@ -85,7 +88,7 @@ CheckVarStoreSize: LoadVarStore: movb $0, %al - movb %al, %es:($4) + movb %al, %es:(4) movw (%di), %cx # ES:DI = 1500:0 xorw %di, %di @@ -96,9 +99,9 @@ LoadVarStore: SaveVolumeId: popw %es movw VolId(%bp), %ax - movw %ax, %es:($0) # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId + movw %ax, %es:(0) # Save Volume Id to 0:19000. we will find the correct volume according to this VolumeId movw VolId+2(%bp), %ax - movw %ax, %es:($2) + movw %ax, %es:(2) # Read Efildr popw %cx @@ -219,7 +222,7 @@ FoundLastCluster: ReadBlocks: pusha - addl LBAOffsetForBootSector(%bp), %eax # Add LBAOffsetForBootSector to Start LBA + addl LBAOffsetForBootSector(%bp), %eax # Add LBAOffsetForBootSector to Start LBA addl HiddenSectors(%bp), %eax # Add HiddenSectors to Start LBA movl %eax, %esi # esi = Start LBA movw %bx, %cx # cx = Number of blocks to read @@ -240,7 +243,7 @@ ReadCylinderLoop: LimitTransfer: pushw %ax # save ax movw %es, %ax # ax = es - shrw %ax # ax = Number of blocks into mem system + shrw $(BLOCK_SHIFT-4), %ax # ax = Number of blocks into mem system andw $0x7f, %ax # ax = Number of blocks into current seg addw %bx, %ax # ax = End Block number of transfer cmpw $0x80, %ax # See if it crosses a 64K boundry @@ -272,7 +275,7 @@ NotCrossing64KBoundry: addl %ebx, %esi # StartLBA = StartLBA + NumberOfBlocks subw %bx, %cx # Blocks = Blocks - NumberOfBlocks movw %es, %ax - shlw %bx + shlw $(BLOCK_SHIFT-4), %bx addw %bx, %ax movw %ax, %es # es:di = es:di + NumberOfBlocks*BLOCK_SIZE cmpw $0, %cx @@ -299,11 +302,11 @@ Halt: ErrorString: .byte 'S', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, 'o', 0x0c, 'r', 0x0c, '!',0x0c - .org 0x0241 # For Code size overflow, Modified this just for pass build + .org 0x01fa LBAOffsetForBootSector: .long 0x0 - #.org 0x0227 # For Code size overflow, Modified this just for pass build + .org 0x01fe .word 0xaa55 #****************************************************************************** @@ -316,7 +319,7 @@ LBAOffsetForBootSector: .equ WRITE_DATA_PORT_CMD, 0x0d1 # 8042 command to write the data port .equ ENABLE_A20_CMD, 0x0df # 8042 command to enable A20 - #.org 0x200 + .org 0x200 jmp start Em64String: .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 @@ -354,11 +357,11 @@ MemMapDone: xorl %ebx, %ebx movw %cs, %bx # BX=segment shll $4, %ebx # BX="linear" address of segment base - leal GDT_BASE(%ebx), %eax # - movl %eax, (gdtr + 2) # - leal IDT_BASE(%ebx), %eax # - movl %eax, (idtr + 2) # - leal MemoryMapSize(%ebx), %edx # + leal GDT_BASE(%ebx), %eax # EAX=PHYSICAL address of gdt + movl %eax, (gdtr + 2) # Put address of gdt into the gdtr + leal IDT_BASE(%ebx), %eax # EAX=PHYSICAL address of idt + movl %eax, (idtr + 2) # Put address of idt into the idtr + leal MemoryMapSize(%ebx), %edx # Physical base address of the memory map addl $0x1000, %ebx # Source of EFI32 movl %ebx, JUMP+2 @@ -401,6 +404,7 @@ Timeout8042: A20GateEnabled: + movw $0x0008, %bx # Flat data descriptor # # DISABLE INTERRUPTS - Entering Protected Mode @@ -422,11 +426,6 @@ A20GateEnabled: movl %cr0, %eax orb $1, %al movl %eax, %cr0 - - movl $0x008, %eax # Flat data descriptor - movl $0x00400000, %ebp # Destination of EFILDR32 - movl $0x00070000, %ebx # Length of copy - JUMP: # jmp far 0010:00020000 .byte 0x66 @@ -447,7 +446,7 @@ Empty8042Loop: # data ############################################################################## - .align 0x2 + .p2align 1 gdtr: .long GDT_END - GDT_BASE - 1 # GDT limit .long 0 # (GDT base gets set above) @@ -455,7 +454,7 @@ Empty8042Loop: # global descriptor table (GDT) ############################################################################## - .align 0x2 + .p2align 1 GDT_BASE: # null descriptor @@ -532,7 +531,7 @@ GDT_BASE: GDT_END: - .align 0x2 + .p2align 1 @@ -548,7 +547,7 @@ idtr: .long IDT_END - IDT_BASE - 1 # IDT limit ############################################################################## #idt_tag db "IDT",0 - .align 0x2 + .p2align 1 IDT_BASE: # divide by zero (INT 0) @@ -712,7 +711,7 @@ IDT_BASE: .word 0 # offset 31:16 # 85 unspecified descriptors, First 12 of them are reserved, the rest are avail - .fill 85 * 8, 1, 0 # db (85 * 8) dup(0) + .fill 85 * 8, 1, 0 # db (85 * 8) dup(0) # IRQ 0 (System timer) - (INT 0x68) .equ IRQ0_SEL, .-IDT_BASE @@ -844,7 +843,7 @@ IDT_BASE: IDT_END: - .align 0x2 + .p2align 1 MemoryMapSize: .long 0 MemoryMap: .long 0,0,0,0,0,0,0,0