From 5053ee0d6cc0d8390a4e29ba7b7de827c6cce053 Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 23 May 2000 12:18:49 +0000 Subject: Clean up all of the 16-bit assembly code in the x86 bootstrap to work with the new binutils. Now that we have a decent assembler, all the old m4 macros are no longer needed. Instead, straight assembly can be used since as(1) now understands 16-bit addressing, branches, etc. Also, several bugs have been fixed in as(1), allowing boot0.s to be further cleaned up. --- sys/boot/i386/pxeldr/pxeldr.S | 34 +++++++++++++++------------------- sys/boot/i386/pxeldr/pxeldr.s | 34 +++++++++++++++------------------- 2 files changed, 30 insertions(+), 38 deletions(-) (limited to 'sys/boot/i386/pxeldr') diff --git a/sys/boot/i386/pxeldr/pxeldr.S b/sys/boot/i386/pxeldr/pxeldr.S index 6ad5206..c9854f9 100644 --- a/sys/boot/i386/pxeldr/pxeldr.S +++ b/sys/boot/i386/pxeldr/pxeldr.S @@ -85,31 +85,31 @@ start: cld # string ops inc addl %ebx, %ecx # the PXENV+ struct and pushl %ecx # save it on the stack movw $welcome_msg, %si # %ds:(%si) -> welcome message - call putstr # display the welcome message + callw putstr # display the welcome message # # Setup the arguments that the loader is expecting from boot[12] # movw $bootinfo_msg, %si # %ds:(%si) -> boot args message - call putstr # display the message - movl $MEM_ARG, %ebx # %ds:(%ebx) -> boot args + callw putstr # display the message + movl $MEM_ARG, %bx # %ds:(%bx) -> boot args movw %bx, %di # %es:(%di) -> boot args xorl %eax, %eax # zero %eax movw $(MEM_ARG_SIZE/4), %cx # Size of arguments in 32-bit # dwords rep # Clear the arguments stosl # to zero - orb $KARGS_FLAGS_PXE, 0x8(%ebx) # kargs->bootflags |= + orb $KARGS_FLAGS_PXE, 0x8(%bx) # kargs->bootflags |= # KARGS_FLAGS_PXE - popl 0xc(%ebx) # kargs->pxeinfo = *PXENV+ + popl 0xc(%bx) # kargs->pxeinfo = *PXENV+ # # Turn on the A20 address line # - call seta20 # Turn A20 on + callw seta20 # Turn A20 on # # Relocate the loader and BTX using a very lazy protected mode # movw $relocate_msg, %si # Display the - call putstr # relocation message + callw putstr # relocation message movl end+AOUT_ENTRY, %edi # %edi is the destination movl $(end+AOUT_HEADER), %esi # %esi is # the start of the text @@ -121,9 +121,8 @@ start: cld # string ops inc movl %cr0, %eax # Turn on orb $0x1, %al # protected movl %eax, %cr0 # mode - .byte 0xea # long jump to - .word pm_start # clear the instruction - .word SEL_SCODE # pre-fetch queue + ljmp $SEL_SCODE,$pm_start # long jump to clear the + # instruction pre-fetch queue .code32 pm_start: movw $SEL_SDATA, %ax # Initialize movw %ax, %ds # %ds and @@ -155,9 +154,8 @@ pm_16: movw $SEL_RDATA, %ax # Initialize movl %cr0, %eax # Turn off andb $~0x1, %al # protected movl %eax, %cr0 # mode - .byte 0xea # Long jump to - .word pm_end # clear the instruction - .word 0x0 # pre-fetch + ljmp $0,$pm_end # Long jump to clear the + # instruction pre-fetch queue pm_end: sti # Turn interrupts back on now # # Copy the BTX client to MEM_BTX_CLIENT @@ -188,10 +186,8 @@ pm_end: sti # Turn interrupts back on now # Now we just start up BTX and let it do the rest # movw $jump_message, %si # Display the - call putstr # jump message - .byte 0xea # Jump to - .word MEM_BTX_ENTRY # BTX entry - .word 0x0 # point + callw putstr # jump message + ljmp $0,$MEM_BTX_ENTRY # Jump to the BTX entry point # # Display a null-terminated string @@ -199,7 +195,7 @@ pm_end: sti # Turn interrupts back on now putstr: lodsb # load %al from %ds:(%si) testb %al,%al # stop at null jnz putc # if the char != null, output it - ret # return when null is hit + retw # return when null is hit putc: movw $0x7,%bx # attribute for output movb $0xe,%ah # BIOS: put_char int $0x10 # call BIOS, print char in %al @@ -220,7 +216,7 @@ seta20.2: inb $0x64,%al # Get status movb $0xdf,%al # Enable outb %al,$0x60 # A20 sti # Enable interrupts - ret # To caller + retw # To caller # # BTX client to start btxldr diff --git a/sys/boot/i386/pxeldr/pxeldr.s b/sys/boot/i386/pxeldr/pxeldr.s index 6ad5206..c9854f9 100644 --- a/sys/boot/i386/pxeldr/pxeldr.s +++ b/sys/boot/i386/pxeldr/pxeldr.s @@ -85,31 +85,31 @@ start: cld # string ops inc addl %ebx, %ecx # the PXENV+ struct and pushl %ecx # save it on the stack movw $welcome_msg, %si # %ds:(%si) -> welcome message - call putstr # display the welcome message + callw putstr # display the welcome message # # Setup the arguments that the loader is expecting from boot[12] # movw $bootinfo_msg, %si # %ds:(%si) -> boot args message - call putstr # display the message - movl $MEM_ARG, %ebx # %ds:(%ebx) -> boot args + callw putstr # display the message + movl $MEM_ARG, %bx # %ds:(%bx) -> boot args movw %bx, %di # %es:(%di) -> boot args xorl %eax, %eax # zero %eax movw $(MEM_ARG_SIZE/4), %cx # Size of arguments in 32-bit # dwords rep # Clear the arguments stosl # to zero - orb $KARGS_FLAGS_PXE, 0x8(%ebx) # kargs->bootflags |= + orb $KARGS_FLAGS_PXE, 0x8(%bx) # kargs->bootflags |= # KARGS_FLAGS_PXE - popl 0xc(%ebx) # kargs->pxeinfo = *PXENV+ + popl 0xc(%bx) # kargs->pxeinfo = *PXENV+ # # Turn on the A20 address line # - call seta20 # Turn A20 on + callw seta20 # Turn A20 on # # Relocate the loader and BTX using a very lazy protected mode # movw $relocate_msg, %si # Display the - call putstr # relocation message + callw putstr # relocation message movl end+AOUT_ENTRY, %edi # %edi is the destination movl $(end+AOUT_HEADER), %esi # %esi is # the start of the text @@ -121,9 +121,8 @@ start: cld # string ops inc movl %cr0, %eax # Turn on orb $0x1, %al # protected movl %eax, %cr0 # mode - .byte 0xea # long jump to - .word pm_start # clear the instruction - .word SEL_SCODE # pre-fetch queue + ljmp $SEL_SCODE,$pm_start # long jump to clear the + # instruction pre-fetch queue .code32 pm_start: movw $SEL_SDATA, %ax # Initialize movw %ax, %ds # %ds and @@ -155,9 +154,8 @@ pm_16: movw $SEL_RDATA, %ax # Initialize movl %cr0, %eax # Turn off andb $~0x1, %al # protected movl %eax, %cr0 # mode - .byte 0xea # Long jump to - .word pm_end # clear the instruction - .word 0x0 # pre-fetch + ljmp $0,$pm_end # Long jump to clear the + # instruction pre-fetch queue pm_end: sti # Turn interrupts back on now # # Copy the BTX client to MEM_BTX_CLIENT @@ -188,10 +186,8 @@ pm_end: sti # Turn interrupts back on now # Now we just start up BTX and let it do the rest # movw $jump_message, %si # Display the - call putstr # jump message - .byte 0xea # Jump to - .word MEM_BTX_ENTRY # BTX entry - .word 0x0 # point + callw putstr # jump message + ljmp $0,$MEM_BTX_ENTRY # Jump to the BTX entry point # # Display a null-terminated string @@ -199,7 +195,7 @@ pm_end: sti # Turn interrupts back on now putstr: lodsb # load %al from %ds:(%si) testb %al,%al # stop at null jnz putc # if the char != null, output it - ret # return when null is hit + retw # return when null is hit putc: movw $0x7,%bx # attribute for output movb $0xe,%ah # BIOS: put_char int $0x10 # call BIOS, print char in %al @@ -220,7 +216,7 @@ seta20.2: inb $0x64,%al # Get status movb $0xdf,%al # Enable outb %al,$0x60 # A20 sti # Enable interrupts - ret # To caller + retw # To caller # # BTX client to start btxldr -- cgit v1.1