Subversion Repositories HelenOS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. /** @addtogroup tdebug
  3.  * @{
  4.  */
  5. /** @file
  6.  */
  7.  
  8. #ifndef KERN_TDEBUG_TYPE_H_
  9. #define KERN_TDEBUG_TYPE_H_
  10.  
  11. /**
  12.  * Type of tdebug event.
  13.  */
  14. typedef enum {
  15.     TDEBUG_EV_STOP,     /**< stopped on monitor request */
  16.     TDEBUG_EV_SYSCALL,  /**< syscall */
  17.     TDEBUG_EV_EXCEPTION,    /**< hardware exception */
  18.     TDEBUG_EV_IBEFORE,  /**< before executing an instruction */
  19.     TDEBUG_EV_IAFTER    /**< after executing an instruction */
  20. } tdebug_event_t;
  21.  
  22. /**
  23.  * Event type bitmasks.
  24.  */
  25. typedef enum {
  26.     TDEBUG_EVMASK_STOP  = (1 << TDEBUG_EV_STOP),
  27.     TDEBUG_EVMASK_SYSCALL   = (1 << TDEBUG_EV_SYSCALL),
  28.     TDEBUG_EVMASK_EXCEPTION = (1 << TDEBUG_EV_EXCEPTION),
  29.     TDEBUG_EVMASK_IBEFORE   = (1 << TDEBUG_EV_IBEFORE),
  30.     TDEBUG_EVMASK_IAFTER    = (1 << TDEBUG_EV_IAFTER),
  31. } tdebug_evmask_t;
  32.  
  33. #ifdef KERNEL
  34.  
  35. #include <atomic.h>
  36. #include <arch/types.h>
  37. #include <arch/interrupt.h>
  38. #include <synch/condvar.h>
  39.  
  40.  
  41. struct thread;
  42. struct task;
  43.  
  44. /**
  45.  * A part of the task structure related to the tdebug interface.
  46.  * Access is synchronized using task lock of the containing task structure,
  47.  * except for the field have_monitor, which is not locked.
  48.  */
  49. typedef struct task_tdebug {
  50.     atomic_t have_monitor;  /**< this field is only informative */
  51.     struct task *monitor;   /**< points to the monitoring task or NULL */
  52.     unative_t method;   /**< method number to use with notifications */
  53.  
  54.     link_t targets;
  55.     link_t targets_link;
  56. } task_tdebug_t;
  57.  
  58. /**
  59.  * A part of the thread structure related to the tdebug interface.
  60.  */
  61. typedef struct thread_tdebug {
  62.     int stopped;
  63.     condvar_t stopped_cv;
  64.     unative_t current_event;
  65.  
  66.     int stop_request;
  67.     unative_t event_mask;
  68.  
  69.     /** Points to the stored userspace istate or NULL if none */
  70.     istate_t *uspace_state;
  71.  
  72.     unative_t *syscall_args;
  73. } thread_tdebug_t;
  74.  
  75. #endif /* KERNEL */
  76.  
  77. #endif
  78.  
  79. /** @}
  80.  */
  81.