[prefix] Add printing functions to libprefix.S

Move the printing functions from pxeprefix.S into libprefix.S, so they
are available for debug from any prefix.
This commit is contained in:
Michael Brown
2008-03-11 11:32:19 +00:00
parent 12f203c606
commit 297002d7bd
3 changed files with 112 additions and 128 deletions
-106
View File
@@ -320,112 +320,6 @@ print_free_basemem:
finished:
jmp run_etherboot
/*****************************************************************************
* Subroutine: print character (with LF -> LF,CR translation)
*
* Parameters:
* %al : character to print
* Returns:
* Nothing
*****************************************************************************
*/
print_character:
/* Preserve registers */
pushw %ax
pushw %bx
pushw %bp
/* Print character */
movw $0x0007, %bx /* page 0, attribute 7 (normal) */
movb $0x0e, %ah /* write char, tty mode */
cmpb $0x0a, %al /* '\n'? */
jne 1f
int $0x10
movb $0x0d, %al
1: int $0x10
/* Restore registers and return */
popw %bp
popw %bx
popw %ax
ret
/*****************************************************************************
* Subroutine: print a NUL-terminated string
*
* Parameters:
* %ds:%si : string to print
* Returns:
* Nothing
*****************************************************************************
*/
print_message:
/* Preserve registers */
pushw %ax
pushw %si
/* Print string */
1: lodsb
testb %al, %al
je 2f
call print_character
jmp 1b
2: /* Restore registers and return */
popw %si
popw %ax
ret
/*****************************************************************************
* Subroutine: print hex digit
*
* Parameters:
* %al (low nibble) : digit to print
* Returns:
* Nothing
*****************************************************************************
*/
print_hex_nibble:
/* Preserve registers */
pushw %ax
/* Print digit (technique by Norbert Juffa <norbert.juffa@amd.com> */
andb $0x0f, %al
cmpb $10, %al
sbbb $0x69, %al
das
call print_character
/* Restore registers and return */
popw %ax
ret
/*****************************************************************************
* Subroutine: print hex byte
*
* Parameters:
* %al : byte to print
* Returns:
* Nothing
*****************************************************************************
*/
print_hex_byte:
rorb $4, %al
call print_hex_nibble
rorb $4, %al
call print_hex_nibble
ret
/*****************************************************************************
* Subroutine: print hex word
*
* Parameters:
* %ax : word to print
* Returns:
* Nothing
*****************************************************************************
*/
print_hex_word:
xchgb %al, %ah
call print_hex_byte
xchgb %al, %ah
call print_hex_byte
ret
/*****************************************************************************
* Subroutine: print segment:offset address
*