summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2018-03-21 13:39:18 +0100
committerMichael Brown2018-03-21 13:44:04 +0100
commit6149e0af3ca21d8ea2a903dd555e6e5c4b6a630a (patch)
tree3e69a17c8b949eb2060cd062af726853a8be92eb
parent[undi] Treat invalid IRQ numbers as non-fatal errors (diff)
downloadipxe-6149e0af3ca21d8ea2a903dd555e6e5c4b6a630a.tar.gz
ipxe-6149e0af3ca21d8ea2a903dd555e6e5c4b6a630a.tar.xz
ipxe-6149e0af3ca21d8ea2a903dd555e6e5c4b6a630a.zip
[librm] Provide symbols for inline code placed into other sections
Provide symbols constructed from the object name and line number for code fragments placed into alternative sections, such as inline REAL_CODE() assembly placed into .text16. This simplifies the debugging task of finding the source code corresponding to a given instruction pointer. Note that we cannot use __FUNCTION__ since it is not a preprocessor macro and so cannot be concatenated with string literals. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/arch/x86/include/librm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/arch/x86/include/librm.h b/src/arch/x86/include/librm.h
index 597c65e6..6bad9c42 100644
--- a/src/arch/x86/include/librm.h
+++ b/src/arch/x86/include/librm.h
@@ -254,9 +254,13 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
#define CODE_DEFAULT ".code32"
#endif
+/* LINE_SYMBOL: declare a symbol for the current source code 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 ) \
".section \".text16\", \"ax\", @progbits\n\t" \
+ "\n" LINE_SYMBOL "\n\t" \
".code16\n\t" \
asm_code_str "\n\t" \
CODE_DEFAULT "\n\t" \
@@ -276,6 +280,7 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
"push $1f\n\t" \
"call phys_call\n\t" \
".section \".text.phys\", \"ax\", @progbits\n\t"\
+ "\n" LINE_SYMBOL "\n\t" \
".code32\n\t" \
"\n1:\n\t" \
asm_code_str \