Skip to content

Instantly share code, notes, and snippets.

@Pokechu22
Last active April 18, 2024 22:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pokechu22/caa73242a5969ff5dc413177fcb7f516 to your computer and use it in GitHub Desktop.
Save Pokechu22/caa73242a5969ff5dc413177fcb7f516 to your computer and use it in GitHub Desktop.
Ghidra Starlet (Wii IOS) processor spec - place these files in Processors/ARM/data/languages
@define ENDIAN "big"
@define T_VARIANT ""
@define VERSION_5 ""
@define VERSION_5E ""
@include "ARM.sinc"
# Hacky because we can't define a new token for bits 5-15 since sleigh doesn't
# allow adding new fields to the instrArm token
ioscallnum: value is c0507 & c0811 & c1212 & c1313 & c1414=0 & c1515=0
[ value = (c0507 | c0811 << 3 | c1212 << 7 | c1313 << 8); ]
{ export *[const]:1 value; }
define pcodeop ios_syscall;
:iossyscall^COND ioscallnum is $(AMODE) & COND & c0004=0x10 & c1627=0x600 & ioscallnum
{
build COND;
ios_syscall(ioscallnum);
}
<?xml version="1.1" encoding="UTF-8"?>
<language_definitions>
<language processor="ARM"
endian="big"
size="32"
variant="Starlet"
version="1.0"
slafile="ARM_Starlet.sla"
processorspec="ARMt_v45.pspec"
manualindexfile="../manuals/ARM.idx"
id="ARM:BE:32:Starlet">
<description>Starlet</description>
<compiler name="default" spec="ARM_v45.cspec" id="default"/>
</language>
</language_definitions>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Allow conversion from regular arm to starlet. This is a noop. -->
<language_translation>
<from_language version="1">ARM:BE:32:v8</from_language>
<to_language version="1">ARM:BE:32:Starlet</to_language>
</language_translation>
@xerpi
Copy link

xerpi commented Oct 18, 2023

Note: To generate ARM_Starlet.sla manually, run (on Linux x86-64):

<Ghidra install dir>/Ghidra/Features/Decompiler/os/linux_x86_64/sleigh -a Processors/ARM/

@Pokechu22
Copy link
Author

Ghidra also automatically generates it when you first use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment