Make end of line consistent for DuetPkg. There is no other update.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9149 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2009-08-20 06:44:42 +00:00
parent ff68065a57
commit f3eb213152
9 changed files with 4350 additions and 4350 deletions

View File

@ -1,260 +1,260 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
#* #*
#* Copyright 2006 - 2007, Intel Corporation #* Copyright 2006 - 2007, Intel Corporation
#* All rights reserved. This program and the accompanying materials #* All rights reserved. This program and the accompanying materials
#* are licensed and made available under the terms and conditions of the BSD License #* 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 #* which accompanies this distribution. The full text of the license may be found at
#* http://opensource.org/licenses/bsd-license.php #* http://opensource.org/licenses/bsd-license.php
#* #*
#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, #* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#* #*
#* Mbr.asm #* Mbr.asm
#* #*
#* Abstract: #* Abstract:
#* #*
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
.equ BLOCK_SIZE, 0x0200 .equ BLOCK_SIZE, 0x0200
.equ BLOCK_MASK, 0x01ff .equ BLOCK_MASK, 0x01ff
.equ BLOCK_SHIFT, 9 .equ BLOCK_SHIFT, 9
# **************************************************************************** # ****************************************************************************
# Code loaded by BIOS at 0x0000:0x7C00 # Code loaded by BIOS at 0x0000:0x7C00
# **************************************************************************** # ****************************************************************************
.org 0x0 .org 0x0
.global _start .global _start
_start: _start:
# **************************************************************************** # ****************************************************************************
# Start Print # Start Print
# **************************************************************************** # ****************************************************************************
movw $0xb800, %ax movw $0xb800, %ax
movw %ax, %es movw %ax, %es
movw $0x7c0, %ax movw $0x7c0, %ax
movw %ax, %ds movw %ax, %ds
leaw %cs:StartString, %si leaw %cs:StartString, %si
movw $10, %cx movw $10, %cx
movw $160, %di movw $160, %di
rep rep
movsw movsw
# **************************************************************************** # ****************************************************************************
# Print over # Print over
# **************************************************************************** # ****************************************************************************
# **************************************************************************** # ****************************************************************************
# Initialize segment registers and copy code at 0x0000:0x7c00 to 0x0000:0x0600 # Initialize segment registers and copy code at 0x0000:0x7c00 to 0x0000:0x0600
# **************************************************************************** # ****************************************************************************
xorw %ax, %ax # AX = 0x0000 xorw %ax, %ax # AX = 0x0000
movw $0x7c00, %bx # BX = 0x7C00 movw $0x7c00, %bx # BX = 0x7C00
movw $0x600, %bp # BP = 0x0600 movw $0x600, %bp # BP = 0x0600
movw RelocatedStart, %si # SI = Offset(RelocatedStart) movw RelocatedStart, %si # SI = Offset(RelocatedStart)
movw $0x200, %cx # CX = 0x0200 movw $0x200, %cx # CX = 0x0200
subw %si, %cx # CS = 0x0200 - Offset(RelocatedStart) subw %si, %cx # CS = 0x0200 - Offset(RelocatedStart)
leaw (%bp,%si,), %di # DI = 0x0600 + Offset(RelocatedStart) leaw (%bp,%si,), %di # DI = 0x0600 + Offset(RelocatedStart)
leaw (%bx,%si,), %si # BX = 0x7C00 + Offset(RelocatedStart) leaw (%bx,%si,), %si # BX = 0x7C00 + Offset(RelocatedStart)
movw %ax, %ss # SS = 0x0000 movw %ax, %ss # SS = 0x0000
movw %bx, %sp # SP = 0x7C00 movw %bx, %sp # SP = 0x7C00
movw %ax, %es # ES = 0x0000 movw %ax, %es # ES = 0x0000
movw %ax, %ds # DS = 0x0000 movw %ax, %ds # DS = 0x0000
pushw %ax # PUSH 0x0000 pushw %ax # PUSH 0x0000
pushw %di # PUSH 0x0600 + Offset(RelocatedStart) pushw %di # PUSH 0x0600 + Offset(RelocatedStart)
cld # Clear the direction flag cld # Clear the direction flag
rep rep
movsb # Copy 0x0200 bytes from 0x7C00 to 0x0600 movsb # Copy 0x0200 bytes from 0x7C00 to 0x0600
retl # JMP 0x0000:0x0600 + Offset(RelocatedStart) retl # JMP 0x0000:0x0600 + Offset(RelocatedStart)
# **************************************************************************** # ****************************************************************************
# Code relocated to 0x0000:0x0600 # Code relocated to 0x0000:0x0600
# **************************************************************************** # ****************************************************************************
RelocatedStart: RelocatedStart:
# **************************************************************************** # ****************************************************************************
# Get Driver Parameters to 0x0000:0x7BFC # Get Driver Parameters to 0x0000:0x7BFC
# **************************************************************************** # ****************************************************************************
xorw %ax, %ax # AX = 0 xorw %ax, %ax # AX = 0
movw %ax, %ss # SS = 0 movw %ax, %ss # SS = 0
addw $0x1000, %ax addw $0x1000, %ax
movw %ax, %ds movw %ax, %ds
movw $0x7c00, %sp # SP = 0x7c00 movw $0x7c00, %sp # SP = 0x7c00
movw %sp, %bp # BP = 0x7c00 movw %sp, %bp # BP = 0x7c00
movb $8, %ah # AH = 8 - Get Drive Parameters Function movb $8, %ah # AH = 8 - Get Drive Parameters Function
movb %dl, PhysicalDrive(%bp) # BBS defines that BIOS would pass the booting driver number to the loader through DL movb %dl, PhysicalDrive(%bp) # BBS defines that BIOS would pass the booting driver number to the loader through DL
int $0x13 # Get Drive Parameters int $0x13 # Get Drive Parameters
xorw %ax, %ax # AX = 0 xorw %ax, %ax # AX = 0
movb %dh, %al # AL = DH movb %dh, %al # AL = DH
incb %al # MaxHead = AL + 1 incb %al # MaxHead = AL + 1
pushw %ax # 0000:7bfe = MaxHead pushw %ax # 0000:7bfe = MaxHead
movb %cl, %al # AL = CL movb %cl, %al # AL = CL
andb $0x3f, %al # MaxSector = AL & 0x3f andb $0x3f, %al # MaxSector = AL & 0x3f
pushw %ax # 0000:7bfc = MaxSector pushw %ax # 0000:7bfc = MaxSector
# **************************************************************************** # ****************************************************************************
# Read Target DBR from hard disk to 0x0000:0x7C00 # Read Target DBR from hard disk to 0x0000:0x7C00
# **************************************************************************** # ****************************************************************************
xorw %ax, %ax xorw %ax, %ax
movb MbrPartitionIndicator(%bp), %al # AX = MbrPartitionIndex movb MbrPartitionIndicator(%bp), %al # AX = MbrPartitionIndex
cmpb $0xff, %al # 0xFF means do legacy MBR boot cmpb $0xff, %al # 0xFF means do legacy MBR boot
jnz EfiDbr jnz EfiDbr
LegacyMbr: LegacyMbr:
movl $0x0000600, %eax # Assume LegacyMBR is backuped in Sector 6 movl $0x0000600, %eax # Assume LegacyMBR is backuped in Sector 6
jmp StartReadTo7C00 # EAX = Header/Sector/Tracker/Zero jmp StartReadTo7C00 # EAX = Header/Sector/Tracker/Zero
EfiDbr: EfiDbr:
cmpb $4, %al # MbrPartitionIndex should < 4 cmpb $4, %al # MbrPartitionIndex should < 4
jae BadDbr jae BadDbr
shlw $4, %ax # AX = MBREntrySize * Index shlw $4, %ax # AX = MBREntrySize * Index
addw $0x1be, %ax # AX = MBREntryOffset addw $0x1be, %ax # AX = MBREntryOffset
movw %ax, %di # DI = MBREntryOffset movw %ax, %di # DI = MBREntryOffset
# Here we don't use the C/H/S information provided by Partition table # Here we don't use the C/H/S information provided by Partition table
# but calculate C/H/S from LBA ourselves # but calculate C/H/S from LBA ourselves
# Ci: Cylinder number # Ci: Cylinder number
# Hi: Header number # Hi: Header number
# Si: Sector number # Si: Sector number
movl %es:8(%bp,%di,), %eax # Start LBA movl %es:8(%bp,%di,), %eax # Start LBA
movl %eax, %edx movl %eax, %edx
shrl $16, %edx # DX:AX = Start LBA shrl $16, %edx # DX:AX = Start LBA
# = Ci * (H * S) + Hi * S + (Si - 1) # = Ci * (H * S) + Hi * S + (Si - 1)
# Calculate C/H/S according to LBA # Calculate C/H/S according to LBA
movw $0x7bfa, %bp movw $0x7bfa, %bp
divw 2(%bp) # AX = Hi + H*Ci divw 2(%bp) # AX = Hi + H*Ci
# DX = Si - 1 # DX = Si - 1
incw %dx # DX = Si incw %dx # DX = Si
pushw %dx # 0000:7bfa = Si <---- pushw %dx # 0000:7bfa = Si <----
xorw %dx, %dx # DX:AX = Hi + H*Ci xorw %dx, %dx # DX:AX = Hi + H*Ci
divw 4(%bp) # AX = Ci <---- divw 4(%bp) # AX = Ci <----
# DX = Hi <---- # DX = Hi <----
StartReadTo7C00: StartReadTo7C00:
movb (%bp), %cl # Si movb (%bp), %cl # Si
movb %al, %ch # Ci[0-7] movb %al, %ch # Ci[0-7]
orb %ah, %cl # Ci[8,9] orb %ah, %cl # Ci[8,9]
movw $0x7c00, %bx # ES:BX = 0000:7C00h movw $0x7c00, %bx # ES:BX = 0000:7C00h
movb $0x2, %ah # Function 02h movb $0x2, %ah # Function 02h
movb $1, %al # 1 Sector movb $1, %al # 1 Sector
movb %dl, %dh # Hi movb %dl, %dh # Hi
movw $0x600, %bp movw $0x600, %bp
movb PhysicalDrive(%bp), %dl # Drive number movb PhysicalDrive(%bp), %dl # Drive number
int $0x13 int $0x13
jc BadDbr jc BadDbr
# **************************************************************************** # ****************************************************************************
# Transfer control to BootSector - Jump to 0x0000:0x7C00 # Transfer control to BootSector - Jump to 0x0000:0x7C00
# **************************************************************************** # ****************************************************************************
xorw %ax, %ax xorw %ax, %ax
pushw %ax # PUSH 0x0000 - Segment pushw %ax # PUSH 0x0000 - Segment
movw $0x7c00, %di movw $0x7c00, %di
pushw %di # PUSH 0x7C00 - Offset pushw %di # PUSH 0x7C00 - Offset
retl # JMP 0x0000:0x7C00 retl # JMP 0x0000:0x7C00
# **************************************************************************** # ****************************************************************************
# ERROR Condition: # ERROR Condition:
# **************************************************************************** # ****************************************************************************
BadDbr: BadDbr:
pushw %ax pushw %ax
movw $0xb800, %ax movw $0xb800, %ax
movw %ax, %es movw %ax, %es
movw $0x60, %ax movw $0x60, %ax
movw %ax, %ds movw %ax, %ds
leaw %cs:ErrorString, %si leaw %cs:ErrorString, %si
movw $320, %di movw $320, %di
popw %ax popw %ax
call A2C call A2C
movb %ah, 16(%si) movb %ah, 16(%si)
movb %al, 18(%si) movb %al, 18(%si)
movw $10, %cx movw $10, %cx
rep rep
movsw movsw
Halt: Halt:
jmp Halt jmp Halt
StartString: StartString:
.byte 'M', 0x0c, 'B', 0x0c, 'R', 0x0c, ' ', 0x0c, 'S', 0x0c, 't', 0x0c, 'a', 0x0c, 'r', 0x0c, 't', 0x0c, '!', 0x0c .byte 'M', 0x0c, 'B', 0x0c, 'R', 0x0c, ' ', 0x0c, 'S', 0x0c, 't', 0x0c, 'a', 0x0c, 'r', 0x0c, 't', 0x0c, '!', 0x0c
ErrorString: ErrorString:
.byte 'M', 0x0c, 'B', 0x0c, 'R', 0x0c, ' ', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, ':', 0x0c, '?', 0x0c, '?', 0x0c .byte 'M', 0x0c, 'B', 0x0c, 'R', 0x0c, ' ', 0x0c, 'E', 0x0c, 'r', 0x0c, 'r', 0x0c, ':', 0x0c, '?', 0x0c, '?', 0x0c
# **************************************************************************** # ****************************************************************************
# A2C - convert Ascii code stored in AH to character stored in AX # A2C - convert Ascii code stored in AH to character stored in AX
# **************************************************************************** # ****************************************************************************
A2C: A2C:
movb %ah, %al movb %ah, %al
shrb $4, %ah shrb $4, %ah
andb $0xF, %al andb $0xF, %al
addb '0', %ah addb '0', %ah
addb '0', %al addb '0', %al
cmpb '9', %ah cmpb '9', %ah
jle A2C_L1 jle A2C_L1
addb $7, %ah addb $7, %ah
A2C_L1: A2C_L1:
cmpb '9', %al cmpb '9', %al
jle A2C_L2 jle A2C_L2
addb $7, %al addb $7, %al
A2C_L2: A2C_L2:
ret ret
# **************************************************************************** # ****************************************************************************
# PhysicalDrive - Used to indicate which disk to be boot # PhysicalDrive - Used to indicate which disk to be boot
# Can be patched by tool # Can be patched by tool
# **************************************************************************** # ****************************************************************************
.org 0x01B6 .org 0x01B6
PhysicalDrive: .byte 0x80 PhysicalDrive: .byte 0x80
# **************************************************************************** # ****************************************************************************
# MbrPartitionIndicator - Used to indicate which MBR partition to be boot # MbrPartitionIndicator - Used to indicate which MBR partition to be boot
# Can be patched by tool # Can be patched by tool
# OxFF means boot to legacy MBR. (LBA OFFSET 6) # OxFF means boot to legacy MBR. (LBA OFFSET 6)
# **************************************************************************** # ****************************************************************************
.org 0x01B7 .org 0x01B7
MbrPartitionIndicator: .byte 0 MbrPartitionIndicator: .byte 0
# **************************************************************************** # ****************************************************************************
# Unique MBR signature # Unique MBR signature
# **************************************************************************** # ****************************************************************************
.org 0x01B8 .org 0x01B8
.ascii "DUET" .ascii "DUET"
# **************************************************************************** # ****************************************************************************
# Unknown # Unknown
# **************************************************************************** # ****************************************************************************
.org 0x01BC .org 0x01BC
.word 0 .word 0
# **************************************************************************** # ****************************************************************************
# MBR Entry - To be patched # MBR Entry - To be patched
# **************************************************************************** # ****************************************************************************
.org 0x01BE .org 0x01BE
.long 0,0,0,0 .long 0,0,0,0
.org 0x01CE .org 0x01CE
.long 0,0,0,0 .long 0,0,0,0
.org 0x01DE .org 0x01DE
.long 0,0,0,0 .long 0,0,0,0
.org 0x01EE .org 0x01EE
.long 0,0,0,0 .long 0,0,0,0
# **************************************************************************** # ****************************************************************************
# Sector Signature # Sector Signature
# **************************************************************************** # ****************************************************************************
.org 0x01FE .org 0x01FE
SectorSignature: SectorSignature:
.word 0xaa55 # Boot Sector Signature .word 0xaa55 # Boot Sector Signature

