Should use code16 for 16-bit assembler, otherwise 32-bit prefix will be added

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7721 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2009-02-26 14:41:56 +00:00
parent 0375ec8d8f
commit 20193e01ca
5 changed files with 41 additions and 30 deletions

View File

@ -1,3 +1,6 @@
# Just use host GCC to compile boot sector image.
ASM=gcc
DLINK=ld
ASSEMBLY_CODE_FILE_LIST = $(MODULE_DIR)/bootsect.S \
$(MODULE_DIR)/bs16.S \
@ -30,55 +33,64 @@ all: $(TARGET_FILES)
$(OUTPUT_DIR)/bootsect.o: $(MODULE_DIR)/bootsect.S
$(ASM) -c -o $(OUTPUT_DIR)/bootsect.o $(MODULE_DIR)/bootsect.S
$(OUTPUT_DIR)/bootsect.bin: $(OUTPUT_DIR)/bootsect.o
$(DLINK) -o $(OUTPUT_DIR)/bootsect.bin $(OUTPUT_DIR)/bootsect.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/bootsect.bin $(OUTPUT_DIR)/bootsect.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/bootsect.o>$(OUTPUT_DIR)/bootsect.lst
# bs16.S
$(OUTPUT_DIR)/bs16.o: $(MODULE_DIR)/bs16.S
$(ASM) -c -o $(OUTPUT_DIR)/bs16.o $(MODULE_DIR)/bs16.S
$(OUTPUT_DIR)/bs16.bin: $(OUTPUT_DIR)/bs16.o
$(DLINK) -o $(OUTPUT_DIR)/bs16.bin $(OUTPUT_DIR)/bs16.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/bs16.bin $(OUTPUT_DIR)/bs16.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/bs16.o>$(OUTPUT_DIR)/bs16.lst
# bs32.S
$(OUTPUT_DIR)/bs32.o: $(MODULE_DIR)/bs32.S
$(ASM) -c -o $(OUTPUT_DIR)/bs32.o $(MODULE_DIR)/bs32.S
$(OUTPUT_DIR)/bs32.bin: $(OUTPUT_DIR)/bs32.o
$(DLINK) -o $(OUTPUT_DIR)/bs32.bin $(OUTPUT_DIR)/bs32.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/bs32.bin $(OUTPUT_DIR)/bs32.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/bs32.o>$(OUTPUT_DIR)/bs32.lst
# Gpt.S
$(OUTPUT_DIR)/Gpt.o: $(MODULE_DIR)/Gpt.S
$(ASM) -c -o $(OUTPUT_DIR)/Gpt.o $(MODULE_DIR)/Gpt.S
$(OUTPUT_DIR)/Gpt.bin: $(OUTPUT_DIR)/Gpt.o
$(DLINK) -o $(OUTPUT_DIR)/Gpt.bin $(OUTPUT_DIR)/Gpt.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/Gpt.bin $(OUTPUT_DIR)/Gpt.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/Gpt.o>$(OUTPUT_DIR)/Gpt.lst
# Mbr.S
$(OUTPUT_DIR)/Mbr.o: $(MODULE_DIR)/Mbr.S
$(ASM) -c -o $(OUTPUT_DIR)/Mbr.o $(MODULE_DIR)/Mbr.S
$(OUTPUT_DIR)/Mbr.bin: $(OUTPUT_DIR)/Mbr.o
$(DLINK) -o $(OUTPUT_DIR)/Mbr.bin $(OUTPUT_DIR)/Mbr.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/Mbr.bin $(OUTPUT_DIR)/Mbr.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/Mbr.o>$(OUTPUT_DIR)/Mbr.lst
# start.S
$(OUTPUT_DIR)/start.o: $(MODULE_DIR)/start.S
$(ASM) -c -o $(OUTPUT_DIR)/start.o $(MODULE_DIR)/start.S
$(OUTPUT_DIR)/start.bin: $(OUTPUT_DIR)/start.o
$(DLINK) -o $(OUTPUT_DIR)/start.bin $(OUTPUT_DIR)/start.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/start.bin $(OUTPUT_DIR)/start.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/start.o>$(OUTPUT_DIR)/start.lst
# start16.S
$(OUTPUT_DIR)/start16.o: $(MODULE_DIR)/start16.S
$(ASM) -c -o $(OUTPUT_DIR)/start16.o $(MODULE_DIR)/start16.S
$(OUTPUT_DIR)/start16.bin: $(OUTPUT_DIR)/start16.o
$(DLINK) -o $(OUTPUT_DIR)/start16.bin $(OUTPUT_DIR)/start16.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/start16.bin $(OUTPUT_DIR)/start16.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/start16.o>$(OUTPUT_DIR)/start16.lst
# start32.S
$(OUTPUT_DIR)/start32.o: $(MODULE_DIR)/start32.S
$(ASM) -c -o $(OUTPUT_DIR)/start32.o $(MODULE_DIR)/start32.S
$(OUTPUT_DIR)/start32.bin: $(OUTPUT_DIR)/start32.o
$(DLINK) -o $(OUTPUT_DIR)/start32.bin $(OUTPUT_DIR)/start32.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/start32.bin $(OUTPUT_DIR)/start32.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/start32.o>$(OUTPUT_DIR)/start32.lst
# efi32.S
$(OUTPUT_DIR)/efi32.o: $(MODULE_DIR)/efi32.S
$(ASM) -c -o $(OUTPUT_DIR)/efi32.o $(MODULE_DIR)/efi32.S
$(OUTPUT_DIR)/efi32.bin: $(OUTPUT_DIR)/efi32.o
$(DLINK) -o $(OUTPUT_DIR)/efi32.bin $(OUTPUT_DIR)/efi32.o -Ttext 0
$(DLINK) --oformat binary -o $(OUTPUT_DIR)/efi32.bin $(OUTPUT_DIR)/efi32.o -Ttext 0
objdump --line-numbers --source $(OUTPUT_DIR)/efi32.o>$(OUTPUT_DIR)/efi32.lst
clean:

