From db0a9fc4de11e1379d9f2ca83f0208e6fa37e91d Mon Sep 17 00:00:00 2001 From: obrien Date: Tue, 13 Jan 2004 22:49:45 +0000 Subject: AMD64 has a single MS-Win calling convention, so provide an empty __stdcall. Centralize the definition to make it easier to change. --- sys/compat/ndis/kern_ndis.c | 1 - sys/compat/ndis/pe_var.h | 14 ++++++++++++++ sys/compat/ndis/subr_hal.c | 5 ----- sys/compat/ndis/subr_ndis.c | 1 - sys/compat/ndis/subr_ntoskrnl.c | 1 - sys/compat/ndis/subr_pe.c | 6 ------ 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index e98ab76..d94d25c 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define __stdcall __attribute__((__stdcall__)) #define NDIS_DUMMY_PATH "\\\\some\\bogus\\path" __stdcall static void ndis_status_func(ndis_handle, ndis_status, diff --git a/sys/compat/ndis/pe_var.h b/sys/compat/ndis/pe_var.h index 5178449..e62e5eb 100644 --- a/sys/compat/ndis/pe_var.h +++ b/sys/compat/ndis/pe_var.h @@ -408,6 +408,20 @@ struct image_patch_table { typedef struct image_patch_table image_patch_table; +/* + * Note: Windows uses the _stdcall calling convention. This means + * that the callback functions provided in the function table must + * be declared using __attribute__((__stdcall__)), otherwise the + * Windows code will likely screw up the %esp register and cause + * us to jump to an invalid address when it returns. + */ + +#ifdef __amd64__ +#define __stdcall +#else +#define __stdcall __attribute__((__stdcall__)) +#endif + __BEGIN_DECLS extern int pe_get_dos_header(vm_offset_t, image_dos_header *); extern int pe_is_nt_image(vm_offset_t); diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c index 32e8df1..9c8e86b 100644 --- a/sys/compat/ndis/subr_hal.c +++ b/sys/compat/ndis/subr_hal.c @@ -55,11 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef __amd64__ -#define __stdcall -#else -#define __stdcall __attribute__((__stdcall__)) -#endif #define FUNC void(*)(void) __stdcall static void hal_stall_exec_cpu(uint32_t); diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index 8d5393c..e7c6a2e 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -100,7 +100,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define __stdcall __attribute__((__stdcall__)) #define FUNC void(*)(void) static struct mtx *ndis_interlock; diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c index f986389..1d9c1cc 100644 --- a/sys/compat/ndis/subr_ntoskrnl.c +++ b/sys/compat/ndis/subr_ntoskrnl.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define __stdcall __attribute__((__stdcall__)) #define __regparm __attribute__((regparm(3))) #define FUNC void(*)(void) diff --git a/sys/compat/ndis/subr_pe.c b/sys/compat/ndis/subr_pe.c index e947496..b1480cf 100644 --- a/sys/compat/ndis/subr_pe.c +++ b/sys/compat/ndis/subr_pe.c @@ -575,12 +575,6 @@ pe_functbl_match(functbl, name) * Note that there are actually two copies of the jump table: one * copy is left alone. In a .SYS file, the jump tables are usually * merged into the INIT segment. - * - * Note: Windows uses the _stdcall calling convention. This means - * that the callback functions provided in the function table must - * be declared using __attribute__((__stdcall__)), otherwise the - * Windows code will likely screw up the %esp register and cause - * us to jump to an invalid address when it returns. */ int -- cgit v1.1