]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
Applied a modified version of holger's regparm patches.
authorMichael Brown <mcb30@etherboot.org>
Sat, 28 Jul 2007 23:17:25 +0000 (00:17 +0100)
committerMichael Brown <mcb30@etherboot.org>
Sat, 28 Jul 2007 23:17:25 +0000 (00:17 +0100)
src/arch/i386/Config
src/arch/i386/core/relocate.c
src/arch/i386/interface/pcbios/int13.c
src/arch/i386/interface/pxe/pxe_call.c
src/core/main.c
src/include/compiler.h

index 877913210fd7b844dd88b654fa592760db17960b..16de411b1271864300f7367f623beac04cb2d494 100644 (file)
@@ -130,6 +130,18 @@ endif
 # this is almost always a win. the kernel uses it, too.
 CFLAGS+= -mpreferred-stack-boundary=2
 
+# use regparm for all functions - C functions called from assembly (or
+# vice versa) need __cdecl now
+CFLAGS+= -mregparm=3
+
+# use -mrtd (same __cdecl requirements as above)
+CFLAGS+= -mrtd
+
+# this is the logical complement to -mregparm=3. 
+# it doesn't currently buy us anything, but if anything ever tries
+# to return small structures, let's be prepared
+CFLAGS+= -freg-struct-return
+
 LDFLAGS+=      -N --no-check-sections
 
 ifeq "$(shell uname -s)" "FreeBSD"
index d3b42d0da00b79e26dd4a59f55efb86dcf5a929b..39d00b098dae26a1cb133f2eafee9ff4aaff983f 100644 (file)
@@ -39,7 +39,7 @@ extern char _end[];
  * address space, and returns the physical address of the new location
  * to the prefix in %edi.
  */
-void relocate ( struct i386_all_regs *ix86 ) {
+__cdecl void relocate ( struct i386_all_regs *ix86 ) {
        struct memory_map memmap;
        unsigned long start, end, size, padded_size;
        unsigned long new_start, new_end;
index f7cb67958121484fa3820b9cb240dc173f7f7a80..53817c7a833e0e3aa37f58b84e1a09816b9c4ecc 100644 (file)
@@ -321,7 +321,7 @@ static int int13_get_extended_parameters ( struct int13_drive *drive,
  * INT 13 handler
  *
  */
-static void int13 ( struct i386_all_regs *ix86 ) {
+static __cdecl void int13 ( struct i386_all_regs *ix86 ) {
        int command = ix86->regs.ah;
        unsigned int bios_drive = ix86->regs.dl;
        unsigned int original_bios_drive = bios_drive;
index 834ca73807b475e7ee8d34ab5b8da23e4ce67c21..1c1b5066c17a60a7b56d86116b11038c400ede80 100644 (file)
@@ -112,7 +112,7 @@ static PXENV_EXIT_t pxenv_unknown ( struct s_PXENV_UNKNOWN *pxenv_unknown ) {
  * @v es:di            Address of PXE parameter block
  * @ret ax             PXE exit code
  */
-void pxe_api_call ( struct i386_all_regs *ix86 ) {
+__cdecl void pxe_api_call ( struct i386_all_regs *ix86 ) {
        int opcode = ix86->regs.bx;
        userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
        size_t param_len;
@@ -304,7 +304,7 @@ void pxe_api_call ( struct i386_all_regs *ix86 ) {
  * @v es:di            Address of PXE parameter block
  * @ret ax             PXE exit code
  */
-void pxe_loader_call ( struct i386_all_regs *ix86 ) {
+__cdecl void pxe_loader_call ( struct i386_all_regs *ix86 ) {
        userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
        struct s_UNDI_LOADER params;
        PXENV_EXIT_t ret;
index 09dccc76166350dff0f1d756a0d8857682b71428..88fbb57945686d42fa118a189535aea6b95c2244 100644 (file)
@@ -24,7 +24,7 @@ Literature dealing with the network protocols:
  *
  * @ret rc             Return status code
  */
-int main ( void ) {
+__cdecl int main ( void ) {
 
        initialise();
        startup();
index 376936d0ee64c8c272041669812668e3da4dc45d..b130f28fd692daefaef0667aa2cbaccc82703d23 100644 (file)
@@ -276,6 +276,9 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr,
 /** Declare a variable or data structure as unused. */
 #define __unused __attribute__ (( unused ))
 
+/** Apply standard C calling conventions */
+#define __cdecl __attribute__ (( cdecl , regparm(0) ))
+
 /**
  * Declare a function as used.
  *