Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2786 → Rev 2787

/branches/tracing/kernel/generic/include/tdebug/systdebug.h
0,0 → 1,26
 
/** @addtogroup tdebug
* @{
*/
/** @file
*/
 
#ifndef KERN_SYSTDEBUG_H_
#define KERN_SYSTDEBUG_H_
 
#include <arch/types.h>
#include <syscall/sysarg64.h>
 
unative_t sys_tdebug_attach_task(sysarg64_t *task_id, unative_t method);
unative_t sys_tdebug_detach_task(sysarg64_t *task_id);
unative_t sys_tdebug_continue_thread(sysarg64_t *thread_id);
unative_t sys_tdebug_get_syscall_args(sysarg64_t *thread_id,
uintptr_t *buffer, unative_t *len);
unative_t sys_tdebug_set_event_mask(sysarg64_t *thread_id, unative_t ev_mask);
unative_t sys_tdebug_stop_thread(sysarg64_t *thread_id);
unative_t sys_tdebug_stop_task(sysarg64_t *task_id);
 
#endif
 
/** @}
*/
/branches/tracing/kernel/generic/include/tdebug/tdebug.h
0,0 → 1,51
 
/** @addtogroup tdebug
* @{
*/
/** @file
*/
 
#ifndef KERN_TDEBUG_H_
#define KERN_TDEBUG_H_
 
#include <atomic.h>
#include <arch/types.h>
#include <tdebug/tdebug_type.h>
#include <arch.h>
 
/*
* Managing tdebug structures.
*/
void tdebug_task_init(struct task *ta);
void tdebug_thread_init(struct thread *t);
void tdebug_cleanup(void);
 
/*
* Creating hooks at strategic points in the kernel.
*/
 
void tdebug_syscall_event(unative_t a1, unative_t a2, unative_t a3,
unative_t a4, unative_t a5, unative_t a6, unative_t id, unative_t rc);
void tdebug_exception_event(int n);
void tdebug_stopping_point(void);
 
static inline int tdebug_have_monitor()
{
return atomic_get(&TASK->tdebug.have_monitor);
}
 
/*
* Used to implement tdebug syscalls
*/
int tdebug_attach_task(task_id_t taskid, unative_t method);
int tdebug_detach_task(task_id_t taskid);
int tdebug_continue_thread(thread_id_t tid);
int tdebug_get_syscall_args(thread_id_t tid, unative_t *sc_args);
int tdebug_set_event_mask(thread_id_t tid, unative_t ev_mask);
int tdebug_stop_thread(thread_id_t tid);
int tdebug_stop_task(task_id_t taskid);
 
#endif
 
/** @}
*/
/branches/tracing/kernel/generic/include/tdebug/tdebug_type.h
0,0 → 1,80
 
/** @addtogroup tdebug
* @{
*/
/** @file
*/
 
#ifndef KERN_TDEBUG_TYPE_H_
#define KERN_TDEBUG_TYPE_H_
 
/**
* Type of tdebug event.
*/
typedef enum {
TDEBUG_EV_STOP, /**< stopped on monitor request */
TDEBUG_EV_SYSCALL, /**< syscall */
TDEBUG_EV_EXCEPTION, /**< hardware exception */
TDEBUG_EV_IBEFORE, /**< before executing an instruction */
TDEBUG_EV_IAFTER /**< after executing an instruction */
} tdebug_event_t;
 
/**
* Event type bitmasks.
*/
typedef enum {
TDEBUG_EVMASK_STOP = (1 << TDEBUG_EV_STOP),
TDEBUG_EVMASK_SYSCALL = (1 << TDEBUG_EV_SYSCALL),
TDEBUG_EVMASK_EXCEPTION = (1 << TDEBUG_EV_EXCEPTION),
TDEBUG_EVMASK_IBEFORE = (1 << TDEBUG_EV_IBEFORE),
TDEBUG_EVMASK_IAFTER = (1 << TDEBUG_EV_IAFTER),
} tdebug_evmask_t;
 
#ifdef KERNEL
 
#include <atomic.h>
#include <arch/types.h>
#include <arch/interrupt.h>
#include <synch/condvar.h>
 
 
struct thread;
struct task;
 
/**
* A part of the task structure related to the tdebug interface.
* Access is synchronized using task lock of the containing task structure,
* except for the field have_monitor, which is not locked.
*/
typedef struct task_tdebug {
atomic_t have_monitor; /**< this field is only informative */
struct task *monitor; /**< points to the monitoring task or NULL */
unative_t method; /**< method number to use with notifications */
 
link_t targets;
link_t targets_link;
} task_tdebug_t;
 
/**
* A part of the thread structure related to the tdebug interface.
*/
typedef struct thread_tdebug {
int stopped;
condvar_t stopped_cv;
unative_t current_event;
 
int stop_request;
unative_t event_mask;
 
/** Points to the stored userspace istate or NULL if none */
istate_t *uspace_state;
 
unative_t *syscall_args;
} thread_tdebug_t;
 
#endif /* KERNEL */
 
#endif
 
/** @}
*/