Rev 2868 | Rev 2872 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2868 | Rev 2871 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | #include <errno.h> |
12 | #include <errno.h> |
13 | #include <udebug.h> |
13 | #include <udebug.h> |
14 | #include <async.h> |
14 | #include <async.h> |
15 | 15 | ||
16 | #include "syscalls.h" |
16 | #include "syscalls.h" |
- | 17 | #include "ipc.h" |
|
17 | #include "errors.h" |
18 | #include "errors.h" |
18 | #include "debug_api.h" |
19 | #include "debug_api.h" |
19 | 20 | ||
20 | #define THBUF_SIZE 64 |
21 | #define THBUF_SIZE 64 |
21 | unsigned thread_hash_buf[THBUF_SIZE]; |
22 | unsigned thread_hash_buf[THBUF_SIZE]; |
Line 109... | Line 110... | ||
109 | printf(", %d", sc_args[i]); |
110 | printf(", %d", sc_args[i]); |
110 | } |
111 | } |
111 | putchar(')'); |
112 | putchar(')'); |
112 | } |
113 | } |
113 | 114 | ||
- | 115 | void sc_ipc_call_async_fast(unsigned *sc_args) |
|
- | 116 | { |
|
- | 117 | ipc_call_t call; |
|
- | 118 | int phoneid; |
|
- | 119 | ||
- | 120 | phoneid = sc_args[0]; |
|
- | 121 | ||
- | 122 | IPC_SET_METHOD(call, sc_args[1]); |
|
- | 123 | IPC_SET_ARG1(call, sc_args[2]); |
|
- | 124 | IPC_SET_ARG2(call, sc_args[3]); |
|
- | 125 | IPC_SET_ARG3(call, sc_args[4]); |
|
- | 126 | IPC_SET_ARG4(call, sc_args[5]); |
|
- | 127 | IPC_SET_ARG5(call, 0); |
|
- | 128 | ||
- | 129 | ipc_parse_call_out(phoneid, &call); |
|
- | 130 | } |
|
- | 131 | ||
114 | void sc_ipc_call_async_slow(unsigned *sc_args) |
132 | void sc_ipc_call_async_slow(unsigned *sc_args) |
115 | { |
133 | { |
116 | unsigned ipc_args[6]; |
134 | ipc_call_t call; |
117 | int rc; |
135 | int rc; |
118 | 136 | ||
119 | memset(ipc_args, 0, sizeof(ipc_args)); |
137 | memset(&call, 0, sizeof(call)); |
120 | rc = debug_mem_read(phoneid, ipc_args, sc_args[1], sizeof(ipc_args)); |
138 | rc = debug_mem_read(phoneid, &call.args, sc_args[1], sizeof(call.args)); |
121 | 139 | ||
122 | if (rc >= 0) { |
140 | if (rc >= 0) { |
123 | printf("args: (%u, %u, %u, %u, %u, %u)\n", |
141 | ipc_parse_call_out(sc_args[0], &call); |
- | 142 | } |
|
- | 143 | } |
|
- | 144 | ||
124 | ipc_args[0], ipc_args[1], ipc_args[2], |
145 | void sc_ipc_wait(unsigned *sc_args, int sc_rc) |
- | 146 | { |
|
- | 147 | ipc_call_t call; |
|
- | 148 | int rc; |
|
- | 149 | ||
- | 150 | if (sc_rc == 0) return 0; |
|
- | 151 | ||
- | 152 | memset(&call, 0, sizeof(call)); |
|
- | 153 | 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", |
|
125 | ipc_args[3], ipc_args[4], ipc_args[5]); |
155 | phoneid, (int)&call, sc_args[0], sizeof(call), rc); |
- | 156 | ||
- | 157 | if (rc >= 0) { |
|
- | 158 | ipc_parse_call_in(&call); |
|
126 | } |
159 | } |
127 | } |
160 | } |
128 | 161 | ||
129 | void event_syscall(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
162 | void event_syscall(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
130 | { |
163 | { |
Line 150... | Line 183... | ||
150 | print_sc_args(sc_args, syscall_desc[sc_id].n_args); |
183 | print_sc_args(sc_args, syscall_desc[sc_id].n_args); |
151 | rv_type = syscall_desc[sc_id].rv_type; |
184 | rv_type = syscall_desc[sc_id].rv_type; |
152 | print_sc_retval(sc_rc, rv_type); |
185 | print_sc_retval(sc_rc, rv_type); |
153 | 186 | ||
154 | switch (sc_id) { |
187 | switch (sc_id) { |
- | 188 | case SYS_IPC_CALL_ASYNC_FAST: |
|
- | 189 | sc_ipc_call_async_fast(sc_args); |
|
- | 190 | break; |
|
155 | case SYS_IPC_CALL_ASYNC_SLOW: |
191 | case SYS_IPC_CALL_ASYNC_SLOW: |
156 | sc_ipc_call_async_slow(sc_args); |
192 | sc_ipc_call_async_slow(sc_args); |
157 | break; |
193 | break; |
- | 194 | case SYS_IPC_WAIT: |
|
- | 195 | sc_ipc_wait(sc_args, sc_rc); |
|
- | 196 | break; |
|
158 | default: |
197 | default: |
159 | break; |
198 | break; |
160 | } |
199 | } |
161 | 200 | ||
162 | async_serialize_end(); |
201 | async_serialize_end(); |