diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-03-19 21:10:57 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1996-03-19 21:10:57 +0000 |
commit | 169c29d1b708c51bbae3f546e0adfe0d433b5b7b (patch) | |
tree | 15b32c155eb85259ca3be610962de5f8aa24b91c /sys/vm | |
parent | 7aa5f12551d2fef2475152a3a5c9b9961e14b83a (diff) |
Merging w/ NetBSD 021796.
speaker upgraded to the current.
some changes to the VM stuff (ie kern_thread.c added and so).
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/kern_lock.c | 27 | ||||
-rw-r--r-- | sys/vm/lock.h | 4 | ||||
-rw-r--r-- | sys/vm/vm_glue.c | 58 | ||||
-rw-r--r-- | sys/vm/vm_param.h | 7 |
4 files changed, 17 insertions, 79 deletions
diff --git a/sys/vm/kern_lock.c b/sys/vm/kern_lock.c index 91cab2f4543..f81ca2d4641 100644 --- a/sys/vm/kern_lock.c +++ b/sys/vm/kern_lock.c @@ -70,15 +70,10 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/proc.h> #include <vm/vm.h> -/* XXX */ -#include <sys/proc.h> -typedef void *thread_t; -#define current_thread() ((thread_t)&curproc->p_thread) -/* XXX */ - #if NCPUS > 1 /* @@ -170,7 +165,7 @@ void lock_init(l, can_sleep) l->want_upgrade = FALSE; l->read_count = 0; l->can_sleep = can_sleep; - l->thread = (char *)-1; /* XXX */ + l->thread = (thread_t)-1; /* XXX */ l->recursion_depth = 0; } @@ -197,7 +192,7 @@ void lock_write(l) simple_lock(&l->interlock); - if (((thread_t)l->thread) == current_thread()) { + if (l->thread == (thread_t)¤t_thread()) { /* * Recursive lock. */ @@ -275,7 +270,7 @@ void lock_read(l) simple_lock(&l->interlock); - if (((thread_t)l->thread) == current_thread()) { + if (l->thread == (thread_t)¤t_thread()) { /* * Recursive lock. */ @@ -322,7 +317,7 @@ boolean_t lock_read_to_write(l) l->read_count--; - if (((thread_t)l->thread) == current_thread()) { + if (l->thread == (thread_t)¤t_thread()) { /* * Recursive lock. */ @@ -404,7 +399,7 @@ boolean_t lock_try_write(l) simple_lock(&l->interlock); - if (((thread_t)l->thread) == current_thread()) { + if (l->thread == (thread_t)¤t_thread()) { /* * Recursive lock */ @@ -443,7 +438,7 @@ boolean_t lock_try_read(l) { simple_lock(&l->interlock); - if (((thread_t)l->thread) == current_thread()) { + if (l->thread == (thread_t)¤t_thread()) { /* * Recursive lock */ @@ -478,7 +473,7 @@ boolean_t lock_try_read_to_write(l) simple_lock(&l->interlock); - if (((thread_t)l->thread) == current_thread()) { + if (l->thread == (thread_t)¤t_thread()) { /* * Recursive lock */ @@ -516,7 +511,7 @@ void lock_set_recursive(l) if (!l->want_write) { panic("lock_set_recursive: don't have write lock"); } - l->thread = (char *) current_thread(); + l->thread = (thread_t)¤t_thread(); simple_unlock(&l->interlock); } @@ -527,10 +522,10 @@ void lock_clear_recursive(l) lock_t l; { simple_lock(&l->interlock); - if (((thread_t) l->thread) != current_thread()) { + if (l->thread != (thread_t)¤t_thread()) { panic("lock_clear_recursive: wrong thread"); } if (l->recursion_depth == 0) - l->thread = (char *)-1; /* XXX */ + l->thread = (thread_t)-1; /* XXX */ simple_unlock(&l->interlock); } diff --git a/sys/vm/lock.h b/sys/vm/lock.h index 1157b83f356..a2a518c8ebb 100644 --- a/sys/vm/lock.h +++ b/sys/vm/lock.h @@ -78,7 +78,7 @@ */ struct slock { - int lock_data; /* in general 1 bit is sufficient */ + boolean_t lock_data; /* in general 1 bit is sufficient */ }; typedef struct slock simple_lock_data_t; @@ -131,7 +131,7 @@ struct lock { int read_count; /* Number of accepted readers */ #endif /* ns32000 */ #endif /* vax */ - void *thread; /* Thread that has lock, if recursive locking allowed */ + struct thread *thread; /* Thread that has lock, if recursive locking allowed */ /* (should be thread_t, but but we then have mutually recursive definitions) */ int recursion_depth;/* Depth of recursion */ diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index cd7e32e2838..19fbbf5f62e 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_glue.c,v 1.9 1996/03/03 17:45:29 niklas Exp $ */ +/* $OpenBSD: vm_glue.c,v 1.10 1996/03/19 21:10:55 mickey Exp $ */ /* $NetBSD: vm_glue.c,v 1.52 1996/02/12 21:51:59 christos Exp $ */ /* @@ -548,61 +548,9 @@ swapout(p) } /* - * The rest of these routines fake thread handling - */ - -void -assert_wait(event, ruptible) - void *event; - boolean_t ruptible; -{ -#ifdef lint - ruptible++; -#endif - curproc->p_thread = event; -} - -void -thread_block() -{ - int s = splhigh(); - - if (curproc->p_thread) - tsleep(curproc->p_thread, PVM, "thrd_block", 0); - splx(s); -} - -void -thread_sleep(event, lock, ruptible) - void *event; - simple_lock_t lock; - boolean_t ruptible; -{ - int s = splhigh(); - -#ifdef lint - ruptible++; -#endif - curproc->p_thread = event; - simple_unlock(lock); - if (curproc->p_thread) - tsleep(event, PVM, "thrd_sleep", 0); - splx(s); -} - -void -thread_wakeup(event) - void *event; -{ - int s = splhigh(); - - wakeup(event); - splx(s); -} - -/* * DEBUG stuff */ +#ifdef DEBUG int indent = 0; @@ -630,3 +578,5 @@ iprintf(pr, fmt /* , va_alist */) (*pr)("%r", fmt, ap); va_end(ap); } +#endif + diff --git a/sys/vm/vm_param.h b/sys/vm/vm_param.h index 4f63abc747a..572281a2c3e 100644 --- a/sys/vm/vm_param.h +++ b/sys/vm/vm_param.h @@ -74,13 +74,6 @@ #include <machine/vmparam.h> /* - * This belongs in types.h, but breaks too many existing programs. - */ -typedef int boolean_t; -#define TRUE 1 -#define FALSE 0 - -/* * The machine independent pages are refered to as PAGES. A page * is some number of hardware pages, depending on the target machine. */ |