aboutsummaryrefslogtreecommitdiffstats
path: root/mbr
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-07-11 17:37:00 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-07-11 17:37:00 -0700
commitb033154be62ec4ebd5831e09241af7f7971a7da1 (patch)
tree142e62e078bab87cf0568eb1425e996bf8cbdacd /mbr
parente8c07079cbf59fdd85e9e434dce9dcda1c217961 (diff)
downloadlwip-b033154be62ec4ebd5831e09241af7f7971a7da1.tar.gz
lwip-b033154be62ec4ebd5831e09241af7f7971a7da1.tar.xz
lwip-b033154be62ec4ebd5831e09241af7f7971a7da1.zip
MBR: shave another ~4 bytes through an ugly error message hack
Use the "return address points to data" trick to shave a few bytes off the generation of error messages.
Diffstat (limited to 'mbr')
-rw-r--r--mbr/mbr.S39
1 files changed, 17 insertions, 22 deletions
diff --git a/mbr/mbr.S b/mbr/mbr.S
index 06e19805..424c46d5 100644
--- a/mbr/mbr.S
+++ b/mbr/mbr.S
@@ -105,7 +105,10 @@ next:
call scan_partition_table
/* If we get here, we have no OS */
- jmp missing_os
+missing_os:
+ call error
+ .ascii "Missing operating system.\r\n"
+ .byte 0
/*
* read_sector: read a single sector pointed to by %eax to 0x7c00.
@@ -241,6 +244,11 @@ scan_partition_table:
popal
ret
+too_many_active:
+ call error
+ .ascii "Multiple active partitions.\r\n"
+ .byte 0
+
/*
* boot: invoke the actual bootstrap. (%si) points to the partition
* table entry, and 28(%bp) has the partition table base.
@@ -260,20 +268,17 @@ boot:
cli
jmp bootsec
-/*
- * error messages
- */
-missing_os:
- movw $missing_os_msg, %si
- jmp error
disk_error:
- movw $disk_error_msg, %si
- jmp error
-too_many_active:
- movw $too_many_active_msg, %si
- /* jmp error */
+ call error
+ .ascii "Operating system load error.\r\n"
+ .byte 0
+/*
+ * Print error messages. This is invoked with "call", with the
+ * error message at the return address.
+ */
error:
+ popw %si
2:
lodsb
andb %al, %al
@@ -288,13 +293,3 @@ error:
die:
hlt
jmp die
-
-missing_os_msg:
- .ascii "Missing operating system.\r\n"
- .byte 0
-disk_error_msg:
- .ascii "Operating system load error.\r\n"
- .byte 0
-too_many_active_msg:
- .ascii "Multiple active partitions.\r\n"
- .byte 0