-MD and TRAPFRAME
This commit is contained in:
parent
5eab649255
commit
6b379e4707
5 changed files with 18 additions and 13 deletions
|
@ -53,4 +53,15 @@
|
|||
// map the trampoline page to the highest address,
|
||||
// in both user and kernel space.
|
||||
#define TRAMPOLINE (MAXVA - PGSIZE)
|
||||
#define KSTACK(p) (TRAMPOLINE - (p+1)* 2*PGSIZE)
|
||||
#define KSTACK(p) (TRAMPOLINE - ((p)+1)* 2*PGSIZE)
|
||||
|
||||
// User memory layout.
|
||||
// Address zero first:
|
||||
// text
|
||||
// original data and bss
|
||||
// fixed-size stack
|
||||
// expandable heap
|
||||
// ...
|
||||
// TRAPFRAME (p->tf, used by the trampoline)
|
||||
// TRAMPOLINE (the same page as in the kernel)
|
||||
#define TRAPFRAME (TRAMPOLINE - PGSIZE)
|
||||
|
|
|
@ -156,8 +156,8 @@ proc_pagetable(struct proc *p)
|
|||
mappages(pagetable, TRAMPOLINE, PGSIZE,
|
||||
(uint64)trampout, PTE_R | PTE_X);
|
||||
|
||||
// map the trapframe, for trampoline.S.
|
||||
mappages(pagetable, (TRAMPOLINE - PGSIZE), PGSIZE,
|
||||
// map the trapframe just below TRAMPOLINE, for trampoline.S.
|
||||
mappages(pagetable, TRAPFRAME, PGSIZE,
|
||||
(uint64)(p->tf), PTE_R | PTE_W);
|
||||
|
||||
return pagetable;
|
||||
|
@ -169,7 +169,7 @@ void
|
|||
proc_freepagetable(pagetable_t pagetable, uint64 sz)
|
||||
{
|
||||
unmappages(pagetable, TRAMPOLINE, PGSIZE, 0);
|
||||
unmappages(pagetable, TRAMPOLINE-PGSIZE, PGSIZE, 0);
|
||||
unmappages(pagetable, TRAPFRAME, PGSIZE, 0);
|
||||
if(sz > 0)
|
||||
uvmfree(pagetable, sz);
|
||||
}
|
||||
|
|
|
@ -105,9 +105,3 @@ struct proc {
|
|||
struct inode *cwd; // Current directory
|
||||
char name[16]; // Process name (debugging)
|
||||
};
|
||||
|
||||
// Process memory is laid out contiguously, low addresses first:
|
||||
// text
|
||||
// original data and bss
|
||||
// fixed-size stack
|
||||
// expandable heap
|
||||
|
|
|
@ -75,7 +75,7 @@ trampin:
|
|||
# user page table.
|
||||
#
|
||||
# sscratch points to where the process's p->tf is
|
||||
# mapped into user space (TRAMPOLINE - 4096).
|
||||
# mapped into user space, at TRAPFRAME.
|
||||
#
|
||||
|
||||
# swap a0 and sscratch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue