no more PAGEBREAK
This commit is contained in:
parent
b4f89bb529
commit
a77287e924
|
@ -43,7 +43,6 @@ binit(void)
|
||||||
|
|
||||||
initlock(&bcache.lock, "bcache");
|
initlock(&bcache.lock, "bcache");
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
// Create linked list of buffers
|
// Create linked list of buffers
|
||||||
bcache.head.prev = &bcache.head;
|
bcache.head.prev = &bcache.head;
|
||||||
bcache.head.next = &bcache.head;
|
bcache.head.next = &bcache.head;
|
||||||
|
@ -140,6 +139,3 @@ brelse(struct buf *b)
|
||||||
|
|
||||||
release(&bcache.lock);
|
release(&bcache.lock);
|
||||||
}
|
}
|
||||||
//PAGEBREAK!
|
|
||||||
// Blank page.
|
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,6 @@ printptr(uint64 x) {
|
||||||
consputc(digits[x >> (sizeof(uint64) * 8 - 4)]);
|
consputc(digits[x >> (sizeof(uint64) * 8 - 4)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//PAGEBREAK: 50
|
|
||||||
|
|
||||||
// Print to the console. only understands %d, %x, %p, %s.
|
// Print to the console. only understands %d, %x, %p, %s.
|
||||||
void
|
void
|
||||||
printf(char *fmt, ...)
|
printf(char *fmt, ...)
|
||||||
|
|
|
@ -101,7 +101,6 @@ void pipeclose(struct pipe*, int);
|
||||||
int piperead(struct pipe*, uint64, int);
|
int piperead(struct pipe*, uint64, int);
|
||||||
int pipewrite(struct pipe*, uint64, int);
|
int pipewrite(struct pipe*, uint64, int);
|
||||||
|
|
||||||
//PAGEBREAK: 16
|
|
||||||
// proc.c
|
// proc.c
|
||||||
int cpuid(void);
|
int cpuid(void);
|
||||||
void exit(void);
|
void exit(void);
|
||||||
|
|
|
@ -127,7 +127,6 @@ fileread(struct file *f, uint64 addr, int n)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
// Write to file f.
|
// Write to file f.
|
||||||
// addr is a user virtual address.
|
// addr is a user virtual address.
|
||||||
int
|
int
|
||||||
|
|
|
@ -186,7 +186,6 @@ iinit(int dev)
|
||||||
|
|
||||||
static struct inode* iget(uint dev, uint inum);
|
static struct inode* iget(uint dev, uint inum);
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
// Allocate an inode on device dev.
|
// Allocate an inode on device dev.
|
||||||
// Mark it as allocated by giving it type type.
|
// Mark it as allocated by giving it type type.
|
||||||
// Returns an unlocked but allocated and referenced inode.
|
// Returns an unlocked but allocated and referenced inode.
|
||||||
|
@ -363,7 +362,6 @@ iunlockput(struct inode *ip)
|
||||||
iput(ip);
|
iput(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
// Inode content
|
// Inode content
|
||||||
//
|
//
|
||||||
// The content (data) associated with each inode is stored
|
// The content (data) associated with each inode is stored
|
||||||
|
@ -450,7 +448,6 @@ stati(struct inode *ip, struct stat *st)
|
||||||
st->size = ip->size;
|
st->size = ip->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
// Read data from inode.
|
// Read data from inode.
|
||||||
// Caller must hold ip->lock.
|
// Caller must hold ip->lock.
|
||||||
// If user_dst==1, then dst is a user virtual address;
|
// If user_dst==1, then dst is a user virtual address;
|
||||||
|
@ -476,7 +473,6 @@ readi(struct inode *ip, int user_dst, uint64 dst, uint off, uint n)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PAGEBREAK!
|
|
||||||
// Write data to inode.
|
// Write data to inode.
|
||||||
// Caller must hold ip->lock.
|
// Caller must hold ip->lock.
|
||||||
// If user_src==1, then src is a user virtual address;
|
// If user_src==1, then src is a user virtual address;
|
||||||
|
@ -508,7 +504,6 @@ writei(struct inode *ip, int user_src, uint64 src, uint off, uint n)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
// Directories
|
// Directories
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -575,7 +570,6 @@ dirlink(struct inode *dp, char *name, uint inum)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
// Paths
|
// Paths
|
||||||
|
|
||||||
// Copy the next path element from path into name.
|
// Copy the next path element from path into name.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Physical memory allocator, intended to allocate
|
// Physical memory allocator, intended to allocate
|
||||||
// memory for user processes, kernel stacks, page table pages,
|
// memory for user processes, kernel stacks, page-table pages,
|
||||||
// and pipe buffers. Allocates 4096-byte pages.
|
// and pipe buffers. Allocates 4096-byte pages.
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
@ -39,7 +39,7 @@ freerange(void *pa_start, void *pa_end)
|
||||||
for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE)
|
for(; p + PGSIZE <= (char*)pa_end; p += PGSIZE)
|
||||||
kfree(p);
|
kfree(p);
|
||||||
}
|
}
|
||||||
//PAGEBREAK: 21
|
|
||||||
// Free the page of physical memory pointed at by v,
|
// Free the page of physical memory pointed at by v,
|
||||||
// which normally should have been returned by a
|
// which normally should have been returned by a
|
||||||
// call to kalloc(). (The exception is when
|
// call to kalloc(). (The exception is when
|
||||||
|
|
|
@ -45,7 +45,6 @@ pipealloc(struct file **f0, struct file **f1)
|
||||||
(*f1)->pipe = pi;
|
(*f1)->pipe = pi;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
//PAGEBREAK: 20
|
|
||||||
bad:
|
bad:
|
||||||
if(pi)
|
if(pi)
|
||||||
kfree((char*)pi);
|
kfree((char*)pi);
|
||||||
|
@ -74,7 +73,6 @@ pipeclose(struct pipe *pi, int writable)
|
||||||
release(&pi->lock);
|
release(&pi->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK: 40
|
|
||||||
int
|
int
|
||||||
pipewrite(struct pipe *pi, uint64 addr, int n)
|
pipewrite(struct pipe *pi, uint64 addr, int n)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,6 @@ allocpid() {
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK: 32
|
|
||||||
// Look in the process table for an UNUSED proc.
|
// Look in the process table for an UNUSED proc.
|
||||||
// If found, initialize state required to run in the kernel,
|
// If found, initialize state required to run in the kernel,
|
||||||
// and return with p->lock held.
|
// and return with p->lock held.
|
||||||
|
@ -192,7 +191,6 @@ uchar initcode[] = {
|
||||||
0x00, 0x00, 0x00
|
0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
//PAGEBREAK: 32
|
|
||||||
// Set up first user process.
|
// Set up first user process.
|
||||||
void
|
void
|
||||||
userinit(void)
|
userinit(void)
|
||||||
|
@ -405,7 +403,6 @@ wait(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK: 42
|
|
||||||
// Per-CPU process scheduler.
|
// Per-CPU process scheduler.
|
||||||
// Each CPU calls scheduler() after setting itself up.
|
// Each CPU calls scheduler() after setting itself up.
|
||||||
// Scheduler never returns. It loops, doing:
|
// Scheduler never returns. It loops, doing:
|
||||||
|
|
|
@ -28,8 +28,6 @@ struct cpu {
|
||||||
|
|
||||||
extern struct cpu cpus[NCPU];
|
extern struct cpu cpus[NCPU];
|
||||||
|
|
||||||
//PAGEBREAK: 17
|
|
||||||
|
|
||||||
// per-process data for the trap handling code in trampoline.S.
|
// per-process data for the trap handling code in trampoline.S.
|
||||||
// sits in a page by itself just under the trampoline page in the
|
// sits in a page by itself just under the trampoline page in the
|
||||||
// user page table. not specially mapped in the kernel page table.
|
// user page table. not specially mapped in the kernel page table.
|
||||||
|
|
|
@ -181,7 +181,6 @@ isdirempty(struct inode *dp)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//PAGEBREAK!
|
|
||||||
uint64
|
uint64
|
||||||
sys_unlink(void)
|
sys_unlink(void)
|
||||||
{
|
{
|
||||||
|
|
10
kernel/vm.c
10
kernel/vm.c
|
@ -60,10 +60,10 @@ kvminithart()
|
||||||
|
|
||||||
// Return the address of the PTE in page table pagetable
|
// Return the address of the PTE in page table pagetable
|
||||||
// that corresponds to virtual address va. If alloc!=0,
|
// that corresponds to virtual address va. If alloc!=0,
|
||||||
// create any required page table pages.
|
// create any required page-table pages.
|
||||||
//
|
//
|
||||||
// The risc-v Sv39 scheme has three levels of page table
|
// The risc-v Sv39 scheme has three levels of page-table
|
||||||
// pages. A page table page contains 512 64-bit PTEs.
|
// pages. A page-table page contains 512 64-bit PTEs.
|
||||||
// A 64-bit virtual address is split into five fields:
|
// A 64-bit virtual address is split into five fields:
|
||||||
// 39..63 -- must be zero.
|
// 39..63 -- must be zero.
|
||||||
// 30..38 -- 9 bits of level-2 index.
|
// 30..38 -- 9 bits of level-2 index.
|
||||||
|
@ -249,7 +249,7 @@ uvmdealloc(pagetable_t pagetable, uint64 oldsz, uint64 newsz)
|
||||||
return newsz;
|
return newsz;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursively free page table pages.
|
// Recursively free page-table pages.
|
||||||
// All leaf mappings must already have been removed.
|
// All leaf mappings must already have been removed.
|
||||||
static void
|
static void
|
||||||
freewalk(pagetable_t pagetable)
|
freewalk(pagetable_t pagetable)
|
||||||
|
@ -270,7 +270,7 @@ freewalk(pagetable_t pagetable)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free user memory pages,
|
// Free user memory pages,
|
||||||
// then free page table pages.
|
// then free page-table pages.
|
||||||
void
|
void
|
||||||
uvmfree(pagetable_t pagetable, uint64 sz)
|
uvmfree(pagetable_t pagetable, uint64 sz)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue