Replies: 3 comments 10 replies
-
I think your context register idea should work, although I don't know how you tried to execute it to know for sure. There will always be some duplication with sleigh. It's just the nature of the code. But I think you only need to duplicate it 3 times. I looked through the NS32000 instruction set and all the For example:
or
You can write your tokens so that the first 16 bytes use the same token, and the Then you only have to worry about the additional index byte |
Beta Was this translation helpful? Give feedback.
-
I've made some good progress, using the 16-bit token as suggested above even for 24-bit instructions, but now I'm having issues with a format 4 16-bit instruction with two The matching instruction and
with
and where For the instruction sequence The instruction info is: Instruction Summary
-------------------
Mnemonic : MOVB
Number of Operands: 2
Address : ram:00000065
Flow Type : FALL_THROUGH
Fallthrough : 00000068
Delay slot depth : 0
Hash : 7cfcaed4
Input Objects:
const:0x3
Result Objects:
Constructor Line #'s:
MOV(NS32016.slaspec:277), i(NS32016.slaspec:174),
gen1(NS32016.slaspec:211), imm(NS32016.slaspec:178),
gen2(NS32016.slaspec:224), disp2(NS32016.slaspec:133)
Byte Length : 3
Instr Bytes : 01010100 10100101 00000011
Mask : 11111111 11111111 00000000
Masked Bytes: 01010100 10100101 00000000
Instr Context:
[Instruction context has not been set] I tried creating a second Is there a good example in any of the existing processor Sleigh files for how to correctly consume the additional extension bytes (and in the correct order) ? thanks! p.s. if a separate question is preferred for search purposes let me know. |
Beta Was this translation helpful? Give feedback.
-
I've been restarting Ghidra between each test anyway, as I didn't know about The binary (for an E-mu Emax sampler) is here I suspect I've bitten off more than I can chew with the NS32016 as a first project for Sleigh... (but thanks for the support!) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to learn Sleigh to disassemble NS32016 code, and it's a hairy instruction set.
In particular there's a 5 bit field variously named
gen
,gen1
andgen2
that can appear in various (7?) different locations with varying length instructions, but with identical semantics in each case. Worse still, some values of that field can then require that additional tokens (of varying lengths) are read in from the instruction stream.Is there a way in Sleigh to just create a single table that will work without it being specific to the particular bit placement of that field within the instruction?
Currently the code looks like this, but doesn't yet cover all of the possible addressing modes, and this is for just for one of the possible places that this field can appear:
disp
is a variable length field for signed displacements, identified by the top two bits in the first byte:I tried using a context register as a way to "pass" a specific field instance that could be read in the
disp
table but the Sleigh compiler didn't allow that :( To make it worse some instructions can effectively end up with fourgen
type fields in them, where there are two primarygen
fields each of which for values0xb111XX
can point to an index byte which itself contains agen
field!Thanks for any advice!
Beta Was this translation helpful? Give feedback.
All reactions