[SeaBIOS] [PATCH 02/13] Don't restrict VISIBLEx C functions to only x mode.

Kevin O'Connor kevin at koconnor.net
Tue May 29 06:07:10 CEST 2012


Since SeaBIOS has been updated to use "_cfuncx_" prefixes when calling
cross-mode C functions, there is no reason to restrict an exported C
function to only the given mode.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/apm.c       |   11 ++---------
 src/romlayout.S |    4 ++--
 src/types.h     |   16 ++++++++--------
 3 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/apm.c b/src/apm.c
index 5e45b77..54696e9 100644
--- a/src/apm.c
+++ b/src/apm.c
@@ -223,15 +223,8 @@ handle_1553(struct bregs *regs)
     }
 }
 
-void VISIBLE16
-handle_apm16(struct bregs *regs)
-{
-    debug_enter(regs, DEBUG_HDL_apm);
-    handle_1553(regs);
-}
-
-void VISIBLE32SEG
-handle_apm32(struct bregs *regs)
+void VISIBLE16 VISIBLE32SEG
+handle_apm(struct bregs *regs)
 {
     debug_enter(regs, DEBUG_HDL_apm);
     handle_1553(regs);
diff --git a/src/romlayout.S b/src/romlayout.S
index 399f596..c95e8bc 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -308,7 +308,7 @@ entry_pnp_real:
 entry_apm16:
         pushfw          // save flags
         pushl %eax      // dummy
-        ENTRY_ARG handle_apm16
+        ENTRY_ARG handle_apm
         addw $4, %sp    // pop dummy
         popfw           // restore flags
         lretw
@@ -321,7 +321,7 @@ entry_apm32:
         pushl %cs               // Move second descriptor after %cs to %gs
         addl $16, (%esp)
         popl %gs
-        ENTRY_ARG_ESP _cfunc32seg_handle_apm32
+        ENTRY_ARG_ESP _cfunc32seg_handle_apm
         popl %gs
         popfl
         lretl
diff --git a/src/types.h b/src/types.h
index 0f83697..b10f3b3 100644
--- a/src/types.h
+++ b/src/types.h
@@ -44,11 +44,11 @@ extern void __force_link_error__only_in_16bit(void) __noreturn;
 // Notes a function as externally visible in the 16bit code chunk.
 # define VISIBLE16 __VISIBLE
 // Notes a function as externally visible in the 32bit flat code chunk.
-# define VISIBLE32FLAT __section(".discard.func32flat." UNIQSEC) noinline
+# define VISIBLE32FLAT
 // Notes a 32bit flat function that will only be called during init.
-# define VISIBLE32INIT VISIBLE32FLAT
+# define VISIBLE32INIT
 // Notes a function as externally visible in the 32bit segmented code chunk.
-# define VISIBLE32SEG __section(".discard.func32seg." UNIQSEC) noinline
+# define VISIBLE32SEG
 // Designate a variable as (only) visible to 16bit code.
 # define VAR16 __section(".data16." UNIQSEC)
 // Designate a variable as visible to 16bit, 32bit, and assembler code.
@@ -72,9 +72,9 @@ extern void __force_link_error__only_in_16bit(void) __noreturn;
 # define ASSERT32SEG() __force_link_error__only_in_32bit_segmented()
 # define ASSERT32FLAT() __force_link_error__only_in_32bit_flat()
 #elif MODESEGMENT == 1
-# define VISIBLE16 __section(".discard.func16." UNIQSEC) noinline
-# define VISIBLE32FLAT __section(".discard.func32flat." UNIQSEC) noinline
-# define VISIBLE32INIT VISIBLE32FLAT
+# define VISIBLE16
+# define VISIBLE32FLAT
+# define VISIBLE32INIT
 # define VISIBLE32SEG __VISIBLE
 # define VAR16 __section(".discard.var16." UNIQSEC)
 # define VAR16VISIBLE VAR16 __VISIBLE __weak
@@ -89,10 +89,10 @@ extern void __force_link_error__only_in_16bit(void) __noreturn;
 # define ASSERT32SEG() do { } while (0)
 # define ASSERT32FLAT() __force_link_error__only_in_32bit_flat()
 #else
-# define VISIBLE16 __section(".discard.func16." UNIQSEC) noinline
+# define VISIBLE16
 # define VISIBLE32FLAT __section(".text.runtime." UNIQSEC) __VISIBLE
 # define VISIBLE32INIT __section(".text.init." UNIQSEC) __VISIBLE
-# define VISIBLE32SEG __section(".discard.func32seg." UNIQSEC) noinline
+# define VISIBLE32SEG
 # define VAR16 __section(".discard.var16." UNIQSEC)
 # define VAR16VISIBLE VAR16 __VISIBLE __weak
 # define VAR16EXPORT VAR16VISIBLE
-- 
1.7.6.5




More information about the SeaBIOS mailing list