Initial groundwork for ARM64 support

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7001 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2018-06-03 21:00:53 +00:00
parent bca384e691
commit 460b3f59a9
11 changed files with 101 additions and 51 deletions

View file

@ -289,6 +289,32 @@ PLUGINFUNCTION(Get)
} PLUGINFUNCTIONEND
#ifdef SYSTEM_ARM64
/*
TODO: CallProc not implemeted.
Fake the behavior of the System plugin for the LoadImage API function so MUI works.
BUGBUG: MUI is leaking DeleteObject and failing GetClientRect
*/
SystemProc* CallProc(SystemProc *proc)
{
INT_PTR ret, *place;
int cmp = lstrcmp(proc->ProcName, sizeof(TCHAR) > 1 ? _T("LoadImageW") : _T("LoadImageA"));
if (!cmp)
{
ret = (INT_PTR) LoadImage((HINSTANCE)proc->Params[1].Value,
(LPCTSTR)proc->Params[2].Value, (UINT)proc->Params[3].Value,
(int)proc->Params[4].Value, (int)proc->Params[5].Value,
(UINT)proc->Params[6].Value);
LastError = GetLastError();
}
else
proc->ProcResult = PR_ERROR, ret = 0, LastError = ERROR_INVALID_FUNCTION;
place = (INT_PTR*) proc->Params[0].Value;
if (proc->Params[0].Option != -1) place = (INT_PTR*) &(proc->Params[0].Value);
if (place) *place = ret;
return proc;
}
#endif //~ SYSTEM_ARM64
#ifdef _WIN64
/*
BUGBUG: TODO: CallBack support not implemeted!
@ -1158,7 +1184,7 @@ void ParamsOut(SystemProc *proc)
HANDLE CreateCallback(SystemProc *cbproc)
{
#ifdef SYSTEM_AMD64
#if defined(SYSTEM_AMD64) || defined(SYSTEM_ARM64)
return BUGBUG64(HANDLE) NULL;
#else
char *mem;
@ -1357,7 +1383,7 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpReserved)
#ifdef SYSTEM_X86
retexpr[0] = (char) 0xC2;
retexpr[2] = 0x00;
#elif defined(SYSTEM_AMD64)
#elif defined(SYSTEM_AMD64) || defined(SYSTEM_ARM64)
retexpr[0] = BUGBUG64(0);
#else
#error TODO

View file

@ -7,6 +7,8 @@
# define SYSTEM_AMD64
#elif defined(_M_IX86) || defined(__i386__) || defined(_X86_)
# define SYSTEM_X86
#elif defined(_M_ARM64)
# define SYSTEM_ARM64
#else
# error "Unknown architecture!"
#endif
@ -147,7 +149,7 @@ struct tag_CallbackThunk
#pragma pack(pop)
*/
char asm_code[10];
#elif defined(SYSTEM_AMD64)
#elif defined(SYSTEM_AMD64) || defined(SYSTEM_ARM64)
char asm_code[BUGBUG64(1)]; // TODO: BUGBUG64
#else
#error "Asm thunk not implemeted for this architecture!"
@ -159,7 +161,7 @@ struct tag_CallbackThunk
// Free() only knows about pNext in CallbackThunk, it does not know anything about the assembly, that is where this helper comes in...
#ifdef SYSTEM_X86
# define GetAssociatedSysProcFromCallbackThunkPtr(pCbT) ( (SystemProc*) *(unsigned int*) (((char*)(pCbT))+1) )
#elif defined(SYSTEM_AMD64)
#elif defined(SYSTEM_AMD64) || defined(SYSTEM_ARM64)
# define GetAssociatedSysProcFromCallbackThunkPtr(pCbT) BUGBUG64(NULL)
#else
# error "GetAssociatedSysProcFromCallbackThunkPtr not defined for the current architecture!"