Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jamchamb committed Jun 26, 2019
0 parents commit 9b2c835
Show file tree
Hide file tree
Showing 27 changed files with 3,735 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .antProperties.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- This file is generated on each "Link Ghidra" command. Do not modify. -->

<project>
<property name="ghidra.install.dir" value="/opt/ghidra" />
</project>
409 changes: 409 additions & 0 deletions .classpath

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
build/
dist/
data/languages/*.sla

.gradle/

.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# CDT- autotools
.autotools

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Annotation Processing
.apt_generated/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
24 changes: 24 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RX62T</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>Ghidra</name>
<type>2</type>
<location>/opt/ghidra</location>
</link>
</linkedResources>
</projectDescription>
Empty file added Module.manifest
Empty file.
33 changes: 33 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Builds a Ghidra Extension for a given Ghidra installation.
//
// An absolute path to the Ghidra installation directory must be supplied either by setting the
// GHIDRA_INSTALL_DIR environment variable or Gradle project property:
//
// > export GHIDRA_INSTALL_DIR=<Absolute path to Ghidra>
// > gradle
//
// or
//
// > gradle -PGHIDRA_INSTALL_DIR=<Absolute path to Ghidra>
//
// Gradle should be invoked from the directory of the project to build. Please see the
// application.gradle.version property in <GHIDRA_INSTALL_DIR>/Ghidra/application.properties
// for the correction version of Gradle to use for the Ghidra installation you specify.

//----------------------START "DO NOT MODIFY" SECTION------------------------------
def ghidraInstallDir

if (System.env.GHIDRA_INSTALL_DIR) {
ghidraInstallDir = System.env.GHIDRA_INSTALL_DIR
}
else if (project.hasProperty("GHIDRA_INSTALL_DIR")) {
ghidraInstallDir = project.getProperty("GHIDRA_INSTALL_DIR")
}

if (ghidraInstallDir) {
apply from: new File(ghidraInstallDir).getCanonicalPath() + "/support/buildExtension.gradle"
}
else {
throw new GradleException("GHIDRA_INSTALL_DIR is not defined!")
}
//----------------------END "DO NOT MODIFY" SECTION-------------------------------
15 changes: 15 additions & 0 deletions data/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
The "data" directory is intended to hold data files that will be used by this module and will
not end up in the .jar file, but will be present in the zip or tar file. Typically, data
files are placed here rather than in the resources directory if the user may need to edit them.

An optional data/languages directory can exist for the purpose of containing various Sleigh language
specification files and importer opinion files.

The data/build.xml is used for building the contents of the data/languages directory.

The skel language definition has been commented-out within the skel.ldefs file so that the
skeleton language does not show-up within Ghidra.

See the Sleigh language documentation (docs/languages/sleigh.htm or sleigh.pdf) for details
on Sleigh language specification syntax.

81 changes: 81 additions & 0 deletions data/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
+ Compile sleigh languages within this module.
+ Eclipse: right-click on this file and choose menu item "Run As->Ant Build"
+ From command line (requires ant install)
+ - cd to data directory containing this file
+ - run ant
-->

<project name="privateBuildDeveloper" default="sleighCompile">

<property name="sleigh.compile.class" value="ghidra.pcodeCPort.slgh_compile.SleighCompile"/>

<property name="repo.dir" value="../../../.." />
<property name="repo.marker.dir" value="${repo.dir}/.git" />

<!--Import optional ant properties. GhidraDev Eclipse plugin produces this so this file can find the Ghidra installation-->
<import file="../.antProperties.xml" optional="true" />

<condition property="devmode">
<available file="${repo.marker.dir}" type="dir" />
</condition>

<target name="buildSleighClasspathDev" if="devmode">

<property name="framework.path" value="${repo.dir}/../ghidra.git/Ghidra/Framework"/>
<property name="libs.path" value="${repo.dir}/../ghidra.bin.git/ExternalLibraries/libsForRuntime"/>

<path id="sleigh.class.path">
<pathelement location="${framework.path}/SoftwareModeling/bin"/>
<pathelement location="${framework.path}/Generic/bin"/>
<pathelement location="${framework.path}/Utility/bin"/>
<fileset dir="${libs.path}">
<include name="*.jar"/>
</fileset>
</path>

<available classname="${sleigh.compile.class}" classpathref="sleigh.class.path" property="sleigh.compile.exists"/>

</target>

<target name="buildSleighClasspathDist" unless="devmode">

<!-- If language module is detached from installation, get Ghidra installation directory path from imported properties -->
<condition property="framework.path" value="${ghidra.install.dir}/Ghidra/Framework" else="../../../Framework">
<available file="${ghidra.install.dir}" type="dir" />
</condition>

<path id="sleigh.class.path">
<fileset dir="${framework.path}/SoftwareModeling/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${framework.path}/Generic/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${framework.path}/Utility/lib">
<include name="*.jar"/>
</fileset>
</path>
<available classname="${sleigh.compile.class}" classpathref="sleigh.class.path" property="sleigh.compile.exists"/>

</target>

<target name="sleighCompile" depends="buildSleighClasspathDist, buildSleighClasspathDev">

<fail unless="sleigh.compile.exists" />

<java classname="${sleigh.compile.class}"
classpathref="sleigh.class.path"
fork="true"
failonerror="true">
<jvmarg value="-Xmx2048M"/>
<arg value="-u"/>
<arg value="-a"/>
<arg value="./languages"/>
</java>

</target>

</project>
152 changes: 152 additions & 0 deletions data/languages/rx62t.cspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- See Relax specification: Ghidra/Framework/SoftwareModeling/data/languages/compiler_spec.rxg -->

<compiler_spec>
<data_organization>
<pointer_size value="4" />
<short_size value="2" />
<integer_size value="4" />
<long_size value="4" />
<float_size value="4" />
</data_organization>
<global>
<range space="ram"/>
<!--<range space="io"/>-->
</global>
<stackpointer register="SP" space="ram"/>
<!--
<segmentop space="ram" userop="segment" baseinsize="2" innerinsize="2" farpointer="yes">
<baseop code="INT_ZEXT"/>
<baseop code="INT_LEFT" value="12"/>
<innerop code="INT_ZEXT"/>
<constresolve>
<register name="rBBR"/>
</constresolve>
</segmentop>
-->
<returnaddress>
<varnode space="stack" offset="0" size="4"/>
</returnaddress>
<default_proto>
<prototype name="__fastcall" extrapop="unknown" stackshift="4">
<input>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R1"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R2"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R3"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R4"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R15"/>
</pentry>
<pentry minsize="1" maxsize="500" align="4">
<addr space="stack" offset="4"/>
</pentry>
</input>
<output>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R1"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R2"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R3"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R4"/>
</pentry>
<pentry minsize="1" maxsize="4" extension="inttype">
<register name="R14"/>
</pentry>
</output>
<unaffected>
<register name="SP"/>
<register name="R6"/>
<register name="R7"/>
<register name="R8"/>
<register name="R9"/>
<register name="R10"/>
<register name="R11"/>
<register name="R12"/>
<register name="R13"/>
</unaffected>
</prototype>
</default_proto>
<!--
<prototype name="__asmAF" extrapop="2" stackshift="2" strategy="register">
<input>
<pentry minsize="1" maxsize="1">
<register name="A"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="BC"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="HL"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="DE"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="IY"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="IX"/>
</pentry>
<pentry minsize="1" maxsize="500" align="2">
<addr offset="2" space="stack"/>
</pentry>
</input>
<output>
<pentry minsize="1" maxsize="2">
<register name="AF"/>
</pentry>
</output>
<unaffected>
<register name="SP"/>
<register name="rBBR"/>
<register name="BC_"/>
<register name="HL_"/>
<register name="DE_"/>
<register name="AF_"/>
</unaffected>
</prototype>
<prototype name="__stdcall" extrapop="2" stackshift="2">
<input>
<pentry minsize="1" maxsize="1">
<register name="A"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="BC"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="HL"/>
</pentry>
<pentry minsize="1" maxsize="500" align="2">
<addr offset="2" space="stack"/>
</pentry>
</input>
<output>
<pentry minsize="1" maxsize="1">
<register name="AF"/>
</pentry>
</output>
<unaffected>
<register name="SP"/>
<register name="rBBR"/>
<register name="BC_"/>
<register name="HL_"/>
<register name="DE_"/>
<register name="AF_"/>
</unaffected>
</prototype>
-->
</compiler_spec>
17 changes: 17 additions & 0 deletions data/languages/rx62t.ldefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- See Relax specification: Ghidra/Framework/SoftwareModeling/data/languages/language_definitions.rxg -->

<language_definitions>
<language processor="RX62T"
endian="little"
size="32"
variant="default"
version="1.0"
slafile="rx62t.sla"
processorspec="rx62t.pspec"
id="rx62t:LE:32:default">
<description>RX62T/RXv2 Language Module</description>
<compiler name="default" spec="rx62t.cspec" id="default"/>
</language>
</language_definitions>
Loading

0 comments on commit 9b2c835

Please sign in to comment.