From: "André Hentschel" Subject: [PATCH 19/23] dbghelp: Add support for PPC64 Message-Id: <20210131173433.114385-20-nerv@dawncrow.de> Date: Sun, 31 Jan 2021 18:34:29 +0100 In-Reply-To: <20210131173433.114385-1-nerv@dawncrow.de> References: <20210131173433.114385-1-nerv@dawncrow.de> Signed-off-by: André Hentschel --- dlls/dbghelp/Makefile.in | 1 + dlls/dbghelp/cpu_ppc64.c | 119 +++++++++++++++++++++++++++++++++++++++ dlls/dbghelp/dbghelp.c | 6 +- 3 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 dlls/dbghelp/cpu_ppc64.c diff --git a/dlls/dbghelp/Makefile.in b/dlls/dbghelp/Makefile.in index a370b94e7ce..531d36487bc 100644 --- a/dlls/dbghelp/Makefile.in +++ b/dlls/dbghelp/Makefile.in @@ -10,6 +10,7 @@ C_SRCS = \ cpu_arm.c \ cpu_arm64.c \ cpu_i386.c \ + cpu_ppc64.c \ cpu_x86_64.c \ dbghelp.c \ dwarf.c \ diff --git a/dlls/dbghelp/cpu_ppc64.c b/dlls/dbghelp/cpu_ppc64.c new file mode 100644 index 00000000000..52a5f10e3d5 --- /dev/null +++ b/dlls/dbghelp/cpu_ppc64.c @@ -0,0 +1,119 @@ +/* + * File cpu_ppc64.c + * + * Copyright (C) 2009 Eric Pouech + * Copyright (C) 2010-2013 André Hentschel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "dbghelp_private.h" +#include "winternl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); + +static BOOL ppc64_get_addr(HANDLE hThread, const CONTEXT* ctx, + enum cpu_addr ca, ADDRESS64* addr) +{ + return FALSE; +} + +#ifdef __powerpc64__ + +/* indexes in Reserved array */ +#define __CurrentModeCount 0 + +#define curr_mode (frame->Reserved[__CurrentModeCount] & 0x0F) +#define curr_count (frame->Reserved[__CurrentModeCount] >> 4) + +#define set_curr_mode(m) {frame->Reserved[__CurrentModeCount] &= ~0x0F; frame->Reserved[__CurrentModeCount] |= (m & 0x0F);} +#define inc_curr_count() (frame->Reserved[__CurrentModeCount] += 0x10) + +/* fetch_next_frame() + * + * modify (at least) context.Pc using unwind information + * either out of debug info (dwarf), or simple Lr trace + */ +static BOOL fetch_next_frame(struct cpu_stack_walk* csw, union ctx *pcontext, + DWORD_PTR curr_pc) +{ + FIXME("stub\n"); + return TRUE; +} + +static BOOL ppc64_stack_walk(struct cpu_stack_walk *csw, STACKFRAME64 *frame, + union ctx *context) +{ + FIXME("stub\n"); + return FALSE; +} +#else +static BOOL ppc64_stack_walk(struct cpu_stack_walk* csw, STACKFRAME64 *frame, + union ctx *ctx) +{ + return FALSE; +} +#endif + +static unsigned ppc64_map_dwarf_register(unsigned regno, const struct module* module, BOOL eh_frame) +{ + FIXME("stub\n"); + return 0; +} + +static void *ppc64_fetch_context_reg(union ctx *pctx, unsigned regno, unsigned *size) +{ + FIXME("Unknown register %x\n", regno); + return NULL; +} + +static const char* ppc64_fetch_regname(unsigned regno) +{ + FIXME("Unknown register %x\n", regno); + return NULL; +} + +static BOOL ppc64_fetch_minidump_thread(struct dump_context* dc, unsigned index, unsigned flags, const CONTEXT* ctx) +{ + FIXME("stub\n"); + return TRUE; +} + +static BOOL ppc64_fetch_minidump_module(struct dump_context* dc, unsigned index, unsigned flags) +{ + FIXME("stub\n"); + return FALSE; +} + +DECLSPEC_HIDDEN struct cpu cpu_ppc64 = { + IMAGE_FILE_MACHINE_POWERPC64, + 8, + 0, + ppc64_get_addr, + ppc64_stack_walk, + NULL, + ppc64_map_dwarf_register, + ppc64_fetch_context_reg, + ppc64_fetch_regname, + ppc64_fetch_minidump_thread, + ppc64_fetch_minidump_module, +}; diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index 00d7b61fbd8..d55aae943a4 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -147,9 +147,9 @@ const char* wine_dbgstr_addr(const ADDRESS64* addr) } } -extern struct cpu cpu_i386, cpu_x86_64, cpu_arm, cpu_arm64; +extern struct cpu cpu_i386, cpu_x86_64, cpu_arm, cpu_arm64, cpu_ppc64; -static struct cpu* dbghelp_cpus[] = {&cpu_i386, &cpu_x86_64, &cpu_arm, &cpu_arm64, NULL}; +static struct cpu* dbghelp_cpus[] = {&cpu_i386, &cpu_x86_64, &cpu_arm, &cpu_arm64, &cpu_ppc64, NULL}; struct cpu* dbghelp_current_cpu = #if defined(__i386__) &cpu_i386 @@ -159,6 +159,8 @@ struct cpu* dbghelp_current_cpu = &cpu_arm #elif defined(__aarch64__) &cpu_arm64 +#elif defined(__powerpc64__) + &cpu_ppc64 #else #error define support for your CPU #endif -- 2.25.1