Subject: [Etherboot-developers] [PATCH] move RM_FRAGMENT to the beginning of undi.c Actions...
From: Glauber Costa ([email protected])
Date: Oct 14, 2008 9:17:11 am
List: net.sourceforge.lists.etherboot-developers

I'm currently facing a compile problem with gcc 4.3.0 at undi.c Looking at the generated code, it seems gcc is inlining _undi_call into _undi_call_silent, thus making rm_undi_call be defined twice.

Using gcc option -fno-inline also fixes this, but then the compiler won't do any kind of inlining, even "good" ones, so this fix seem to do the right
thing.

Signed-off-by: Glauber Costa <[email protected]>

--- src/arch/i386/drivers/net/undi.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/arch/i386/drivers/net/undi.c b/src/arch/i386/drivers/net/undi.c index 084fc18..1ffea43 100644 --- a/src/arch/i386/drivers/net/undi.c +++ b/src/arch/i386/drivers/net/undi.c @@ -33,6 +33,19 @@ $Id$ /* E820 map mangler */ #include "hidemem.h"

+RM_FRAGMENT(rm_undi_call, + "popw %di\n\t" /* %es:di = routine */ + "popw %es\n\t" + "pushw %cs\n\t" /* set up return address */ + "call 1f\n\t1:popw %bx\n\t" + "leaw (2f-1b)(%bx), %ax\n\t" + "pushw %ax\n\t" + "pushw %es\n\t" /* routine address to stack */ + "pushw %di\n\t" + "lret\n\t" /* calculated lcall */ + "\n2:\n\t" /* continuation point */ +); + /* NIC specific static variables go here */ static undi_t undi = { .pnp_bios = NULL, @@ -403,21 +416,9 @@ static PXENV_EXIT_t _undi_call ( uint16_t routine_seg, { routine_off, routine_seg }, st0, st1, st2 };

- RM_FRAGMENT(rm_undi_call, - "popw %di\n\t" /* %es:di = routine */ - "popw %es\n\t" - "pushw %cs\n\t" /* set up return address */ - "call 1f\n\t1:popw %bx\n\t" - "leaw (2f-1b)(%bx), %ax\n\t" - "pushw %ax\n\t" - "pushw %es\n\t" /* routine address to stack */ - "pushw %di\n\t" - "lret\n\t" /* calculated lcall */ - "\n2:\n\t" /* continuation point */ - );

/* Parameters are left on stack: set out_stack = in_stack */ - ret = real_call ( rm_undi_call, &in_stack, &in_stack ); + ret = real_call ( rm_undi_call, &in_stack, &in_stack );

/* UNDI API calls may rudely change the status of A20 and not * bother to restore it afterwards. Intel is known to be