Skip to content

Commit

Permalink
Fix Windows regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole André Vadla Ravnås committed Apr 11, 2014
1 parent 019f1e9 commit 2ff857b
Show file tree
Hide file tree
Showing 12 changed files with 272 additions and 68 deletions.
56 changes: 49 additions & 7 deletions gum-32.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
<Filter Include="vapi">
<UniqueIdentifier>{c9fdd7fd-d1cb-41ce-a511-b326acab51f1}</UniqueIdentifier>
</Filter>
<Filter Include="core\arch-arm">
<UniqueIdentifier>{3de8e70e-7e64-469c-bca3-90eb555c03c3}</UniqueIdentifier>
</Filter>
<Filter Include="core\arch-arm64">
<UniqueIdentifier>{12159555-5953-43fc-873d-2754adb9b815}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SolutionDir)udis86\libudis86\udis86.c">
Expand Down Expand Up @@ -186,9 +192,6 @@
<ClCompile Include="libs\gum\heap\gumheapapi.c">
<Filter>libs\heap</Filter>
</ClCompile>
<ClCompile Include="gum\backend-x86\gumclosure-x86.c">
<Filter>core\backend-x86</Filter>
</ClCompile>
<ClCompile Include="gum\gumscript.cpp">
<Filter>core</Filter>
</ClCompile>
Expand Down Expand Up @@ -225,6 +228,24 @@
<ClCompile Include="gum\backend-windows\gumprocess-windows.c">
<Filter>core\backend-windows</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm64\gumarm64relocator.c">
<Filter>core\arch-arm64</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm64\gumarm64writer.c">
<Filter>core\arch-arm64</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumarmrelocator.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumarmwriter.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumthumbrelocator.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumthumbwriter.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(SolutionDir)udis86\libudis86\extern.h">
Expand Down Expand Up @@ -413,9 +434,6 @@
<ClInclude Include="libs\gum\heap\gumallocatorprobe-priv.h">
<Filter>libs\heap</Filter>
</ClInclude>
<ClInclude Include="gum\gumclosure.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="gum\gumscript-priv.h">
<Filter>core</Filter>
</ClInclude>
Expand Down Expand Up @@ -458,6 +476,30 @@
<ClInclude Include="$(SolutionDir)udis86\libudis86\udint.h">
<Filter>udis86</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm64\gumarm64.h">
<Filter>core\arch-arm64</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm64\gumarm64relocator.h">
<Filter>core\arch-arm64</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm64\gumarm64writer.h">
<Filter>core\arch-arm64</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumarm.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumarmrelocator.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumarmwriter.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumthumbrelocator.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumthumbwriter.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="vapi\gum-1.0.vapi">
Expand All @@ -469,4 +511,4 @@
<Filter>udis86</Filter>
</CustomBuild>
</ItemGroup>
</Project>
</Project>
62 changes: 52 additions & 10 deletions gum-64.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
<Filter Include="core">
<UniqueIdentifier>{37ab3c51-1983-4479-91c9-010eb64aae2f}</UniqueIdentifier>
</Filter>
<Filter Include="core\arch-x86">
<UniqueIdentifier>{41ad8d23-ee83-4901-a2ac-26b1e995b0b3}</UniqueIdentifier>
</Filter>
<Filter Include="core\backend-windows">
<UniqueIdentifier>{344c8464-6e81-4ed7-b64f-62e262bf6134}</UniqueIdentifier>
</Filter>
Expand All @@ -31,6 +28,15 @@
<Filter Include="vapi">
<UniqueIdentifier>{4f6067a4-9b67-4259-a2b6-8c902581f2c6}</UniqueIdentifier>
</Filter>
<Filter Include="core\arch-arm">
<UniqueIdentifier>{422492e7-f2de-49a2-923f-f70237e2f44c}</UniqueIdentifier>
</Filter>
<Filter Include="core\arch-arm64">
<UniqueIdentifier>{8e89e69d-014f-4730-8e4b-ed9caa938949}</UniqueIdentifier>
</Filter>
<Filter Include="core\arch-x86">
<UniqueIdentifier>{41ad8d23-ee83-4901-a2ac-26b1e995b0b3}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(SolutionDir)udis86\libudis86\decode.c">
Expand Down Expand Up @@ -186,9 +192,6 @@
<ClCompile Include="libs\gum\heap\gumheapapi.c">
<Filter>libs\heap</Filter>
</ClCompile>
<ClCompile Include="gum\backend-x86\gumclosure-x86.c">
<Filter>core\backend-x86</Filter>
</ClCompile>
<ClCompile Include="gum\gumscript.cpp">
<Filter>core</Filter>
</ClCompile>
Expand Down Expand Up @@ -225,6 +228,24 @@
<ClCompile Include="gum\backend-windows\gumprocess-windows.c">
<Filter>core\backend-windows</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm64\gumarm64relocator.c">
<Filter>core\arch-arm64</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm64\gumarm64writer.c">
<Filter>core\arch-arm64</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumarmrelocator.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumarmwriter.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumthumbrelocator.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
<ClCompile Include="gum\arch-arm\gumthumbwriter.c">
<Filter>core\arch-arm</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(SolutionDir)udis86\libudis86\extern.h">
Expand Down Expand Up @@ -413,9 +434,6 @@
<ClInclude Include="libs\gum\heap\gumallocatorprobe-priv.h">
<Filter>libs\heap</Filter>
</ClInclude>
<ClInclude Include="gum\gumclosure.h">
<Filter>core</Filter>
</ClInclude>
<ClInclude Include="gum\gumscript-priv.h">
<Filter>core</Filter>
</ClInclude>
Expand Down Expand Up @@ -458,6 +476,30 @@
<ClInclude Include="$(SolutionDir)udis86\libudis86\udint.h">
<Filter>udis86</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm64\gumarm64.h">
<Filter>core\arch-arm64</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm64\gumarm64relocator.h">
<Filter>core\arch-arm64</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm64\gumarm64writer.h">
<Filter>core\arch-arm64</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumarm.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumarmrelocator.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumarmwriter.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumthumbrelocator.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
<ClInclude Include="gum\arch-arm\gumthumbwriter.h">
<Filter>core\arch-arm</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="vapi\gum-1.0.vapi">
Expand All @@ -469,4 +511,4 @@
<Filter>udis86</Filter>
</CustomBuild>
</ItemGroup>
</Project>
</Project>
28 changes: 26 additions & 2 deletions gum-common.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<ClInclude Include="gum\gum.h" />
<ClInclude Include="gum\gumarray.h" />
<ClInclude Include="gum\gumbacktracer.h" />
<ClInclude Include="gum\gumclosure.h" />
<ClInclude Include="gum\gumcodeallocator.h" />
<ClInclude Include="gum\gumdefs.h" />
<ClInclude Include="gum\gumevent.h" />
Expand Down Expand Up @@ -94,7 +93,32 @@
</ItemGroup>

