Commit graph

342 commits

Author SHA1 Message Date
caheckman
3556745c32 start patterns for protected mode 2019-08-27 14:35:45 -04:00
caheckman
d9ad00e9ca Move segmentop tag into the pspec 2019-08-27 14:35:44 -04:00
caheckman
8240d3c8db Added x86:LE:16:Protected Mode 2019-08-27 14:35:43 -04:00
caheckman
7125cc4171 fixed bug detecting segmented addressing, new 16-bit start patterns 2019-08-27 14:27:19 -04:00
caheckman
afbceb2072 Set near/far prototype models during function purge analysis 2019-08-26 16:45:53 -04:00
Ryan Kurtz
939e3790d3 Merge remote-tracking branch 'origin/GT-3089_emteere_PR-910_aroulin_plt32-reloc' 2019-08-26 08:45:10 -04:00
emteere
6e82ab7769 GT-3089 Accepting pull request, fixed a few more relocations and added a
few that might be found in .o files.
2019-08-23 14:50:42 -04:00
caheckman
612c0d6f3e name to address space map
shortcut to address space map
more adjustments to shortcuts
allow null AddrSpace pointer in raw baselist
holes in the space indices
almost working
GT-2873 decompiler, other, and overlays
GT-2873 added OTHER space to java sleigh compiler, fixed decompiler
exception
isOtherSpace method
isOtherSpace java, addressing code review comments
GT-2873 added null check in decompiler reset
GT-2873 code review changes
Read and write space_other tag in SLA files
Version number for .sla file
GT-2873 fixups after merge
GT-2873 renamed Sparc registers: OTHER->OTHERWIN, WINWSTATE->WSTATE
GT-2873 added option in AddressInput to control OTHER space visibility
GT-2873 OTHER space now global
GT-2873 fixing comments refering to decompiler code in BasicCompilerSpec
2019-08-22 12:30:18 -04:00
Ryan Kurtz
0e5d55d74d Merge remote-tracking branch 'origin/GT-3095_ghidorahrex_PR-871_andyhhp_x86_sahf_lahf_64bit' 2019-08-20 14:29:40 -04:00
Ryan Kurtz
ee61c15a46 Merge remote-tracking branch 'origin/GT-3092_ghidorahrex_PR-834_mumbel_x86.offset' 2019-08-20 14:16:46 -04:00
Andrew Cooper
239106a356 x86: Restore the use of SAHF/LAHF in 64bit mode
The SAHF/LAHF instructions date from the 32bit x86 days, and where initially
marked as obsolete in the AMD 64bit spec.  All processors have the requisite
logic, as they are backwards compatible in 32bit mode.

The original 64bit CPUs from Intel and AMD would raise #UD for these
instructions, per the AMD64 spec.

However, they were were sufficiently critical for software emulators that the
instructions were "reintroduced" into the AMD64 spec, with a new CPUID bit
indicating that the they were now usable in 64bit mode.

In practice, every 64bit capable processor since 2005 has supported them.

Fixes #837
2019-08-17 20:34:55 +01:00
Andy Roulin
1cc1751ad5 x86: fix ELF R_X86_64_GOT32/R_X86_64_PLT32 reloc
R_X86_64_GOT32 and R_X86_64_PLT32 are 32-bit entries but the ELF
RelocationHandler would rewrite longs (64-bit), overwriting the
following bytes with the 64-bit sign-extension thus overwriting
the next instructions.

Rewrite int (32-bit) instead and properly relocate entries using
addend and offset fields as defined in AMD64 ABI.

