diff options
-rw-r--r-- | ddb/db_sym.h | 8 | ||||
-rw-r--r-- | i386/i386/lock.h | 6 | ||||
-rw-r--r-- | kern/lock.c | 4 | ||||
-rw-r--r-- | kern/lock.h | 5 | ||||
-rw-r--r-- | kern/lock_mon.c | 8 | ||||
-rw-r--r-- | kern/thread.h | 4 |
6 files changed, 24 insertions, 11 deletions
diff --git a/ddb/db_sym.h b/ddb/db_sym.h index 20450f64..f4fb5284 100644 --- a/ddb/db_sym.h +++ b/ddb/db_sym.h @@ -116,6 +116,10 @@ extern void db_symbol_values( db_symtab_t *stab, char** namep, db_expr_t* valuep); +/* find symbol in current task */ +#define db_search_symbol(val,strgy,offp) \ + db_search_task_symbol(val,strgy,offp,0) + /* find name&value given approx val */ #define db_find_sym_and_offset(val,namep,offp) \ @@ -157,10 +161,6 @@ extern void db_symbol_values( db_symtab_t *stab, db_free_symbol(s); \ } while(0); -/* find symbol in current task */ -#define db_search_symbol(val,strgy,offp) \ - db_search_task_symbol(val,strgy,offp,0) - /* strcmp, modulo leading char */ extern boolean_t db_eqname( const char* src, const char* dst, char c ); diff --git a/i386/i386/lock.h b/i386/i386/lock.h index b189a559..56370440 100644 --- a/i386/i386/lock.h +++ b/i386/i386/lock.h @@ -59,7 +59,7 @@ #define SIMPLE_LOCK_INITIALIZER(l) \ {.lock_data = 0} -#define simple_lock(l) \ +#define _simple_lock(l) \ ({ \ while(_simple_lock_xchg_(l, 1)) \ while (*(volatile int *)&(l)->lock_data) \ @@ -67,10 +67,10 @@ 0; \ }) -#define simple_unlock(l) \ +#define _simple_unlock(l) \ (_simple_lock_xchg_(l, 0)) -#define simple_lock_try(l) \ +#define _simple_lock_try(l) \ (!_simple_lock_xchg_(l, 1)) /* diff --git a/kern/lock.c b/kern/lock.c index 81c6a129..f076c328 100644 --- a/kern/lock.c +++ b/kern/lock.c @@ -673,7 +673,11 @@ void db_show_all_slocks(void) #else /* MACH_SLOCKS && NCPUS == 1 */ void db_show_all_slocks(void) { +#if MACH_LOCK_MON + lip(); +#else db_printf("simple lock info not available\n"); +#endif } #endif /* MACH_SLOCKS && NCPUS == 1 */ #endif /* MACH_KDB */ diff --git a/kern/lock.h b/kern/lock.h index 4fcbe8ab..48976196 100644 --- a/kern/lock.h +++ b/kern/lock.h @@ -39,6 +39,11 @@ #if NCPUS > 1 #include <machine/lock.h>/*XXX*/ +#if MACH_LOCK_MON == 0 +#define simple_lock _simple_lock +#define simple_lock_try _simple_lock_try +#define simple_unlock _simple_unlock +#endif #endif #define MACH_SLOCKS ((NCPUS > 1) || MACH_LDEBUG) diff --git a/kern/lock_mon.c b/kern/lock_mon.c index a963ec05..bb446b7a 100644 --- a/kern/lock_mon.c +++ b/kern/lock_mon.c @@ -45,7 +45,8 @@ #include <mach/boolean.h> #include <kern/thread.h> #include <kern/lock.h> - +#include <machine/ipl.h> +#include <ddb/db_sym.h> def_simple_lock_data(extern , kdb_lock) def_simple_lock_data(extern , printf_lock) @@ -93,7 +94,6 @@ decl_simple_lock_data(, **lock) { struct lock_info *li = &(lock_info[HASH_LOCK(*lock)].info[0]); int i; - my_cpu = cpu_number(); for (i=0; i < LOCK_INFO_PER_BUCKET; i++, li++) if (li->lock) { @@ -114,7 +114,7 @@ void simple_lock(lock) decl_simple_lock_data(, *lock) { struct lock_info *li = locate_lock_info(&lock); - my_cpu = cpu_number(); + int my_cpu = cpu_number(); if (current_thread()) li->stack = current_thread()->lock_stack++; @@ -133,7 +133,7 @@ int simple_lock_try(lock) decl_simple_lock_data(, *lock) { struct lock_info *li = locate_lock_info(&lock); - my_cpu = cpu_number(); + int my_cpu = cpu_number(); if (curr_ipl[my_cpu]) li->masked++; diff --git a/kern/thread.h b/kern/thread.h index a5abefcc..f8232d1a 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -229,6 +229,10 @@ struct thread { #if NCPUS > 1 processor_t last_processor; /* processor this last ran on */ #endif /* NCPUS > 1 */ + +#if MACH_LOCK_MON + int lock_stack; +#endif }; /* typedef of thread_t is in kern/kern_types.h */ |