mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
Use emergency TEB selector to avoid debugger crashes when stepping
through relay stubs (or when FS is invalid otherwise).
This commit is contained in:
parent
72dcd5c8b5
commit
2e30f6ffa3
@ -219,8 +219,10 @@ typedef struct _CONTEXT /* Note 1 */
|
||||
#ifdef FS_sig
|
||||
#include "syslevel.h"
|
||||
#define HANDLER_INIT() \
|
||||
SET_FS(IS_SELECTOR_SYSTEM(CS_sig(HANDLER_CONTEXT)) ? \
|
||||
FS_sig(HANDLER_CONTEXT) : SYSLEVEL_Win16CurrentTeb)
|
||||
do { int fs = IS_SELECTOR_SYSTEM(CS_sig(HANDLER_CONTEXT)) ? \
|
||||
FS_sig(HANDLER_CONTEXT) : SYSLEVEL_Win16CurrentTeb; \
|
||||
if (!fs) fs = SYSLEVEL_EmergencyTeb; \
|
||||
SET_FS(fs); } while (0)
|
||||
#else
|
||||
#define HANDLER_INIT() /* nothing */
|
||||
#endif
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "winbase.h"
|
||||
|
||||
extern WORD SYSLEVEL_Win16CurrentTeb;
|
||||
extern WORD SYSLEVEL_EmergencyTeb;
|
||||
|
||||
void SYSLEVEL_Init(void);
|
||||
VOID SYSLEVEL_EnterWin16Lock(VOID);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "heap.h"
|
||||
#include "task.h"
|
||||
#include "ldt.h"
|
||||
#include "syslevel.h"
|
||||
#include "thread.h"
|
||||
#include "winerror.h"
|
||||
#include "pe_image.h"
|
||||
@ -237,6 +238,9 @@ BOOL32 PROCESS_Init(void)
|
||||
if (!(thdb = THREAD_Create( pdb, 0, FALSE, NULL, NULL, NULL, NULL ))) return FALSE;
|
||||
thdb->unix_pid = getpid();
|
||||
|
||||
/* Remember TEB selector of initial process for emergency use */
|
||||
SYSLEVEL_EmergencyTeb = thdb->teb_sel;
|
||||
|
||||
/* Create the environment DB of the first process */
|
||||
if (!PROCESS_BuildEnvDB( pdb )) return FALSE;
|
||||
|
||||
|
@ -16,6 +16,9 @@ static SEGPTR segpWin16Mutex;
|
||||
/* Global variable to save current TEB while in 16-bit code */
|
||||
WORD SYSLEVEL_Win16CurrentTeb = 0;
|
||||
|
||||
/* TEB of initial process for emergency use */
|
||||
WORD SYSLEVEL_EmergencyTeb = 0;
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* SYSLEVEL_Init
|
||||
|
Loading…
Reference in New Issue
Block a user