Commit 0a277b63 authored by Alexandre Julliard's avatar Alexandre Julliard

Adapted for new register functions support (ESP_reg in register

functions now points after the arguments).
parent 06b97899
......@@ -96,12 +96,10 @@ static void EXC_DefaultHandling( EXCEPTION_RECORD *rec, CONTEXT *context )
}
/*******************************************************************
* EXC_RaiseException
*
* Implementation of NtRaiseException.
/***********************************************************************
* RtlRaiseException (NTDLL.464)
*/
static void EXC_RaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
void WINAPI REGS_FUNC(RtlRaiseException)( EXCEPTION_RECORD *rec, CONTEXT *context )
{
PEXCEPTION_FRAME frame, dispatch, nested_frame;
EXCEPTION_RECORD newrec;
......@@ -160,16 +158,17 @@ static void EXC_RaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
/*******************************************************************
* EXC_RtlUnwind
*
* Implementation of RtlUnwind.
* RtlUnwind (KERNEL32.590) (NTDLL.518)
*/
static void EXC_RtlUnwind( EXCEPTION_FRAME *pEndFrame, EXCEPTION_RECORD *pRecord,
CONTEXT *context )
void WINAPI REGS_FUNC(RtlUnwind)( PEXCEPTION_FRAME pEndFrame, LPVOID unusedEip,
PEXCEPTION_RECORD pRecord, DWORD returnEax,
CONTEXT *context )
{
EXCEPTION_RECORD record, newrec;
PEXCEPTION_FRAME frame, dispatch;
EAX_reg(context) = returnEax;
/* build an exception record, if we do not have one */
if (!pRecord)
{
......@@ -235,69 +234,15 @@ static void EXC_RtlUnwind( EXCEPTION_FRAME *pEndFrame, EXCEPTION_RECORD *pRecord
* Real prototype:
* DWORD WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *ctx, BOOL first );
*/
REGS_ENTRYPOINT(NtRaiseException)
void WINAPI REGS_FUNC(NtRaiseException)( EXCEPTION_RECORD *rec, CONTEXT *ctx,
BOOL first, CONTEXT *context )
{
DWORD ret;
EXCEPTION_RECORD *rec;
CONTEXT *ctx;
BOOL first;
ret = STACK32_POP(context); /* return addr */
rec = (PEXCEPTION_RECORD)STACK32_POP(context);
ctx = (PCONTEXT)STACK32_POP(context);
first = (BOOL)STACK32_POP(context);
STACK32_PUSH(context,ret); /* restore return addr */
EXC_RaiseException( rec, ctx );
REGS_FUNC(RtlRaiseException)( rec, ctx );
*context = *ctx;
}
/***********************************************************************
* RtlRaiseException (NTDLL.464)
*
* Real prototype:
* void WINAPI RtlRaiseException(PEXCEPTION_RECORD pRecord)
*/
REGS_ENTRYPOINT(RtlRaiseException)
{
EXCEPTION_RECORD *rec;
DWORD ret;
ret = STACK32_POP(context); /* return addr */
rec = (PEXCEPTION_RECORD)STACK32_POP(context);
STACK32_PUSH(context,ret); /* restore return addr */
rec->ExceptionAddress = (LPVOID)EIP_reg(context);
EXC_RaiseException( rec, context );
}
/*******************************************************************
* RtlUnwind (KERNEL32.590) (NTDLL.518)
*
* The real prototype is:
* void WINAPI RtlUnwind( PEXCEPTION_FRAME pEndFrame, LPVOID unusedEip,
* PEXCEPTION_RECORD pRecord, DWORD returnEax );
*/
REGS_ENTRYPOINT(RtlUnwind)
{
PEXCEPTION_FRAME pEndFrame;
PEXCEPTION_RECORD pRecord;
/* get the arguments from the stack */
DWORD ret = STACK32_POP(context); /* return addr */
pEndFrame = (PEXCEPTION_FRAME)STACK32_POP(context);
(void)STACK32_POP(context); /* unused arg */
pRecord = (PEXCEPTION_RECORD)STACK32_POP(context);
EAX_reg(context) = STACK32_POP(context);
STACK32_PUSH(context,ret); /* restore return addr */
EXC_RtlUnwind( pEndFrame, pRecord, context );
}
/***********************************************************************
* RtlRaiseStatus (NTDLL.465)
*
* Raise an exception with ExceptionCode = status
......
......@@ -374,11 +374,11 @@ BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type)
* NTDLL_alloca_probe [NTDLL.861]
* Glorified "enter xxxx".
*/
REGS_ENTRYPOINT(NTDLL_chkstk)
void WINAPI REGS_FUNC(NTDLL_chkstk)( CONTEXT *context )
{
ESP_reg(context) -= EAX_reg(context);
}
REGS_ENTRYPOINT(NTDLL_alloca_probe)
void WINAPI REGS_FUNC(NTDLL_alloca_probe)( CONTEXT *context )
{
ESP_reg(context) -= EAX_reg(context);
}
......
......@@ -85,6 +85,6 @@ typedef void *VA_LIST16;
#define STACK32_POP(context) (*(*(DWORD **)&ESP_reg(context))++)
/* Win32 register functions */
#define REGS_ENTRYPOINT(name) void WINAPI __regs_##name( CONTEXT *context )
#define REGS_FUNC(name) __regs_##name
#endif /* __WINE_STACKFRAME_H */
......@@ -1560,21 +1560,24 @@ HMODULE WINAPI MapHModuleSL(HMODULE16 hmod) {
/***************************************************************************
* MapHInstLS (KERNEL32.516)
*/
REGS_ENTRYPOINT(MapHInstLS) {
void WINAPI REGS_FUNC(MapHInstLS)( CONTEXT *context )
{
EAX_reg(context) = MapHModuleLS(EAX_reg(context));
}
/***************************************************************************
* MapHInstSL (KERNEL32.518)
*/
REGS_ENTRYPOINT(MapHInstSL) {
void WINAPI REGS_FUNC(MapHInstSL)( CONTEXT *context )
{
EAX_reg(context) = MapHModuleSL(EAX_reg(context));
}
/***************************************************************************
* MapHInstLS_PN (KERNEL32.517)
*/
REGS_ENTRYPOINT(MapHInstLS_PN) {
void WINAPI REGS_FUNC(MapHInstLS_PN)( CONTEXT *context )
{
if (EAX_reg(context))
EAX_reg(context) = MapHModuleLS(EAX_reg(context));
}
......@@ -1582,7 +1585,8 @@ REGS_ENTRYPOINT(MapHInstLS_PN) {
/***************************************************************************
* MapHInstSL_PN (KERNEL32.519)
*/
REGS_ENTRYPOINT(MapHInstSL_PN) {
void WINAPI REGS_FUNC(MapHInstSL_PN)( CONTEXT *context )
{
if (EAX_reg(context))
EAX_reg(context) = MapHModuleSL(EAX_reg(context));
}
......
......@@ -558,11 +558,9 @@ LPVOID WINAPI MapSLFix( SEGPTR sptr )
* UnMapSLFixArray (KERNEL32.701)
*/
REGS_ENTRYPOINT(UnMapSLFixArray) /* SEGPTR sptr[], INT32 length */
void WINAPI REGS_FUNC(UnMapSLFixArray)( SEGPTR sptr[], INT length, CONTEXT *context )
{
/* Must not change EAX, hence defined as 'register' function */
/* We need to remove the arguments ourselves */
ESP_reg( context ) += 8;
}
/***********************************************************************
......@@ -642,17 +640,17 @@ x_SMapLS_IP_EBP_x(CONTEXT *context,int argoff) {
EAX_reg(context) = ptr;
}
REGS_ENTRYPOINT(SMapLS_IP_EBP_8) {x_SMapLS_IP_EBP_x(context,8);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_12) {x_SMapLS_IP_EBP_x(context,12);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_16) {x_SMapLS_IP_EBP_x(context,16);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_20) {x_SMapLS_IP_EBP_x(context,20);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_24) {x_SMapLS_IP_EBP_x(context,24);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_28) {x_SMapLS_IP_EBP_x(context,28);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_32) {x_SMapLS_IP_EBP_x(context,32);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_36) {x_SMapLS_IP_EBP_x(context,36);}
REGS_ENTRYPOINT(SMapLS_IP_EBP_40) {x_SMapLS_IP_EBP_x(context,40);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_8)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,8);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_12)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,12);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_16)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,16);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_20)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,20);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_24)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,24);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_28)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,28);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_32)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,32);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_36)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,36);}
void WINAPI REGS_FUNC(SMapLS_IP_EBP_40)(CONTEXT *context) {x_SMapLS_IP_EBP_x(context,40);}
REGS_ENTRYPOINT(SMapLS)
void WINAPI REGS_FUNC(SMapLS)( CONTEXT *context )
{
if (EAX_reg(context)>=0x10000) {
EAX_reg(context) = MapLS((LPVOID)EAX_reg(context));
......@@ -662,7 +660,7 @@ REGS_ENTRYPOINT(SMapLS)
}
}
REGS_ENTRYPOINT(SUnMapLS)
void WINAPI REGS_FUNC(SUnMapLS)( CONTEXT *context )
{
if (EAX_reg(context)>=0x10000)
UnMapLS((SEGPTR)EAX_reg(context));
......@@ -674,15 +672,15 @@ x_SUnMapLS_IP_EBP_x(CONTEXT *context,int argoff) {
UnMapLS(*(DWORD*)(EBP_reg(context)+argoff));
*(DWORD*)(EBP_reg(context)+argoff)=0;
}
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_8) { x_SUnMapLS_IP_EBP_x(context,8); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_12) { x_SUnMapLS_IP_EBP_x(context,12); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_16) { x_SUnMapLS_IP_EBP_x(context,16); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_20) { x_SUnMapLS_IP_EBP_x(context,20); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_24) { x_SUnMapLS_IP_EBP_x(context,24); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_28) { x_SUnMapLS_IP_EBP_x(context,28); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_32) { x_SUnMapLS_IP_EBP_x(context,32); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_36) { x_SUnMapLS_IP_EBP_x(context,36); }
REGS_ENTRYPOINT(SUnMapLS_IP_EBP_40) { x_SUnMapLS_IP_EBP_x(context,40); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_8)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,8); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_12)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,12); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_16)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,16); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_20)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,20); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_24)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,24); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_28)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,28); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_32)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,32); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_36)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,36); }
void WINAPI REGS_FUNC(SUnMapLS_IP_EBP_40)(CONTEXT *context) { x_SUnMapLS_IP_EBP_x(context,40); }
/**********************************************************************
* AllocMappedBuffer (KERNEL32.38)
......@@ -703,7 +701,7 @@ REGS_ENTRYPOINT(SUnMapLS_IP_EBP_40) { x_SUnMapLS_IP_EBP_x(context,40); }
* The SEGPTR is used by the caller!
*/
REGS_ENTRYPOINT(AllocMappedBuffer)
void WINAPI REGS_FUNC(AllocMappedBuffer)( CONTEXT *context )
{
HGLOBAL handle = GlobalAlloc(0, EDI_reg(context) + 8);
DWORD *buffer = (DWORD *)GlobalLock(handle);
......@@ -736,7 +734,7 @@ REGS_ENTRYPOINT(AllocMappedBuffer)
* Input: EDI register: pointer to buffer
*/
REGS_ENTRYPOINT(FreeMappedBuffer)
void WINAPI REGS_FUNC(FreeMappedBuffer)( CONTEXT *context )
{
if (EDI_reg(context))
{
......
......@@ -180,7 +180,7 @@ type win32
172 stdcall NtQueryValueKey(long long long long long long) NtQueryValueKey
173 stub NtQueryVirtualMemory
174 stub NtQueryVolumeInformationFile
175 register NtRaiseException() NtRaiseException
175 register NtRaiseException(ptr ptr long) NtRaiseException
176 stub NtRaiseHardError
177 stdcall NtReadFile(long long long long long long long long long) NtReadFile
178 stub NtReadRequestData
......@@ -469,7 +469,7 @@ type win32
461 stub RtlQuerySecurityObject
462 stub RtlQueryTagHeap
463 stub RtlQueryTimeZoneInformation
464 register RtlRaiseException() RtlRaiseException
464 register RtlRaiseException(ptr) RtlRaiseException
465 stdcall RtlRaiseStatus(long) RtlRaiseStatus
466 stub RtlRandom
467 stub RtlReAllocateHeap
......@@ -523,7 +523,7 @@ type win32
515 stdcall RtlUnicodeToOemN(ptr long ptr ptr long) RtlUnicodeToOemN
516 stub RtlUniform
517 stub RtlUnlockHeap
518 register RtlUnwind() RtlUnwind
518 register RtlUnwind(ptr ptr ptr long) RtlUnwind
519 stub RtlUpcaseUnicodeChar
520 stdcall RtlUpcaseUnicodeString(ptr ptr long) RtlUpcaseUnicodeString
521 stub RtlUpcaseUnicodeStringToAnsiString
......
......@@ -54,7 +54,7 @@ LPVOID WINAPI GetPK16SysVar(void)
/**********************************************************************
* CommonUnimpStub (KERNEL32.17)
*/
REGS_ENTRYPOINT(CommonUnimpStub)
void WINAPI REGS_FUNC(CommonUnimpStub)( CONTEXT *context )
{
if (EAX_reg(context))
MESSAGE( "*** Unimplemented Win32 API: %s\n", (LPSTR)EAX_reg(context) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment