mirror of
https://github.com/ipxe/ipxe
synced 2025-12-18 18:40:24 +03:00
[i386] Rename __cdecl to __asmcall
__cdecl is a misleading name, since it currently encapsulates both cdecl and regparm(0) attributes. Rename to __asmcall.
This commit is contained in:
@@ -22,11 +22,11 @@ endif
|
|||||||
CFLAGS += -mpreferred-stack-boundary=2
|
CFLAGS += -mpreferred-stack-boundary=2
|
||||||
|
|
||||||
# Code size reduction. Use regparm for all functions - C functions
|
# Code size reduction. Use regparm for all functions - C functions
|
||||||
# called from assembly (or vice versa) need __cdecl now
|
# called from assembly (or vice versa) need __asmcall now
|
||||||
#
|
#
|
||||||
CFLAGS += -mregparm=3
|
CFLAGS += -mregparm=3
|
||||||
|
|
||||||
# Code size reduction. Use -mrtd (same __cdecl requirements as above)
|
# Code size reduction. Use -mrtd (same __asmcall requirements as above)
|
||||||
CFLAGS += -mrtd
|
CFLAGS += -mrtd
|
||||||
|
|
||||||
# Code size reduction. This is the logical complement to -mregparm=3.
|
# Code size reduction. This is the logical complement to -mregparm=3.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <realmode.h>
|
#include <realmode.h>
|
||||||
|
|
||||||
void __cdecl _dump_regs ( struct i386_all_regs *ix86 ) {
|
void __asmcall _dump_regs ( struct i386_all_regs *ix86 ) {
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
TEXT16_CODE ( ".globl dump_regs\n\t"
|
TEXT16_CODE ( ".globl dump_regs\n\t"
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ static void gdbmach_enable_hwbps ( void ) {
|
|||||||
__asm__ __volatile__ ( "movl %0, %%dr7\n" : : "r" ( dr7 ) );
|
__asm__ __volatile__ ( "movl %0, %%dr7\n" : : "r" ( dr7 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
__cdecl void gdbmach_handler ( int signo, gdbreg_t *regs ) {
|
__asmcall void gdbmach_handler ( int signo, gdbreg_t *regs ) {
|
||||||
gdbmach_disable_hwbps();
|
gdbmach_disable_hwbps();
|
||||||
gdbstub_handler ( signo, regs );
|
gdbstub_handler ( signo, regs );
|
||||||
gdbmach_enable_hwbps();
|
gdbmach_enable_hwbps();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ extern char _etextdata[];
|
|||||||
* address space, and returns the physical address of the new location
|
* address space, and returns the physical address of the new location
|
||||||
* to the prefix in %edi.
|
* to the prefix in %edi.
|
||||||
*/
|
*/
|
||||||
__cdecl void relocate ( struct i386_all_regs *ix86 ) {
|
__asmcall void relocate ( struct i386_all_regs *ix86 ) {
|
||||||
struct memory_map memmap;
|
struct memory_map memmap;
|
||||||
unsigned long start, end, size, padded_size;
|
unsigned long start, end, size, padded_size;
|
||||||
unsigned long new_start, new_end;
|
unsigned long new_start, new_end;
|
||||||
|
|||||||
11
src/arch/i386/include/bits/compiler.h
Normal file
11
src/arch/i386/include/bits/compiler.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef _BITS_COMPILER_H
|
||||||
|
#define _BITS_COMPILER_H
|
||||||
|
|
||||||
|
#ifndef ASSEMBLY
|
||||||
|
|
||||||
|
/** Declare a function with standard calling conventions */
|
||||||
|
#define __asmcall __attribute__ (( cdecl, regparm(0) ))
|
||||||
|
|
||||||
|
#endif /* ASSEMBLY */
|
||||||
|
|
||||||
|
#endif /* _BITS_COMPILER_H */
|
||||||
@@ -30,6 +30,6 @@ extern void pxe_hook_int1a ( void );
|
|||||||
extern int pxe_unhook_int1a ( void );
|
extern int pxe_unhook_int1a ( void );
|
||||||
extern void pxe_init_structures ( void );
|
extern void pxe_init_structures ( void );
|
||||||
extern int pxe_start_nbp ( void );
|
extern int pxe_start_nbp ( void );
|
||||||
extern __cdecl void pxe_api_call ( struct i386_all_regs *ix86 );
|
extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 );
|
||||||
|
|
||||||
#endif /* _PXE_CALL_H */
|
#endif /* _PXE_CALL_H */
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#define JBLEN 6
|
#define JBLEN 6
|
||||||
typedef unsigned long jmp_buf[JBLEN];
|
typedef unsigned long jmp_buf[JBLEN];
|
||||||
|
|
||||||
extern int __cdecl setjmp (jmp_buf env);
|
extern int __asmcall setjmp (jmp_buf env);
|
||||||
extern void __cdecl longjmp (jmp_buf env, int val);
|
extern void __asmcall longjmp (jmp_buf env, int val);
|
||||||
|
|
||||||
#endif /* ETHERBOOT_SETJMP_H */
|
#endif /* ETHERBOOT_SETJMP_H */
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ static int int13_get_extended_parameters ( struct int13_drive *drive,
|
|||||||
* INT 13 handler
|
* INT 13 handler
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static __cdecl void int13 ( struct i386_all_regs *ix86 ) {
|
static __asmcall void int13 ( struct i386_all_regs *ix86 ) {
|
||||||
int command = ix86->regs.ah;
|
int command = ix86->regs.ah;
|
||||||
unsigned int bios_drive = ix86->regs.dl;
|
unsigned int bios_drive = ix86->regs.dl;
|
||||||
struct int13_drive *drive;
|
struct int13_drive *drive;
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ static PXENV_EXIT_t pxenv_unknown ( struct s_PXENV_UNKNOWN *pxenv_unknown ) {
|
|||||||
* @v es:di Address of PXE parameter block
|
* @v es:di Address of PXE parameter block
|
||||||
* @ret ax PXE exit code
|
* @ret ax PXE exit code
|
||||||
*/
|
*/
|
||||||
__cdecl void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
__asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
||||||
int opcode = ix86->regs.bx;
|
int opcode = ix86->regs.bx;
|
||||||
userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
|
userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
|
||||||
size_t param_len;
|
size_t param_len;
|
||||||
@@ -339,7 +339,7 @@ __cdecl void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
|||||||
* @v es:di Address of PXE parameter block
|
* @v es:di Address of PXE parameter block
|
||||||
* @ret ax PXE exit code
|
* @ret ax PXE exit code
|
||||||
*/
|
*/
|
||||||
__cdecl void pxe_loader_call ( struct i386_all_regs *ix86 ) {
|
__asmcall void pxe_loader_call ( struct i386_all_regs *ix86 ) {
|
||||||
userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
|
userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
|
||||||
struct s_UNDI_LOADER params;
|
struct s_UNDI_LOADER params;
|
||||||
PXENV_EXIT_t ret;
|
PXENV_EXIT_t ret;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ uint16_t __bss16 ( com32_saved_sp );
|
|||||||
/**
|
/**
|
||||||
* Interrupt call helper
|
* Interrupt call helper
|
||||||
*/
|
*/
|
||||||
void __cdecl com32_intcall ( uint8_t interrupt, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
|
void __asmcall com32_intcall ( uint8_t interrupt, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
|
||||||
|
|
||||||
memcpy_user ( virt_to_user( &com32_regs ), 0,
|
memcpy_user ( virt_to_user( &com32_regs ), 0,
|
||||||
phys_to_user ( inregs_phys ), 0,
|
phys_to_user ( inregs_phys ), 0,
|
||||||
@@ -111,7 +111,7 @@ void __cdecl com32_intcall ( uint8_t interrupt, physaddr_t inregs_phys, physaddr
|
|||||||
/**
|
/**
|
||||||
* Farcall helper
|
* Farcall helper
|
||||||
*/
|
*/
|
||||||
void __cdecl com32_farcall ( uint32_t proc, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
|
void __asmcall com32_farcall ( uint32_t proc, physaddr_t inregs_phys, physaddr_t outregs_phys ) {
|
||||||
|
|
||||||
memcpy_user ( virt_to_user( &com32_regs ), 0,
|
memcpy_user ( virt_to_user( &com32_regs ), 0,
|
||||||
phys_to_user ( inregs_phys ), 0,
|
phys_to_user ( inregs_phys ), 0,
|
||||||
@@ -170,7 +170,7 @@ void __cdecl com32_farcall ( uint32_t proc, physaddr_t inregs_phys, physaddr_t o
|
|||||||
/**
|
/**
|
||||||
* CDECL farcall helper
|
* CDECL farcall helper
|
||||||
*/
|
*/
|
||||||
int __cdecl com32_cfarcall ( uint32_t proc, physaddr_t stack, size_t stacksz ) {
|
int __asmcall com32_cfarcall ( uint32_t proc, physaddr_t stack, size_t stacksz ) {
|
||||||
int32_t eax;
|
int32_t eax;
|
||||||
|
|
||||||
copy_user_to_rm_stack ( phys_to_user ( stack ), stacksz );
|
copy_user_to_rm_stack ( phys_to_user ( stack ), stacksz );
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ void comboot_run_kernel ( )
|
|||||||
/**
|
/**
|
||||||
* Terminate program interrupt handler
|
* Terminate program interrupt handler
|
||||||
*/
|
*/
|
||||||
static __cdecl void int20 ( struct i386_all_regs *ix86 __unused ) {
|
static __asmcall void int20 ( struct i386_all_regs *ix86 __unused ) {
|
||||||
longjmp ( comboot_return, COMBOOT_RETURN_EXIT );
|
longjmp ( comboot_return, COMBOOT_RETURN_EXIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ static __cdecl void int20 ( struct i386_all_regs *ix86 __unused ) {
|
|||||||
/**
|
/**
|
||||||
* DOS-compatible API
|
* DOS-compatible API
|
||||||
*/
|
*/
|
||||||
static __cdecl void int21 ( struct i386_all_regs *ix86 ) {
|
static __asmcall void int21 ( struct i386_all_regs *ix86 ) {
|
||||||
ix86->flags |= CF;
|
ix86->flags |= CF;
|
||||||
|
|
||||||
switch ( ix86->regs.ah ) {
|
switch ( ix86->regs.ah ) {
|
||||||
@@ -287,7 +287,7 @@ static __cdecl void int21 ( struct i386_all_regs *ix86 ) {
|
|||||||
/**
|
/**
|
||||||
* SYSLINUX API
|
* SYSLINUX API
|
||||||
*/
|
*/
|
||||||
static __cdecl void int22 ( struct i386_all_regs *ix86 ) {
|
static __asmcall void int22 ( struct i386_all_regs *ix86 ) {
|
||||||
ix86->flags |= CF;
|
ix86->flags |= CF;
|
||||||
|
|
||||||
switch ( ix86->regs.ax ) {
|
switch ( ix86->regs.ax ) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static struct feature features_end[0] __table_end ( struct feature, features );
|
|||||||
*
|
*
|
||||||
* @ret rc Return status code
|
* @ret rc Return status code
|
||||||
*/
|
*/
|
||||||
__cdecl int main ( void ) {
|
__asmcall int main ( void ) {
|
||||||
struct feature *feature;
|
struct feature *feature;
|
||||||
|
|
||||||
initialise();
|
initialise();
|
||||||
|
|||||||
@@ -302,9 +302,6 @@ int __debug_disable;
|
|||||||
/** Declare a variable or data structure as unused. */
|
/** Declare a variable or data structure as unused. */
|
||||||
#define __unused __attribute__ (( unused ))
|
#define __unused __attribute__ (( unused ))
|
||||||
|
|
||||||
/** Apply standard C calling conventions */
|
|
||||||
#define __cdecl __attribute__ (( cdecl , regparm(0) ))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare a function as pure - i.e. without side effects
|
* Declare a function as pure - i.e. without side effects
|
||||||
*/
|
*/
|
||||||
@@ -372,4 +369,6 @@ int __debug_disable;
|
|||||||
|
|
||||||
#endif /* ASSEMBLY */
|
#endif /* ASSEMBLY */
|
||||||
|
|
||||||
|
#include <bits/compiler.h>
|
||||||
|
|
||||||
#endif /* COMPILER_H */
|
#endif /* COMPILER_H */
|
||||||
|
|||||||
@@ -68,6 +68,6 @@ static inline void srand ( unsigned int seed ) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
extern int system ( const char *command );
|
extern int system ( const char *command );
|
||||||
extern __cdecl int main ( void );
|
extern __asmcall int main ( void );
|
||||||
|
|
||||||
#endif /* STDLIB_H */
|
#endif /* STDLIB_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user