Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2892 → Rev 2787

/branches/tracing/kernel/arch/ia32/include/tdebug.h
0,0 → 1,15
/** @addtogroup ia32
* @{
*/
/** @file
*/
 
#ifndef KERN_ia32_TDEBUG_H_
#define KERN_ia32_TDEBUG_H_
 
extern int tdebug_iafter_update(struct thread *t);
 
#endif
 
/** @}
*/
/branches/tracing/kernel/arch/ia32/Makefile.inc
151,4 → 151,5
arch/$(ARCH)/src/boot/boot.S \
arch/$(ARCH)/src/boot/memmap.c \
arch/$(ARCH)/src/fpu_context.c \
arch/$(ARCH)/src/debugger.c
arch/$(ARCH)/src/debugger.c \
arch/$(ARCH)/src/tdebug.c
/branches/tracing/kernel/arch/ia32/src/tdebug.c
0,0 → 1,51
/** @addtogroup ia32
* @{
*/
/** @file
*/
 
#include <proc/thread.h>
#include <console/klog.h>
#include <arch/tdebug.h>
 
/* trap flag */
#define EFLAGS_TF 0x100
 
/**
* Called when the IAFTER event setting is (potentially) changed.
*
* On this arch the TRAP flag in userspace state is set
* according to the setting of TDEBUG_EVMASK_IAFTER
* in order to stop after the execution of each instruction.
*
* The calling thread must have already locked t.
*
* Returns 0 on success, non-zero on failure. (Mainly if IAFTER is set, but
* architecture does not support it.)
*/
int tdebug_iafter_update(thread_t *t)
{
uint32_t eflags;
 
if (t->tdebug.uspace_state == NULL) {
/* userspace state is not available */
/* FIXME: this should not happen when properly imlemented */
klog_printf("fail: uspace_state not available\n");
return -1;
}
 
eflags = t->tdebug.uspace_state->eflags;
 
if ((t->tdebug.event_mask & TDEBUG_EVMASK_IAFTER) != 0) {
eflags = eflags | EFLAGS_TF;
} else {
eflags = eflags & ~EFLAGS_TF;
}
 
t->tdebug.uspace_state->eflags = eflags;
return 0;
}
 
 
/** @}
*/