updated alarmtest
This commit is contained in:
parent
78f863f8ae
commit
56583b1402
6 changed files with 32 additions and 25 deletions
|
@ -173,7 +173,6 @@ int copyinstr(pagetable_t, char *, uint64, uint64);
|
|||
// plic.c
|
||||
void plicinit(void);
|
||||
void plicinithart(void);
|
||||
uint64 plic_pending(void);
|
||||
int plic_claim(void);
|
||||
void plic_complete(int);
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ exec(char *path, char **argv)
|
|||
p->tf->epc = elf.entry; // initial program counter = main
|
||||
p->tf->sp = sp; // initial stack pointer
|
||||
proc_freepagetable(oldpagetable, oldsz);
|
||||
|
||||
return argc; // this ends up in a0, the first argument to main(argc, argv)
|
||||
|
||||
bad:
|
||||
|
|
|
@ -28,20 +28,6 @@ plicinithart(void)
|
|||
*(uint32*)PLIC_SPRIORITY(hart) = 0;
|
||||
}
|
||||
|
||||
// return a bitmap of which IRQs are waiting
|
||||
// to be served.
|
||||
uint64
|
||||
plic_pending(void)
|
||||
{
|
||||
uint64 mask;
|
||||
|
||||
//mask = *(uint32*)(PLIC + 0x1000);
|
||||
//mask |= (uint64)*(uint32*)(PLIC + 0x1004) << 32;
|
||||
mask = *(uint64*)PLIC_PENDING;
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
// ask the PLIC what interrupt we should serve.
|
||||
int
|
||||
plic_claim(void)
|
||||
|
|
|
@ -95,7 +95,7 @@ struct proc {
|
|||
int pid; // Process ID
|
||||
|
||||
// these are private to the process, so p->lock need not be held.
|
||||
uint64 kstack; // Bottom of kernel stack for this process
|
||||
uint64 kstack; // Virtual address of kernel stack
|
||||
uint64 sz; // Size of process memory (bytes)
|
||||
pagetable_t pagetable; // Page table
|
||||
struct trapframe *tf; // data page for trampoline.S
|
||||
|
|
|
@ -34,7 +34,8 @@ acquire(struct spinlock *lk)
|
|||
|
||||
// Tell the C compiler and the processor to not move loads or stores
|
||||
// past this point, to ensure that the critical section's memory
|
||||
// references happen after the lock is acquired.
|
||||
// references happen strictly after the lock is acquired.
|
||||
// On RISC-V, this emits a fence instruction.
|
||||
__sync_synchronize();
|
||||
|
||||
// Record info about lock acquisition for holding() and debugging.
|
||||
|
@ -52,8 +53,10 @@ release(struct spinlock *lk)
|
|||
|
||||
// Tell the C compiler and the CPU to not move loads or stores
|
||||
// past this point, to ensure that all the stores in the critical
|
||||
// section are visible to other CPUs before the lock is released.
|
||||
// On RISC-V, this turns into a fence instruction.
|
||||
// section are visible to other CPUs before the lock is released,
|
||||
// and that loads in the critical section occur strictly before
|
||||
// the lock is released.
|
||||
// On RISC-V, this emits a fence instruction.
|
||||
__sync_synchronize();
|
||||
|
||||
// Release the lock, equivalent to lk->locked = 0.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue