summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/include
diff options
context:
space:
mode:
authorMichael Brown2016-02-19 00:23:38 +0100
committerMichael Brown2016-02-19 00:23:38 +0100
commit31b5c2e753dbcb3d5023bccc8e644d0bcb56b2ad (patch)
tree536967f3f34fba94970a31cbde3fe1d2cf657cce /src/arch/x86/include
parent[librm] Convert prot_call() to a real-mode near call (diff)
downloadipxe-31b5c2e753dbcb3d5023bccc8e644d0bcb56b2ad.tar.gz
ipxe-31b5c2e753dbcb3d5023bccc8e644d0bcb56b2ad.tar.xz
ipxe-31b5c2e753dbcb3d5023bccc8e644d0bcb56b2ad.zip
[librm] Provide an abstraction wrapper for prot_call
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/include')
-rw-r--r--src/arch/x86/include/librm.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/arch/x86/include/librm.h b/src/arch/x86/include/librm.h
index 379e085a2..2786027a0 100644
--- a/src/arch/x86/include/librm.h
+++ b/src/arch/x86/include/librm.h
@@ -19,7 +19,19 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define LONG_DS 0x40
#endif
-#ifndef ASSEMBLY
+#ifdef ASSEMBLY
+
+/**
+ * Call C function from real-mode code
+ *
+ * @v function C function
+ */
+.macro virtcall function
+ pushl $\function
+ call prot_call
+.endm
+
+#else /* ASSEMBLY */
#ifdef UACCESS_LIBRM
#define UACCESS_PREFIX_librm
@@ -27,6 +39,15 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define UACCESS_PREFIX_librm __librm_
#endif
+/**
+ * Call C function from real-mode code
+ *
+ * @v function C function
+ */
+#define VIRT_CALL( function ) \
+ "pushl $( " #function " )\n\t" \
+ "call prot_call\n\t"
+
/* Variables in librm.S */
extern unsigned long virt_offset;