Ignore:
Timestamp:
2010-01-25T21:40:13Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e515b21a
Parents:
0d21b53
Message:

Allow taskdump to read register state and extract PC, FP (not implemented for all arches).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/udebug/udebug_ipc.c

    r0d21b53 r80487bc5  
    287287        ipc_answer(&TASK->kb.box, call);
    288288}
     289
     290/** Receive a REGS_READ call.
     291 *
     292 * Reads the thread's register state (istate structure).
     293 */
     294static void udebug_receive_regs_read(call_t *call)
     295{
     296        thread_t *t;
     297        unative_t uspace_addr;
     298        unative_t to_copy;
     299        void *buffer;
     300        int rc;
     301
     302        t = (thread_t *) IPC_GET_ARG2(call->data);
     303
     304        rc = udebug_regs_read(t, &buffer);
     305        if (rc < 0) {
     306                IPC_SET_RETVAL(call->data, rc);
     307                ipc_answer(&TASK->kb.box, call);
     308                return;
     309        }
     310
     311        /*
     312         * Make use of call->buffer to transfer data to caller's userspace
     313         */
     314
     315        uspace_addr = IPC_GET_ARG3(call->data);
     316        to_copy = sizeof(istate_t);
     317
     318        IPC_SET_RETVAL(call->data, 0);
     319        /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
     320           same code in process_answer() can be used
     321           (no way to distinguish method in answer) */
     322        IPC_SET_ARG1(call->data, uspace_addr);
     323        IPC_SET_ARG2(call->data, to_copy);
     324
     325        call->buffer = buffer;
     326
     327        ipc_answer(&TASK->kb.box, call);
     328}
     329
    289330
    290331/** Process an MEM_READ call.
     
    374415                udebug_receive_args_read(call);
    375416                break;
     417        case UDEBUG_M_REGS_READ:
     418                udebug_receive_regs_read(call);
     419                break;
    376420        case UDEBUG_M_MEM_READ:
    377421                udebug_receive_mem_read(call);
Note: See TracChangeset for help on using the changeset viewer.