- Timestamp:
- 2010-01-26T22:46:29Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 196a1439, 2314381
- Parents:
- e515b21a
- Location:
- kernel/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/udebug/udebug.h
re515b21a r3698e44 107 107 */ 108 108 UDEBUG_M_THREAD_READ, 109 110 /** Read the name of the debugged task. 111 * 112 * - ARG2 - destination address in the caller's address space 113 * - ARG3 - size of receiving buffer in bytes 114 * 115 * The kernel fills the buffer with a non-terminated string. 116 * 117 * - ARG2 - number of bytes that were actually copied 118 * - ARG3 - number of bytes of the complete data 119 * 120 */ 121 UDEBUG_M_NAME_READ, 109 122 110 123 /** Read the list of the debugged task's address space areas. -
kernel/generic/include/udebug/udebug_ops.h
re515b21a r3698e44 47 47 int udebug_thread_read(void **buffer, size_t buf_size, size_t *stored, 48 48 size_t *needed); 49 int udebug_name_read(char **data, size_t *data_size); 49 50 int udebug_args_read(thread_t *t, void **buffer); 50 51 -
kernel/generic/src/udebug/udebug_ipc.c
re515b21a r3698e44 198 198 IPC_SET_ARG3(call->data, needed); 199 199 call->buffer = buffer; 200 201 ipc_answer(&TASK->kb.box, call); 202 } 203 204 /** Process a NAME_READ call. 205 * 206 * Returns a string containing the name of the task. 207 * 208 * @param call The call structure. 209 */ 210 static void udebug_receive_name_read(call_t *call) 211 { 212 unative_t uspace_addr; 213 unative_t to_copy; 214 size_t data_size; 215 size_t buf_size; 216 void *data; 217 218 uspace_addr = IPC_GET_ARG2(call->data); /* Destination address */ 219 buf_size = IPC_GET_ARG3(call->data); /* Dest. buffer size */ 220 221 /* 222 * Read task name. 223 */ 224 udebug_name_read((char **) &data, &data_size); 225 226 /* Copy MAX(buf_size, data_size) bytes */ 227 228 if (buf_size > data_size) 229 to_copy = data_size; 230 else 231 to_copy = buf_size; 232 233 /* 234 * Make use of call->buffer to transfer data to caller's userspace 235 */ 236 237 IPC_SET_RETVAL(call->data, 0); 238 /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that 239 same code in process_answer() can be used 240 (no way to distinguish method in answer) */ 241 IPC_SET_ARG1(call->data, uspace_addr); 242 IPC_SET_ARG2(call->data, to_copy); 243 244 IPC_SET_ARG3(call->data, data_size); 245 call->buffer = data; 200 246 201 247 ipc_answer(&TASK->kb.box, call); … … 409 455 udebug_receive_thread_read(call); 410 456 break; 457 case UDEBUG_M_NAME_READ: 458 udebug_receive_name_read(call); 459 break; 411 460 case UDEBUG_M_AREAS_READ: 412 461 udebug_receive_areas_read(call); -
kernel/generic/src/udebug/udebug_ops.c
re515b21a r3698e44 46 46 #include <errno.h> 47 47 #include <print.h> 48 #include <string.h> 48 49 #include <syscall/copy.h> 49 50 #include <ipc/ipc.h> … … 439 440 } 440 441 442 /** Read task name. 443 * 444 * Returns task name as non-terminated string in a newly allocated buffer. 445 * Also returns the size of the data. 446 * 447 * @param data Place to store pointer to newly allocated block. 448 * @param data_size Place to store size of the data. 449 * 450 * @returns EOK. 451 */ 452 int udebug_name_read(char **data, size_t *data_size) 453 { 454 size_t name_size; 455 456 name_size = str_size(TASK->name) + 1; 457 *data = malloc(name_size, 0); 458 *data_size = name_size; 459 460 memcpy(*data, TASK->name, name_size); 461 462 return 0; 463 } 464 441 465 /** Read the arguments of a system call. 442 466 *
Note:
See TracChangeset
for help on using the changeset viewer.