Rev 2816 | Rev 2818 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2816 | Rev 2817 | ||
---|---|---|---|
Line 125... | Line 125... | ||
125 | 125 | ||
126 | klog_printf("debug_args_read() done"); |
126 | klog_printf("debug_args_read() done"); |
127 | return 1; /* actually need becksend with retval 0 */ |
127 | return 1; /* actually need becksend with retval 0 */ |
128 | } |
128 | } |
129 | 129 | ||
- | 130 | static int udebug_rp_regs_read(call_t *call, phone_t *phone) |
|
- | 131 | { |
|
- | 132 | thread_t *t; |
|
- | 133 | task_t *ta; |
|
- | 134 | void *uspace_buffer; |
|
- | 135 | unative_t to_copy; |
|
- | 136 | int rc; |
|
- | 137 | istate_t *state; |
|
- | 138 | ||
- | 139 | klog_printf("debug_regs_read()"); |
|
- | 140 | // FIXME: verify task/thread state |
|
- | 141 | ||
- | 142 | state = THREAD->uspace_state; |
|
- | 143 | if (state == NULL) { |
|
- | 144 | klog_printf("debug_regs_read() - istate not available"); |
|
- | 145 | return EBUSY; |
|
- | 146 | } |
|
- | 147 | ||
- | 148 | ta = get_lock_callee_task(phone); |
|
- | 149 | t = (thread_t *) IPC_GET_ARG2(call->data); |
|
- | 150 | if (!thread_exists(t)) { |
|
- | 151 | spinlock_unlock(&ta->lock); |
|
- | 152 | return ENOENT; |
|
- | 153 | } |
|
- | 154 | ||
- | 155 | uspace_buffer = (void *)IPC_GET_ARG3(call->data); |
|
- | 156 | to_copy = IPC_GET_ARG4(call->data); |
|
- | 157 | if (to_copy > sizeof(istate_t)) to_copy = sizeof(istate_t); |
|
- | 158 | ||
- | 159 | rc = copy_to_uspace(uspace_buffer, t->uspace_state, to_copy); |
|
- | 160 | if (rc != 0) { |
|
- | 161 | spinlock_unlock(&ta->lock); |
|
- | 162 | klog_printf("debug_regs_read() - copy failed"); |
|
- | 163 | return rc; |
|
- | 164 | } |
|
- | 165 | ||
- | 166 | spinlock_unlock(&ta->lock); |
|
- | 167 | ||
- | 168 | IPC_SET_ARG1(call->data, to_copy); |
|
- | 169 | IPC_SET_ARG2(call->data, sizeof(istate_t)); |
|
- | 170 | ||
- | 171 | klog_printf("debug_regs_read() done"); |
|
- | 172 | return 1; /* actually need becksend with retval 0 */ |
|
- | 173 | } |
|
- | 174 | ||
- | 175 | static int udebug_rp_regs_write(call_t *call, phone_t *phone) |
|
- | 176 | { |
|
- | 177 | thread_t *t; |
|
- | 178 | task_t *ta; |
|
- | 179 | void *uspace_data; |
|
- | 180 | unative_t to_copy; |
|
- | 181 | int rc; |
|
- | 182 | istate_t *state; |
|
- | 183 | ||
- | 184 | klog_printf("debug_regs_write()"); |
|
- | 185 | // FIXME: verify task/thread state |
|
- | 186 | ||
- | 187 | state = THREAD->uspace_state; |
|
- | 188 | if (state == NULL) { |
|
- | 189 | klog_printf("debug_regs_write() - istate not available"); |
|
- | 190 | return EBUSY; |
|
- | 191 | } |
|
- | 192 | ||
- | 193 | ta = get_lock_callee_task(phone); |
|
- | 194 | t = (thread_t *) IPC_GET_ARG2(call->data); |
|
- | 195 | if (!thread_exists(t)) { |
|
- | 196 | spinlock_unlock(&ta->lock); |
|
- | 197 | return ENOENT; |
|
- | 198 | } |
|
- | 199 | ||
- | 200 | uspace_data = (void *)IPC_GET_ARG3(call->data); |
|
- | 201 | to_copy = IPC_GET_ARG4(call->data); |
|
- | 202 | if (to_copy > sizeof(istate_t)) to_copy = sizeof(istate_t); |
|
- | 203 | ||
- | 204 | rc = copy_from_uspace(t->uspace_state, uspace_data, to_copy); |
|
- | 205 | if (rc != 0) { |
|
- | 206 | spinlock_unlock(&ta->lock); |
|
- | 207 | klog_printf("debug_regs_write() - copy failed"); |
|
- | 208 | return rc; |
|
- | 209 | } |
|
- | 210 | ||
- | 211 | spinlock_unlock(&ta->lock); |
|
- | 212 | ||
- | 213 | IPC_SET_ARG1(call->data, to_copy); |
|
- | 214 | IPC_SET_ARG2(call->data, sizeof(istate_t)); |
|
- | 215 | ||
- | 216 | klog_printf("debug_regs_write() done"); |
|
- | 217 | return 1; /* actually need becksend with retval 0 */ |
|
- | 218 | } |
|
- | 219 | ||
130 | static int udebug_rp_thread_read(call_t *call, phone_t *phone) |
220 | static int udebug_rp_thread_read(call_t *call, phone_t *phone) |
131 | { |
221 | { |
132 | thread_t *t; |
222 | thread_t *t; |
133 | link_t *cur; |
223 | link_t *cur; |
134 | task_t *ta; |
224 | task_t *ta; |
Line 198... | Line 288... | ||
198 | rc = udebug_rp_go(call, phone); |
288 | rc = udebug_rp_go(call, phone); |
199 | return rc; |
289 | return rc; |
200 | case UDEBUG_M_ARGS_READ: |
290 | case UDEBUG_M_ARGS_READ: |
201 | rc = udebug_rp_args_read(call, phone); |
291 | rc = udebug_rp_args_read(call, phone); |
202 | return rc; |
292 | return rc; |
- | 293 | case UDEBUG_M_REGS_READ: |
|
- | 294 | rc = udebug_rp_regs_read(call, phone); |
|
- | 295 | return rc; |
|
- | 296 | case UDEBUG_M_REGS_WRITE: |
|
- | 297 | rc = udebug_rp_regs_write(call, phone); |
|
- | 298 | return rc; |
|
203 | case UDEBUG_M_THREAD_READ: |
299 | case UDEBUG_M_THREAD_READ: |
204 | rc = udebug_rp_thread_read(call, phone); |
300 | rc = udebug_rp_thread_read(call, phone); |
205 | return rc; |
301 | return rc; |
206 | default: |
302 | default: |
207 | break; |
303 | break; |