xv6-simplified 0.1
简化版xv6
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
kalloc.c File Reference

申请物理页面(allocator)以及释放 More...

#include "include/types.h"
#include "include/riscv.h"
#include "include/defs.h"
#include "include/memlayout.h"
Include dependency graph for kalloc.c:

Data Structures

struct  run
 

Functions

void freerange (void *pa_start, void *pa_end)
 释放从pa_start到pa_end范围内的内存
 
void * kalloc (void)
 申请一个4096-byte的页表的物理内存
 
void kfree (void *pa)
 释放内存,通常释放kalloc申请到的内存,初始化kinit时除外
 
void kinit ()
 初始化内存分配
 

Variables

char end []
 
struct { 
 
   struct run *   freelist 
 
kmem 
 

Detailed Description

申请物理页面(allocator)以及释放

Date
23.04.26
Author
xin
Version
0.1 @status Stable

Function Documentation

◆ freerange()

void freerange ( void *  pa_start,
void *  pa_end 
)

释放从pa_start到pa_end范围内的内存

Parameters
pa_start地址开始处
pa_end地址结尾处
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kalloc()

void * kalloc ( void  )

申请一个4096-byte的页表的物理内存

Returns
指向申请到的页表的指针,若申请失败返回0
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kfree()

void kfree ( void *  pa)

释放内存,通常释放kalloc申请到的内存,初始化kinit时除外

Parameters
pa指向待释放内存的指针
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kinit()

void kinit ( void  )

初始化内存分配

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ end

char end[]
extern

◆ freelist

struct run* freelist

◆ [struct]

struct { ... } kmem