View File

@ -18,7 +18,7 @@
#.MODEL small
.stack:
.486p:
.code16:
.code16
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x020
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
@ -275,7 +275,7 @@ ErrorString:
# LBA Offset for BootSector, need patched by tool for HD boot.
# ****************************************************************************
# .org 0x01fa # Comment it for pass build. Should optimise code size.
.org 0x01fa # Comment it for pass build. Should optimise code size.
LBAOffsetForBootSector:
.long 0x0
@ -283,7 +283,7 @@ LBAOffsetForBootSector:
# Sector Signature
# ****************************************************************************
# .org 0x01fe # Comment it for pass build.
.org 0x01fe # Comment it for pass build.
SectorSignature:
.word 0xaa55 # Boot Sector Signature

View File

@ -18,7 +18,7 @@
#.MODEL small
.stack:
.486p:
.code16:
.code16
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x020
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
@ -275,7 +275,7 @@ ErrorString:
# LBA Offset for BootSector, need patched by tool for HD boot.
# ****************************************************************************
# .org 0x01fa # Comment it for pass build. Should optimise code size.
.org 0x01fa
LBAOffsetForBootSector:
.long 0x0
@ -283,7 +283,7 @@ LBAOffsetForBootSector:
# Sector Signature
# ****************************************************************************
# .org 0x01fe # Comment it for pass build. Should optimise code size.
.org 0x01fe
SectorSignature:
.word 0xaa55 # Boot Sector Signature

View File

@ -16,10 +16,9 @@
#------------------------------------------------------------------------------
#.MODEL small
#.stack:
#.486p:
.code16:
.section .text
.stack:
.486p:
.code16
.equ FAT_DIRECTORY_ENTRY_SIZE, 0x0020
.equ FAT_DIRECTORY_ENTRY_SHIFT, 5
@ -31,7 +30,7 @@
.equ LOADER_FILENAME_PART2, 0x30325244 # "DR20"
.equ LOADER_FILENAME_PART3, 0x20202030 # "0___"
.org 0x00
.org 0x0
.global _start
_start:
Ia32Jump:
@ -80,7 +79,7 @@ BootSectorEntryPoint:
# ****************************************************************************
# Start Print
# ****************************************************************************
leaw %cs:StartString, %si
movw $StartString, %si
call PrintString
# ****************************************************************************
@ -283,7 +282,7 @@ NotFoundAll:
jne FoundEFILDR
BadBootSector:
DiskError:
leaw %cs:ErrorString, %si
movw $ErrorString, %si
call PrintString
Halt:
jmp Halt
@ -297,7 +296,7 @@ ErrorString:
# LBA Offset for BootSector, need patched by tool for HD boot.
# ****************************************************************************
# .org 0x01fa # BUG_BUG
#.org 0x01fa
LBAOffsetForBootSector:
.long 0x0
@ -305,7 +304,7 @@ LBAOffsetForBootSector:
# Sector Signature
# ****************************************************************************
# .org 0x01fe # BUG_BUG
#.org 0x01fe
SectorSignature:
.word 0xaa55 # Boot Sector Signature

View File

@ -22,7 +22,7 @@
.486:
#.MODEL flat
.stack:
.code16:
.code:
.org 0x21000
.equ DEFAULT_HANDLER_SIZE, INT1 - INT0