Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Kochkov committed Feb 2, 2019
0 parents commit 4ac8b5c
Show file tree
Hide file tree
Showing 16 changed files with 94,999 additions and 0 deletions.
35,440 changes: 35,440 additions & 0 deletions 80-n2040-36_b_hexagon_v62_prog_ref_manual.txt

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) 2016, Fundación Dr. Manuel Sadosky
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Overview

This is a Hexagon disassembly and analysis plugin generator for radare2.
It uses text file of the specification as a source (recognized from PDF file),
and some additional text files with some amendments.

It processes the files and generate C code in `r2` directory. Just run `importer.py`.

The parsing part based largely on [hexag00n](https://github.com/programa-stic/hexag00n) importer.

# Contributors

* Anton Kochkov

* Lucas Molas

* Iván Arce

* Juan Heguiabehere

* Christian Heitman

* D.C.


282 changes: 282 additions & 0 deletions const_extenders.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
Rd = memb(##U32)
Rd = memub(##U32)
Rd = memh(##U32)
Rd = memuh(##U32)
Rd = memw(##U32)
Rd = memd(##U32)
if (Pt) Rd = memb (Rs + #u6:0) // +
if (!Pt) Rd = memb (Rs + #u6:0) // +
if (Pt.new) Rd = memb (Rs + #u6:0) // +
if (!Pt.new) Rd = memb (Rs + #u6:0) // +
if (Pt) Rd = memub (Rs + #u6:0) // +
if (!Pt) Rd = memub (Rs + #u6:0) // +
if (Pt.new) Rd = memub (Rs + #u6:0) // +
if (!Pt.new) Rd = memub (Rs + #u6:0) // +
if (Pt) Rd = memh (Rs + #u6:1) // +
if (!Pt) Rd = memh (Rs + #u6:1) // +
if (Pt.new) Rd = memh (Rs + #u6:1) // +
if (!Pt.new) Rd = memh (Rs + #u6:1) // +
if (Pt) Rd = memuh (Rs + #u6:1) // +
if (!Pt) Rd = memuh (Rs + #u6:1) // +
if (Pt.new) Rd = memuh (Rs + #u6:1) // +
if (!Pt.new) Rd = memuh (Rs + #u6:1) // +
if (Pt) Rd = memw (Rs + #u6:2) // +
if (!Pt) Rd = memw (Rs + #u6:2) // +
if (Pt.new) Rd = memw (Rs + #u6:2) // +
if (!Pt.new) Rd = memw (Rs + #u6:2) // +
if (Pt) Rdd = memd (Rs + #u6:3) // +
if (!Pt) Rdd = memd (Rs + #u6:3) // +
if (Pt.new) Rdd = memd (Rs + #u6:3) // +
if (!Pt.new) Rdd = memd (Rs + #u6:3) // +
Rd = memb (Rs + #s11:0) // +
Rd = memub (Rs + #s11:0) // +
Rd = memh (Rs + #s11:1) // +
Rd = memuh (Rs + #s11:1) // +
Rd = memw (Rs + #s11:2) // +
Rdd = memd (Rs + #s11:3) // +
Rd = memb (Re=#U6) // +
Rd = memub (Re=#U6) // +
Rd = memh (Re=#U6) // +
Rd = memuh (Re=#U6) // +
Rd = memw (Re=#U6) // +
Rdd = memd (Re=#U6) // +
Rd = memb (Rt<<#u2 + #U6) // +
Rd = memub (Rt<<#u2 + #U6) // +
Rd = memh (Rt<<#u2 + #U6) // +
Rd = memuh (Rt<<#u2 + #U6) // +
Rd = memw (Rt<<#u2 + #U6) // +
Rdd = memd (Rt<<#u2 + #U6) // +
if (Pt) Rd = memb (#u6) // +
if (!Pt) Rd = memb (#u6) // +
if (Pt.new) Rd = memb (#u6) // +
if (!Pt.new) Rd = memb (#u6) // +
if (Pt) Rd = memub (#u6) // +
if (!Pt) Rd = memub (#u6) // +
if (Pt.new) Rd = memub (#u6) // +
if (!Pt.new) Rd = memub (#u6) // +
if (Pt) Rd = memh (#u6) // +
if (!Pt) Rd = memh (#u6) // +
if (Pt.new) Rd = memh (#u6) // +
if (!Pt.new) Rd = memh (#u6) // +
if (Pt) Rd = memuh (#u6) // +
if (!Pt) Rd = memuh (#u6) // +
if (Pt.new) Rd = memuh (#u6) // +
if (!Pt.new) Rd = memuh (#u6) // +
if (Pt) Rd = memw (#u6) // +
if (!Pt) Rd = memw (#u6) // +
if (Pt.new) Rd = memw (#u6) // +
if (!Pt.new) Rd = memw (#u6) // +
if (Pt) Rdd = memd (#u6) // +
if (!Pt) Rdd = memd (#u6) // +
if (Pt.new) Rdd = memd (#u6) // +
if (!Pt.new) Rdd = memd (#u6) // +
memb(gp+#u16:0) = Rt // +
memh(gp+#u16:0) = Rt // +
memw(gp+#u16:0) = Rt // +
memd(gp+#u16:0) = Rtt // +
memb(gp+#u16:0) = Nt.new // +
memh(gp+#u16:0) = Nt.new // +
memw(gp+#u16:0) = Nt.new // +
memd(gp+#u16:0) = Nt.new // +
if (Pv) memb(Rs + #u6:0) = Rt // +
if (!Pv) memb(Rs + #u6:0) = Rt // +
if (Pv.new) memb(Rs + #u6:0) = Rt // +
if (!Pv.new) memb(Rs + #u6:0) = Rt // +
if (Pv) memb(Rs + #u6:0) = Rt.new
if (!Pv) memb(Rs + #u6:0) = Rt.new
if (Pv.new) memb(Rs + #u6:0) = Rt.new
if (!Pv.new) memb(Rs + #u6:0) = Rt.new
if (Pv) memh(Rs + #u6:1) = Rt // +
if (!Pv) memh(Rs + #u6:1) = Rt // +
if (Pv.new) memh(Rs + #u6:1) = Rt // +
if (!Pv.new) memh(Rs + #u6:1) = Rt // +
if (Pv) memh(Rs + #u6:1) = Rt.new
if (!Pv) memh(Rs + #u6:1) = Rt.new
if (Pv.new) memh(Rs + #u6:1) = Rt.new
if (!Pv.new) memh(Rs + #u6:1) = Rt.new
if (Pv) memw(Rs + #u6:2) = Rt // +
if (!Pv) memw(Rs + #u6:2) = Rt // +
if (Pv.new) memw(Rs + #u6:2) = Rt // +
if (!Pv.new) memw(Rs + #u6:2) = Rt // +
if (Pt) memw(Rs + ##U32) = Rt.new
if (!Pt) memw(Rs + ##U32) = Rt.new
if (Pt.new) memw(Rs + ##U32) = Rt.new
if (!Pt.new) memw(Rs + ##U32) = Rt.new
if (Pv) memd(Rs + #u6:3) = Rtt // +
if (!Pv) memd(Rs + #u6:3) = Rtt // +
if (Pv.new) memd(Rs + #u6:3) = Rtt // +
if (!Pv.new) memd(Rs + #u6:3) = Rtt // +
if (Pt) memd(Rs + ##U32) = Ntt.new
if (!Pt) memd(Rs + ##U32) = Ntt.new
if (Pt.new) memd(Rs + ##U32) = Ntt.new
if (!Pt.new) memd(Rs + ##U32) = Ntt.new
memb(Rs + #s11:0) = Rt // +
memh(Rs + #s11:1) = Rt // +
memw(Rs + #s11:2) = Rt // +
memd(Rs + #s11:3) = Rtt // +
memb(Rs + #s11:0) = Nt.new // +
memh(Rs + #s11:1) = Nt.new // +
memw(Rs + #s11:2) = Nt.new // +
memd(Rs + #s11:3) = Ntt.new // +
memb(Re=#U6) = Rt // +
memh(Re=#U6) = Rt // +
memw(Re=#U6) = Rt // +
memd(Re=#U6) = Rtt // +
memb(Re=##U32) = Rt.new
memh(Re=##U32) = Rt.new
memw(Re=##U32) = Rt.new
memd(Re=##U32) = Rt.new
memb(Ru<<#u2 + #U6) = Rt // +
memh(Ru<<#u2 + #U6) = Rt // +
memw(Ru<<#u2 + #U6) = Rt // +
memd(Ru<<#u2 + #U6) = Rtt // +
memb(Ru<<#u2 + #U6) = Nt.new // +
memh(Ru<<#u2 + #U6) = Nt.new // +
memw(Ru<<#u2 + #U6) = Nt.new // +
memd(Ru<<#u2 + #U6) = Nt.new // +
if (Pt) memb(#u6) = Rt // +
if (Pt) memb(#u6) = Rt // +
if (!Pt) memb(#u6) = Rt // +
if (!Pt) memb(#u6) = Rt // +
if (Pt) memb(#u6) = Nt.new // +
if (Pt) memb(#u6) = Nt.new // +
if (!Pt) memb(#u6) = Nt.new // +
if (!Pt) memb(#u6) = Nt.new // +
if (Pt) memh(#u6) = Rt // +
if (Pt) memh(#u6) = Rt // +
if (!Pt) memh(#u6) = Rt // +
if (!Pt) memh(#u6) = Rt // +
if (Pt) memh(#u6) = Nt.new // +
if (Pt) memh(#u6) = Nt.new // +
if (!Pt) memh(#u6) = Nt.new // +
if (!Pt) memh(#u6) = Nt.new // +
if (Pt) memw(#u6) = Rt // +
if (Pt) memw(#u6) = Rt // +
if (!Pt) memw(#u6) = Rt // +
if (!Pt) memw(#u6) = Rt // +
if (Pt) memw(#u6) = Nt.new // +
if (Pt) memw(#u6) = Nt.new // +
if (!Pt) memw(#u6) = Nt.new // +
if (!Pt) memw(#u6) = Nt.new // +
if (Pt) memd(#u6) = Rtt // +
if (Pt) memd(#u6) = Rtt // +
if (!Pt) memd(#u6) = Rtt // +
if (!Pt) memd(#u6) = Rtt // +
if (Pt) memd(#u6) = Rt.new
if (Pt) memd(#u6) = Rt.new
if (!Pt) memd(#u6) = Rt.new
if (!Pt) memd(#u6) = Rt.new
memw(Rs + #u6) = ##U32
if Ps memw(Rs + #u6) = ##U32
if !Ps memw(Rs + #u6) = ##U32
memw(Rs + Rt<<#u2) = ##U32
if (cmp.eq(Ns.new,#U5)) jump:nt #r9:2 // +
if (cmp.eq(Ns.new,#U5)) jump:t #r9:2 // +
if (!cmp.eq(Ns.new,#U5)) jump:nt #r9:2 // +
if (!cmp.eq(Ns.new,#U5)) jump:t #r9:2 // +
if (cmp.gt(Ns.new,#U5)) jump:nt #r9:2 // +
if (cmp.gt(Ns.new,#U5)) jump:t #r9:2 // +
if (!cmp.gt(Ns.new,#U5)) jump:nt #r9:2 // +
if (!cmp.gt(Ns.new,#U5)) jump:t #r9:2 // +
if (cmp.gtu(Ns.new,##U5)) jump:nt #r9:2 // +
if (cmp.gtu(Ns.new,##U5)) jump:t #r9:2 // +
if (!cmp.gtu(Ns.new,##U5)) jump:nt #r9:2 // +
if (!cmp.gtu(Ns.new,##U5)) jump:t #r9:2 // +
Rd = #s16 // +
Rdd = combine(Rs,#s8) // + [1]
Rdd = combine(#s8,Rs) // + [1]
Rdd = combine(#s8,#s8) // + [1]
Rdd = combine(#s8,#U6) // + [2]
Rd = mux (Pu, Rs,#s8) // + [1]
Rd = mux (Pu, #s8, Rs) // + [1]
Rd = mux(Pu,#s8,#S8) // + [1]
if (Pu) Rd = add(Rs,#s8) // +
if (!Pu) Rd = add(Rs,#s8) // +
if (Pu.new) Rd = add(Rs,#s8) // +
if (!Pu.new) Rd = add(Rs,#s8) // +
if (Pu) Rd = #s12 // +
if (!Pu) Rd = #s12 // +
if (Pu.new) Rd = #s12 // +
if (!Pu.new) Rd = #s12 // +
Pd = cmp.eq (Rs,#s10) // +
Pd = !cmp.eq (Rs,#s10) // +
Pd = cmp.gt (Rs,#s10) // +
Pd = !cmp.gt (Rs,#s10) // +
Pd = cmp.gtu (Rs,#u9) // +
Pd = !cmp.gtu (Rs,#u9) // +
Rd = cmp.eq(Rs,#s8) // +
Rd = !cmp.eq(Rs,#s8) // +
Rd = and(Rs,#s10) // +
Rd = or(Rs,#s10) // +
Rd = sub(#s10,Rs) // +
Rd = add(Rs,#s16) // +
Rd = mpyi(Rs,#m9) // +
Rd += mpyi(Rs,#u8) // +
Rd -= mpyi(Rs,#u8) // +
Rx += add(Rs,#s8) // +
Rx -= add(Rs,#s8) // +
Rd = #s16 // +
jump #r22:2 // +
call #r22:2 // +
if (Pu) call #r15:2 // +
if (!Pu) call #r15:2 // +
Pd = sp1loop0(#r7:2,#U10) // + [1]
Pd = sp1loop0(#r7:2,Rs) // + [1]
Pd = sp2loop0(#r7:2,#U10) // + [1]
Pd = sp2loop0(#r7:2,Rs) // + [1]
Pd = sp3loop0(#r7:2,#U10) // + [1]
Pd = sp3loop0(#r7:2,Rs) // + [1]
loop0 (#r7:2,#U10) // + [1]
loop0 (#r7:2,Rs) // + [1]
loop1 (#r7:2,#U10) // + [1]
loop1 (#r7:2,Rs) // + [1]
Rd = add(pc,#u6) // + [1]
Rd = add(#u6,mpyi(Rs,#u6)) // + [1]
Rd = add(#6,mpyi(Rs,Rt)) // + [1]
Rd = add(Rs,add(Ru,#s6)) // +
Rd = add(Rs,sub(#s6,Ru)) // +
Rd = sub(##u32,add(Rs,Rt)) // WTF - not in the manual
Rx = or(Rs,and(Rx,#s10)) // +
Rx = add (#u8,asl(Rx,#U5)) // + [1]
Rx = add (#u8,asr(Rx,#U5)) // + [1]
Rx = add (#u8,lsr(Rx,#U5)) // + [1]
Rx = sub (#u8,asl(Rx,#U5)) // + [1]
Rx = sub (#u8,asr(Rx,#U5)) // + [1]
Rx = sub (#u8,lsr(Rx,#U5)) // + [1]
Rx = and (#u8,asl(Rx,#U5)) // + [1]
Rx = and (#u8,asr(Rx,#U5)) // + [1]
Rx = and (#u8,lsr(Rx,#U5)) // + [1]
Rx = or (#u8,asl(Rx,#U5)) // + [1]
Rx = or (#u8,asr(Rx,#U5)) // + [1]
Rx = or (#u8,lsr(Rx,#U5)) // + [1]
Rx = add (#u8,asl(Rs,Rx)) // +
Rx = add (#u8,asr(Rs,Rx)) // +
Rx = add (#u8,lsr(Rs,Rx)) // +
Rx = sub (#u8,asl(Rs,Rx)) // +
Rx = sub (#u8,asr(Rs,Rx)) // +
Rx = sub (#u8,lsr(Rs,Rx)) // +
Rx = and (#u8,asl(Rs,Rx)) // +
Rx = and (#u8,asr(Rs,Rx)) // +
Rx = and (#u8,lsr(Rs,Rx)) // +
Rx = or (#u8,asl(Rs,Rx)) // +
Rx = or (#u8,asr(Rs,Rx)) // +
Rx = or (#u8,lsr(Rs,Rx)) // +
Rx = add (#u8,asl(Rx,Rs)) // WTF - no such instruction
Rx = add (#u8,asr(Rx,Rs)) // WTF
Rx = add (#u8,lsr(Rx,Rs)) // WTF
Rx = sub (#u8,asl(Rx,Rs)) // WTF
Rx = sub (#u8,asr(Rx,Rs)) // WTF
Rx = sub (#u8,lsr(Rx,Rs)) // WTF
Rx = and (#u8,asl(Rx,Rs)) // WTF
Rx = and (#u8,asr(Rx,Rs)) // WTF
Rx = and (#u8,lsr(Rx,Rs)) // WTF
Rx = or (#u8,asl(Rx,Rs)) // WTF
Rx = or (#u8,asr(Rx,Rs)) // WTF
Rx = or (#u8,lsr(Rx,Rs)) // WTF
Pd = cmpb.eq (Rs,#u8) // +
Pd = cmpb.gt (Rs,#s8) // +
Pd = cmpb.gtu (Rs,#u7) // +
Pd = cmph.eq (Rs,#s8) // +
Pd = cmph.gt (Rs,#s8) // +
Pd = cmph.gtu (Rs,#u7) // +

Loading

0 comments on commit 4ac8b5c

Please sign in to comment.