Signed-off-by: Andy Roulin <andy.roulin@gmail.com>
2019-08-15 08:09:14 -07:00
emteere
522662477e GT-2955 (closes #881): Certifying
Pulled-from: mumbel <22204578+mumbel@users.noreply.github.com>
2019-08-14 18:28:21 -04:00
mumbel
88f127566c Sign-extended imm32 for 64-bit mode
Several x86_64 instructions were not sign extending the imm32 to
64-bits for the 64-bit mode instruction:  ADD, AND, CMD, and SUB,
while: ADC, MOV, and TEST were correct
2019-08-06 17:40:53 -05:00
Andrew Cooper
97b4528388 x86: Improvements to breakpoint disassembly
* `CC` and `CD 03` are different instructions, but previously disassembled to
   `INT 3` and `INT 0x3` respectively.

   The proper mnemonic for the former is `INT3` (no space), while the latter
   is a byte sequence only seen in tests and when trying to exploit emulator
   bugs.  Switch `CC` to use its documented mnemonic, which makes it easier to
   distinguish.

 * `INT1`, also commonly known as `ICEBP` (In Circuit Emulator Break-Point)
   has existed since the 486 processor, and was finally documented by Intel
   following the fallout from CVE-2018-8897.  Model it after `INT3`.

 * It is unclear why there is a specialisation for `:INT n29`, because vector
   29 is `#VC` in newer AMD CPUs, and can't be invoked using the `INT $29`
   instruction anyway.

   The byte sequence `CC 1D` always gets disassembled using `:INT imm8`, which
   suggests that SLEIGH has noticed the redundancy and folded the decode
   rules.  Drop the specialisation.

Fixes #514
2019-08-03 19:13:53 +01:00
ghidorahrex
071f98e18b Added support for operand-size override (0x66) prefix on :movbe
instructions.
2019-07-30 08:30:37 -04:00
mumbel
6f3fc3c32e x86 consistent offsets 2019-07-24 19:51:04 -05:00
Ryan Kurtz
674d5cee53 Merge remote-tracking branch 'origin/GT-3015_ryanmkurtz_PR-756_Piruzzolo_AAM' 2019-07-18 08:48:30 -04:00
ghidra1
e565601299 Merge remote-tracking branch 'origin/ghidra1_BitFields' 2019-07-17 18:45:27 -04:00
Ryan Kurtz
a4f7cdc414 Merge remote-tracking branch 'origin/GT-2940_GhidorahRex_PR_Support_for_RD_WR_FS_GS_BASE' 2019-07-17 12:33:49 -04:00
ghidra1
a7345527c9 BitFields - added preliminary support for composite bitfields 2019-07-17 11:55:29 -04:00
Ryan Kurtz
7a696dd6c2 Merge remote-tracking branch 'origin/GT-3007_ryanmkurtz_PR-719_williballenthin_patterncontraints' 2019-07-17 09:21:43 -04:00
Ryan Kurtz
c6f0bbc614 Merge remote-tracking branch 'origin/GT-3006_ryanmkurtz_PR-671_marpie_implement_callfixup_chkstk' 2019-07-17 09:01:23 -04:00
Ryan Kurtz
a4b9304cd8 Merge remote-tracking branch 'origin/GT-3004_ryanmkurtz_PR-771_GregoryMorse_x86_16_ida' 2019-07-17 08:19:50 -04:00
caheckman
ab7e57c521 Merge remote-tracking branch 'github/Github-732_caheckman_x64cspec' 2019-07-15 15:20:40 -04:00
caheckman
12d3da029b Refactor ParamEntry look-up allowing "contained by" discovery 2019-07-15 15:15:37 -04:00
caheckman
ef12c20829 Fix for "Unknown function tag: scope" error 2019-07-15 15:13:11 -04:00
ghidra1
e0e2c58eb7 Merge remote-tracking branch 'origin/ghidra1_Emulator'
Conflicts:
	gradle/root/eclipse.gradle
2019-07-12 16:14:17 -04:00
Gregory Morse
70a7d03099
Update x86.ldefs
x86 16-bit in IDA Pro >= 7.0 and probably earlier uses the metapc processor type and not any of those listed anymore.  I am not sure how many others should also be included but probably all of them.  The bit size is the primary selection, not the processor type anymore so although metapc is confirmed, perhaps the following should also be added as they are under 32-bit:
	<external_name tool="IDA-PRO" name="80686p"/>
	<external_name tool="IDA-PRO" name="k62"/>
	<external_name tool="IDA-PRO" name="p2"/>
	<external_name tool="IDA-PRO" name="p3"/>
	<external_name tool="IDA-PRO" name="athlon"/>
	<external_name tool="IDA-PRO" name="p4"/>

Though this is certainly a legacy IDA 5.x and maybe 6.x issue mainly.  AFAIK, all the >= 7.0 IDA versions use metapc for all x86.  Specific processors were any early feature that was consolidated there.
2019-07-10 01:57:16 +02:00
Piruzzolo
b549c0d8fc
removes unneeded == 1 2019-07-09 17:42:29 +02:00
Piruzzolo
d98290061d
Fix AAA, AAM, DAA, DAS x86 intructions + typo fix
According to Intel manual, the AAM instruction has a MOD, not an AND. Likely a typo. More, (AF == 1) added instead of AF (but I think it's pretty much the same)
+ bonus typo fix
2019-07-04 01:02:55 +02:00
ghidra1
dd15435371 Added P-Code Test framework to facilitate semantic verification through
emulation
2019-06-25 09:37:15 -04:00
Willi Ballenthin
b0f6af4930
x86/data/patterns/patternconstraints: remove extra text node
removing a line that appears to be superfluous. also, fix indentation.

unfortunately, i have *not* tested this, as i noticed this apparent extra line during a visual inspection. i don't have a build environment currently configured.
2019-06-24 15:04:37 -06:00
Ryan Kurtz
a1d68852ca Merge remote-tracking branch 'origin/GT-2943_GhidorahRex_PR-kreeblah_Update_x86_manual_index' 2019-06-20 07:59:03 -04:00
Markus Piéton
dce4f0a074 Implement Callfixup for x64 __chkstk function. 2019-06-10 17:02:41 +02:00
Andrew Cooper
28d473fed9 x86: Support for {RD,WR}{FS,GS}BASE instructions
This was derived from the existing readPID instruction, whose encoding is very
similar.

Fixes #554
2019-05-06 19:35:08 +01:00
ghidravore
f1e50fb079 Major refactoring of the gradle build system. 2019-04-23 15:20:26 -04:00
caheckman
53d9018f9e GT-2755: certified
Pulled-from: Markus Piéton <marpie@a12d404.net>
2019-04-15 11:22:55 -04:00
Markus Piéton
bdcbe2cf3a Callfixup for _guard_dispatch_icall on x86-64-win
Change goto to call
As pointed out by @caheckman [here](https://github.com/NationalSecurityAgency/ghidra/pull/340#issuecomment-482248465) the `goto` should be a `call`.
2019-04-15 11:15:12 -04:00
Kreeblah
b00852877c Updated x86 manual index
Updated x86 manual indexes to the following:

Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2 (2A, 2B, 2C & 2D): Instruction Set Reference, A-Z, Sep 2016 (325383-060US), available at https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf

AMD64 Architecture Programmer's Manual Volume 3: General-Purpose and System Instructions, Rev 3.26 May 2018 (24594), available at https://www.amd.com/system/files/TechDocs/24594.pdf

AMD64 Architecture Programmer's Manual Volume 4: 128-Bit and 256-Bit Media Instructions, Rev 3.23 Feb 2019 (26568), available at https://www.amd.com/system/files/TechDocs/26568.pdf

AMD64 Architecture Programmer's Manual Volume 5: 64-Bit Media and x87 Floating-Point Instructions, Rev 3.15 May 2018 (26569), available at https://www.amd.com/system/files/TechDocs/26569_APM_v5.pdf

AMD64 Technology 128-Bit SSE5 Instruction Set, Rev 3.01 August 2007 (43479), which is unchanged from the provided .idx. I can't find a newer version of the publication (or a different publication) that lists the same instructions, so I left it as it was. The only copy of the actual publication that I can find is at http://www.cs.northwestern.edu/~pdinda/icsclass/doc/AMD_ARCH_MANUALS/AMD64_128_Bit_SSE5_Instrs.pdf but it looks to be incomplete, as it stops at ROUNDSS.
2019-04-06 09:56:12 -07:00
ghidra1
7179c6de81 GT-2667 added support for generating sleigh build.xml files 2019-03-29 17:24:31 -04:00
Dan
79d8f164f8 Candidate release of source code. 2019-03-26 13:46:51 -04:00