Browse Source

Applied a modified version of holger's regparm patches.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
a6a1052096

+ 12
- 0
src/arch/i386/Config View File

@@ -130,6 +130,18 @@ endif
130 130
 # this is almost always a win. the kernel uses it, too.
131 131
 CFLAGS+= -mpreferred-stack-boundary=2
132 132
 
133
+# use regparm for all functions - C functions called from assembly (or
134
+# vice versa) need __cdecl now
135
+CFLAGS+= -mregparm=3
136
+
137
+# use -mrtd (same __cdecl requirements as above)
138
+CFLAGS+= -mrtd
139
+
140
+# this is the logical complement to -mregparm=3. 
141
+# it doesn't currently buy us anything, but if anything ever tries
142
+# to return small structures, let's be prepared
143
+CFLAGS+= -freg-struct-return
144
+
133 145
 LDFLAGS+=	-N --no-check-sections
134 146
 
135 147
 ifeq "$(shell uname -s)" "FreeBSD"

+ 1
- 1
src/arch/i386/core/relocate.c View File

@@ -39,7 +39,7 @@ extern char _end[];
39 39
  * address space, and returns the physical address of the new location
40 40
  * to the prefix in %edi.
41 41
  */
42
-void relocate ( struct i386_all_regs *ix86 ) {
42
+__cdecl void relocate ( struct i386_all_regs *ix86 ) {
43 43
 	struct memory_map memmap;
44 44
 	unsigned long start, end, size, padded_size;
45 45
 	unsigned long new_start, new_end;

+ 1
- 1
src/arch/i386/interface/pcbios/int13.c View File

@@ -321,7 +321,7 @@ static int int13_get_extended_parameters ( struct int13_drive *drive,
321 321
  * INT 13 handler
322 322
  *
323 323
  */
324
-static void int13 ( struct i386_all_regs *ix86 ) {
324
+static __cdecl void int13 ( struct i386_all_regs *ix86 ) {
325 325
 	int command = ix86->regs.ah;
326 326
 	unsigned int bios_drive = ix86->regs.dl;
327 327
 	unsigned int original_bios_drive = bios_drive;

+ 2
- 2
src/arch/i386/interface/pxe/pxe_call.c View File

@@ -112,7 +112,7 @@ static PXENV_EXIT_t pxenv_unknown ( struct s_PXENV_UNKNOWN *pxenv_unknown ) {
112 112
  * @v es:di		Address of PXE parameter block
113 113
  * @ret ax		PXE exit code
114 114
  */
115
-void pxe_api_call ( struct i386_all_regs *ix86 ) {
115
+__cdecl void pxe_api_call ( struct i386_all_regs *ix86 ) {
116 116
 	int opcode = ix86->regs.bx;
117 117
 	userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
118 118
 	size_t param_len;
@@ -304,7 +304,7 @@ void pxe_api_call ( struct i386_all_regs *ix86 ) {
304 304
  * @v es:di		Address of PXE parameter block
305 305
  * @ret ax		PXE exit code
306 306
  */
307
-void pxe_loader_call ( struct i386_all_regs *ix86 ) {
307
+__cdecl void pxe_loader_call ( struct i386_all_regs *ix86 ) {
308 308
 	userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
309 309
 	struct s_UNDI_LOADER params;
310 310
 	PXENV_EXIT_t ret;

+ 1
- 1
src/core/main.c View File

@@ -24,7 +24,7 @@ Literature dealing with the network protocols:
24 24
  *
25 25
  * @ret rc		Return status code
26 26
  */
27
-int main ( void ) {
27
+__cdecl int main ( void ) {
28 28
 
29 29
 	initialise();
30 30
 	startup();

+ 3
- 0
src/include/compiler.h View File

@@ -276,6 +276,9 @@ extern void dbg_hex_dump_da ( unsigned long dispaddr,
276 276
 /** Declare a variable or data structure as unused. */
277 277
 #define __unused __attribute__ (( unused ))
278 278
 
279
+/** Apply standard C calling conventions */
280
+#define __cdecl __attribute__ (( cdecl , regparm(0) ))
281
+
279 282
 /**
280 283
  * Declare a function as used.
281 284
  *

Loading…
Cancel
Save