CHDK_DE Vorschauversion  Trunk Rev. 6014
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
boot.c-Dateireferenz
#include "lolevel.h"
#include "platform.h"
#include "core.h"
+ Include-Abhängigkeitsdiagramm für boot.c:

gehe zum Quellcode dieser Datei

Funktionen

void createHook (void *pNewTcb)
 
void deleteHook (void *pTcb)
 
void boot ()
 
void __attribute__ ((naked, noinline))
 *-------------------------------------------------------------------— Mehr ...
 
void h_usrInit ()
 
void h_usrKernelInit ()
 
void h_usrRoot ()
 

Variablen

long wrs_kernel_bss_start
 
long wrs_kernel_bss_end
 
const char *const new_sa = &_end
 

Dokumentation der Funktionen

void __attribute__ ( (naked, noinline)  )

*-------------------------------------------------------------------—

!!

IS_ERROR( hSoundHandle )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

"MOV R3, #0\n" "STR R3, [R9]\n"

TODO! below is from sd400

Definiert in Zeile 17 der Datei boot.c.

24 {
25  long *canon_data_src = (void*)0xFFAD7700; // This is the address of the "Startofdata" string on the firmware
26  long *canon_data_dst = (void*)0x1900; // This is where the boot data is copiedduring firmware update
27  long canon_data_len = 0xEB60; // This is the length of data from "Startofdata" to the end of the firmware dump
28  long *canon_bss_start = (void*)0x10460; // = 0xEB60 + 0x1900, just after data
29  long canon_bss_len = 0x72DC0 - 0x10460; // The original address of h_usrKernelInit - bss start
30  long i;
31 
32  asm volatile (
33  "MRC p15, 0, R0,c1,c0\n"
34  "ORR R0, R0, #0x1000\n"
35  "ORR R0, R0, #4\n"
36  "ORR R0, R0, #1\n"
37  "MCR p15, 0, R0,c1,c0\n"
38  :::"r0");
39 
40 
41  for(i=0;i<canon_data_len/4;i++)
42  canon_data_dst[i]=canon_data_src[i];
43 
44  for(i=0;i<canon_bss_len/4;i++)
45  canon_bss_start[i]=0;
46 
47  asm volatile (
48  "MRC p15, 0, R0,c1,c0\n"
49  "ORR R0, R0, #0x1000\n"
50  "BIC R0, R0, #4\n"
51  "ORR R0, R0, #1\n"
52  "MCR p15, 0, R0,c1,c0\n"
53  :::"r0");
54 
55  h_usrInit();
56 }
void boot ( )

Definiert in Zeile 43 der Datei boot.c.

43  {
44 
45  long *canon_data_src = (void*)0xFFEDAC70; // value taken at ROM:FFC00188
46  long *canon_data_dst = (void*)0x1900;
47  long canon_data_len = 0xDF84 - 0x1900; // data_end - data_start 0xDF7C taken at ROM:FFC00138
48  long *canon_bss_start = (void*)0xDF84; // just after data
49  long canon_bss_len = 0xD4F38 - 0xDF84; // d4ec8 taken at ROM:FFC00FB4
50 
51  long i;
52 
53  // enable caches and write buffer...
54  // this is a carryover from old dryos ports, may not be useful
55  asm volatile (
56  "MRC p15, 0, R0,c1,c0\n"
57  "ORR R0, R0, #0x1000\n"
58  "ORR R0, R0, #4\n"
59  "ORR R0, R0, #1\n"
60  "MCR p15, 0, R0,c1,c0\n"
61  :::"r0"
62  );
63 
64  for(i=0;i<canon_data_len/4;i++)
65  canon_data_dst[i]=canon_data_src[i];
66 
67  for(i=0;i<canon_bss_len/4;i++)
68  canon_bss_start[i]=0;
69 
70  asm volatile ("B sub_FFC001A4_my\n");
71 };
void createHook ( void *  pNewTcb)

Definiert in Zeile 110 der Datei main.c.

111 {
112  char *name = (char*)(*(long*)((char*)pNewTcb+0x34));
113  long *entry = (long*)((char*)pNewTcb+0x74);
114 
115  // always hook first task creation
116  // to create SpyProc
117  if (!stop_hooking){
118  task_prev = (void*)(*entry);
119  *entry = (long)task_start_hook;
120  stop_hooking = 1;
121  } else {
122  // hook/replace another tasks
123  if (my_ncmp(name, "tPhySw", 6) == 0){
124  *entry = (long)physw_hook;
125  }
126 
127  if (my_ncmp(name, "tInitFileM", 10) == 0){
128  init_file_modules_prev = (void*)(*entry);
129 #if CAM_MULTIPART
130  *entry = (long)init_file_modules_task;
131 #else
132  *entry = (long)init_file_modules_hook;
133 #endif
134  }
135 
136  if (my_ncmp(name, "tCaptSeqTa", 10) == 0){
137  *entry = (long)capt_seq_hook;
138  }
139 
140 #if CAM_CHDK_HAS_EXT_VIDEO_MENU
141  if (my_ncmp(name, "tMovieReco", 10) == 0){
142  *entry = (long)movie_record_hook;
143  }
144 #endif
145 
146 #if CAM_EXT_TV_RANGE
147  if (my_ncmp(name, "tExpDrvTas", 10) == 0){
148  *entry = (long)exp_drv_task;
149  }
150 #endif
151 
152 #if CAM_HAS_FILEWRITETASK_HOOK
153  if (my_ncmp(name, "tFileWrite", 10) == 0){
154  *entry = (long)filewritetask;
155  }
156 #endif
157 
158 // for cameras that have a "touch control dial" with 'TouchW' task.
159 // some cameras may use a different task name
160 #ifdef HOOK_TOUCHW
161  if (my_ncmp(name, "tTouchW", 7) == 0){
162  *entry = (long)my_touchw_task;
163  }
164 #endif
165 
166  core_hook_task_create(pNewTcb);
167  }
168 }
void deleteHook ( void *  pTcb)

