From: andrewfish Date: Sun, 8 Aug 2010 19:07:14 +0000 (+0000) Subject: Fix reverse gasket issue that was breaking watch dog timer. X-Git-Tag: edk2-stable201903~15618 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=2ec364f9bf0a66e56e752088aa3e7b124262d2a5 Fix reverse gasket issue that was breaking watch dog timer. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10779 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/UnixPkg/Sec/Gasket.h b/UnixPkg/Sec/Gasket.h index 16862c95bd..60a6ab2078 100644 --- a/UnixPkg/Sec/Gasket.h +++ b/UnixPkg/Sec/Gasket.h @@ -99,7 +99,9 @@ UINTN GasketUint64Uintn (void *api, UINT64 a, UINTN b); UINT64 GasketUintnUint64Uintn (void *api, UINTN a, UINT64 b, UINTN c); UINTN GasketUintnUint16 (void *api, UINTN a, UINT16 b); -UINTN ReverseGasketUint64 (void *api, UINT64 a); +typedef void (*CALL_BACK) (UINT64 Delta); + +UINTN ReverseGasketUint64 (CALL_BACK CallBack, UINT64 a); // // Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL diff --git a/UnixPkg/Sec/Ia32/Gasket.S b/UnixPkg/Sec/Ia32/Gasket.S index caeabf89eb..0464090527 100644 --- a/UnixPkg/Sec/Ia32/Gasket.S +++ b/UnixPkg/Sec/Ia32/Gasket.S @@ -235,23 +235,27 @@ _GasketUintnUint16: call *%eax leave ret + + .globl _ReverseGasketUint64 _ReverseGasketUint64: pushl %ebp movl %esp, %ebp - subl $56, %esp + subl $40, %esp movl 12(%ebp), %eax - movl %eax, -32(%ebp) + movl %eax, -16(%ebp) movl 16(%ebp), %eax - movl %eax, -28(%ebp) - movl 8(%ebp), %eax movl %eax, -12(%ebp) - movl -32(%ebp), %eax + movl -16(%ebp), %eax + movl -12(%ebp), %edx movl %eax, (%esp) - movl -12(%ebp), %eax + movl %edx, 4(%esp) + movl 8(%ebp), %eax call *%eax leave ret + + .subsections_via_symbols #endif diff --git a/UnixPkg/Sec/Ia32/GasketTemplate.c b/UnixPkg/Sec/Ia32/GasketTemplate.c index 8ff801d72e..bb703bf631 100644 --- a/UnixPkg/Sec/Ia32/GasketTemplate.c +++ b/UnixPkg/Sec/Ia32/GasketTemplate.c @@ -35,6 +35,7 @@ typedef UINT32 UINTN; typedef int (*GASKET_VOID) (); typedef int (*GASKET_UINTN) (UINTN); +typedef int (*GASKET_UINT64) (UINT64); typedef int (*GASKET_UINTN_UINTN) (UINTN, UINTN); typedef int (*GASKET_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN); typedef int (*GASKET_UINTN_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN, UINTN); @@ -143,7 +144,7 @@ ReverseGasketUint64 (void *api, UINT64 a) { GASKET_UINTN func; - func = (GASKET_UINTN)api; + func = (GASKET_UINT64)api; func (a); return; } diff --git a/UnixPkg/Sec/SecMain.inf b/UnixPkg/Sec/SecMain.inf index fc1dd1c33d..88477c60cd 100644 --- a/UnixPkg/Sec/SecMain.inf +++ b/UnixPkg/Sec/SecMain.inf @@ -87,6 +87,11 @@ GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h + GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/SecMain -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib/crtn.o + GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings + GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h + GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h + # # Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version # diff --git a/UnixPkg/Sec/UnixThunk.c b/UnixPkg/Sec/UnixThunk.c index 08cdd62157..29d9328d90 100644 --- a/UnixPkg/Sec/UnixThunk.c +++ b/UnixPkg/Sec/UnixThunk.c @@ -58,7 +58,7 @@ settimer_handler (int sig) if (settimer_callback) { #ifdef __APPLE__ - ReverseGasketUint64 (settimer_callback, delta); + ReverseGasketUint64 (settimer_callback, delta); #else (*settimer_callback)(delta); #endif diff --git a/UnixPkg/Sec/X64/GasketEfiTemplate.c b/UnixPkg/Sec/X64/GasketEfiTemplate.c index f1919ae549..c9fc748f5e 100644 --- a/UnixPkg/Sec/X64/GasketEfiTemplate.c +++ b/UnixPkg/Sec/X64/GasketEfiTemplate.c @@ -403,10 +403,8 @@ typedef void (*SET_TIMER_CALLBACK)(UINT64 delta); UINTN -ReverseGasketUint64 (void *api, UINT64 a) +ReverseGasketUint64 (SET_TIMER_CALLBACK settimer_callback, UINT64 a) { - SET_TIMER_CALLBACK settimer_callback = (SET_TIMER_CALLBACK)api; - (*settimer_callback)(a); return 0; } diff --git a/UnixPkg/Sec/X64/GasketTemplate.c b/UnixPkg/Sec/X64/GasketTemplate.c index f9f2785524..7345e23126 100644 --- a/UnixPkg/Sec/X64/GasketTemplate.c +++ b/UnixPkg/Sec/X64/GasketTemplate.c @@ -35,6 +35,7 @@ typedef UINT64 UINTN; typedef UINTN (*GASKET_VOID) (); typedef UINTN (*GASKET_UINTN) (UINTN); +typedef UINTN (*GASKET_UINT64) (UINT64); typedef UINTN (*GASKET_UINTN_UINTN) (UINTN, UINTN); typedef UINTN (*GASKET_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN); typedef UINTN (*GASKET_UINTN_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN, UINTN); @@ -141,9 +142,9 @@ GasketUintnUint16 (void *api, UINTN a, UINT16 b) void ReverseGasketUint64 (void *api, UINT64 a) { - GASKET_UINTN func; + GASKET_UINT64 func; - func = (GASKET_UINTN)api; + func = (GASKET_UINT64)api; func (a); return; }