remove acquire1 and release1
This commit is contained in:
parent
f3d290220f
commit
679a977cb2
2
defs.h
2
defs.h
|
@ -64,8 +64,6 @@ int cpu(void);
|
||||||
struct spinlock;
|
struct spinlock;
|
||||||
void acquire(struct spinlock * lock);
|
void acquire(struct spinlock * lock);
|
||||||
void release(struct spinlock * lock);
|
void release(struct spinlock * lock);
|
||||||
void acquire1(struct spinlock * lock, struct proc *);
|
|
||||||
void release1(struct spinlock * lock, struct proc *);
|
|
||||||
|
|
||||||
// main.c
|
// main.c
|
||||||
void load_icode(struct proc *p, uint8_t *binary, unsigned size);
|
void load_icode(struct proc *p, uint8_t *binary, unsigned size);
|
||||||
|
|
20
spinlock.c
20
spinlock.c
|
@ -10,7 +10,7 @@
|
||||||
// because cprintf uses them itself.
|
// because cprintf uses them itself.
|
||||||
#define cprintf dont_use_cprintf
|
#define cprintf dont_use_cprintf
|
||||||
|
|
||||||
extern int use_console_lock;
|
extern int bootstrap;
|
||||||
|
|
||||||
int
|
int
|
||||||
getcallerpc(void *v)
|
getcallerpc(void *v)
|
||||||
|
@ -19,7 +19,7 @@ getcallerpc(void *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
acquire1(struct spinlock * lock, struct proc *cp)
|
acquire(struct spinlock * lock)
|
||||||
{
|
{
|
||||||
if(cpus[cpu()].nlock++ == 0)
|
if(cpus[cpu()].nlock++ == 0)
|
||||||
cli();
|
cli();
|
||||||
|
@ -30,23 +30,11 @@ acquire1(struct spinlock * lock, struct proc *cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
release1(struct spinlock * lock, struct proc *cp)
|
release(struct spinlock * lock)
|
||||||
{
|
{
|
||||||
cpuid(0, 0, 0, 0, 0); // memory barrier
|
cpuid(0, 0, 0, 0, 0); // memory barrier
|
||||||
lock->locked = 0;
|
lock->locked = 0;
|
||||||
if(--cpus[cpu()].nlock == 0)
|
if(--cpus[cpu()].nlock == 0 && !bootstrap)
|
||||||
sti();
|
sti();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
acquire(struct spinlock *lock)
|
|
||||||
{
|
|
||||||
acquire1(lock, curproc[cpu()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
release(struct spinlock *lock)
|
|
||||||
{
|
|
||||||
release1(lock, curproc[cpu()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue