diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-07-11 17:37:00 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-07-11 17:37:00 -0700 |
commit | b033154be62ec4ebd5831e09241af7f7971a7da1 (patch) | |
tree | 142e62e078bab87cf0568eb1425e996bf8cbdacd /mbr/mbr.S | |
parent | e8c07079cbf59fdd85e9e434dce9dcda1c217961 (diff) | |
download | syslinux-b033154be62ec4ebd5831e09241af7f7971a7da1.tar.gz syslinux-b033154be62ec4ebd5831e09241af7f7971a7da1.tar.xz syslinux-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/mbr.S')
-rw-r--r-- | mbr/mbr.S | 39 |
1 files changed, 17 insertions, 22 deletions
@@ -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 |