Commit 91ba80df authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Set first LDT entry value as ntdll does.

parent b831dbfc
......@@ -30,13 +30,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
#define IS_VM86_MODE(ctx) (ctx->EFlags & V86_FLAG)
static const unsigned first_ldt_entry = 32;
static ADDRESS_MODE get_selector_type(HANDLE hThread, const WOW64_CONTEXT *ctx, WORD sel)
{
LDT_ENTRY le;
if (IS_VM86_MODE(ctx)) return AddrModeReal;
/* null or system selector */
if (!(sel & 4) || ((sel >> 3) < 17)) return AddrModeFlat;
if (!(sel & 4) || ((sel >> 3) < first_ldt_entry)) return AddrModeFlat;
if (dbg_curr_process->process_io->get_selector(hThread, sel, &le))
return le.HighWord.Bits.Default_Big ? AddrMode1632 : AddrMode1616;
/* selector doesn't exist */
......@@ -52,7 +54,7 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
case AddrModeReal:
return (void*)((DWORD_PTR)(LOWORD(addr->Segment) << 4) + (DWORD_PTR)addr->Offset);
case AddrMode1632:
if (!(addr->Segment & 4) || ((addr->Segment >> 3) < 17))
if (!(addr->Segment & 4) || ((addr->Segment >> 3) < first_ldt_entry))
return (void*)(DWORD_PTR)addr->Offset;
/* fall through */
case AddrMode1616:
......
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