Jump to content

- - - - -

OS Syscall disassembler

  • Please log in to reply
No replies to this topic

#1 hejsotnoss


    Casio Fan

  • Members
  • PipPip
  • 31 posts
  • Gender:Male
  • Interests:programming

  • Calculators:

Posted 26 March 2020 - 06:30 PM

Hi everyone,


I want to release a syscall disassembler that I wrote recently.



I put the code on my github page: https://github.com/h...ll-disassembler.


You can build with: gcc -Wall -Wextra -O2 syscall.c disassemble.c


The usage is: [binary OS file] [syscall]


For syscall strlen you can do:

./a.out 2_04_0200_sh4.fls AD6


and the program would return:

Syscall offset table: 0x801C7D88
Syscall offset: 0x80197670

Offset:         Code:        Instruction:
80197670:       A001         bra 0x001
80197672:       E500         mov #0x00,R5
80197674:       7501         add #0x01,R5
80197676:       6643         mov R4,R6
80197678:       6260         mov.b @R6,R2
8019767A:       2228         tst R2,R2
8019767C:       8FFA         bf/s 0xFA
8019767E:       7401         add #0x01,R4
80197680:       000B         rts
80197682:       6053         mov R5,R0
80197684:       7FF4         add #0xF4,R15
80197686:       1F51         mov.l R5,@(0x1,R15)
80197688:       6543         mov R4,R5
8019768A:       1F62         mov.l R6,@(0x2,R15)
8019768C:       51F1         mov.l @(0x1,R15),R1
8019768E:       A001         bra 0x001
80197690:       2F42         mov.l R4,@R15
80197692:       7501         add #0x01,R5
80197694:       6250         mov.b @R5,R2
80197696:       2228         tst R2,R2
80197698:       8BFB         bf 0xFB
8019769A:       A007         bra 0x007
8019769C:       E400         mov #0x00,R4
8019769E:       6214         mov.b @R1+,R2
801976A0:       6653         mov R5,R6
801976A2:       7501         add #0x01,R5
801976A4:       2228         tst R2,R2
801976A6:       8D04         bt/s 0x04
801976A8:       2620         mov.b R2,@R6
801976AA:       7401         add #0x01,R4
801976AC:       57F2         mov.l @(0x2,R15),R7
801976AE:       3472         cmp/hs R7,R4
801976B0:       8BF5         bf 0xF5
801976B2:       51F2         mov.l @(0x2,R15),R1
801976B4:       3412         cmp/hs R1,R4
801976B6:       8B01         bf 0x01
801976B8:       E200         mov #0x00,R2
801976BA:       2520         mov.b R2,@R5
801976BC:       60F2         mov.l @R15,R0
801976BE:       000B         rts

I can also release the code I wrote to generate the disassembler if anyone is interested.

I hope someone can find this useful :)


Thank you for reading,



Edited by hejsotnoss, 26 March 2020 - 07:01 PM.

  • TBit and jakiki6 like this

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users