diff options
Diffstat (limited to 'sys/lockdoc')
| -rw-r--r-- | sys/lockdoc/init_data.c | 10 | ||||
| -rw-r--r-- | sys/lockdoc/log.c | 86 |
2 files changed, 52 insertions, 44 deletions
diff --git a/sys/lockdoc/init_data.c b/sys/lockdoc/init_data.c index bce4ea7a20f..12d7b752547 100644 --- a/sys/lockdoc/init_data.c +++ b/sys/lockdoc/init_data.c @@ -1,4 +1,6 @@ #include <arch/x86/include/cpufunc.h> +#include <arch/i386/include/pio.h> + #include <sys/lwp.h> #include <sys/lockdoc.h> @@ -15,7 +17,7 @@ void lockdoc_send_current_task_addr(void) { la_buffer.action = LOCKDOC_CURRENT_TASK; la_buffer.ptr = (uint32_t)((uint32_t)curcpu()->ci_self + offsetof(struct cpu_info, ci_curlwp)); - outb_(PING_CHAR,IO_PORT_LOG); + lockdoc_outb(PING_CHAR,IO_PORT_LOG); x86_write_flags(flags); } @@ -30,7 +32,7 @@ void lockdoc_send_lwp_flag_offset(void) { la_buffer.action = LOCKDOC_LWP_FLAG_OFFSET; la_buffer.ptr = offsetof(struct lwp, l_pflag); - outb_(PING_CHAR,IO_PORT_LOG); + lockdoc_outb(PING_CHAR,IO_PORT_LOG); x86_write_flags(flags); } @@ -45,7 +47,7 @@ void lockdoc_send_pid_offset(void) { la_buffer.action = LOCKDOC_PID_OFFSET; la_buffer.ptr = offsetof(struct lwp, l_lid); - outb_(PING_CHAR,IO_PORT_LOG); + lockdoc_outb(PING_CHAR,IO_PORT_LOG); x86_write_flags(flags); } @@ -60,7 +62,7 @@ void lockdoc_send_kernel_version(void) { snprintf((char*)&la_buffer.type, LOG_CHAR_BUFFER_LEN, "%s", "notimplemented"); // TODO Implement la_buffer.action = LOCKDOC_KERNEL_VERSION; - outb_(PING_CHAR,IO_PORT_LOG); + lockdoc_outb(PING_CHAR,IO_PORT_LOG); x86_write_flags(flags); } diff --git a/sys/lockdoc/log.c b/sys/lockdoc/log.c index b8207e54d46..7454713a353 100644 --- a/sys/lockdoc/log.c +++ b/sys/lockdoc/log.c @@ -12,28 +12,28 @@ struct log_action la_buffer; // Mutexes are always considered write locks inline void __mutex_enter(kmutex_t * lock, const char* file, int line, const char* func) { _mutex_enter(lock); - lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, 0); } inline void __mutex_exit(kmutex_t * lock, const char* file, int line, const char* func) { - lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, 0); _mutex_exit(lock); } inline void __mutex_spin_enter(kmutex_t * lock, const char* file, int line, const char* func) { _mutex_spin_enter(lock); - lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, 0); } inline void __mutex_spin_exit(kmutex_t * lock, const char* file, int line, const char* func) { - lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, 0); _mutex_spin_exit(lock); } inline int __mutex_tryenter(kmutex_t * lock, const char* file, int line, const char* func) { int enter = _mutex_tryenter(lock); if(enter != 0) { - lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, 0); } return enter; } @@ -44,46 +44,42 @@ inline int __mutex_tryenter(kmutex_t * lock, const char* file, int line, const c inline int __rw_tryupgrade(krwlock_t * lock, const char* file, int line, const char* func) { int upgrade = _rw_tryupgrade(lock); if(upgrade != 0) { - lockdoc_log_lock(V_READ, lock, file, line, func, LOCK_TYPE, LOCK_NONE); - lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(V_READ, lock, file, line, func, LOCK_TYPE, 0); + lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, 0); } return upgrade; } inline void __rw_downgrade(krwlock_t * lock, const char* file, int line, const char* func) { _rw_downgrade(lock); - lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); - lockdoc_log_lock(P_READ, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, 0); + lockdoc_log_lock(P_READ, lock, file, line, func, LOCK_TYPE, 0); } inline void __rw_enter(krwlock_t * lock, const krw_t type, const char* file, int line, const char* func) { _rw_enter(lock, type); if(type == RW_READER) - lockdoc_log_lock(P_READ, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(P_READ, lock, file, line, func, LOCK_TYPE, 0); else - lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, 0); } inline int __rw_tryenter(krwlock_t * lock, const krw_t type, const char* file, int line, const char* func) { int enter = _rw_tryenter(lock, type); if(enter != 0) { if(type == RW_READER) - lockdoc_log_lock(P_READ, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(P_READ, lock, file, line, func, LOCK_TYPE, 0); else - lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(P_WRITE, lock, file, line, func, LOCK_TYPE, 0); } return enter; } inline void __rw_exit(krwlock_t * lock, const char* file, int line, const char* func) { - /* - * See sys/sys/rwlock.h - * We cannot include this directly due to circular dependencies. - */ if(rw_lock_op(lock) == RW_WRITER) - lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(V_WRITE, lock, file, line, func, LOCK_TYPE, 0); else - lockdoc_log_lock(V_READ, lock, file, line, func, LOCK_TYPE, LOCK_NONE); + lockdoc_log_lock(V_READ, lock, file, line, func, LOCK_TYPE, 0); _rw_exit(lock); } #undef LOCK_TYPE @@ -93,7 +89,7 @@ inline void __x86_disable_intr(const char* file, int line, const char* func) { eflags = x86_read_flags(); if (eflags & (1 << 9)){ // Check if interrupts were enabled in the first place - lockdoc_log_lock(P_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", LOCK_NONE); + lockdoc_log_lock(P_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", 0); } _x86_disable_intr(); @@ -104,43 +100,53 @@ inline void __x86_enable_intr(const char* file, int line, const char* func) { eflags = x86_read_flags(); if (!(eflags & (1 << 9))){ // Check if interrupts were disabled in the first place - lockdoc_log_lock(V_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", LOCK_NONE); + lockdoc_log_lock(V_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", 0); } _x86_enable_intr(); } -int32_t lockdoc_get_ctx(void) { - if (curlwp == NULL) { - return 0; - } else if (curlwp->l_pflag & LP_INTR) { - return -1; - } else { - return curlwp->l_lid; +void __trace_irqs_on(const char *file, int line) { + lockdoc_log_lock(V_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", 0); +} + +void __trace_irqs_on_check(int tf_eflags, const char *file, int line) { + u_long cur_eflags; + cur_eflags = x86_read_flags(); + if ((tf_eflags & (1 << 9)) && !(cur_eflags & (1 << 9))) { + lockdoc_log_lock(V_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", 0); } } -void __trace_irqs_on(struct trapframe *frame, const char *file, int line) { - lockdoc_log_lock(V_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", LOCK_NONE); +/* Since we cannot use the C DEFINES in interrupt handling asm routines */ +void __trace_irqs_on_asm(void) { + __trace_irqs_on("asm", 0); } -void __trace_irqs_on_check(struct trapframe *frame, const char *file, int line) { +void __trace_irqs_off(const char *file, int line) { + lockdoc_log_lock(P_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", 0); +} + +void __trace_irqs_off_check(int tf_eflags, const char *file, int line) { u_long cur_eflags; cur_eflags = x86_read_flags(); - if ((frame->tf_eflags & (1 << 9)) && !(cur_eflags & (1 << 9))) { - lockdoc_log_lock(V_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", LOCK_NONE); + if ((tf_eflags & (1 << 9)) && !(cur_eflags & (1 << 9))) { + lockdoc_log_lock(P_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", 0); } } -void __trace_irqs_off(struct trapframe *frame, const char *file, int line) { - lockdoc_log_lock(P_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", frame->tf_trapno); +/* Since we cannot use the C DEFINES in interrupt handling asm routines */ +void __trace_irqs_off_asm(void) { + __trace_irqs_off("asm", 0); } -void __trace_irqs_off_check(struct trapframe *frame, const char *file, int line) { - u_long cur_eflags; - cur_eflags = x86_read_flags(); - if ((frame->tf_eflags & (1 << 9)) && !(cur_eflags & (1 << 9))) { - lockdoc_log_lock(P_WRITE, (void *)PSEUDOLOCK_ADDR_HARDIRQ, file, line, "dummy", "dummy", frame->tf_trapno); +int32_t lockdoc_get_ctx(void) { + if (curlwp == NULL) { + return 0; + } else if (curlwp->l_pflag & LP_INTR) { + return -1; + } else { + return curlwp->l_lid; } } |