Definiert in Zeile 170 der Datei main.c.

171 {
172  core_hook_task_delete(pTcb);
173 }
void h_usrInit ( )

Definiert in Zeile 59 der Datei boot.c.

60 {
61  asm volatile (
62  "STR LR, [SP,#-4]!\n"
63  "BL sub_FF811B20\n"
64  "MOV R0, #2\n"
65  "MOV R1, R0\n"
66  "BL sub_FFABDC68\n"
67  "BL sub_FFAAA238\n"
68  "BL sub_FF81125C\n"
69  "BL sub_FF811838\n"
70  "LDR LR, [SP],#4\n"
71  "B h_usrKernelInit\n"
72  );
73 
74 }
void h_usrKernelInit ( )

Definiert in Zeile 76 der Datei boot.c.

77 {
78  asm volatile (
79  "STMFD SP!, {R4,LR}\n"
80  "SUB SP, SP, #8\n"
81  "BL sub_FFABE168\n"
82  "BL sub_FFAD0C28\n"
83  "LDR R3, =0xF894\n"
84  "LDR R2, =0x704A0\n"
85  "LDR R1, [R3]\n"
86  "LDR R0, =0x7278C\n"
87  "MOV R3, #0x100\n"
88  "BL sub_FFACC464\n"
89  "LDR R3, =0xF854\n"
90  "LDR R0, =0xFC74\n"
91  "LDR R1, [R3]\n"
92  "BL sub_FFACC464\n"
93  "LDR R3, =0xF910\n"
94  "LDR R0, =0x72760\n"
95  "LDR R1, [R3]\n"
96  "BL sub_FFACC464\n"
97  "BL sub_FFAD57A8\n"
98  "BL sub_FF811348\n"
99  "MOV R4, #0\n"
100  "MOV R3, R0\n"
101  "MOV R12, #0x800\n"
102  "LDR R0, =h_usrRoot\n"
103  "MOV R1, #0x4000\n"
104  );
105 
106  //"LDR R2, =0xB2DC0\n" // 0x72DC0 + 0x40000
107  asm volatile (
108  "LDR R2, =new_sa\n"
109  "LDR R2, [R2]\n"
110  );
111 
112  asm volatile (
113  "STR R12, [SP]\n"
114  "STR R4, [SP,#4]\n"
115  "BL sub_FFACDE68\n"
116  "ADD SP, SP, #8\n"
117  "LDMFD SP!, {R4,PC}\n"
118  );
119 
120 }
void h_usrRoot ( )

Definiert in Zeile 123 der Datei boot.c.

124 {
125 // volatile long *p;
126 
127  asm volatile (
128  "STMFD SP!, {R4,R5,LR}\n"
129  "MOV R5, R0\n"
130  "MOV R4, R1\n"
131  "BL sub_FF811BA0\n"
132  "MOV R1, R4\n"
133  "MOV R0, R5\n"
134  "BL sub_FFAC4450\n" // memInit
135  "MOV R1, R4\n"
136  "MOV R0, R5\n"
137  "BL sub_FFAC4EC8\n" // mmPartLibInit <----- OK up to here!!
138 
139  //"BL sub_FF811928\n" // Here something BAD happens! It initializes the MMU, but SD500 has this replaced by a NULLSUB call...
140 
141  "BL sub_FF811814\n"
142  "MOV R0, #0x32\n"
143  "BL sub_FFAC6938\n" // selectInit
144  "BL sub_FF811BE4\n"
145  "BL sub_FF811BC4\n"
146  "BL sub_FF811C10\n"
147  "BL sub_FFAC61F8\n" //selTaskDeleteHookAdd
148  "BL sub_FF811B94\n"
149  );
150 
153 
154  drv_self_hide();
155 
156  asm volatile (
157  "LDMFD SP!, {R4,R5,LR}\n"
158  "B sub_FF811408\n"
159  );
160 
161 }

Variablen-Dokumentation

const char* const new_sa = &_end

Definiert in Zeile 12 der Datei boot.c.

long wrs_kernel_bss_end
long wrs_kernel_bss_start