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
 # this is almost always a win. the kernel uses it, too.
130
 # this is almost always a win. the kernel uses it, too.
131
 CFLAGS+= -mpreferred-stack-boundary=2
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
 LDFLAGS+=	-N --no-check-sections
145
 LDFLAGS+=	-N --no-check-sections
134
 
146
 
135
 ifeq "$(shell uname -s)" "FreeBSD"
147
 ifeq "$(shell uname -s)" "FreeBSD"

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

39
  * address space, and returns the physical address of the new location
39
  * address space, and returns the physical address of the new location
40
  * to the prefix in %edi.
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
 	struct memory_map memmap;
43
 	struct memory_map memmap;
44
 	unsigned long start, end, size, padded_size;
44
 	unsigned long start, end, size, padded_size;
45
 	unsigned long new_start, new_end;
45
 	unsigned long new_start, new_end;

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

321
  * INT 13 handler
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
 	int command = ix86->regs.ah;
325
 	int command = ix86->regs.ah;
326
 	unsigned int bios_drive = ix86->regs.dl;
326
 	unsigned int bios_drive = ix86->regs.dl;
327
 	unsigned int original_bios_drive = bios_drive;
327
 	unsigned int original_bios_drive = bios_drive;

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

112
  * @v es:di		Address of PXE parameter block
112
  * @v es:di		Address of PXE parameter block
113
  * @ret ax		PXE exit code
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
 	int opcode = ix86->regs.bx;
116
 	int opcode = ix86->regs.bx;
117
 	userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
117
 	userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
118
 	size_t param_len;
118
 	size_t param_len;
304
  * @v es:di		Address of PXE parameter block
304
  * @v es:di		Address of PXE parameter block
305
  * @ret ax		PXE exit code
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
 	userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
308
 	userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
309
 	struct s_UNDI_LOADER params;
309
 	struct s_UNDI_LOADER params;
310
 	PXENV_EXIT_t ret;
310
 	PXENV_EXIT_t ret;

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

24
  *
24
  *
25
  * @ret rc		Return status code
25
  * @ret rc		Return status code
26
  */
26
  */
27
-int main ( void ) {
27
+__cdecl int main ( void ) {
28
 
28
 
29
 	initialise();
29
 	initialise();
30
 	startup();
30
 	startup();

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

276
 /** Declare a variable or data structure as unused. */
276
 /** Declare a variable or data structure as unused. */
277
 #define __unused __attribute__ (( unused ))
277
 #define __unused __attribute__ (( unused ))
278
 
278
 
279
+/** Apply standard C calling conventions */
280
+#define __cdecl __attribute__ (( cdecl , regparm(0) ))
281
+
279
 /**
282
 /**
280
  * Declare a function as used.
283
  * Declare a function as used.
281
  *
284
  *

Loading…
Cancel
Save