26 |
/* |
/* |
27 |
* HISTORY |
* HISTORY |
28 |
* $Log$ |
* $Log$ |
29 |
* Revision 1.1 1992/10/06 18:31:16 mib |
* Revision 1.2 2002/05/27 02:50:10 roland |
30 |
* entered into RCS |
* 2002-05-26 Roland McGrath <roland@frob.com> |
31 |
* |
* |
32 |
|
* Changes merged from CMU MK83a version: |
33 |
|
* * cthreads.h, options.h: Various cleanups. |
34 |
|
* * call.c, cthread_data.c, sync.c, mig_support.c: Likewise. |
35 |
|
* * i386/cthreads.h, i386/thread.c, i386/lock.s: Likewise. |
36 |
|
* * cthread_internals.h: Add decls for internal functions. |
37 |
|
* (struct cproc): Use vm_offset_t for stack_base and stack_size members. |
38 |
|
* Use natural_t for context member. |
39 |
|
* * cprocs.c: Use prototypes for all defns. |
40 |
|
* * cthreads.c: Likewise. |
41 |
|
* (cthread_exit): Cast any_t to integer_t before int. |
42 |
|
* |
43 |
|
* Revision 2.6 93/05/10 17:51:38 rvb |
44 |
|
* Use C Comment |
45 |
|
* [93/05/04 18:14:05 rvb] |
46 |
|
* |
47 |
* Revision 2.5 91/05/14 17:57:20 mrt |
* Revision 2.5 91/05/14 17:57:20 mrt |
48 |
* Correcting copyright |
* Correcting copyright |
49 |
* |
* |
67 |
* boolean_t spin_try_lock(int *m) |
* boolean_t spin_try_lock(int *m) |
68 |
*/ |
*/ |
69 |
ENTRY(spin_try_lock) |
ENTRY(spin_try_lock) |
70 |
movl 4(%esp),%ecx / point at mutex |
movl 4(%esp),%ecx /* point at mutex */ |
71 |
movl $1,%eax / set locked value in acc |
movl $1,%eax /* set locked value in acc */ |
72 |
xchg %eax,(%ecx) / swap with mutex |
xchg %eax,(%ecx) /* swap with mutex */ |
73 |
/ xchg with memory is automatically |
/* xchg with memory is automatically */ |
74 |
/ locked |
/* locked */ |
75 |
xorl $1,%eax / 1 (locked) => FALSE |
xorl $1,%eax /* 1 (locked) => FALSE */ |
76 |
/ 0 (locked) => TRUE |
/* 0 (locked) => TRUE */ |
77 |
ret |
ret |
78 |
|
|
79 |
/* |
/* |
80 |
* void spin_unlock(int *m) |
* void spin_unlock(int *m) |
81 |
*/ |
*/ |
82 |
ENTRY(spin_unlock) |
ENTRY(spin_unlock) |
83 |
movl 4(%esp),%ecx / point at mutex |
movl 4(%esp),%ecx /* point at mutex */ |
84 |
xorl %eax,%eax / set unlocked value in acc |
xorl %eax,%eax /* set unlocked value in acc */ |
85 |
xchg %eax,(%ecx) / swap with mutex |
xchg %eax,(%ecx) /* swap with mutex */ |
86 |
/ xchg with memory is automatically |
/* xchg with memory is automatically */ |
87 |
/ locked |
/* locked */ |
88 |
ret |
ret |