diskstart: move writestr_early out of boot sector
authorH. Peter Anvin <hpa@linux.intel.com>
Tue, 25 Jan 2011 22:11:11 +0000 (14:11 -0800)
committerH. Peter Anvin <hpa@linux.intel.com>
Tue, 25 Jan 2011 22:11:11 +0000 (14:11 -0800)
We can save 8 bytes in the boot sector by moving writestr_early out
and putting the real routine in sector 1.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
core/diskboot.inc
core/diskstart.inc

index 8f04f37..4a730b0 100644 (file)
@@ -390,8 +390,15 @@ kaboom:
                pop dword [fdctab]      ; Restore FDC table
 .patch:                                        ; When we have full code, intercept here
                mov si,bailmsg
-               call writestr_early
+.loop:         lodsb
+               and al,al
+                jz .done
+               mov ah,0Eh              ; Write to screen as TTY
+               mov bx,0007h            ; Attribute
+               int 10h
+               jmp short .loop
 
+.done:
                xor ax,ax
 .again:                int 16h                 ; Wait for keypress
                                        ; NB: replaced by int 18h if
@@ -401,24 +408,6 @@ kaboom:
                jmp short .norge
 
 ;
-;
-; writestr_early: write a null-terminated string to the console
-;          This assumes we're on page 0.  This is only used for early
-;           messages, so it should be OK.
-;
-writestr_early:
-               pushad
-.loop:         lodsb
-               and al,al
-                jz .return
-               mov ah,0Eh              ; Write to screen as TTY
-               mov bx,0007h            ; Attribute
-               int 10h
-               jmp short .loop
-.return:       popad
-               ret
-
-;
 ; INT 13h wrapper function
 ;
 xint13:
index 9280f7d..4e2d1fc 100644 (file)
@@ -370,6 +370,24 @@ maxtrans:
 .ok:           ret
 
 ;
+;
+; writestr_early: write a null-terminated string to the console
+;          This assumes we're on page 0.  This is only used for early
+;           messages, so it should be OK.
+;
+writestr_early:
+               pushad
+.loop:         lodsb
+               and al,al
+                jz .return
+               mov ah,0Eh              ; Write to screen as TTY
+               mov bx,0007h            ; Attribute
+               int 10h
+               jmp short .loop
+.return:       popad
+               ret
+
+;
 ; Checksum error message
 ;
 checksumerr_msg        db ' Load error - ', 0  ; Boot failed appended