Simplify Apple CC support.
* commands/i386/pc/drivemap_int13h.S: Use LOCAL when possible. Add 0 byte at the end not to have a symbol with empty target. * mmap/i386/pc/mmap_helper.S: Likewise. * genmk.rb: Ignore errors 2030 and 2050. * kern/i386/pc/startup.S: Use LOCAL when possible.
This commit is contained in:
parent
8d2977bb7a
commit
969d1c782d
5 changed files with 58 additions and 86 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2010-03-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Simplify Apple CC support.
|
||||
|
||||
* commands/i386/pc/drivemap_int13h.S: Use LOCAL when possible.
|
||||
Add 0 byte at the end not to have a symbol with empty target.
|
||||
* mmap/i386/pc/mmap_helper.S: Likewise.
|
||||
* genmk.rb: Ignore errors 2030 and 2050.
|
||||
* kern/i386/pc/startup.S: Use LOCAL when possible.
|
||||
|
||||
2010-03-26 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
Testcase and the fix for final semicolon on cmdline.
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define INT13H_OFFSET(x) ((x) - EXT_C(grub_drivemap_handler))
|
||||
#define INT13H_OFFSET(x) ((x) - LOCAL (base))
|
||||
|
||||
.code16
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
|||
|
||||
/* The replacement int13 handler. Preserve all registers. */
|
||||
FUNCTION(grub_drivemap_handler)
|
||||
LOCAL (base):
|
||||
/* Save %dx for future restore. */
|
||||
push %dx
|
||||
/* Push flags. Used to simulate interrupt with original flags. */
|
||||
|
@ -35,12 +36,7 @@ FUNCTION(grub_drivemap_handler)
|
|||
/* Map the drive number (always in DL). */
|
||||
push %ax
|
||||
push %bx
|
||||
#ifdef APPLE_CC
|
||||
grub_drivemap_mapstart_ofs = INT13H_OFFSET(EXT_C(grub_drivemap_mapstart))
|
||||
movw $grub_drivemap_mapstart_ofs, %bx
|
||||
#else
|
||||
movw $INT13H_OFFSET(EXT_C(grub_drivemap_mapstart)), %bx
|
||||
#endif
|
||||
movw $INT13H_OFFSET(LOCAL (mapstart)), %bx
|
||||
|
||||
more_remaining:
|
||||
movw %cs:(%bx), %ax
|
||||
|
@ -66,12 +62,7 @@ not_found:
|
|||
popf
|
||||
pushf
|
||||
|
||||
#ifdef APPLE_CC
|
||||
grub_drivemap_oldhandler_ofs = INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
||||
#else
|
||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
||||
#endif
|
||||
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||
|
||||
push %bp
|
||||
mov %sp, %bp
|
||||
|
@ -94,11 +85,7 @@ norestore:
|
|||
popf
|
||||
pushf
|
||||
|
||||
#ifdef APPLE_CC
|
||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
||||
#else
|
||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
||||
#endif
|
||||
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||
|
||||
push %bp
|
||||
mov %sp, %bp
|
||||
|
@ -111,9 +98,13 @@ norestore:
|
|||
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
||||
IVT entries (thus PI:SC in mem). */
|
||||
VARIABLE(grub_drivemap_oldhandler)
|
||||
LOCAL (oldhandler):
|
||||
.word 0x0, 0x0
|
||||
|
||||
/* This label MUST be at the end of the copied block, since the installer code
|
||||
reserves additional space for mappings at runtime and copies them over it. */
|
||||
.align 2
|
||||
.align 2
|
||||
|
||||
VARIABLE(grub_drivemap_mapstart)
|
||||
LOCAL (mapstart):
|
||||
.byte 0
|
||||
|
|
2
genmk.rb
2
genmk.rb
|
@ -161,7 +161,7 @@ else
|
|||
-rm -f $@
|
||||
-rm -f $@.bin
|
||||
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@.bin #{pre_obj} #{mod_obj}
|
||||
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@
|
||||
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -ew2030 -ew2050 -nu -nd $@.bin $@
|
||||
-rm -f $@.bin
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include <multiboot.h>
|
||||
#include <multiboot2.h>
|
||||
|
||||
#define ABS(x) ((x) - _start + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
||||
#define ABS(x) ((x) - LOCAL (base) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
||||
|
||||
.file "startup.S"
|
||||
|
||||
|
@ -66,16 +66,15 @@
|
|||
.globl start, _start
|
||||
start:
|
||||
_start:
|
||||
LOCAL (base):
|
||||
/*
|
||||
* Guarantee that "main" is loaded at 0x0:0x8200.
|
||||
*/
|
||||
#ifdef APPLE_CC
|
||||
codestart_abs = ABS(codestart) - 0x10000
|
||||
ljmp $0, $(codestart_abs)
|
||||
#ifdef __APPLE__
|
||||
ljmp $0, $(ABS(LOCAL (codestart)) - 0x10000)
|
||||
#else
|
||||
ljmp $0, $ABS(codestart)
|
||||
ljmp $0, $ABS(LOCAL (codestart))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compatibility version number
|
||||
*
|
||||
|
@ -183,7 +182,7 @@ multiboot_trampoline:
|
|||
.code16
|
||||
|
||||
/* the real mode code continues... */
|
||||
codestart:
|
||||
LOCAL (codestart):
|
||||
cli /* we're not safe here! */
|
||||
|
||||
/* set up %ds, %ss, and %es */
|
||||
|
@ -1156,7 +1155,7 @@ FUNCTION(grub_console_real_putchar)
|
|||
*/
|
||||
|
||||
/* this table is used in translate_keycode below */
|
||||
translation_table:
|
||||
LOCAL (translation_table):
|
||||
.word GRUB_CONSOLE_KEY_LEFT, GRUB_TERM_LEFT
|
||||
.word GRUB_CONSOLE_KEY_RIGHT, GRUB_TERM_RIGHT
|
||||
.word GRUB_CONSOLE_KEY_UP, GRUB_TERM_UP
|
||||
|
@ -1178,11 +1177,10 @@ translate_keycode:
|
|||
pushw %bx
|
||||
pushw %si
|
||||
|
||||
#ifdef APPLE_CC
|
||||
translation_table_abs = ABS (translation_table) - 0x10000
|
||||
movw $(translation_table_abs), %si
|
||||
#ifdef __APPLE__
|
||||
movw $(ABS(LOCAL (translation_table)) - 0x10000), %si
|
||||
#else
|
||||
movw $ABS(translation_table), %si
|
||||
movw $ABS(LOCAL (translation_table)), %si
|
||||
#endif
|
||||
|
||||
1: lodsw
|
||||
|
|
|
@ -19,32 +19,27 @@
|
|||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define DS(x) ((x) - segstart)
|
||||
#define DS(x) ((x) - LOCAL (segstart))
|
||||
|
||||
segstart:
|
||||
LOCAL (segstart):
|
||||
VARIABLE(grub_machine_mmaphook_start)
|
||||
.code16
|
||||
VARIABLE(grub_machine_mmaphook_int12)
|
||||
push %ds
|
||||
push %cs
|
||||
pop %ds
|
||||
#ifdef APPLE_CC
|
||||
grub_machine_mmaphook_kblow_rel = DS (EXT_C (grub_machine_mmaphook_kblow))
|
||||
movw (grub_machine_mmaphook_kblow_rel), %ax
|
||||
#else
|
||||
movw DS (EXT_C (grub_machine_mmaphook_kblow)), %ax
|
||||
#endif
|
||||
movw DS (LOCAL (kblow)), %ax
|
||||
pop %ds
|
||||
iret
|
||||
|
||||
VARIABLE(grub_machine_mmaphook_int15)
|
||||
pushf
|
||||
cmpw $0xe801, %ax
|
||||
jz e801
|
||||
jz LOCAL (e801)
|
||||
cmpw $0xe820, %ax
|
||||
jz e820
|
||||
jz LOCAL (e820)
|
||||
cmpb $0x88, %ah
|
||||
jz h88
|
||||
jz LOCAL (h88)
|
||||
popf
|
||||
/* ljmp */
|
||||
.byte 0xea
|
||||
|
@ -53,67 +48,44 @@ VARIABLE (grub_machine_mmaphook_int15offset)
|
|||
VARIABLE (grub_machine_mmaphook_int15segment)
|
||||
.word 0
|
||||
|
||||
e801:
|
||||
LOCAL (e801):
|
||||
popf
|
||||
push %ds
|
||||
push %cs
|
||||
pop %ds
|
||||
#ifdef APPLE_CC
|
||||
grub_machine_mmaphook_kbin16mb_rel = DS (EXT_C (grub_machine_mmaphook_kbin16mb))
|
||||
grub_machine_mmaphook_64kbin4gb_rel = DS (EXT_C (grub_machine_mmaphook_64kbin4gb))
|
||||
movw (grub_machine_mmaphook_kbin16mb_rel), %ax
|
||||
movw (grub_machine_mmaphook_64kbin4gb_rel), %bx
|
||||
#else
|
||||
movw DS (EXT_C (grub_machine_mmaphook_kbin16mb)), %ax
|
||||
movw DS (EXT_C (grub_machine_mmaphook_64kbin4gb)), %bx
|
||||
#endif
|
||||
movw DS (LOCAL (kbin16mb)), %ax
|
||||
movw DS (LOCAL (m64kbin4gb)), %bx
|
||||
movw %ax, %cx
|
||||
movw %bx, %dx
|
||||
pop %ds
|
||||
clc
|
||||
iret
|
||||
|
||||
h88:
|
||||
LOCAL (h88):
|
||||
popf
|
||||
push %ds
|
||||
push %cs
|
||||
pop %ds
|
||||
#ifdef APPLE_CC
|
||||
movw (grub_machine_mmaphook_kbin16mb_rel), %ax
|
||||
#else
|
||||
movw DS (EXT_C (grub_machine_mmaphook_kbin16mb)), %ax
|
||||
#endif
|
||||
movw DS (LOCAL (kbin16mb)), %ax
|
||||
pop %ds
|
||||
clc
|
||||
iret
|
||||
|
||||
e820:
|
||||
#ifdef APPLE_CC
|
||||
mmaphook_mmap_rel = DS(mmaphook_mmap)
|
||||
mmaphook_mmap_num_rel = DS(EXT_C(grub_machine_mmaphook_mmap_num))
|
||||
#endif
|
||||
LOCAL (e820):
|
||||
popf
|
||||
push %ds
|
||||
push %cs
|
||||
pop %ds
|
||||
cmpw $20, %cx
|
||||
jb errexit
|
||||
#ifdef APPLE_CC
|
||||
cmpw (mmaphook_mmap_num_rel), %bx
|
||||
#else
|
||||
cmpw DS (EXT_C (grub_machine_mmaphook_mmap_num)), %bx
|
||||
#endif
|
||||
jae errexit
|
||||
jb LOCAL (errexit)
|
||||
cmpw DS (LOCAL (mmap_num)), %bx
|
||||
jae LOCAL (errexit)
|
||||
cmp $0x534d4150, %edx
|
||||
jne errexit
|
||||
jne LOCAL (errexit)
|
||||
push %si
|
||||
push %di
|
||||
movw $20, %cx
|
||||
#ifdef APPLE_CC
|
||||
movl $(mmaphook_mmap_rel), %esi
|
||||
#else
|
||||
movw $(DS(mmaphook_mmap)), %si
|
||||
#endif
|
||||
movw $(DS(LOCAL (mmaphook_mmap))), %si
|
||||
mov %bx, %ax
|
||||
imul $20, %ax
|
||||
add %ax, %si
|
||||
|
@ -122,19 +94,15 @@ e820:
|
|||
pop %si
|
||||
movl $20, %ecx
|
||||
inc %bx
|
||||
#ifdef APPLE_CC
|
||||
cmpw (mmaphook_mmap_num_rel), %bx
|
||||
#else
|
||||
cmpw DS(EXT_C(grub_machine_mmaphook_mmap_num)), %bx
|
||||
#endif
|
||||
jb noclean
|
||||
cmpw DS(LOCAL (mmap_num)), %bx
|
||||
jb LOCAL (noclean)
|
||||
xor %bx, %bx
|
||||
noclean:
|
||||
LOCAL (noclean):
|
||||
mov $0x534d4150, %eax
|
||||
pop %ds
|
||||
clc
|
||||
iret
|
||||
errexit:
|
||||
LOCAL (errexit):
|
||||
mov $0x534d4150, %eax
|
||||
pop %ds
|
||||
stc
|
||||
|
@ -142,13 +110,18 @@ errexit:
|
|||
iret
|
||||
|
||||
VARIABLE(grub_machine_mmaphook_mmap_num)
|
||||
LOCAL (mmap_num):
|
||||
.word 0
|
||||
VARIABLE(grub_machine_mmaphook_kblow)
|
||||
LOCAL (kblow):
|
||||
.word 0
|
||||
VARIABLE (grub_machine_mmaphook_kbin16mb)
|
||||
LOCAL (kbin16mb):
|
||||
.word 0
|
||||
VARIABLE (grub_machine_mmaphook_64kbin4gb)
|
||||
LOCAL (m64kbin4gb):
|
||||
.word 0
|
||||
mmaphook_mmap:
|
||||
LOCAL (mmaphook_mmap):
|
||||
/* Memory map is placed just after the interrupt handlers. */
|
||||
VARIABLE(grub_machine_mmaphook_end)
|
||||
.byte 0
|
||||
|
|
Loading…
Reference in a new issue