With Apple assembly in .macro environvemnt you have to use $$ instead

of $. So introduce new preprocessor macro MACRO_DOLLAR(x) which expands
	to $$x on Apple and to $x on everything else.
This commit is contained in:
Vladimir Serbinenko 2013-11-24 05:55:47 +01:00
parent b700a427d2
commit 09bc0a577d
4 changed files with 22 additions and 14 deletions

View file

@ -1,3 +1,9 @@
2013-11-24 Vladimir Serbinenko <phcoder@gmail.com>
With Apple assembly in .macro environvemnt you have to use $$ instead
of $. So introduce new preprocessor macro MACRO_DOLLAR(x) which expands
to $$x on Apple and to $x on everything else.
2013-11-24 Vladimir Serbinenko <phcoder@gmail.com> 2013-11-24 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/Makefile.am: Use correct TARGET_OBJCONV rather than * grub-core/Makefile.am: Use correct TARGET_OBJCONV rather than

View file

@ -40,12 +40,12 @@ LOCAL(floppy_probe):
* Perform floppy probe. * Perform floppy probe.
*/ */
movw $probe_values - 1, %si movw MACRO_DOLLAR(probe_values) - 1, %si
LOCAL(probe_loop): LOCAL(probe_loop):
/* reset floppy controller INT 13h AH=0 */ /* reset floppy controller INT 13h AH=0 */
xorw %ax, %ax xorw %ax, %ax
int $0x13 int MACRO_DOLLAR(0x13)
incw %si incw %si
movb (%si), %cl movb (%si), %cl
@ -65,20 +65,20 @@ fd_probe_error_string: .asciz "Floppy"
1: 1:
/* perform read */ /* perform read */
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw MACRO_DOLLAR(GRUB_BOOT_MACHINE_BUFFER_SEG), %bx
movw %bx, %es movw %bx, %es
xorw %bx, %bx xorw %bx, %bx
movw $0x201, %ax movw MACRO_DOLLAR(0x201), %ax
movb $0, %ch movb MACRO_DOLLAR(0), %ch
movb $0, %dh movb MACRO_DOLLAR(0), %dh
int $0x13 int MACRO_DOLLAR(0x13)
/* if error, jump to "LOCAL(probe_loop)" */ /* if error, jump to "LOCAL(probe_loop)" */
jc LOCAL(probe_loop) jc LOCAL(probe_loop)
/* %cl is already the correct value! */ /* %cl is already the correct value! */
movb $1, %dh movb MACRO_DOLLAR(1), %dh
movb $79, %ch movb MACRO_DOLLAR(79), %ch
jmp LOCAL(final_init) jmp LOCAL(final_init)
.endm .endm

View file

@ -186,11 +186,7 @@ VARIABLE(grub_gdb_stack)
.text .text
1: 1:
.if EC .if EC
#ifdef __APPLE__ add MACRO_DOLLAR(4), %esp
add $$4, %esp
#else
add $4, %esp
#endif
.endif .endif
save_context save_context

View file

@ -27,6 +27,12 @@
/* Add an underscore to a C symbol in assembler code if needed. */ /* Add an underscore to a C symbol in assembler code if needed. */
#ifndef GRUB_UTIL #ifndef GRUB_UTIL
#ifdef __APPLE__
#define MACRO_DOLLAR(x) $$ ## x
#else
#define MACRO_DOLLAR(x) $ ## x
#endif
#if HAVE_ASM_USCORE #if HAVE_ASM_USCORE
#ifdef ASM_FILE #ifdef ASM_FILE
# define EXT_C(sym) _ ## sym # define EXT_C(sym) _ ## sym