Rev 2871 | Rev 2873 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2871 | Rev 2872 | ||
---|---|---|---|
Line 110... | Line 110... | ||
110 | printf(", %d", sc_args[i]); |
110 | printf(", %d", sc_args[i]); |
111 | } |
111 | } |
112 | putchar(')'); |
112 | putchar(')'); |
113 | } |
113 | } |
114 | 114 | ||
115 | void sc_ipc_call_async_fast(unsigned *sc_args) |
115 | void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc) |
116 | { |
116 | { |
117 | ipc_call_t call; |
117 | ipc_call_t call; |
118 | int phoneid; |
118 | int phoneid; |
- | 119 | ||
- | 120 | if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY) |
|
- | 121 | return; |
|
119 | 122 | ||
120 | phoneid = sc_args[0]; |
123 | phoneid = sc_args[0]; |
121 | 124 | ||
122 | IPC_SET_METHOD(call, sc_args[1]); |
125 | IPC_SET_METHOD(call, sc_args[1]); |
123 | IPC_SET_ARG1(call, sc_args[2]); |
126 | IPC_SET_ARG1(call, sc_args[2]); |
124 | IPC_SET_ARG2(call, sc_args[3]); |
127 | IPC_SET_ARG2(call, sc_args[3]); |
125 | IPC_SET_ARG3(call, sc_args[4]); |
128 | IPC_SET_ARG3(call, sc_args[4]); |
126 | IPC_SET_ARG4(call, sc_args[5]); |
129 | IPC_SET_ARG4(call, sc_args[5]); |
127 | IPC_SET_ARG5(call, 0); |
130 | IPC_SET_ARG5(call, 0); |
128 | 131 | ||
129 | ipc_parse_call_out(phoneid, &call); |
132 | ipc_parse_call_out(phoneid, &call, sc_rc); |
130 | } |
133 | } |
131 | 134 | ||
132 | void sc_ipc_call_async_slow(unsigned *sc_args) |
135 | void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc) |
133 | { |
136 | { |
134 | ipc_call_t call; |
137 | ipc_call_t call; |
135 | int rc; |
138 | int rc; |
136 | 139 | ||
- | 140 | if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY) |
|
- | 141 | return; |
|
- | 142 | ||
137 | memset(&call, 0, sizeof(call)); |
143 | memset(&call, 0, sizeof(call)); |
138 | rc = debug_mem_read(phoneid, &call.args, sc_args[1], sizeof(call.args)); |
144 | rc = debug_mem_read(phoneid, &call.args, sc_args[1], sizeof(call.args)); |
139 | 145 | ||
140 | if (rc >= 0) { |
146 | if (rc >= 0) { |
141 | ipc_parse_call_out(sc_args[0], &call); |
147 | ipc_parse_call_out(sc_args[0], &call, sc_rc); |
142 | } |
148 | } |
143 | } |
149 | } |
144 | 150 | ||
- | 151 | void sc_ipc_call_sync_fast(unsigned *sc_args) |
|
- | 152 | { |
|
- | 153 | ipc_call_t question, reply; |
|
- | 154 | int rc; |
|
- | 155 | int phoneidx; |
|
- | 156 | ||
- | 157 | printf("sc_ipc_call_sync_fast()\n"); |
|
- | 158 | phoneidx = sc_args[0]; |
|
- | 159 | ||
- | 160 | IPC_SET_METHOD(question, sc_args[1]); |
|
- | 161 | IPC_SET_ARG1(question, sc_args[2]); |
|
- | 162 | IPC_SET_ARG2(question, sc_args[3]); |
|
- | 163 | IPC_SET_ARG3(question, sc_args[4]); |
|
- | 164 | IPC_SET_ARG4(question, 0); |
|
- | 165 | IPC_SET_ARG5(question, 0); |
|
- | 166 | ||
- | 167 | printf("memset\n"); |
|
- | 168 | memset(&reply, 0, sizeof(reply)); |
|
- | 169 | printf("debug_mem_read(phone=%d, buffer_ptr=%u, src_addr=%d, n=%d\n", |
|
- | 170 | phoneid, &reply.args, sc_args[5], sizeof(reply.args)); |
|
- | 171 | rc = debug_mem_read(phoneid, &reply.args, sc_args[5], sizeof(reply.args)); |
|
- | 172 | printf("dmr->%d\n", rc); |
|
- | 173 | if (rc < 0) return; |
|
- | 174 | ||
- | 175 | printf("call ipc_parse_call_sync\n"); |
|
- | 176 | ipc_parse_call_sync(phoneidx, &question, &reply); |
|
- | 177 | } |
|
- | 178 | ||
- | 179 | void sc_ipc_call_sync_slow(unsigned *sc_args) |
|
- | 180 | { |
|
- | 181 | ipc_call_t question, reply; |
|
- | 182 | int rc; |
|
- | 183 | ||
- | 184 | memset(&question, 0, sizeof(question)); |
|
- | 185 | rc = debug_mem_read(phoneid, &question.args, sc_args[1], sizeof(question.args)); |
|
- | 186 | printf("dmr->%d\n", rc); |
|
- | 187 | if (rc < 0) return; |
|
- | 188 | ||
- | 189 | memset(&reply, 0, sizeof(reply)); |
|
- | 190 | rc = debug_mem_read(phoneid, &reply.args, sc_args[2], sizeof(reply.args)); |
|
- | 191 | printf("dmr->%d\n", rc); |
|
- | 192 | if (rc < 0) return; |
|
- | 193 | ||
- | 194 | ipc_parse_call_sync(sc_args[0], &question, &reply); |
|
- | 195 | } |
|
- | 196 | ||
145 | void sc_ipc_wait(unsigned *sc_args, int sc_rc) |
197 | void sc_ipc_wait(unsigned *sc_args, int sc_rc) |
146 | { |
198 | { |
147 | ipc_call_t call; |
199 | ipc_call_t call; |
148 | int rc; |
200 | int rc; |
149 | 201 | ||
150 | if (sc_rc == 0) return 0; |
202 | if (sc_rc == 0) return 0; |
151 | 203 | ||
152 | memset(&call, 0, sizeof(call)); |
204 | memset(&call, 0, sizeof(call)); |
153 | rc = debug_mem_read(phoneid, &call, sc_args[0], sizeof(call)); |
205 | rc = debug_mem_read(phoneid, &call, sc_args[0], sizeof(call)); |
154 | printf("debug_mem_read(phone %d, dest %d, app-mem src %d, size %d -> %d\n", |
206 | // printf("debug_mem_read(phone %d, dest %d, app-mem src %d, size %d -> %d\n", |
155 | phoneid, (int)&call, sc_args[0], sizeof(call), rc); |
207 | // phoneid, (int)&call, sc_args[0], sizeof(call), rc); |
156 | 208 | ||
157 | if (rc >= 0) { |
209 | if (rc >= 0) { |
158 | ipc_parse_call_in(&call); |
210 | ipc_parse_call_in(&call, sc_rc); |
159 | } |
211 | } |
160 | } |
212 | } |
161 | 213 | ||
162 | void event_syscall(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
214 | void event_syscall(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
163 | { |
215 | { |
Line 168... | Line 220... | ||
168 | /* Read syscall arguments */ |
220 | /* Read syscall arguments */ |
169 | rc = debug_args_read(phoneid, thread_hash, sc_args); |
221 | rc = debug_args_read(phoneid, thread_hash, sc_args); |
170 | 222 | ||
171 | async_serialize_start(); |
223 | async_serialize_start(); |
172 | 224 | ||
173 | printf("[%d] ", thread_id); |
225 | // printf("[%d] ", thread_id); |
174 | 226 | ||
175 | if (rc < 0) { |
227 | if (rc < 0) { |
176 | printf("error\n"); |
228 | printf("error\n"); |
177 | async_serialize_end(); |
229 | async_serialize_end(); |
178 | return; |
230 | return; |
Line 184... | Line 236... | ||
184 | rv_type = syscall_desc[sc_id].rv_type; |
236 | rv_type = syscall_desc[sc_id].rv_type; |
185 | print_sc_retval(sc_rc, rv_type); |
237 | print_sc_retval(sc_rc, rv_type); |
186 | 238 | ||
187 | switch (sc_id) { |
239 | switch (sc_id) { |
188 | case SYS_IPC_CALL_ASYNC_FAST: |
240 | case SYS_IPC_CALL_ASYNC_FAST: |
189 | sc_ipc_call_async_fast(sc_args); |
241 | sc_ipc_call_async_fast(sc_args, sc_rc); |
190 | break; |
242 | break; |
191 | case SYS_IPC_CALL_ASYNC_SLOW: |
243 | case SYS_IPC_CALL_ASYNC_SLOW: |
- | 244 | sc_ipc_call_async_slow(sc_args, sc_rc); |
|
- | 245 | break; |
|
- | 246 | case SYS_IPC_CALL_SYNC_FAST: |
|
- | 247 | sc_ipc_call_sync_fast(sc_args); |
|
- | 248 | break; |
|
- | 249 | case SYS_IPC_CALL_SYNC_SLOW: |
|
192 | sc_ipc_call_async_slow(sc_args); |
250 | sc_ipc_call_sync_slow(sc_args); |
193 | break; |
251 | break; |
194 | case SYS_IPC_WAIT: |
252 | case SYS_IPC_WAIT: |
195 | sc_ipc_wait(sc_args, sc_rc); |
253 | sc_ipc_wait(sc_args, sc_rc); |
196 | break; |
254 | break; |
197 | default: |
255 | default: |
Line 227... | Line 285... | ||
227 | 285 | ||
228 | /* Run thread until an event occurs */ |
286 | /* Run thread until an event occurs */ |
229 | rc = debug_go(phoneid, thread_hash, |
287 | rc = debug_go(phoneid, thread_hash, |
230 | &ev_type, &val0, &val1); |
288 | &ev_type, &val0, &val1); |
231 | 289 | ||
232 | printf("rc = %d, ev_type=%d\n", rc, ev_type); |
290 | // printf("rc = %d, ev_type=%d\n", rc, ev_type); |
233 | if (ev_type == UDEBUG_EVENT_FINISHED) { |
291 | if (ev_type == UDEBUG_EVENT_FINISHED) { |
234 | printf("thread %u debugging finished\n", thread_id); |
292 | printf("thread %u debugging finished\n", thread_id); |
235 | break; |
293 | break; |
236 | } |
294 | } |
237 | 295 |