2009-08-14 Pavel Roskin <proski@gnu.org>
* boot/i386/pc/cdboot.S: Use LOCAL for local labels. Eliminate ABS and APPLE_CC. * boot/i386/pc/diskboot.S: Likewise. * boot/i386/pc/lnxboot.S: Likewise. Hardcode the number of code sectors allow compilation on MacOSX. * conf/i386-pc.rmk: Enable unconditional compilation of lnxboot.img.
This commit is contained in:
parent
9a10df160e
commit
d404ee5646
5 changed files with 63 additions and 164 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2009-08-14 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* boot/i386/pc/cdboot.S: Use LOCAL for local labels. Eliminate
|
||||||
|
ABS and APPLE_CC.
|
||||||
|
* boot/i386/pc/diskboot.S: Likewise.
|
||||||
|
* boot/i386/pc/lnxboot.S: Likewise. Hardcode the number of code
|
||||||
|
sectors allow compilation on MacOSX.
|
||||||
|
* conf/i386-pc.rmk: Enable unconditional compilation of
|
||||||
|
lnxboot.img.
|
||||||
|
|
||||||
2009-08-13 Colin Watson <cjwatson@ubuntu.com>
|
2009-08-13 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
* util/grub-mkconfig.in: Export GRUB_HIDDEN_TIMEOUT.
|
* util/grub-mkconfig.in: Export GRUB_HIDDEN_TIMEOUT.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grub/symbol.h>
|
||||||
#include <grub/boot.h>
|
#include <grub/boot.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
|
@ -38,9 +39,9 @@
|
||||||
|
|
||||||
start:
|
start:
|
||||||
_start:
|
_start:
|
||||||
call next
|
call LOCAL(next)
|
||||||
|
|
||||||
next:
|
LOCAL(next):
|
||||||
jmp 1f
|
jmp 1f
|
||||||
|
|
||||||
. = start + 8
|
. = start + 8
|
||||||
|
@ -67,24 +68,17 @@ bi_reserved:
|
||||||
movw %ax, %ds
|
movw %ax, %ds
|
||||||
movw %ax, %es
|
movw %ax, %es
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
err_noboot_msg_abs = 0x7C00 + err_noboot_msg - start
|
|
||||||
movw $err_noboot_msg_abs, %si
|
|
||||||
bi_length_dif = bi_length - next
|
|
||||||
movl %cs:bi_length_dif(%bx), %ecx
|
|
||||||
#else
|
|
||||||
movw $(0x7C00 + err_noboot_msg - start), %si
|
movw $(0x7C00 + err_noboot_msg - start), %si
|
||||||
movl %cs: bi_length - next(%bx), %ecx
|
movl %cs: bi_length - LOCAL(next)(%bx), %ecx
|
||||||
#endif
|
|
||||||
orl %ecx, %ecx
|
orl %ecx, %ecx
|
||||||
jz fail
|
jz LOCAL(fail)
|
||||||
|
|
||||||
addl $((1 << CDSEC_SHIFT) - 1), %ecx
|
addl $((1 << CDSEC_SHIFT) - 1), %ecx
|
||||||
shrl $CDSEC_SHIFT, %ecx
|
shrl $CDSEC_SHIFT, %ecx
|
||||||
|
|
||||||
movl %cs: bi_file - next(%bx), %esi
|
movl %cs: bi_file - LOCAL(next)(%bx), %esi
|
||||||
|
|
||||||
call read_cdrom
|
call LOCAL(read_cdrom)
|
||||||
|
|
||||||
ljmp $(DATA_ADDR >> 4), $0
|
ljmp $(DATA_ADDR >> 4), $0
|
||||||
|
|
||||||
|
@ -93,7 +87,7 @@ bi_reserved:
|
||||||
* esi: start sector
|
* esi: start sector
|
||||||
* ecx: number of sectors
|
* ecx: number of sectors
|
||||||
*/
|
*/
|
||||||
read_cdrom:
|
LOCAL(read_cdrom):
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
|
|
||||||
/* Number of blocks to read. */
|
/* Number of blocks to read. */
|
||||||
|
@ -134,7 +128,7 @@ read_cdrom:
|
||||||
|
|
||||||
2:
|
2:
|
||||||
shrw $1, %di /* Reduce transfer size. */
|
shrw $1, %di /* Reduce transfer size. */
|
||||||
jz cdrom_fail
|
jz LOCAL(cdrom_fail)
|
||||||
movw %di, 0x10(%si)
|
movw %di, 0x10(%si)
|
||||||
movw %di, 2(%si)
|
movw %di, 2(%si)
|
||||||
movb $0x42, %ah
|
movb $0x42, %ah
|
||||||
|
@ -155,15 +149,10 @@ read_cdrom:
|
||||||
addw $0x12, %sp
|
addw $0x12, %sp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
cdrom_fail:
|
LOCAL(cdrom_fail):
|
||||||
#ifdef APPLE_CC
|
|
||||||
err_cdfail_msg_abs = 0x7C00 + err_cdfail_msg - start
|
|
||||||
movw $(err_cdfail_msg_abs), %si
|
|
||||||
#else
|
|
||||||
movw $(0x7C00 + err_cdfail_msg - start), %si
|
movw $(0x7C00 + err_cdfail_msg - start), %si
|
||||||
#endif
|
|
||||||
|
|
||||||
fail:
|
LOCAL(fail):
|
||||||
movb $0x0e, %ah
|
movb $0x0e, %ah
|
||||||
xorw %bx, %bx
|
xorw %bx, %bx
|
||||||
1:
|
1:
|
||||||
|
|
|
@ -16,23 +16,14 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grub/symbol.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* defines for the code go here
|
* defines for the code go here
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Absolute addresses
|
#define MSG(x) movw $x, %si; call LOCAL(message)
|
||||||
This makes the assembler generate the address without support
|
|
||||||
from the linker. (ELF can't relocate 16-bit addresses!) */
|
|
||||||
#define ABS(x) (x-_start+GRUB_BOOT_MACHINE_KERNEL_ADDR)
|
|
||||||
|
|
||||||
/* Print message string */
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
#define MSG(x) x ## _abs = ABS(x); mov $x ## _abs, %esi; call message
|
|
||||||
#else
|
|
||||||
#define MSG(x) movw $ABS(x), %si; call message
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.file "diskboot.S"
|
.file "diskboot.S"
|
||||||
|
|
||||||
|
@ -65,33 +56,27 @@ _start:
|
||||||
popw %si
|
popw %si
|
||||||
|
|
||||||
/* this sets up for the first run through "bootloop" */
|
/* this sets up for the first run through "bootloop" */
|
||||||
#ifdef APPLE_CC
|
movw $(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE), %di
|
||||||
firstlist_off_abs = ABS (firstlist - GRUB_BOOT_MACHINE_LIST_SIZE)
|
|
||||||
movl $firstlist_off_abs, %edi
|
|
||||||
#else
|
|
||||||
movw $ABS(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE), %di
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* save the sector number of the second sector in %ebp */
|
/* save the sector number of the second sector in %ebp */
|
||||||
movl (%di), %ebp
|
movl (%di), %ebp
|
||||||
|
|
||||||
/* this is the loop for reading the rest of the kernel in */
|
/* this is the loop for reading the rest of the kernel in */
|
||||||
bootloop:
|
LOCAL(bootloop):
|
||||||
|
|
||||||
/* check the number of sectors to read */
|
/* check the number of sectors to read */
|
||||||
cmpw $0, 8(%di)
|
cmpw $0, 8(%di)
|
||||||
|
|
||||||
/* if zero, go to the start function */
|
/* if zero, go to the start function */
|
||||||
je bootit
|
je LOCAL(bootit)
|
||||||
|
|
||||||
setup_sectors:
|
LOCAL(setup_sectors):
|
||||||
/* check if we use LBA or CHS */
|
/* check if we use LBA or CHS */
|
||||||
cmpb $0, -1(%si)
|
cmpb $0, -1(%si)
|
||||||
|
|
||||||
/* jump to chs_mode if zero */
|
/* use CHS if zero, LBA otherwise */
|
||||||
je chs_mode
|
je LOCAL(chs_mode)
|
||||||
|
|
||||||
lba_mode:
|
|
||||||
/* load logical sector start */
|
/* load logical sector start */
|
||||||
movl (%di), %ebx
|
movl (%di), %ebx
|
||||||
movl 4(%di), %ecx
|
movl 4(%di), %ecx
|
||||||
|
@ -150,16 +135,16 @@ lba_mode:
|
||||||
movb $0x42, %ah
|
movb $0x42, %ah
|
||||||
int $0x13
|
int $0x13
|
||||||
|
|
||||||
jc read_error
|
jc LOCAL(read_error)
|
||||||
|
|
||||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||||
jmp copy_buffer
|
jmp LOCAL(copy_buffer)
|
||||||
|
|
||||||
chs_mode:
|
LOCAL(chs_mode):
|
||||||
/* load logical sector start (top half) */
|
/* load logical sector start (top half) */
|
||||||
movl 4(%di), %eax
|
movl 4(%di), %eax
|
||||||
orl %eax, %eax
|
orl %eax, %eax
|
||||||
jnz geometry_error
|
jnz LOCAL(geometry_error)
|
||||||
|
|
||||||
/* load logical sector start (bottom half) */
|
/* load logical sector start (bottom half) */
|
||||||
movl (%di), %eax
|
movl (%di), %eax
|
||||||
|
@ -184,7 +169,7 @@ chs_mode:
|
||||||
|
|
||||||
/* do we need too many cylinders? */
|
/* do we need too many cylinders? */
|
||||||
cmpw 8(%si), %ax
|
cmpw 8(%si), %ax
|
||||||
jge geometry_error
|
jge LOCAL(geometry_error)
|
||||||
|
|
||||||
/* determine the maximum sector length of this read */
|
/* determine the maximum sector length of this read */
|
||||||
movw (%si), %ax /* get number of sectors per track/head */
|
movw (%si), %ax /* get number of sectors per track/head */
|
||||||
|
@ -254,12 +239,12 @@ chs_mode:
|
||||||
movb $0x2, %ah /* function 2 */
|
movb $0x2, %ah /* function 2 */
|
||||||
int $0x13
|
int $0x13
|
||||||
|
|
||||||
jc read_error
|
jc LOCAL(read_error)
|
||||||
|
|
||||||
/* save source segment */
|
/* save source segment */
|
||||||
movw %es, %bx
|
movw %es, %bx
|
||||||
|
|
||||||
copy_buffer:
|
LOCAL(copy_buffer):
|
||||||
|
|
||||||
/* load addresses for copy from disk buffer to destination */
|
/* load addresses for copy from disk buffer to destination */
|
||||||
movw 10(%di), %es /* load destination segment */
|
movw 10(%di), %es /* load destination segment */
|
||||||
|
@ -299,17 +284,17 @@ copy_buffer:
|
||||||
|
|
||||||
/* check if finished with this dataset */
|
/* check if finished with this dataset */
|
||||||
cmpw $0, 8(%di)
|
cmpw $0, 8(%di)
|
||||||
jne setup_sectors
|
jne LOCAL(setup_sectors)
|
||||||
|
|
||||||
/* update position to load from */
|
/* update position to load from */
|
||||||
subw $GRUB_BOOT_MACHINE_LIST_SIZE, %di
|
subw $GRUB_BOOT_MACHINE_LIST_SIZE, %di
|
||||||
|
|
||||||
/* jump to bootloop */
|
/* jump to bootloop */
|
||||||
jmp bootloop
|
jmp LOCAL(bootloop)
|
||||||
|
|
||||||
/* END OF MAIN LOOP */
|
/* END OF MAIN LOOP */
|
||||||
|
|
||||||
bootit:
|
LOCAL(bootit):
|
||||||
/* print a newline */
|
/* print a newline */
|
||||||
MSG(notification_done)
|
MSG(notification_done)
|
||||||
popw %dx /* this makes sure %dl is our "boot" drive */
|
popw %dx /* this makes sure %dl is our "boot" drive */
|
||||||
|
@ -319,21 +304,21 @@ bootit:
|
||||||
/*
|
/*
|
||||||
* BIOS Geometry translation error (past the end of the disk geometry!).
|
* BIOS Geometry translation error (past the end of the disk geometry!).
|
||||||
*/
|
*/
|
||||||
geometry_error:
|
LOCAL(geometry_error):
|
||||||
MSG(geometry_error_string)
|
MSG(geometry_error_string)
|
||||||
jmp general_error
|
jmp LOCAL(general_error)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read error on the disk.
|
* Read error on the disk.
|
||||||
*/
|
*/
|
||||||
read_error:
|
LOCAL(read_error):
|
||||||
MSG(read_error_string)
|
MSG(read_error_string)
|
||||||
|
|
||||||
general_error:
|
LOCAL(general_error):
|
||||||
MSG(general_error_string)
|
MSG(general_error_string)
|
||||||
|
|
||||||
/* go here when you need to stop the machine hard after an error condition */
|
/* go here when you need to stop the machine hard after an error condition */
|
||||||
stop: jmp stop
|
LOCAL(stop): jmp LOCAL(stop)
|
||||||
|
|
||||||
notification_string: .asciz "loading"
|
notification_string: .asciz "loading"
|
||||||
|
|
||||||
|
@ -361,12 +346,11 @@ general_error_string: .asciz " Error"
|
||||||
int $0x10 /* display a byte */
|
int $0x10 /* display a byte */
|
||||||
|
|
||||||
incw %si
|
incw %si
|
||||||
message:
|
LOCAL(message):
|
||||||
movb (%si), %al
|
movb (%si), %al
|
||||||
cmpb $0, %al
|
cmpb $0, %al
|
||||||
jne 1b /* if not end of string, jmp to display */
|
jne 1b /* if not end of string, jmp to display */
|
||||||
ret
|
ret
|
||||||
lastlist:
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This area is an empty space between the main body of code below which
|
* This area is an empty space between the main body of code below which
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <grub/symbol.h>
|
||||||
#include <grub/boot.h>
|
#include <grub/boot.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
|
@ -25,14 +26,8 @@
|
||||||
|
|
||||||
.file "lnxboot.S"
|
.file "lnxboot.S"
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
#error Building lnxboot.img with Apple's as results in an unusable image
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CODE_ADDR 0x6000
|
#define CODE_ADDR 0x6000
|
||||||
#ifndef APPLE_CC
|
#define CODE_SECTORS 1
|
||||||
#define CODE_LENG (code_end - start)
|
|
||||||
#endif
|
|
||||||
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
|
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
|
||||||
|
|
||||||
#define BLCK_LENG 0x4000
|
#define BLCK_LENG 0x4000
|
||||||
|
@ -45,17 +40,12 @@
|
||||||
|
|
||||||
data_start:
|
data_start:
|
||||||
xorl %ebp, %ebp
|
xorl %ebp, %ebp
|
||||||
jmp linux_next
|
jmp LOCAL(linux_next)
|
||||||
|
|
||||||
. = data_start + 0x1F1
|
. = data_start + 0x1F1
|
||||||
|
|
||||||
setup_sects:
|
setup_sects:
|
||||||
/* Apple's cc can't fill this value. */
|
.byte CODE_SECTORS
|
||||||
#ifdef APPLE_CC
|
|
||||||
.byte 0
|
|
||||||
#else
|
|
||||||
.byte (CODE_LENG >> 9)
|
|
||||||
#endif
|
|
||||||
root_flags:
|
root_flags:
|
||||||
.word 0
|
.word 0
|
||||||
syssize:
|
syssize:
|
||||||
|
@ -74,7 +64,7 @@ boot_flag:
|
||||||
start:
|
start:
|
||||||
_start:
|
_start:
|
||||||
|
|
||||||
jmp linux_init
|
jmp LOCAL(linux_init)
|
||||||
|
|
||||||
.ascii "HdrS" /* Header signature. */
|
.ascii "HdrS" /* Header signature. */
|
||||||
.word 0x0203 /* Header version number. */
|
.word 0x0203 /* Header version number. */
|
||||||
|
@ -132,40 +122,22 @@ reg_edx:
|
||||||
data_leng:
|
data_leng:
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
linux_init:
|
LOCAL(linux_init):
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
reg_edx_rel = reg_edx - start
|
|
||||||
code32_start_rel = code32_start - start
|
|
||||||
movw %cs:(reg_edx_rel), %dx
|
|
||||||
movl %cs:(code32_start_rel), %ebp
|
|
||||||
#else
|
|
||||||
movw %cs:(reg_edx - start), %dx
|
movw %cs:(reg_edx - start), %dx
|
||||||
movl %cs:(code32_start - start), %ebp
|
movl %cs:(code32_start - start), %ebp
|
||||||
#endif
|
|
||||||
|
|
||||||
linux_next:
|
LOCAL(linux_next):
|
||||||
|
|
||||||
call normalize
|
call LOCAL(normalize)
|
||||||
|
|
||||||
normalize:
|
LOCAL(normalize):
|
||||||
popw %bx
|
popw %bx
|
||||||
#ifdef APPLE_CC
|
subw $(LOCAL(normalize) - start), %bx
|
||||||
normalize_rel = normalize - start
|
|
||||||
subw $(normalize_rel), %bx
|
|
||||||
#else
|
|
||||||
subw $(normalize - start), %bx
|
|
||||||
#endif
|
|
||||||
shrw $4, %bx
|
shrw $4, %bx
|
||||||
movw %cs, %ax
|
movw %cs, %ax
|
||||||
addw %bx, %ax
|
addw %bx, %ax
|
||||||
pushw %ax
|
pushw %ax
|
||||||
#ifdef APPLE_CC
|
|
||||||
real_code_rel = real_code - start
|
|
||||||
pushw $(real_code_rel)
|
|
||||||
#else
|
|
||||||
pushw $(real_code - start)
|
pushw $(real_code - start)
|
||||||
#endif
|
|
||||||
lret /* Jump to real_code. */
|
lret /* Jump to real_code. */
|
||||||
|
|
||||||
real_code:
|
real_code:
|
||||||
|
@ -191,13 +163,7 @@ real_code:
|
||||||
|
|
||||||
rep
|
rep
|
||||||
movsl
|
movsl
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
real_code_2_rel = real_code_2 - start
|
|
||||||
ljmp $(CODE_ADDR >> 4), $(real_code_2_rel)
|
|
||||||
#else
|
|
||||||
ljmp $(CODE_ADDR >> 4), $(real_code_2 - start)
|
ljmp $(CODE_ADDR >> 4), $(real_code_2 - start)
|
||||||
#endif
|
|
||||||
|
|
||||||
real_code_2:
|
real_code_2:
|
||||||
|
|
||||||
|
@ -216,21 +182,14 @@ real_code_2:
|
||||||
addl %ecx, %esi
|
addl %ecx, %esi
|
||||||
movl $DATA_ADDR, %edi
|
movl $DATA_ADDR, %edi
|
||||||
|
|
||||||
call move_memory
|
call LOCAL(move_memory)
|
||||||
|
|
||||||
/* Check for multiboot signature. */
|
/* Check for multiboot signature. */
|
||||||
cmpl $MULTIBOOT_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
|
cmpl $MULTIBOOT_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
|
||||||
jz 1f
|
jz 1f
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
ramdisk_image_rel = ramdisk_image - start
|
|
||||||
ramdisk_size_rel = ramdisk_size - start
|
|
||||||
movl (ramdisk_image_rel), %esi
|
|
||||||
movl (ramdisk_size_rel), %ecx
|
|
||||||
#else
|
|
||||||
movl (ramdisk_image - start), %esi
|
movl (ramdisk_image - start), %esi
|
||||||
movl (ramdisk_size - start), %ecx
|
movl (ramdisk_size - start), %ecx
|
||||||
#endif
|
|
||||||
movl $(DATA_ADDR - 0x200), %edi
|
movl $(DATA_ADDR - 0x200), %edi
|
||||||
jmp 2f
|
jmp 2f
|
||||||
|
|
||||||
|
@ -240,17 +199,11 @@ real_code_2:
|
||||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
|
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
|
||||||
|
|
||||||
2:
|
2:
|
||||||
call move_memory
|
call LOCAL(move_memory)
|
||||||
|
|
||||||
movsbl %dh, %eax
|
movsbl %dh, %eax
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART)
|
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART)
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
|
||||||
reg_edx_rel = reg_edx - start
|
|
||||||
movsbl (reg_edx_rel + 2), %eax
|
|
||||||
#else
|
|
||||||
movsbl (reg_edx + 2 - start), %eax
|
movsbl (reg_edx + 2 - start), %eax
|
||||||
#endif
|
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART)
|
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART)
|
||||||
|
|
||||||
movb $0xFF, %dh
|
movb $0xFF, %dh
|
||||||
|
@ -264,7 +217,7 @@ real_code_2:
|
||||||
* ecx: number of bytes
|
* ecx: number of bytes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
move_memory:
|
LOCAL(move_memory):
|
||||||
incl %ecx
|
incl %ecx
|
||||||
andb $0xFE, %cl
|
andb $0xFE, %cl
|
||||||
pushw %dx
|
pushw %dx
|
||||||
|
@ -279,28 +232,6 @@ move_memory:
|
||||||
pushl %ecx
|
pushl %ecx
|
||||||
|
|
||||||
movl %esi, %eax
|
movl %esi, %eax
|
||||||
#ifdef APPLE_CC
|
|
||||||
gdt_src1_rel = gdt_src1 - start
|
|
||||||
gdt_src2_rel = gdt_src2 - start
|
|
||||||
gdt_dst1_rel = gdt_dst1 - start
|
|
||||||
gdt_dst2_rel = gdt_dst2 - start
|
|
||||||
gdt_rel = gdt - start
|
|
||||||
|
|
||||||
movw %si, (gdt_src1_rel)
|
|
||||||
shrl $16, %eax
|
|
||||||
movb %al, (gdt_src1_rel + 2)
|
|
||||||
movb %ah, (gdt_src2_rel)
|
|
||||||
|
|
||||||
movl %edi, %eax
|
|
||||||
movw %di, (gdt_dst1_rel)
|
|
||||||
shrl $16, %eax
|
|
||||||
movb %al, (gdt_dst1_rel + 2)
|
|
||||||
movb %ah, (gdt_dst2_rel)
|
|
||||||
|
|
||||||
movw $(gdt_rel), %si
|
|
||||||
movb $0x87, %ah
|
|
||||||
shrw $1, %cx
|
|
||||||
#else
|
|
||||||
movw %si, (gdt_src1 - start)
|
movw %si, (gdt_src1 - start)
|
||||||
shrl $16, %eax
|
shrl $16, %eax
|
||||||
movb %al, (gdt_src1 + 2 - start)
|
movb %al, (gdt_src1 + 2 - start)
|
||||||
|
@ -315,7 +246,6 @@ move_memory:
|
||||||
movw $(gdt - start), %si
|
movw $(gdt - start), %si
|
||||||
movb $0x87, %ah
|
movb $0x87, %ah
|
||||||
shrw $1, %cx
|
shrw $1, %cx
|
||||||
#endif
|
|
||||||
|
|
||||||
int $0x15
|
int $0x15
|
||||||
|
|
||||||
|
@ -325,13 +255,8 @@ move_memory:
|
||||||
popl %esi
|
popl %esi
|
||||||
|
|
||||||
jnc 2f
|
jnc 2f
|
||||||
#ifdef APPLE_CC
|
|
||||||
err_int15_msg_rel = err_int15_msg - start
|
|
||||||
movw $(err_int15_msg_rel), %si
|
|
||||||
#else
|
|
||||||
movw $(err_int15_msg - start), %si
|
movw $(err_int15_msg - start), %si
|
||||||
#endif
|
jmp LOCAL(fail)
|
||||||
jmp fail
|
|
||||||
|
|
||||||
2:
|
2:
|
||||||
|
|
||||||
|
@ -349,7 +274,7 @@ move_memory:
|
||||||
* si: message
|
* si: message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fail:
|
LOCAL(fail):
|
||||||
movb $0x0e, %ah
|
movb $0x0e, %ah
|
||||||
xorw %bx, %bx
|
xorw %bx, %bx
|
||||||
1:
|
1:
|
||||||
|
@ -362,11 +287,4 @@ fail:
|
||||||
err_int15_msg:
|
err_int15_msg:
|
||||||
.ascii "move memory fails\0"
|
.ascii "move memory fails\0"
|
||||||
|
|
||||||
/* Unsupported feature in Apple's cc. */
|
. = _start + CODE_SECTORS * 512
|
||||||
#ifndef APPLE_CC
|
|
||||||
. = (. & (~0x1FF)) + 0x1FF
|
|
||||||
#endif
|
|
||||||
|
|
||||||
.byte 0
|
|
||||||
|
|
||||||
code_end:
|
|
||||||
|
|
|
@ -10,7 +10,8 @@ COMMON_LDFLAGS = -m32 -nostdlib
|
||||||
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
|
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img cdboot.img
|
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
||||||
|
pxeboot.img
|
||||||
|
|
||||||
# For boot.img.
|
# For boot.img.
|
||||||
boot_img_SOURCES = boot/i386/pc/boot.S
|
boot_img_SOURCES = boot/i386/pc/boot.S
|
||||||
|
@ -31,9 +32,6 @@ diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)8000
|
||||||
diskboot_img_FORMAT = binary
|
diskboot_img_FORMAT = binary
|
||||||
|
|
||||||
# For lnxboot.img.
|
# For lnxboot.img.
|
||||||
ifeq ($(TARGET_APPLE_CC), 0)
|
|
||||||
pkglib_IMAGES += lnxboot.img
|
|
||||||
endif
|
|
||||||
lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
|
lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
|
||||||
lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)6000
|
lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)6000
|
||||||
|
|
Loading…
Reference in a new issue