Browse Source

[i386] Rename __cdecl to __asmcall

__cdecl is a misleading name, since it currently encapsulates both
cdecl and regparm(0) attributes.  Rename to __asmcall.
tags/v0.9.6
Michael Brown 15 years ago
parent
commit
dc60c24146

+ 2
- 2
src/arch/i386/Makefile View File

22
 CFLAGS		+= -mpreferred-stack-boundary=2
22
 CFLAGS		+= -mpreferred-stack-boundary=2
23
 
23
 
24
 # Code size reduction.  Use regparm for all functions - C functions
24
 # Code size reduction.  Use regparm for all functions - C functions
25
-# called from assembly (or vice versa) need __cdecl now
25
+# called from assembly (or vice versa) need __asmcall now
26
 #
26
 #
27
 CFLAGS		+= -mregparm=3
27
 CFLAGS		+= -mregparm=3
28
 
28
 
29
-# Code size reduction.  Use -mrtd (same __cdecl requirements as above)
29
+# Code size reduction.  Use -mrtd (same __asmcall requirements as above)
30
 CFLAGS		+= -mrtd
30
 CFLAGS		+= -mrtd
31
 
31
 
32
 # Code size reduction.  This is the logical complement to -mregparm=3.
32
 # Code size reduction.  This is the logical complement to -mregparm=3.

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

1
 #include <stdio.h>
1
 #include <stdio.h>
2
 #include <realmode.h>
2
 #include <realmode.h>
3
 
3
 