<ItemGroup>
<ClCompile Include="gum\backend-x86\gumclosure-x86.c" />
<ClInclude Include="gum\arch-arm\gumarm.h" />
<ClInclude Include="gum\arch-arm\gumarmwriter.h" />
<ClInclude Include="gum\arch-arm\gumarmrelocator.h" />
<ClInclude Include="gum\arch-arm\gumthumbwriter.h" />
<ClInclude Include="gum\arch-arm\gumthumbrelocator.h" />
</ItemGroup>

<ItemGroup>
<ClCompile Include="gum\arch-arm\gumarmwriter.c" />
<ClCompile Include="gum\arch-arm\gumarmrelocator.c" />
<ClCompile Include="gum\arch-arm\gumthumbwriter.c" />
<ClCompile Include="gum\arch-arm\gumthumbrelocator.c" />
</ItemGroup>

<ItemGroup>
<ClInclude Include="gum\arch-arm64\gumarm64.h" />
<ClInclude Include="gum\arch-arm64\gumarm64writer.h" />
<ClInclude Include="gum\arch-arm64\gumarm64relocator.h" />
</ItemGroup>

<ItemGroup>
<ClCompile Include="gum\arch-arm64\gumarm64writer.c" />
<ClCompile Include="gum\arch-arm64\gumarm64relocator.c" />
</ItemGroup>

<ItemGroup>
<ClCompile Include="gum\backend-x86\guminterceptor-x86.c" />
<ClCompile Include="gum\backend-x86\gumstalker-x86.c" />
</ItemGroup>
Expand Down
22 changes: 12 additions & 10 deletions gum/arch-arm/gumarmrelocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ gum_arm_relocator_read_one (GumArmRelocator * self,
raw_insn = GUINT32_FROM_LE (*((guint32 *) self->input_cur));
insn = &self->input_insns[gum_arm_relocator_inpos (self)];

category = (raw_insn >> 25) & 0b111;
category = (raw_insn >> 25) & 7;

insn->mnemonic = GUM_ARM_UNKNOWN;
insn->address = self->input_cur;
Expand All @@ -119,33 +119,33 @@ gum_arm_relocator_read_one (GumArmRelocator * self,

switch (category)
{
case 0b000: /* data processing */
case 0b001:
case 0: /* data processing */
case 1:
{
guint opcode = (raw_insn >> 21) & 0b1111;
guint opcode = (raw_insn >> 21) & 0xf;
switch (opcode)
{
case 0b1101:
case 0xd:
insn->mnemonic = GUM_ARM_MOV;
break;
}
break;
}

case 0b010: /* load/store */
case 2: /* load/store */
break;

case 0b100: /* load/store multiple */
case 4: /* load/store multiple */
{
guint base_register = (raw_insn >> 16) & 0b1111;
guint base_register = (raw_insn >> 16) & 0xf;
guint is_load = (raw_insn >> 20) & 1;
if (base_register == GUM_AREG_SP)
insn->mnemonic = is_load ? GUM_ARM_POP : GUM_ARM_PUSH;
break;
}

case 0b101: /* control */
if (((raw_insn >> 28) & 0b1111) == 0b1111)
case 5: /* control */
if (((raw_insn >> 28) & 0xf) == 0xf)
{
insn->mnemonic = GUM_ARM_BLX_IMM_A2;
}
Expand Down Expand Up @@ -324,6 +324,8 @@ gum_arm_relocator_rewrite_branch_imm (GumArmRelocator * self,
} distance;
GumAddress absolute_target;

(void) self;

raw_insn = *ctx->raw_insn;
if ((raw_insn & 0x00800000) != 0)
distance.u = 0xfc000000 | ((raw_insn & 0x00ffffff) << 2);
Expand Down
2 changes: 1 addition & 1 deletion gum/arch-arm/gumarmwriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ gum_arm_writer_cur (GumArmWriter * self)
guint
gum_arm_writer_offset (GumArmWriter * self)
{
return (self->code - self->base) * sizeof (guint32);
return (guint) (self->code - self->base) * sizeof (guint32);
}

void
Expand Down
Loading

0 comments on commit 2ff857b

Please sign in to comment.