Austin English : dbghelp: Add initial Sparc CPU support.

Alexandre Julliard julliard at winehq.org
Mon Aug 23 10:50:19 CDT 2010


Module: wine
Branch: master
Commit: e92a552dca077caaeae0899e8a6114ff3e8ded84
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e92a552dca077caaeae0899e8a6114ff3e8ded84

Author: Austin English <austinenglish at gmail.com>
Date:   Fri Aug 20 09:44:25 2010 -0500

dbghelp: Add initial Sparc CPU support.

---

 dlls/dbghelp/Makefile.in |    1 +
 dlls/dbghelp/cpu_sparc.c |   79 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/dbghelp/dbghelp.c   |    6 ++-
 include/winnt.h          |    3 ++
 4 files changed, 87 insertions(+), 2 deletions(-)

diff --git a/dlls/dbghelp/Makefile.in b/dlls/dbghelp/Makefile.in
index a6ba4e0..d4e57c9 100644
--- a/dlls/dbghelp/Makefile.in
+++ b/dlls/dbghelp/Makefile.in
@@ -12,6 +12,7 @@ C_SRCS = \
 	coff.c \
 	cpu_i386.c \
 	cpu_ppc.c \
+	cpu_sparc.c \
 	cpu_x86_64.c \
 	crc32.c \
 	dbghelp.c \
diff --git a/dlls/dbghelp/cpu_sparc.c b/dlls/dbghelp/cpu_sparc.c
new file mode 100644
index 0000000..c69e419
--- /dev/null
+++ b/dlls/dbghelp/cpu_sparc.c
@@ -0,0 +1,79 @@
+/*
+ * File cpu_sparc.c
+ *
+ * Copyright (C) 2009-2009, Eric Pouech
+ * Copyright (C) 2010, Austin English
+ *
+ * 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 <assert.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "dbghelp_private.h"
+#include "winternl.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
+
+static unsigned sparc_get_addr(HANDLE hThread, const CONTEXT* ctx,
+                             enum cpu_addr ca, ADDRESS64* addr)
+{
+   switch (ca)
+    {
+    case cpu_addr_pc:
+    case cpu_addr_stack:
+    case cpu_addr_frame:
+    default:
+         FIXME("not done for Sparc\n");
+    }
+    return FALSE;
+}
+
+static BOOL sparc_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CONTEXT* context)
+{
+    FIXME("not done for Sparc\n");
+    return FALSE;
+}
+
+static unsigned sparc_map_dwarf_register(unsigned regno)
+{
+    FIXME("not done for Sparc\n");
+    return 0;
+}
+
+static void* sparc_fetch_context_reg(CONTEXT* ctx, unsigned regno, unsigned* size)
+{
+    FIXME("not done for Sparc\n");
+    return NULL;
+}
+
+static const char* sparc_fetch_regname(unsigned regno)
+{
+    FIXME("Unknown register %x\n", regno);
+    return NULL;
+}
+
+struct cpu cpu_sparc = {
+    IMAGE_FILE_MACHINE_SPARC,
+    4,
+    sparc_get_addr,
+    sparc_stack_walk,
+    NULL,
+    sparc_map_dwarf_register,
+    sparc_fetch_context_reg,
+    sparc_fetch_regname,
+};
diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c
index 0966f27..fe7d892 100644
--- a/dlls/dbghelp/dbghelp.c
+++ b/dlls/dbghelp/dbghelp.c
@@ -151,9 +151,9 @@ const char* wine_dbgstr_addr(const ADDRESS64* addr)
     }
 }
 
-extern struct cpu       cpu_i386, cpu_x86_64, cpu_ppc;
+extern struct cpu       cpu_i386, cpu_x86_64, cpu_ppc, cpu_sparc;
 
-static struct cpu*      dbghelp_cpus[] = {&cpu_i386, &cpu_x86_64, &cpu_ppc, NULL};
+static struct cpu*      dbghelp_cpus[] = {&cpu_i386, &cpu_x86_64, &cpu_ppc, &cpu_sparc, NULL};
 struct cpu*             dbghelp_current_cpu =
 #if defined(__i386__)
     &cpu_i386
@@ -161,6 +161,8 @@ struct cpu*             dbghelp_current_cpu =
     &cpu_x86_64
 #elif defined(__powerpc__)
     &cpu_ppc
+#elif defined(__sparc__)
+    &cpu_sparc
 #else
 #error define support for your CPU
 #endif
diff --git a/include/winnt.h b/include/winnt.h
index 0bcb31b..cc8a2cb 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -2692,6 +2692,9 @@ typedef struct _IMAGE_VXD_HEADER {
 #define	IMAGE_FILE_MACHINE_M32R		0x9041
 #define	IMAGE_FILE_MACHINE_CEE		0xc0ee
 
+/* Wine extension */
+#define	IMAGE_FILE_MACHINE_SPARC	0x2000
+
 #define	IMAGE_SIZEOF_FILE_HEADER		20
 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER	56
 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER	28




More information about the wine-cvs mailing list