Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Oct 21st, 2012  |  syntax: None  |  size: 1.13 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. set $workspace = 0x40000000
  2.  
  3. define load_usb_firmware
  4.         # load helper
  5.         # lbu r4,(r1+0)
  6.         set *($workspace+0)  = 0x40240000
  7.         # lbu r5,(r1+1)
  8.         set *($workspace+4)  = 0x40250001
  9.         # sli r5,r5,8
  10.         set *($workspace+8)  = 0x3ca50008
  11.         # or r4,r4,r5
  12.         set *($workspace+12)  = 0xb8852000
  13.         # sw (r2+0),r4
  14.         set *($workspace+16)  = 0x58440000
  15.         # addi r1,r1,2
  16.         set *($workspace+20)  = 0x34210002
  17.         # addi r2,r2,4
  18.         set *($workspace+24) = 0x34420004
  19.         # addi r3,r3,-2
  20.         set *($workspace+28) = 0x3463fffe
  21.         # bg r3,r0,-32
  22.         set *($workspace+32) = 0x4860fff8
  23.         # break
  24.         set *($workspace+36) = 0xac000002
  25.  
  26.         # save registers
  27.         set $saved_r1 = $r1
  28.         set $saved_r2 = $r2
  29.         set $saved_r3 = $r3
  30.         set $saved_r4 = $r4
  31.         set $saved_r5 = $r5
  32.         set $saved_pc = $pc
  33.  
  34.         restore $arg0 binary $workspace+64
  35.         set $r1 = $workspace+64
  36.         set $r2 = 0xa0000000
  37.         set $r3 = 2048
  38.         jump *($workspace)
  39.  
  40.         # recall registers
  41.         set $r1 = $saved_r1
  42.         set $r2 = $saved_r2
  43.         set $r3 = $saved_r3
  44.         set $r4 = $saved_r4
  45.         set $r5 = $saved_r5
  46.         set $pc = $saved_pc
  47. end
  48.  
  49. document load_usb_firmware
  50.         Loads an USB firmware from a binary file.
  51.         Syntax: load_usb_firmware <filename>
  52. end