]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/BootSector/bootsect.asm
OvmfPkg: Add section of memory to use for PEI on S3 resume
[mirror_edk2.git] / DuetPkg / BootSector / bootsect.asm
index 972e36e8a1666fd140ea491c3ecb4c024954d437..3366b7acf73fb2d13232f9d0a225b7071b12090a 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 - 2007, 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
@@ -9,9 +9,22 @@
 ;*   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
-;*  \r
-;*   Abstract:\r
+;*   bootsect.asm\r
+;*    \r
+;*   bootsect.asm 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
@@ -81,13 +94,13 @@ BootSectorEntryPoint:
   mov   ah,8                                ; ah = 8 - Get Drive Parameters Function\r
   mov   byte ptr [bp+PhysicalDrive],dl      ; BBS defines that BIOS would pass the booting driver number to the loader through DL\r
   int   13h                                 ; Get Drive Parameters\r
-  xor   ax,ax                   ; ax = 0\r
-  mov   al,dh                   ; al = dh\r
-  inc   al                      ; MaxHead = al + 1\r
-  push  ax                      ; 0000:7bfe = MaxHead\r
-  mov   al,cl                   ; al = cl\r
-  and   al,03fh                 ; MaxSector = al & 0x3f\r
-  push  ax                      ; 0000:7bfc = MaxSector\r
+  xor   ax,ax                               ; ax = 0\r
+  mov   al,dh                               ; al = dh (number of sides (0 based))\r
+  inc   al                                  ; MaxHead = al + 1\r
+  push  ax                                  ; 0000:7bfe = MaxHead\r
+  mov   al,cl                               ; al = cl (CL = sectors per track)\r
+  and   al,03fh                             ; MaxSector = al & 0x3f\r
+  push  ax                                  ; 0000:7bfc = MaxSector\r
 \r
   cmp   word ptr [bp+SectorSignature],0aa55h  ; Verify Boot Sector Signature\r
   jne   BadBootSector\r
@@ -149,7 +162,7 @@ FindNext:
   jmp   NotFoundAll\r
 \r
 FoundAll:\r
-FoundEFILDR:\r
+FoundEFILDR:                                  ; 0x7cfe\r
   mov     cx,bx                               ; cx = Start Cluster for EFILDR  <----------------------------------\r
   mov     ax,cs                               ; Destination = 2000:0000\r
   add     ax,2000h\r
@@ -170,8 +183,8 @@ ReadFirstClusterOfEFILDR:
   call    ReadBlocks\r
   pop     ax\r
 JumpIntoFirstSectorOfEFILDR:\r
-  mov     word ptr [bp+JumpSegment],ax\r
-JumpFarInstruction:\r
+  mov     word ptr [bp+JumpSegment],ax        ; 0x7d26\r
+JumpFarInstruction:                           ; 0x7d2a\r
   db      0eah\r
 JumpOffset:\r
   dw      0000h\r
@@ -252,7 +265,7 @@ LimitTransfer:
 ; ****************************************************************************\r
 ; ERROR Condition:\r
 ; ****************************************************************************\r
-NotFoundAll:\r
+NotFoundAll:                            ; 0x7da6\r
   ; if we found EFILDR, continue\r
   test bx,bx\r
   jne  FoundEFILDR\r