4
-void __cdecl _dump_regs ( struct i386_all_regs *ix86 ) {
4
+void __asmcall _dump_regs ( struct i386_all_regs *ix86 ) {
5
 
5
 
6
 	__asm__ __volatile__ (
6
 	__asm__ __volatile__ (
7
 		TEXT16_CODE ( ".globl dump_regs\n\t"
7
 		TEXT16_CODE ( ".globl dump_regs\n\t"

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

142
 	__asm__ __volatile__ ( "movl %0, %%dr7\n" : : "r" ( dr7 ) );
142
 	__asm__ __volatile__ ( "movl %0, %%dr7\n" : : "r" ( dr7 ) );
143
 }
143
 }
144
 
144
 
145
-__cdecl void gdbmach_handler ( int signo, gdbreg_t *regs ) {
145
+__asmcall void gdbmach_handler ( int signo, gdbreg_t *regs ) {
146
 	gdbmach_disable_hwbps();
146
 	gdbmach_disable_hwbps();
147
 	gdbstub_handler ( signo, regs );
147
 	gdbstub_handler ( signo, regs );
148
 	gdbmach_enable_hwbps();
148
 	gdbmach_enable_hwbps();

+ 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
-__cdecl void relocate ( struct i386_all_regs *ix86 ) {
42
+__asmcall 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;

+ 11
- 0
src/arch/i386/include/bits/compiler.h View File

1
+#ifndef _BITS_COMPILER_H
2
+#define _BITS_COMPILER_H
3
+
4
+#ifndef ASSEMBLY
5
+
6
+/** Declare a function with standard calling conventions */
7
+#define __asmcall __attribute__ (( cdecl, regparm(0) ))
8
+
9
+#endif /* ASSEMBLY */
10
+
11
+#endif /* _BITS_COMPILER_H */

+ 1
- 1
src/arch/i386/include/pxe_call.h View File

30
 extern int pxe_unhook_int1a ( void );
30
 extern int pxe_unhook_int1a ( void );
31
 extern void pxe_init_structures ( void );
31
 extern void pxe_init_structures ( void );
32
 extern int pxe_start_nbp ( void );
32
 extern int pxe_start_nbp ( void );
33
-extern __cdecl void pxe_api_call ( struct i386_all_regs *ix86 );
33
+extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 );
34
 
34
 
35
 #endif /* _PXE_CALL_H */
35
 #endif /* _PXE_CALL_H */

+ 2
- 2
src/arch/i386/include/setjmp.h View File

6
 #define JBLEN 6
6
 #define JBLEN 6
7
 typedef unsigned long jmp_buf[JBLEN];
7
 typedef unsigned long jmp_buf[JBLEN];
8
 
8
 
9
-extern int __cdecl setjmp (jmp_buf env);
10
-extern void __cdecl longjmp (jmp_buf env, int val);
9
+extern int __asmcall setjmp (jmp_buf env);
10
+extern void __asmcall longjmp (jmp_buf env, int val);
11
 
11
 
12
 #endif /* ETHERBOOT_SETJMP_H */
12
 #endif /* ETHERBOOT_SETJMP_H */

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

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

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

119
  * @v es:di		Address of PXE parameter block
119
  * @v es:di		Address of PXE parameter block
120
  * @ret ax		PXE exit code
120
  * @ret ax		PXE exit code
121
  */
121
  */
122
-__cdecl void pxe_api_call ( struct i386_all_regs *ix86 ) {
122
+__asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
123
 	int opcode = ix86->regs.bx;
123
 	int opcode = ix86->regs.bx;
124
 	userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
124
 	userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
125
 	size_t param_len;
125
 	size_t param_len;
339
  * @v es:di		Address of PXE parameter block
339
  * @v es:di		Address of PXE parameter block
340
  * @ret ax		PXE exit code
340
  * @ret ax		PXE exit code
341
  */
341
  */
342
-__cdecl void pxe_loader_call ( struct i386_all_regs *ix86 ) {
342
+__asmcall void pxe_loader_call ( struct i386_all_regs *ix86 ) {
343
 	userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
343
 	userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
344
 	struct s_UNDI_LOADER params;
344
 	struct s_UNDI_LOADER params;
345
 	PXENV_EXIT_t ret;
345
 	PXENV_EXIT_t ret;

+ 3
- 3
src/arch/i386/interface/syslinux/com32_call.c View File

41
 /**
41
 /**
42
  * Interrupt call helper
42
  * Interrupt call helper
43
  */
43
  */
44
-void __cdecl com32_intcall ( uint8_t interrupt, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
44
+void __asmcall com32_intcall ( uint8_t interrupt, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
45
 
45
 
46
 	memcpy_user ( virt_to_user( &com32_regs ), 0,
46
 	memcpy_user ( virt_to_user( &com32_regs ), 0,
47
 	              phys_to_user ( inregs_phys ), 0,
47
 	              phys_to_user ( inregs_phys ), 0,
111
 /**
111
 /**
112
  * Farcall helper
112
  * Farcall helper
113
  */
113
  */
114
-void __cdecl com32_farcall ( uint32_t proc, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
114
+void __asmcall com32_farcall ( uint32_t proc, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
115
 
115
 
116
 	memcpy_user ( virt_to_user( &com32_regs ), 0,
116
 	memcpy_user ( virt_to_user( &com32_regs ), 0,
117
 	              phys_to_user ( inregs_phys ), 0,
117
 	              phys_to_user ( inregs_phys ), 0,
170
 /**
170
 /**
171
  * CDECL farcall helper
171
  * CDECL farcall helper
172
  */
172
  */
173
-int __cdecl com32_cfarcall ( uint32_t proc, physaddr_t stack, size_t stacksz ) {
173
+int __asmcall com32_cfarcall ( uint32_t proc, physaddr_t stack, size_t stacksz ) {
174
 	int32_t eax;
174
 	int32_t eax;
175
 
175
 
176
 	copy_user_to_rm_stack ( phys_to_user ( stack ), stacksz );
176
 	copy_user_to_rm_stack ( phys_to_user ( stack ), stacksz );

+ 3
- 3
src/arch/i386/interface/syslinux/comboot_call.c View File

212
 /**
212
 /**
213
  * Terminate program interrupt handler
213
  * Terminate program interrupt handler
214
  */
214
  */
215
-static __cdecl void int20 ( struct i386_all_regs *ix86 __unused ) {
215
+static __asmcall void int20 ( struct i386_all_regs *ix86 __unused ) {
216
 	longjmp ( comboot_return, COMBOOT_RETURN_EXIT );
216
 	longjmp ( comboot_return, COMBOOT_RETURN_EXIT );
217
 }
217
 }
218
 
218
 
220
 /**
220
 /**
221
  * DOS-compatible API
221
  * DOS-compatible API
222
  */
222
  */
223
-static __cdecl void int21 ( struct i386_all_regs *ix86 ) {
223
+static __asmcall void int21 ( struct i386_all_regs *ix86 ) {
224
 	ix86->flags |= CF;
224
 	ix86->flags |= CF;
225
 
225
 
226
 	switch ( ix86->regs.ah ) {
226
 	switch ( ix86->regs.ah ) {
287
 /**
287
 /**
288
  * SYSLINUX API
288
  * SYSLINUX API
289
  */
289
  */
290
-static __cdecl void int22 ( struct i386_all_regs *ix86 ) {
290
+static __asmcall void int22 ( struct i386_all_regs *ix86 ) {
291
 	ix86->flags |= CF;
291
 	ix86->flags |= CF;
292
 
292
 
293
 	switch ( ix86->regs.ax ) {
293
 	switch ( ix86->regs.ax ) {

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

34
  *
34
  *
35
  * @ret rc		Return status code
35
  * @ret rc		Return status code
36
  */
36
  */
37
-__cdecl int main ( void ) {
37
+__asmcall int main ( void ) {
38
 	struct feature *feature;
38
 	struct feature *feature;
39
 
39
 
40
 	initialise();
40
 	initialise();

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

302
 /** Declare a variable or data structure as unused. */
302
 /** Declare a variable or data structure as unused. */
303
 #define __unused __attribute__ (( unused ))
303
 #define __unused __attribute__ (( unused ))
304
 
304
 
305
-/** Apply standard C calling conventions */
306
-#define __cdecl __attribute__ (( cdecl , regparm(0) ))
307
-
308
 /**
305
 /**
309
  * Declare a function as pure - i.e. without side effects
306
  * Declare a function as pure - i.e. without side effects
310
  */
307
  */
372
 
369
 
373
 #endif /* ASSEMBLY */
370
 #endif /* ASSEMBLY */
374
 
371
 
372
+#include <bits/compiler.h>
373
+
375
 #endif /* COMPILER_H */
374
 #endif /* COMPILER_H */

+ 1
- 1
src/include/stdlib.h View File

68
  */
68
  */
69
 
69
 
70
 extern int system ( const char *command );
70
 extern int system ( const char *command );
71
-extern __cdecl int main ( void );
71
+extern __asmcall int main ( void );
72
 
72
 
73
 #endif /* STDLIB_H */
73
 #endif /* STDLIB_H */

Loading…
Cancel
Save