mirror of
https://github.com/geohot/qira
synced 2025-03-13 02:23:07 +03:00
Merge pull request #113 from tim-becker/mipsel
Add support for little endian mips
This commit is contained in:
commit
cd5f8654ad
@ -19,19 +19,23 @@ for i in range(32):
|
||||
AARCH64REGS[0][8+31] = "sp"
|
||||
AARCH64REGS[0].append("pc")
|
||||
|
||||
MIPSREGS = (['$zero', '$at', '$v0', '$v1', '$a0', '$a1', '$a2', '$a3'], 4, True, "mips", ["jal\t","jr\t","jal","jr"])
|
||||
MIPSREGLIST = ['$zero', '$at', '$v0', '$v1', '$a0', '$a1', '$a2', '$a3']
|
||||
for i in range(8):
|
||||
MIPSREGS[0].append('$t'+str(i))
|
||||
MIPSREGLIST.append('$t'+str(i))
|
||||
for i in range(8):
|
||||
MIPSREGS[0].append('$s'+str(i))
|
||||
MIPSREGS[0].append('$t8')
|
||||
MIPSREGS[0].append('$t9')
|
||||
MIPSREGS[0].append('$k0')
|
||||
MIPSREGS[0].append('$k1')
|
||||
MIPSREGS[0].append('$gp')
|
||||
MIPSREGS[0].append('$sp')
|
||||
MIPSREGS[0].append('$fp')
|
||||
MIPSREGS[0].append('$ra')
|
||||
MIPSREGLIST.append('$s'+str(i))
|
||||
MIPSREGLIST.append('$t8')
|
||||
MIPSREGLIST.append('$t9')
|
||||
MIPSREGLIST.append('$k0')
|
||||
MIPSREGLIST.append('$k1')
|
||||
MIPSREGLIST.append('$gp')
|
||||
MIPSREGLIST.append('$sp')
|
||||
MIPSREGLIST.append('$fp')
|
||||
MIPSREGLIST.append('$ra')
|
||||
MIPSREGLIST.append('$pc')
|
||||
|
||||
MIPSREGS = (MIPSREGLIST, 4, True, "mips", ["jal\t","jr\t","jal","jr"])
|
||||
MIPSELREGS = (MIPSREGLIST, 4, False, "mipsel", ["jal\t","jr\t","jal","jr"])
|
||||
|
||||
# this stuff should be moved to static
|
||||
ARMREGS = (['R0','R1','R2','R3','R4','R5','R6','R7','R8','R9','R10','R11','R12','SP','LR','PC'], 4, False, "arm")
|
||||
|
@ -120,6 +120,9 @@ class Program:
|
||||
self.tregs = arch.X86REGS
|
||||
self.qirabinary = qemu_dir + "qira-i386"
|
||||
self.pintool = pin_dir + "obj-ia32/qirapin.so"
|
||||
elif self.fb == 0x08:
|
||||
self.tregs = arch.MIPSELREGS
|
||||
self.qirabinary = qemu_dir + 'qira-mipsel'
|
||||
elif self.fb == 0x1400: # big endian...
|
||||
use_lib('powerpc')
|
||||
self.tregs = arch.PPCREGS
|
||||
|
@ -13,6 +13,8 @@ def get_arch(fb):
|
||||
return 'x86-64'
|
||||
elif fb == 0x03:
|
||||
return 'i386'
|
||||
elif fb == 0x08:
|
||||
return 'mipsel'
|
||||
elif fb == 0x1400: # big endian...
|
||||
return 'ppc'
|
||||
elif fb == 0x800:
|
||||
|
@ -247,8 +247,12 @@ class CsInsn(object):
|
||||
self.md = Cs(CS_ARCH_ARM64, CS_MODE_ARM)
|
||||
elif arch == "ppc":
|
||||
self.md = Cs(CS_ARCH_PPC, CS_MODE_32)
|
||||
elif arch == "mips":
|
||||
self.md = Cs(CS_ARCH_MIPS, CS_MODE_32 | CS_MODE_BIG_ENDIAN)
|
||||
elif arch == "mipsel":
|
||||
self.md = Cs(CS_ARCH_MIPS, CS_MODE_32 | CS_MODE_LITTLE_ENDIAN)
|
||||
else:
|
||||
raise Exception('arch not supported by capstone')
|
||||
raise Exception('arch "{}" not supported by capstone'.format(arch))
|
||||
self.md.detail = True
|
||||
try:
|
||||
self.i = self.md.disasm(self.raw, self.address).next()
|
||||
|
@ -30,6 +30,7 @@ if [ ! -d qemu/qemu-latest ]; then
|
||||
ln -s qemu-latest/ppc-linux-user/qemu-ppc qira-ppc
|
||||
ln -s qemu-latest/aarch64-linux-user/qemu-aarch64 qira-aarch64
|
||||
ln -s qemu-latest/mips-linux-user/qemu-mips qira-mips
|
||||
ln -s qemu-latest/mipsel-linux-user/qemu-mipsel qira-mipsel
|
||||
|
||||
cd qemu-latest
|
||||
patch -p1 < ../../qemu.patch
|
||||
@ -37,6 +38,6 @@ if [ ! -d qemu/qemu-latest ]; then
|
||||
fi
|
||||
|
||||
cd qemu/qemu-latest
|
||||
./configure --target-list=i386-linux-user,x86_64-linux-user,arm-linux-user,ppc-linux-user,aarch64-linux-user,mips-linux-user --enable-tcg-interpreter --enable-debug-tcg --cpu=unknown --enable-tcg-interpreter --enable-debug-tcg --cpu=unknown
|
||||
./configure --target-list=i386-linux-user,x86_64-linux-user,arm-linux-user,ppc-linux-user,aarch64-linux-user,mips-linux-user,mipsel-linux-user --enable-tcg-interpreter --enable-debug-tcg --cpu=unknown --enable-tcg-interpreter --enable-debug-tcg --cpu=unknown
|
||||
make -j $(grep processor < /proc/cpuinfo | wc -l)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user