code you HAVE RUN on your dslr - page 3 - DSLR Hack development - CHDK Forum
supplierdeeply

code you HAVE RUN on your dslr

  • 141 Replies
  • 83474 Views
Re: code you HAVE RUN on your dslr
« Reply #20 on: 16 / May / 2008, 12:09:46 »
Advertisements
I wanted to - but the idc file IDA produces is just gigantic ! I cannot edit it out.
Is there a way to export names added by me ? At least these witch are blue (not sub_ ?) in IDA?
I can post adreses I remember I found:

ROM:FFB4A33C                   reboot
ROM:FF810418                   sysToMonitor
ROM:FF873F90                   checkForFirmup_

ROM:FF8100A0                   romStart
ROM:FF810B7C                   usrInit   

And some code with names I identyfied:
usrInit:
Code: [Select]
usrInit                                 ; CODE XREF: romStart+24p
ROM:FF810B7C                                                           ; usrEntry+8j ...
ROM:FF810B7C
ROM:FF810B7C                   var_14          = -0x14
ROM:FF810B7C                   var_10          = -0x10
ROM:FF810B7C
ROM:FF810B7C 30 40 2D E9                       STMFD   SP!, {R4,R5,LR} ; Store Block to Memory
ROM:FF810B80 00 40 A0 E1                       MOV     R4, R0          ; Rd = Op2
ROM:FF810B84 08 D0 4D E2                       SUB     SP, SP, #8      ; Rd = Op1 - Op2
ROM:FF810B88 B8 50 9F E5                       LDR     R5, =0x2A550    ; Load from Memory
ROM:FF810B8C D7 FD FF EB                       BL      sysHwInit0      ; Branch with Link
ROM:FF810B90 B4 00 9F E5                       LDR     R0, =dword_DFB0 ; Load from Memory
ROM:FF810B94 05 10 60 E0                       RSB     R1, R0, R5      ; Rd = Op2 - Op1
ROM:FF810B98 8E D3 0C EB                       BL      bzero           ; (what, how many)
ROM:FF810B9C AC 30 9F E5                       LDR     R3, =sysStartType ; Load from Memory
ROM:FF810BA0 00 00 A0 E3                       MOV     R0, #0          ; Rd = Op2
ROM:FF810BA4 00 40 83 E5                       STR     R4, [R3]        ; Store to Memory
ROM:FF810BA8 09 36 0D EB                       BL      intVecBaseSet   ; Branch with Link
ROM:FF810BAC 02 10 A0 E3                       MOV     R1, #2          ; Rd = Op2
ROM:FF810BB0 01 00 A0 E3                       MOV     R0, #1          ; Rd = Op2
ROM:FF810BB4 51 05 0D EB                       BL      sub_FFB52100    ; Branch with Link
ROM:FF810BB8 96 38 0D EB                       BL      excVecInit      ; Branch with Link
ROM:FF810BBC D9 FD FF EB                       BL      sysHwInit       ; Branch with Link
ROM:FF810BC0 00 00 A0 E3                       MOV     R0, #0          ; Rd = Op2
ROM:FF810BC4 42 05 0D EB                       BL      cacheEnable_    ; Branch with Link
ROM:FF810BC8 01 00 A0 E3                       MOV     R0, #1          ; Rd = Op2
ROM:FF810BCC 40 05 0D EB                       BL      cacheEnable_    ; Branch with Link
ROM:FF810BD0 4F 04 0D EB                       BL      classLibInit    ; Branch with Link
ROM:FF810BD4 EF BA 0C EB                       BL      taskLibInit     ; Branch with Link
ROM:FF810BD8 74 30 9F E5                       LDR     R3, =off_D840   ; Load from Memory
ROM:FF810BDC 74 20 9F E5                       LDR     R2, =unk_298A0  ; Load from Memory
ROM:FF810BE0 00 10 93 E5                       LDR     R1, [R3]        ; Load from Memory
ROM:FF810BE4 70 00 9F E5                       LDR     R0, =unk_28DE0  ; Load from Memory
ROM:FF810BE8 01 3C A0 E3                       MOV     R3, #0x100      ; Rd = Op2
ROM:FF810BEC 1F CC 0C EB                       BL      qInit           ; Branch with Link
ROM:FF810BF0 68 30 9F E5                       LDR     R3, =off_D880   ; Load from Memory
ROM:FF810BF4 68 00 9F E5                       LDR     R0, =unk_D6E8   ; Load from Memory
ROM:FF810BF8 00 10 93 E5                       LDR     R1, [R3]        ; Load from Memory
ROM:FF810BFC 1B CC 0C EB                       BL      qInit           ; Branch with Link
ROM:FF810C00 60 30 9F E5                       LDR     R3, =off_D7C4   ; Load from Memory
ROM:FF810C04 60 00 9F E5                       LDR     R0, =unk_25A20  ; Load from Memory
ROM:FF810C08 00 10 93 E5                       LDR     R1, [R3]        ; Load from Memory
ROM:FF810C0C 17 CC 0C EB                       BL      qInit           ; Branch with Link
ROM:FF810C10 6D A7 0C EB                       BL      workQInit       ; Branch with Link
ROM:FF810C14 E6 FD FF EB                       BL      sysMemTop       ; Branch with Link
ROM:FF810C18 00 40 A0 E3                       MOV     R4, #0          ; Rd = Op2
ROM:FF810C1C 00 30 A0 E1                       MOV     R3, R0          ; Rd = Op2
ROM:FF810C20 03 CB A0 E3                       MOV     R12, #0xC00     ; Rd = Op2
ROM:FF810C24 05 20 A0 E1                       MOV     R2, R5          ; Rd = Op2
ROM:FF810C28 40 00 9F E5                       LDR     R0, =usrRoot    ; Load from Memory
ROM:FF810C2C 01 19 A0 E3                       MOV     R1, #0x4000     ; Rd = Op2
ROM:FF810C30 00 C0 8D E5                       STR     R12, [SP,#0x14+var_14] ; Store to Memory
ROM:FF810C34 04 40 8D E5                       STR     R4, [SP,#0x14+var_10] ; Store to Memory
ROM:FF810C38 F9 C5 0C EB                       BL      kernelInit      ; Branch with Link
ROM:FF810C3C 08 D0 8D E2                       ADD     SP, SP, #8      ; Rd = Op1 + Op2
ROM:FF810C40 30 80 BD E8                       LDMFD   SP!, {R4,R5,PC} ; Load Block from Memory

usrRoot procedure:
Code: [Select]
usrRoot                                 ; DATA XREF: ROM:off_FF810C70o
ROM:FF810A20                                                           ; ROM:off_FF810DECo
ROM:FF810A20
ROM:FF810A20                   var_14          = -0x14
ROM:FF810A20                   var_10          = -0x10
ROM:FF810A20
ROM:FF810A20 30 40 2D E9                       STMFD   SP!, {R4,R5,LR} ; Store Block to Memory
ROM:FF810A24 01 40 A0 E1                       MOV     R4, R1          ; Rd = Op2
ROM:FF810A28 00 50 A0 E1                       MOV     R5, R0          ; Rd = Op2
ROM:FF810A2C 08 D0 4D E2                       SUB     SP, SP, #8      ; Rd = Op1 - Op2
ROM:FF810A30 F2 C9 0C EB                       BL      eventLibInit    ; Branch with Link
ROM:FF810A34 8C C2 0C EB                       BL      semBLibInit     ; Branch with Link
ROM:FF810A38 5F BE 0C EB                       BL      semMLibInit     ; Branch with Link
ROM:FF810A3C 84 C1 0C EB                       BL      semCLibInit     ; Branch with Link
ROM:FF810A40 3D C6 0C EB                       BL      semQLibInit     ; Branch with Link
ROM:FF810A44 E9 AF 0C EB                       BL      wdLibInit       ; Branch with Link
ROM:FF810A48 02 DC 0C EB                       BL      taskHookInit    ; Branch with Link
ROM:FF810A4C 04 10 A0 E1                       MOV     R1, R4          ; Rd = Op2
ROM:FF810A50 05 00 A0 E1                       MOV     R0, R5          ; Rd = Op2
ROM:FF810A54 13 EF 0C EB                       BL      memInit         ; Branch with Link
ROM:FF810A58 04 10 A0 E1                       MOV     R1, R4          ; Rd = Op2
ROM:FF810A5C 05 00 A0 E1                       MOV     R0, R5          ; Rd = Op2
ROM:FF810A60 ED EC 0C EB                       BL      memPartLibInit  ; Branch with Link
ROM:FF810A64 F4 30 9F E5                       LDR     R3, =sysMmuLibInit ; Load from Memory
ROM:FF810A68 00 30 93 E5                       LDR     R3, [R3]        ; Load from Memory
ROM:FF810A6C 00 00 53 E3                       CMP     R3, #0          ; Set cond. codes on Op1 - Op2
ROM:FF810A70 01 0A A0 E3                       MOV     R0, #0x1000     ; Rd = Op2
ROM:FF810A74 0E 00 00 0A                       BEQ     loc_FF810AB4    ; Branch
ROM:FF810A78 0F E0 A0 E1                       MOV     LR, PC          ; Rd = Op2
ROM:FF810A7C 03 F0 A0 E1                       MOV     PC, R3          ; Rd = Op2
ROM:FF810A80 00 00 50 E3                       CMP     R0, #0          ; Set cond. codes on Op1 - Op2
ROM:FF810A84 01 0A A0 E3                       MOV     R0, #0x1000     ; Rd = Op2
ROM:FF810A88 09 00 00 1A                       BNE     loc_FF810AB4    ; Branch
ROM:FF810A8C EC D4 0C EB                       BL      sub_FFB45E44    ; Branch with Link
ROM:FF810A90 00 00 50 E3                       CMP     R0, #0          ; Set cond. codes on Op1 - Op2
ROM:FF810A94 01 20 A0 E3                       MOV     R2, #1          ; Rd = Op2
ROM:FF810A98 C4 00 9F E5                       LDR     R0, =(dword_1916+2) ; Load from Memory
ROM:FF810A9C 04 00 00 1A                       BNE     loc_FF810AB4    ; Branch
ROM:FF810AA0 C0 30 9F E5                       LDR     R3, =unk_197C   ; Load from Memory
ROM:FF810AA4 00 10 93 E5                       LDR     R1, [R3]        ; Load from Memory
ROM:FF810AA8 D1 D4 0C EB                       BL      sub_FFB45DF4    ; Branch with Link
ROM:FF810AAC 00 00 50 E3                       CMP     R0, #0          ; Set cond. codes on Op1 - Op2
ROM:FF810AB0 09 00 00 1A                       BNE     loc_FF810ADC    ; Branch
ROM:FF810AB4
ROM:FF810AB4                   loc_FF810AB4                            ; CODE XREF: usrRoot+54j
ROM:FF810AB4                                                           ; usrRoot+68j ...
ROM:FF810AB4 D8 00 0D EB                       BL      getErrorNumber  ; Branch with Link
ROM:FF810AB8 00 20 A0 E3                       MOV     R2, #0          ; Rd = Op2
ROM:FF810ABC 00 10 90 E5                       LDR     R1, [R0]        ; Load from Memory
ROM:FF810AC0 02 30 A0 E1                       MOV     R3, R2          ; Rd = Op2
ROM:FF810AC4 A0 00 9F E5                       LDR     R0, =ausrRootMMUconfigurationf ; Load from Memory
ROM:FF810AC8 00 20 8D E5                       STR     R2, [SP,#0x14+var_14] ; Store to Memory
ROM:FF810ACC 04 20 8D E5                       STR     R2, [SP,#0x14+var_10] ; Store to Memory
ROM:FF810AD0 24 FF 0C EB                       BL      printExc        ; Branch with Link
ROM:FF810AD4 01 00 A0 E3                       MOV     R0, #1          ; Rd = Op2
ROM:FF810AD8 17 E6 0C EB                       BL      reboot          ; Branch with Link
ROM:FF810ADC
ROM:FF810ADC                   loc_FF810ADC                            ; CODE XREF: usrRoot+90j
ROM:FF810ADC 00 10 A0 E3                       MOV     R1, #0          ; Rd = Op2
ROM:FF810AE0 88 00 9F E5                       LDR     R0, =usrClock   ; Load from Memory
ROM:FF810AE4 CA 86 0C EB                       BL      sysClockConnect ; Branch with Link
ROM:FF810AE8 3C 00 A0 E3                       MOV     R0, #0x3C ; '<' ; Rd = Op2
ROM:FF810AEC 58 86 0C EB                       BL      sysClockRateSet ; Branch with Link
ROM:FF810AF0 EE 86 0C EB                       BL      sysClockEnable  ; Branch with Link
ROM:FF810AF4 32 00 A0 E3                       MOV     R0, #0x32 ; '2' ; Rd = Op2
ROM:FF810AF8 94 E5 0C EB                       BL      selectInit      ; Branch with Link
ROM:FF810AFC 01 0A A0 E3                       MOV     R0, #0x1000     ; Rd = Op2
ROM:FF810B00 AC FE FF EB                       BL      usrBootLineParse ; Branch with Link
ROM:FF810B04 68 20 9F E5                       LDR     R2, =anull_1    ; Load from Memory
ROM:FF810B08 32 10 A0 E3                       MOV     R1, #0x32 ; '2' ; Rd = Op2
ROM:FF810B0C 14 00 A0 E3                       MOV     R0, #0x14       ; Rd = Op2
ROM:FF810B10 72 F3 0C EB                       BL      iosInit         ; Branch with Link
ROM:FF810B14 81 D9 0C EB                       BL      ttyDrv          ; Branch with Link
ROM:FF810B18 6E FF FF EB                       BL      usrSerialInit   ; Branch with Link
ROM:FF810B1C 9F F7 0C EB                       BL      hashLibInit     ; Branch with Link
ROM:FF810B20 01 00 A0 E3                       MOV     R0, #1          ; Rd = Op2
ROM:FF810B24 45 02 0D EB                       BL      envLibInit      ; Branch with Link
ROM:FF810B28 16 E3 0C EB                       BL      sigInit         ; Branch with Link
ROM:FF810B2C 57 00 0D EB                       BL      sub_FFB50C90    ; Branch with Link
ROM:FF810B30 40 30 9F E5                       LDR     R3, =consoleFd  ; Load from Memory
ROM:FF810B34 32 10 A0 E3                       MOV     R1, #0x32 ; '2' ; Rd = Op2
ROM:FF810B38 00 00 93 E5                       LDR     R0, [R3]        ; Load from Memory
ROM:FF810B3C 41 F0 0C EB                       BL      logInit         ; Branch with Link
ROM:FF810B40 F5 12 0D EB                       BL      stdioInit       ; Branch with Link
ROM:FF810B44 E7 FF 0C EB                       BL      fioLibInit      ; Branch with Link
ROM:FF810B48 66 E5 0C EB                       BL      selTaskDeleteHookAdd ; Branch with Link
ROM:FF810B4C F5 3A 0D EB                       BL      cplusCtorsLink  ; Branch with Link
ROM:FF810B50 5A FE FF EB                       BL      usrAppInit_0    ; startup?
ROM:FF810B54 08 D0 8D E2                       ADD     SP, SP, #8      ; Rd = Op1 + Op2
ROM:FF810B58 30 80 BD E8                       LDMFD   SP!, {R4,R5,PC} ; Load Block from Memory
ROM:FF810B58                   ; End of function usrRoot

Most of the names are from Tornado 2.2 online manuals.
« Last Edit: 16 / May / 2008, 12:12:05 by owerlord »

*

Offline Seklth

  • **
  • 54
  • 400D
Re: code you HAVE RUN on your dslr
« Reply #21 on: 17 / May / 2008, 14:26:18 »
Found the vxWorks reboot and sysToMonitor procedures.
Runned the sysToMonitor - same efect as eventproc_SelfReboot :

how you start sysToMonitor function?
jump to this?

what sysToMonitor do:
if
 0x810000 = MOV     R0, #2
 0x810008 = "Copy"
It jump to 0xFF810004 (condition - seg 0x810000= seg 0xFF810000)
else - it jump 0x810000

Maybe you test run this function without this compares?
and also test run this R0 = 0, 1, 2
« Last Edit: 17 / May / 2008, 14:29:32 by Seklth »

*

Offline Seklth

  • **
  • 54
  • 400D
Re: code you HAVE RUN on your dslr
« Reply #22 on: 17 / May / 2008, 15:34:02 »
http://volohova.zelnet.ru/FuncListSave.rar
idc for save and load list of functions  and my current list for 400D v1.1.1
see path in idc files - #define FILELIST "c:/funclist.txt"

Re: code you HAVE RUN on your dslr
« Reply #23 on: 17 / May / 2008, 17:28:22 »
I run it as a function with one argument (starttype). And I think that if there is:
MOV     R5, #0x81000000
MOV     R5, R5,ASR#8
that means: 0xFF810000 not 0x00810000.
So it is:
IF 0xFF810000 != "MOV R0, #2" then jump 0xFF810000
IF 0xFF810000 == "MOV R0, #2" && 0xFF810008 = "Copy" then jump 0xFF810004

But it runs a function from vmLibInfo+0x14 if it is present in the memory. I don't know what it is - but jumping to the begining of the rom didn't do anything. mayby that function runs the "Loadin ..." ?

One more thing: I runed it with starttype=2. I can try some other - but I didn't find any place where the begining of rom uses this argument - I think it is discarted.


*

Offline Seklth

  • **
  • 54
  • 400D
Re: code you HAVE RUN on your dslr
« Reply #24 on: 17 / May / 2008, 17:38:15 »
owerlord
flags of starttype: rebootLib
2 - its BOOT_CLEAR

Re: code you HAVE RUN on your dslr
« Reply #25 on: 17 / May / 2008, 18:19:43 »
wierd: I just dicovered that the jump to romStart do something - but you have to wait a good bit.
But it's very wierd:
It restarts in the place where you leave the menu ("Version :  1.1.1") and only button that work is "Jump" and it acts like the "->" arrow. (modyfied: No - in fact it does what "Jump" does :-)

Freaky.
« Last Edit: 17 / May / 2008, 18:27:24 by owerlord »

Re: code you HAVE RUN on your dslr
« Reply #26 on: 17 / May / 2008, 18:44:53 »
the romStart from the firmware don't do what vxWorks ought to.
There are no starttype flags I think. It don't copy the .data segment - only writes the adreses to (buffor?) 0xC0A10000+indexes. I think it always zero-s the .bss segment. It's wierd - it means that there are some proces specyfic information out of .bss. But pulling out the battery resets them (but not the user config. Wierd.

*

Offline Seklth

  • **
  • 54
  • 400D
Re: code you HAVE RUN on your dslr
« Reply #27 on: 18 / May / 2008, 05:12:09 »
you test run code restart from powershot? with 0x12345678 flag?


Re: code you HAVE RUN on your dslr
« Reply #28 on: 18 / May / 2008, 06:10:38 »
no. I runned the
ROM:FF8100A0                   romStart
with 4 and 2 flags. same efect. after some time of blank, restarts at menu and only "jump" button works.

*

Offline Seklth

  • **
  • 54
  • 400D
Re: code you HAVE RUN on your dslr
« Reply #29 on: 18 / May / 2008, 06:12:42 »
run with another flag - nothing?

P.S. public you function list =)

 

Related Topics