From bd1f7ef1868dd563a82eacd1bf414bf8d1a7254e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Sun, 14 Jun 2015 23:24:22 +0200 Subject: [PATCH] include: Rename 64-bit PState to 32-bit Cpsr on ARM64. --- dlls/dbghelp/cpu_arm64.c | 5 ++--- dlls/ntdll/signal_arm64.c | 10 +++++----- include/winnt.h | 2 +- programs/winedbg/be_arm64.c | 12 ++++++------ programs/winedbg/gdbproxy.c | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/dlls/dbghelp/cpu_arm64.c b/dlls/dbghelp/cpu_arm64.c index 9e77ac186ad..9c17e27c778 100644 --- a/dlls/dbghelp/cpu_arm64.c +++ b/dlls/dbghelp/cpu_arm64.c @@ -166,7 +166,7 @@ static void* arm64_fetch_context_reg(CONTEXT* ctx, unsigned regno, unsigned* siz #ifdef __aarch64__ switch (regno) { - + case CV_ARM64_PSTATE: *size = sizeof(ctx->Cpsr); return &ctx->Cpsr; case CV_ARM64_X0 + 0: *size = sizeof(ctx->X0); return &ctx->X0; case CV_ARM64_X0 + 1: *size = sizeof(ctx->X1); return &ctx->X1; case CV_ARM64_X0 + 2: *size = sizeof(ctx->X2); return &ctx->X2; @@ -201,7 +201,6 @@ static void* arm64_fetch_context_reg(CONTEXT* ctx, unsigned regno, unsigned* siz case CV_ARM64_LR: *size = sizeof(ctx->Lr); return &ctx->Lr; case CV_ARM64_SP: *size = sizeof(ctx->Sp); return &ctx->Sp; case CV_ARM64_PC: *size = sizeof(ctx->Pc); return &ctx->Pc; - case CV_ARM64_PSTATE: *size = sizeof(ctx->PState); return &ctx->PState; } #endif FIXME("Unknown register %x\n", regno); @@ -212,6 +211,7 @@ static const char* arm64_fetch_regname(unsigned regno) { switch (regno) { + case CV_ARM64_PSTATE: return "cpsr"; case CV_ARM64_X0 + 0: return "x0"; case CV_ARM64_X0 + 1: return "x1"; case CV_ARM64_X0 + 2: return "x2"; @@ -246,7 +246,6 @@ static const char* arm64_fetch_regname(unsigned regno) case CV_ARM64_LR: return "lr"; case CV_ARM64_SP: return "sp"; case CV_ARM64_PC: return "pc"; - case CV_ARM64_PSTATE: return "cpsr"; } FIXME("Unknown register %x\n", regno); return NULL; diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index a8b48163449..e8dedd3b200 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -129,7 +129,7 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext ) context->Lr = LR_sig(sigcontext); /* Link register */ context->Sp = SP_sig(sigcontext); /* Stack pointer */ context->Pc = PC_sig(sigcontext); /* Program Counter */ - context->PState = PSTATE_sig(sigcontext); /* Current State Register */ + context->Cpsr = PSTATE_sig(sigcontext); /* Current State Register */ } @@ -151,7 +151,7 @@ static void restore_context( const CONTEXT *context, ucontext_t *sigcontext ) LR_sig(sigcontext) = context->Lr; /* Link register */ SP_sig(sigcontext) = context->Sp; /* Stack pointer */ PC_sig(sigcontext) = context->Pc; /* Program Counter */ - PSTATE_sig(sigcontext) = context->PState; /* Current State Register */ + PSTATE_sig(sigcontext) = context->Cpsr; /* Current State Register */ } @@ -209,7 +209,7 @@ void copy_context( CONTEXT *to, const CONTEXT *from, DWORD flags ) to->Lr = from->Lr; to->Sp = from->Sp; to->Pc = from->Pc; - to->PState = from->PState; + to->Cpsr = from->Cpsr; } if (flags & CONTEXT_INTEGER) { @@ -241,7 +241,7 @@ NTSTATUS context_to_server( context_t *to, const CONTEXT *from ) to->integer.arm64_regs.x[30] = from->Lr; to->ctl.arm64_regs.sp = from->Sp; to->ctl.arm64_regs.pc = from->Pc; - to->ctl.arm64_regs.pstate = from->PState; + to->ctl.arm64_regs.pstate = from->Cpsr; } if (flags & CONTEXT_INTEGER) { @@ -274,7 +274,7 @@ NTSTATUS context_from_server( CONTEXT *to, const context_t *from ) to->Lr = from->integer.arm64_regs.x[30]; to->Sp = from->ctl.arm64_regs.sp; to->Pc = from->ctl.arm64_regs.pc; - to->PState = from->ctl.arm64_regs.pstate; + to->Cpsr = from->ctl.arm64_regs.pstate; } if (from->flags & SERVER_CTX_INTEGER) { diff --git a/include/winnt.h b/include/winnt.h index fcf65f22b9b..08e7f4820d4 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -1755,6 +1755,7 @@ PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(ULONG_PTR,DWORD*,UNWIND_HISTORY_ typedef struct _CONTEXT { ULONG ContextFlags; + ULONG Cpsr; /* This section is specified/returned if the ContextFlags word contains the flag CONTEXT_INTEGER. */ @@ -1793,7 +1794,6 @@ typedef struct _CONTEXT { ULONGLONG Lr; ULONGLONG Sp; ULONGLONG Pc; - ULONGLONG PState; /* These are selected by CONTEXT_FLOATING_POINT */ /* FIXME */ diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c index b68daef5aaa..80a12beb7b1 100644 --- a/programs/winedbg/be_arm64.c +++ b/programs/winedbg/be_arm64.c @@ -60,7 +60,7 @@ static void be_arm64_print_context(HANDLE hThread, const CONTEXT* ctx, int all_r int i; char buf[8]; - switch (ctx->PState & 0x0f) + switch (ctx->Cpsr & 0x0f) { case 0: strcpy(buf, "EL0t"); break; case 4: strcpy(buf, "EL1t"); break; @@ -73,15 +73,15 @@ static void be_arm64_print_context(HANDLE hThread, const CONTEXT* ctx, int all_r } dbg_printf("Register dump:\n"); - dbg_printf("%s %s Mode\n", (ctx->PState & 0x10) ? "ARM" : "ARM64", buf); + dbg_printf("%s %s Mode\n", (ctx->Cpsr & 0x10) ? "ARM" : "ARM64", buf); strcpy(buf, condflags); for (i = 0; buf[i]; i++) - if (!((ctx->PState >> 26) & (1 << (sizeof(condflags) - i)))) + if (!((ctx->Cpsr >> 26) & (1 << (sizeof(condflags) - i)))) buf[i] = '-'; - dbg_printf(" Pc:%016lx Sp:%016lx Lr:%016lx Pstate:%016lx(%s)\n", - ctx->Pc, ctx->Sp, ctx->Lr, ctx->PState, buf); + dbg_printf(" Pc:%016lx Sp:%016lx Lr:%016lx Cpsr:%08x(%s)\n", + ctx->Pc, ctx->Sp, ctx->Lr, ctx->Cpsr, buf); dbg_printf(" x0: %016lx x1: %016lx x2: %016lx x3: %016lx x4: %016lx\n", ctx->X0, ctx->X1, ctx->X2, ctx->X3, ctx->X4); dbg_printf(" x5: %016lx x6: %016lx x7: %016lx x8: %016lx x9: %016lx\n", @@ -104,6 +104,7 @@ static void be_arm64_print_segment_info(HANDLE hThread, const CONTEXT* ctx) static struct dbg_internal_var be_arm64_ctx[] = { + {CV_ARM64_PSTATE, "cpsr", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Cpsr), dbg_itype_unsigned_int}, {CV_ARM64_X0 + 0, "x0", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, X0), dbg_itype_unsigned_long_int}, {CV_ARM64_X0 + 1, "x1", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, X1), dbg_itype_unsigned_long_int}, {CV_ARM64_X0 + 2, "x2", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, X2), dbg_itype_unsigned_long_int}, @@ -137,7 +138,6 @@ static struct dbg_internal_var be_arm64_ctx[] = {CV_ARM64_LR, "lr", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Lr), dbg_itype_unsigned_long_int}, {CV_ARM64_SP, "sp", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Sp), dbg_itype_unsigned_long_int}, {CV_ARM64_PC, "pc", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Pc), dbg_itype_unsigned_long_int}, - {CV_ARM64_PSTATE, "pstate", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, PState), dbg_itype_unsigned_long_int}, {0, NULL, 0, dbg_itype_none} }; diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index fc5e8e54b24..dd63f7d3130 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -399,6 +399,7 @@ static struct cpu_register cpu_register_map[] = { #elif defined(__aarch64__) static const char target_xml[] = ""; static struct cpu_register cpu_register_map[] = { + REG(Cpsr, 4, CONTEXT_CONTROL), REG(X0, 8, CONTEXT_INTEGER), REG(X1, 8, CONTEXT_INTEGER), REG(X2, 8, CONTEXT_INTEGER), @@ -432,7 +433,6 @@ static struct cpu_register cpu_register_map[] = { REG(Lr, 8, CONTEXT_INTEGER), REG(Sp, 8, CONTEXT_CONTROL), REG(Pc, 8, CONTEXT_CONTROL), - REG(PState, 8, CONTEXT_CONTROL), }; #else # error Define the registers map for your CPU