aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2018-03-21 16:47:33 +0200
committerMichael Brown <mcb30@ipxe.org>2018-03-21 17:00:53 +0200
commitbc85368cdd311fe68ffcf251e7e8e90c14f8a9dc (patch)
tree2966a5d8310f0b57e39a8db9dec202ea5823286d /src/arch/x86
parent6149e0af3ca21d8ea2a903dd555e6e5c4b6a630a (diff)
downloadipxe-bc85368cdd311fe68ffcf251e7e8e90c14f8a9dc.zip
ipxe-bc85368cdd311fe68ffcf251e7e8e90c14f8a9dc.tar.gz
ipxe-bc85368cdd311fe68ffcf251e7e8e90c14f8a9dc.tar.bz2
[librm] Ensure that inline code symbols are unique
Commit 6149e0a ("[librm] Provide symbols for inline code placed into other sections") may cause build failures due to duplicate label names if the compiler chooses to duplicate inline assembly code. Fix by using the "%=" special format string to include a guaranteed-unique number within the label name. The "%=" will be expanded only if constraints exist for the inline assembly. This fix therefore requires that all REAL_CODE() fragments use a (possibly empty) constraint list. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/core/dumpregs.c2
-rw-r--r--src/arch/x86/include/librm.h2
-rw-r--r--src/arch/x86/interface/pcbios/bios_console.c4
-rw-r--r--src/arch/x86/interface/pcbios/bios_reboot.c2
-rw-r--r--src/arch/x86/interface/syslinux/comboot_call.c6
-rw-r--r--src/arch/x86/transitions/librm_test.c2
6 files changed, 9 insertions, 9 deletions
diff --git a/src/arch/x86/core/dumpregs.c b/src/arch/x86/core/dumpregs.c
index 37d62a7..a5108ea 100644
--- a/src/arch/x86/core/dumpregs.c
+++ b/src/arch/x86/core/dumpregs.c
@@ -7,7 +7,7 @@ void __asmcall _dump_regs ( struct i386_all_regs *ix86 ) {
TEXT16_CODE ( ".globl dump_regs\n\t"
"\ndump_regs:\n\t"
VIRT_CALL ( _dump_regs )
- "ret\n\t" ) );
+ "ret\n\t" ) : );
printf ( "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
"ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
diff --git a/src/arch/x86/include/librm.h b/src/arch/x86/include/librm.h
index 6bad9c4..5196d39 100644
--- a/src/arch/x86/include/librm.h
+++ b/src/arch/x86/include/librm.h
@@ -255,7 +255,7 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
#endif
/* LINE_SYMBOL: declare a symbol for the current source code line */
-#define LINE_SYMBOL _S2 ( OBJECT ) "__line_" _S2 ( __LINE__ ) ":"
+#define LINE_SYMBOL _S2 ( OBJECT ) "__line_" _S2 ( __LINE__ ) "__%=:"
/* TEXT16_CODE: declare a fragment of code that resides in .text16 */
#define TEXT16_CODE( asm_code_str ) \
diff --git a/src/arch/x86/interface/pcbios/bios_console.c b/src/arch/x86/interface/pcbios/bios_console.c
index 81e3a7d..08fa6d0 100644
--- a/src/arch/x86/interface/pcbios/bios_console.c
+++ b/src/arch/x86/interface/pcbios/bios_console.c
@@ -521,12 +521,12 @@ static void bios_inject_startup ( void ) {
__asm__ __volatile__ (
TEXT16_CODE ( "\nint16_wrapper:\n\t"
"pushfw\n\t"
- "cmpb $0, %cs:bios_inject_lock\n\t"
+ "cmpb $0, %%cs:bios_inject_lock\n\t"
"jnz 1f\n\t"
VIRT_CALL ( bios_inject )
"\n1:\n\t"
"popfw\n\t"
- "ljmp *%cs:int16_vector\n\t" ) );
+ "ljmp *%%cs:int16_vector\n\t" ) : );
/* Hook INT 16 */
hook_bios_interrupt ( 0x16, ( ( intptr_t ) int16_wrapper ),
diff --git a/src/arch/x86/interface/pcbios/bios_reboot.c b/src/arch/x86/interface/pcbios/bios_reboot.c
index c6c5a5a..071173f 100644
--- a/src/arch/x86/interface/pcbios/bios_reboot.c
+++ b/src/arch/x86/interface/pcbios/bios_reboot.c
@@ -48,7 +48,7 @@ static void bios_reboot ( int warm ) {
put_real ( flag, BDA_SEG, BDA_REBOOT );
/* Jump to system reset vector */
- __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) );
+ __asm__ __volatile__ ( REAL_CODE ( "ljmp $0xf000, $0xfff0" ) : );
}
/**
diff --git a/src/arch/x86/interface/syslinux/comboot_call.c b/src/arch/x86/interface/syslinux/comboot_call.c
index 2f5c252..e70f200 100644
--- a/src/arch/x86/interface/syslinux/comboot_call.c
+++ b/src/arch/x86/interface/syslinux/comboot_call.c
@@ -663,7 +663,7 @@ void hook_comboot_interrupts ( ) {
VIRT_CALL ( int20 )
"clc\n\t"
"call patch_cf\n\t"
- "iret\n\t" ) );
+ "iret\n\t" ) : );
hook_bios_interrupt ( 0x20, ( intptr_t ) int20_wrapper, &int20_vector );
@@ -672,7 +672,7 @@ void hook_comboot_interrupts ( ) {
VIRT_CALL ( int21 )
"clc\n\t"
"call patch_cf\n\t"
- "iret\n\t" ) );
+ "iret\n\t" ) : );
hook_bios_interrupt ( 0x21, ( intptr_t ) int21_wrapper, &int21_vector );
@@ -681,7 +681,7 @@ void hook_comboot_interrupts ( ) {
VIRT_CALL ( int22 )
"clc\n\t"
"call patch_cf\n\t"
- "iret\n\t" ) );
+ "iret\n\t" ) : );
hook_bios_interrupt ( 0x22, ( intptr_t ) int22_wrapper, &int22_vector );
}
diff --git a/src/arch/x86/transitions/librm_test.c b/src/arch/x86/transitions/librm_test.c
index ba4254f..77cf802 100644
--- a/src/arch/x86/transitions/librm_test.c
+++ b/src/arch/x86/transitions/librm_test.c
@@ -97,7 +97,7 @@ static void librm_test_exec ( void ) {
/* Profile complete real-mode call cycle */
for ( i = 0 ; i < PROFILE_COUNT ; i++ ) {
profile_start ( &real_call_profiler );
- __asm__ __volatile__ ( REAL_CODE ( "" ) );
+ __asm__ __volatile__ ( REAL_CODE ( "" ) : );
profile_stop ( &real_call_profiler );
}