Changes in kernel/generic/src/udebug/udebug_ipc.c [336db295:31696b4f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/udebug/udebug_ipc.c
r336db295 r31696b4f 41 41 #include <proc/task.h> 42 42 #include <proc/thread.h> 43 #include <mm/as.h>44 43 #include <arch.h> 45 44 #include <errno.h> … … 166 165 static void udebug_receive_thread_read(call_t *call) 167 166 { 168 uintptr_t uspace_addr; 169 size_t buf_size; 167 unative_t uspace_addr; 168 unative_t to_copy; 169 unsigned total_bytes; 170 unsigned buf_size; 170 171 void *buffer; 171 size_t copied, needed;172 size_t n; 172 173 int rc; 173 174 … … 179 180 * of threads times thread-id size. 180 181 */ 181 rc = udebug_thread_read(&buffer, buf_size, & copied, &needed);182 rc = udebug_thread_read(&buffer, buf_size, &n); 182 183 if (rc < 0) { 183 184 IPC_SET_RETVAL(call->data, rc); … … 186 187 } 187 188 188 /* 189 * Make use of call->buffer to transfer data to caller's userspace 190 */ 191 192 IPC_SET_RETVAL(call->data, 0); 193 /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that 194 same code in process_answer() can be used 195 (no way to distinguish method in answer) */ 196 IPC_SET_ARG1(call->data, uspace_addr); 197 IPC_SET_ARG2(call->data, copied); 198 IPC_SET_ARG3(call->data, needed); 199 call->buffer = buffer; 200 201 ipc_answer(&TASK->kb.box, call); 202 } 203 204 /** Process an AREAS_READ call. 205 * 206 * Returns a list of address space areas in the current task, as an array 207 * of as_area_info_t structures. 208 * 209 * @param call The call structure. 210 */ 211 static void udebug_receive_areas_read(call_t *call) 212 { 213 unative_t uspace_addr; 214 unative_t to_copy; 215 size_t data_size; 216 size_t buf_size; 217 void *data; 218 219 uspace_addr = IPC_GET_ARG2(call->data); /* Destination address */ 220 buf_size = IPC_GET_ARG3(call->data); /* Dest. buffer size */ 221 222 /* 223 * Read area list. 224 */ 225 as_get_area_info(AS, (as_area_info_t **) &data, &data_size); 226 227 /* Copy MAX(buf_size, data_size) bytes */ 228 229 if (buf_size > data_size) 230 to_copy = data_size; 189 total_bytes = n; 190 191 /* Copy MAX(buf_size, total_bytes) bytes */ 192 193 if (buf_size > total_bytes) 194 to_copy = total_bytes; 231 195 else 232 196 to_copy = buf_size; … … 243 207 IPC_SET_ARG2(call->data, to_copy); 244 208 245 IPC_SET_ARG3(call->data, data_size); 246 call->buffer = data; 247 248 ipc_answer(&TASK->kb.box, call); 249 } 250 209 IPC_SET_ARG3(call->data, total_bytes); 210 call->buffer = buffer; 211 212 ipc_answer(&TASK->kb.box, call); 213 } 251 214 252 215 /** Process an ARGS_READ call. … … 368 331 udebug_receive_thread_read(call); 369 332 break; 370 case UDEBUG_M_AREAS_READ:371 udebug_receive_areas_read(call);372 break;373 333 case UDEBUG_M_ARGS_READ: 374 334 udebug_receive_args_read(call);
Note:
See TracChangeset
for help on using the changeset viewer.