View File

@ -19,10 +19,10 @@
# Now in 32-bit protected mode. # Now in 32-bit protected mode.
############################################################################## ##############################################################################
.org 0x21000 .org 0x21000
.global _start .global _start
_start: _start:
.equ DEFAULT_HANDLER_SIZE, INT1 - INT0 .equ DEFAULT_HANDLER_SIZE, INT1 - INT0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -25,10 +25,10 @@
.equ BLOCK_MASK, 0x01ff .equ BLOCK_MASK, 0x01ff
.equ BLOCK_SHIFT, 9 .equ BLOCK_SHIFT, 9
.org 0x0 .org 0x0
.global _start .global _start
_start: _start:
Ia32Jump: Ia32Jump:
jmp BootSectorEntryPoint # JMP inst - 3 bytes jmp BootSectorEntryPoint # JMP inst - 3 bytes

View File

@ -26,10 +26,10 @@
.equ BLOCK_MASK, 0x01ff .equ BLOCK_MASK, 0x01ff
.equ BLOCK_SHIFT, 9 .equ BLOCK_SHIFT, 9
.org 0x00 .org 0x00
.global _start .global _start
_start: _start:
Ia32Jump: Ia32Jump:
jmp BootSectorEntryPoint # JMP inst - 3 bytes jmp BootSectorEntryPoint # JMP inst - 3 bytes

View File

@ -26,10 +26,10 @@
.equ BLOCK_MASK, 0x01ff .equ BLOCK_MASK, 0x01ff
.equ BLOCK_SHIFT, 9 .equ BLOCK_SHIFT, 9
.org 0x0 .org 0x0
.global _start .global _start
_start: _start:
Ia32Jump: Ia32Jump:
jmp BootSectorEntryPoint # JMP inst - 3 bytes jmp BootSectorEntryPoint # JMP inst - 3 bytes

File diff suppressed because it is too large Load Diff