Quellcode durchsuchen

[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 vor 16 Jahren
Ursprung
Commit
dc60c24146

+ 2
- 2
src/arch/i386/Makefile Datei anzeigen

@@ -22,11 +22,11 @@ endif
22 22
 CFLAGS		+= -mpreferred-stack-boundary=2
23 23
 
24 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 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 30
 CFLAGS		+= -mrtd
31 31
 
32 32
 # Code size reduction.  This is the logical complement to -mregparm=3.

+ 1
- 1
src/arch/i386/core/dumpregs.c Datei anzeigen

@@ -1,7 +1,7 @@
1 1
 #include <stdio.h>
2 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 6
 	__asm__ __volatile__ (
7 7
 		TEXT16_CODE ( ".globl dump_regs\n\t"

+ 1
- 1
src/arch/i386/core/gdbmach.c Datei anzeigen

@@ -142,7 +142,7 @@ static void gdbmach_enable_hwbps ( void ) {
142 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 146
 	gdbmach_disable_hwbps();
147 147
 	gdbstub_handler ( signo, regs );
148 148
 	gdbmach_enable_hwbps();

+ 1
- 1
src/arch/i386/core/relocate.c Datei anzeigen

@@ -39,7 +39,7 @@ extern char _etextdata[];
39 39
  * address space, and returns the physical address of the new location
40 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 43
 	struct memory_map memmap;
44 44
 	unsigned long start, end, size, padded_size;
45 45
 	unsigned long new_start, new_end;

+ 11
- 0
src/arch/i386/include/bits/compiler.h Datei anzeigen

@@ -0,0 +1,11 @@
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 Datei anzeigen

@@ -30,6 +30,6 @@ extern void pxe_hook_int1a ( void );
30 30
 extern int pxe_unhook_int1a ( void );
31 31
 extern void pxe_init_structures ( void );
32 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 35
 #endif /* _PXE_CALL_H */

+ 2
- 2
src/arch/i386/include/setjmp.h Datei anzeigen

@@ -6,7 +6,7 @@
6 6
 #define JBLEN 6
7 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 12
 #endif /* ETHERBOOT_SETJMP_H */

+ 1
- 1
src/arch/i386/interface/pcbios/int13.c Datei anzeigen

@@ -322,7 +322,7 @@ static int int13_get_extended_parameters ( struct int13_drive *drive,
322 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 326
 	int command = ix86->regs.ah;
327 327
 	unsigned int bios_drive = ix86->regs.dl;
328 328
 	struct int13_drive *drive;

+ 2
- 2
src/arch/i386/interface/pxe/pxe_call.c Datei anzeigen

@@ -119,7 +119,7 @@ static PXENV_EXIT_t pxenv_unknown ( struct s_PXENV_UNKNOWN *pxenv_unknown ) {
119 119
  * @v es:di		Address of PXE parameter block
120 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 123
 	int opcode = ix86->regs.bx;
124 124
 	userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
125 125
 	size_t param_len;
@@ -339,7 +339,7 @@ __cdecl void pxe_api_call ( struct i386_all_regs *ix86 ) {
339 339
  * @v es:di		Address of PXE parameter block
340 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 343
 	userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
344 344
 	struct s_UNDI_LOADER params;
345 345
 	PXENV_EXIT_t ret;

+ 3
- 3
src/arch/i386/interface/syslinux/com32_call.c Datei anzeigen

@@ -41,7 +41,7 @@ uint16_t __bss16 ( com32_saved_sp );
41 41
 /**
42 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 46
 	memcpy_user ( virt_to_user( &com32_regs ), 0,
47 47
 	              phys_to_user ( inregs_phys ), 0,
@@ -111,7 +111,7 @@ void __cdecl com32_intcall ( uint8_t interrupt, physaddr_t inregs_phys, physaddr
111 111
 /**
112 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 116
 	memcpy_user ( virt_to_user( &com32_regs ), 0,
117 117
 	              phys_to_user ( inregs_phys ), 0,
@@ -170,7 +170,7 @@ void __cdecl com32_farcall ( uint32_t proc, physaddr_t inregs_phys, physaddr_t o
170 170
 /**
171 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 174
 	int32_t eax;
175 175
 
176 176
 	copy_user_to_rm_stack ( phys_to_user ( stack ), stacksz );

+ 3
- 3
src/arch/i386/interface/syslinux/comboot_call.c Datei anzeigen

@@ -212,7 +212,7 @@ void comboot_run_kernel ( )
212 212
 /**
213 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 216
 	longjmp ( comboot_return, COMBOOT_RETURN_EXIT );
217 217
 }
218 218
 
@@ -220,7 +220,7 @@ static __cdecl void int20 ( struct i386_all_regs *ix86 __unused ) {
220 220
 /**
221 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 224
 	ix86->flags |= CF;
225 225
 
226 226
 	switch ( ix86->regs.ah ) {
@@ -287,7 +287,7 @@ static __cdecl void int21 ( struct i386_all_regs *ix86 ) {
287 287
 /**
288 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 291
 	ix86->flags |= CF;
292 292
 
293 293
 	switch ( ix86->regs.ax ) {

+ 1
- 1
src/core/main.c Datei anzeigen

@@ -34,7 +34,7 @@ static struct feature features_end[0] __table_end ( struct feature, features );
34 34
  *
35 35
  * @ret rc		Return status code
36 36
  */
37
-__cdecl int main ( void ) {
37
+__asmcall int main ( void ) {
38 38
 	struct feature *feature;
39 39
 
40 40
 	initialise();

+ 2
- 3
src/include/compiler.h Datei anzeigen

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

+ 1
- 1
src/include/stdlib.h Datei anzeigen

@@ -68,6 +68,6 @@ static inline void srand ( unsigned int seed ) {
68 68
  */
69 69
 
70 70
 extern int system ( const char *command );
71
-extern __cdecl int main ( void );
71
+extern __asmcall int main ( void );
72 72
 
73 73
 #endif /* STDLIB_H */

Laden…
Abbrechen
Speichern