Eric Pouech : dbghelp: Implement the new register methods for x86.

Alexandre Julliard julliard at winehq.org
Fri Apr 2 10:17:09 CDT 2010


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

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Thu Apr  1 21:24:07 2010 +0200

dbghelp: Implement the new register methods for x86.

---

 dlls/dbghelp/cpu_i386.c |   63 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/dlls/dbghelp/cpu_i386.c b/dlls/dbghelp/cpu_i386.c
index 094b241..7a951f7 100644
--- a/dlls/dbghelp/cpu_i386.c
+++ b/dlls/dbghelp/cpu_i386.c
@@ -452,12 +452,73 @@ reg: fop   31
 
 static void* i386_fetch_context_reg(CONTEXT* ctx, unsigned regno, unsigned* size)
 {
-    FIXME("NIY\n");
+#ifdef __i386__
+    switch (regno)
+    {
+    case CV_REG_EAX: *size = sizeof(ctx->Eax); return &ctx->Eax;
+    case CV_REG_EDX: *size = sizeof(ctx->Edx); return &ctx->Edx;
+    case CV_REG_ECX: *size = sizeof(ctx->Ecx); return &ctx->Ecx;
+    case CV_REG_EBX: *size = sizeof(ctx->Ebx); return &ctx->Ebx;
+    case CV_REG_ESI: *size = sizeof(ctx->Esi); return &ctx->Esi;
+    case CV_REG_EDI: *size = sizeof(ctx->Edi); return &ctx->Edi;
+    case CV_REG_EBP: *size = sizeof(ctx->Ebp); return &ctx->Ebp;
+    case CV_REG_ESP: *size = sizeof(ctx->Esp); return &ctx->Esp;
+    case CV_REG_EIP: *size = sizeof(ctx->Eip); return &ctx->Eip;
+
+    case CV_REG_ST0 + 0: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[0*sizeof(long double)];
+    case CV_REG_ST0 + 1: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[1*sizeof(long double)];
+    case CV_REG_ST0 + 2: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[2*sizeof(long double)];
+    case CV_REG_ST0 + 3: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[3*sizeof(long double)];
+    case CV_REG_ST0 + 4: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[4*sizeof(long double)];
+    case CV_REG_ST0 + 5: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[5*sizeof(long double)];
+    case CV_REG_ST0 + 6: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[6*sizeof(long double)];
+    case CV_REG_ST0 + 7: *size = sizeof(long double); return &ctx->FloatSave.RegisterArea[7*sizeof(long double)];
+
+    case CV_REG_EFLAGS: *size = sizeof(ctx->EFlags); return &ctx->EFlags;
+    case CV_REG_ES: *size = sizeof(ctx->SegEs); return &ctx->SegEs;
+    case CV_REG_CS: *size = sizeof(ctx->SegCs); return &ctx->SegCs;
+    case CV_REG_SS: *size = sizeof(ctx->SegSs); return &ctx->SegSs;
+    case CV_REG_DS: *size = sizeof(ctx->SegDs); return &ctx->SegDs;
+    case CV_REG_FS: *size = sizeof(ctx->SegFs); return &ctx->SegFs;
+    case CV_REG_GS: *size = sizeof(ctx->SegGs); return &ctx->SegGs;
+
+    }
+#endif
+    FIXME("Unknown register %x\n", regno);
     return NULL;
 }
 
 static const char* i386_fetch_regname(unsigned regno)
 {
+    switch (regno)
+    {
+    case CV_REG_EAX: return "eax";
+    case CV_REG_EDX: return "edx";
+    case CV_REG_ECX: return "ecx";
+    case CV_REG_EBX: return "ebx";
+    case CV_REG_ESI: return "esi";
+    case CV_REG_EDI: return "edi";
+    case CV_REG_EBP: return "ebp";
+    case CV_REG_ESP: return "esp";
+    case CV_REG_EIP: return "eip";
+
+    case CV_REG_ST0 + 0: return "st0";
+    case CV_REG_ST0 + 1: return "st1";
+    case CV_REG_ST0 + 2: return "st2";
+    case CV_REG_ST0 + 3: return "st3";
+    case CV_REG_ST0 + 4: return "st4";
+    case CV_REG_ST0 + 5: return "st5";
+    case CV_REG_ST0 + 6: return "st6";
+    case CV_REG_ST0 + 7: return "st7";
+
+    case CV_REG_EFLAGS: return "eflags";
+    case CV_REG_ES: return "es";
+    case CV_REG_CS: return "cs";
+    case CV_REG_SS: return "ss";
+    case CV_REG_DS: return "ds";
+    case CV_REG_FS: return "fs";
+    case CV_REG_GS: return "gs";
+    }
     FIXME("Unknown register %x\n", regno);
     return NULL;
 }




More information about the wine-cvs mailing list