retire PUBLIC, PRIVATE and FORWARD

This commit is contained in:
Ben Gras
2012-03-25 20:25:53 +02:00
parent 6a73e85ad1
commit 7336a67dfe
603 changed files with 5776 additions and 5779 deletions

View File

@@ -38,16 +38,16 @@
/* Free PDE slots we tell kernel about */
#define FREE_PDES 2
PRIVATE int first_free_pde = -1;
static int first_free_pde = -1;
/* PDE used to map in kernel, kernel physical address. */
PRIVATE int id_map_high_pde = -1, pagedir_pde = -1;
PRIVATE u32_t global_bit = 0, pagedir_pde_val;
static int id_map_high_pde = -1, pagedir_pde = -1;
static u32_t global_bit = 0, pagedir_pde_val;
PRIVATE int proc_pde = 0;
static int proc_pde = 0;
/* 4MB page size available in hardware? */
PRIVATE int bigpage_ok = 0;
static int bigpage_ok = 0;
/* Our process table entry. */
struct vmproc *vmprocess = &vmproc[VM_PROC_NR];
@@ -58,13 +58,13 @@ struct vmproc *vmprocess = &vmproc[VM_PROC_NR];
*/
#define SPAREPAGES 25
int missing_spares = SPAREPAGES;
PRIVATE struct {
static struct {
void *page;
phys_bytes phys;
} sparepages[SPAREPAGES];
#define MAX_KERNMAPPINGS 10
PRIVATE struct {
static struct {
phys_bytes phys_addr; /* Physical addr. */
phys_bytes len; /* Length in bytes. */
vir_bytes lin_addr; /* Offset in page table. */
@@ -95,13 +95,13 @@ u32_t *page_directories = NULL;
#define STATIC_SPAREPAGES 10
PRIVATE char static_sparepages[I386_PAGE_SIZE*STATIC_SPAREPAGES + I386_PAGE_SIZE];
static char static_sparepages[I386_PAGE_SIZE*STATIC_SPAREPAGES + I386_PAGE_SIZE];
#if SANITYCHECKS
/*===========================================================================*
* pt_sanitycheck *
*===========================================================================*/
PUBLIC void pt_sanitycheck(pt_t *pt, char *file, int line)
void pt_sanitycheck(pt_t *pt, char *file, int line)
{
/* Basic pt sanity check. */
int i;
@@ -143,7 +143,7 @@ PUBLIC void pt_sanitycheck(pt_t *pt, char *file, int line)
/*===========================================================================*
* findhole *
*===========================================================================*/
PRIVATE u32_t findhole(pt_t *pt, u32_t vmin, u32_t vmax)
static u32_t findhole(pt_t *pt, u32_t vmin, u32_t vmax)
{
/* Find a space in the virtual address space of pageteble 'pt',
* between page-aligned BYTE offsets vmin and vmax, to fit
@@ -202,7 +202,7 @@ PRIVATE u32_t findhole(pt_t *pt, u32_t vmin, u32_t vmax)
/*===========================================================================*
* vm_freepages *
*===========================================================================*/
PRIVATE void vm_freepages(vir_bytes vir, vir_bytes phys, int pages, int reason)
static void vm_freepages(vir_bytes vir, vir_bytes phys, int pages, int reason)
{
assert(reason >= 0 && reason < VMP_CATEGORIES);
if(vir >= vmprocess->vm_stacktop) {
@@ -230,7 +230,7 @@ PRIVATE void vm_freepages(vir_bytes vir, vir_bytes phys, int pages, int reason)
/*===========================================================================*
* vm_getsparepage *
*===========================================================================*/
PRIVATE void *vm_getsparepage(phys_bytes *phys)
static void *vm_getsparepage(phys_bytes *phys)
{
int s;
assert(missing_spares >= 0 && missing_spares <= SPAREPAGES);
@@ -251,7 +251,7 @@ PRIVATE void *vm_getsparepage(phys_bytes *phys)
/*===========================================================================*
* vm_checkspares *
*===========================================================================*/
PRIVATE void *vm_checkspares(void)
static void *vm_checkspares(void)
{
int s, n = 0;
static int total = 0, worst = 0;
@@ -277,7 +277,7 @@ PRIVATE void *vm_checkspares(void)
/*===========================================================================*
* vm_allocpage *
*===========================================================================*/
PUBLIC void *vm_allocpage(phys_bytes *phys, int reason)
void *vm_allocpage(phys_bytes *phys, int reason)
{
/* Allocate a page for use by VM itself. */
phys_bytes newpage;
@@ -352,7 +352,7 @@ PUBLIC void *vm_allocpage(phys_bytes *phys, int reason)
/*===========================================================================*
* vm_pagelock *
*===========================================================================*/
PUBLIC void vm_pagelock(void *vir, int lockflag)
void vm_pagelock(void *vir, int lockflag)
{
/* Mark a page allocated by vm_allocpage() unwritable, i.e. only for VM. */
vir_bytes m;
@@ -384,7 +384,7 @@ PUBLIC void vm_pagelock(void *vir, int lockflag)
/*===========================================================================*
* vm_addrok *
*===========================================================================*/
PUBLIC int vm_addrok(void *vir, int writeflag)
int vm_addrok(void *vir, int writeflag)
{
/* Mark a page allocated by vm_allocpage() unwritable, i.e. only for VM. */
pt_t *pt = &vmprocess->vm_pt;
@@ -429,7 +429,7 @@ PUBLIC int vm_addrok(void *vir, int writeflag)
/*===========================================================================*
* pt_ptalloc *
*===========================================================================*/
PRIVATE int pt_ptalloc(pt_t *pt, int pde, u32_t flags)
static int pt_ptalloc(pt_t *pt, int pde, u32_t flags)
{
/* Allocate a page table and write its address into the page directory. */
int i;
@@ -465,7 +465,7 @@ PRIVATE int pt_ptalloc(pt_t *pt, int pde, u32_t flags)
/*===========================================================================*
* pt_ptalloc_in_range *
*===========================================================================*/
PUBLIC int pt_ptalloc_in_range(pt_t *pt, vir_bytes start, vir_bytes end,
int pt_ptalloc_in_range(pt_t *pt, vir_bytes start, vir_bytes end,
u32_t flags, int verify)
{
/* Allocate all the page tables in the range specified. */
@@ -504,7 +504,7 @@ PUBLIC int pt_ptalloc_in_range(pt_t *pt, vir_bytes start, vir_bytes end,
return OK;
}
PRIVATE char *ptestr(u32_t pte)
static char *ptestr(u32_t pte)
{
#define FLAG(constant, name) { \
if(pte & (constant)) { strcat(str, name); strcat(str, " "); } \
@@ -533,7 +533,7 @@ PRIVATE char *ptestr(u32_t pte)
/*===========================================================================*
* pt_map_in_range *
*===========================================================================*/
PUBLIC int pt_map_in_range(struct vmproc *src_vmp, struct vmproc *dst_vmp,
int pt_map_in_range(struct vmproc *src_vmp, struct vmproc *dst_vmp,
vir_bytes start, vir_bytes end)
{
/* Transfer all the mappings from the pt of the source process to the pt of
@@ -585,7 +585,7 @@ PUBLIC int pt_map_in_range(struct vmproc *src_vmp, struct vmproc *dst_vmp,
/*===========================================================================*
* pt_ptmap *
*===========================================================================*/
PUBLIC int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
{
/* Transfer mappings to page dir and page tables from source process and
* destination process. Make sure all the mappings are above the stack, not
@@ -642,7 +642,7 @@ PUBLIC int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
return OK;
}
PUBLIC void pt_clearmapcache(void)
void pt_clearmapcache(void)
{
int f;
/* Make sure kernel will invalidate tlb when using current
@@ -657,7 +657,7 @@ PUBLIC void pt_clearmapcache(void)
/*===========================================================================*
* pt_writemap *
*===========================================================================*/
PUBLIC int pt_writemap(struct vmproc * vmp,
int pt_writemap(struct vmproc * vmp,
pt_t *pt,
vir_bytes v,
phys_bytes physaddr,
@@ -796,7 +796,7 @@ resume_exit:
/*===========================================================================*
* pt_checkrange *
*===========================================================================*/
PUBLIC int pt_checkrange(pt_t *pt, vir_bytes v, size_t bytes,
int pt_checkrange(pt_t *pt, vir_bytes v, size_t bytes,
int write)
{
int p, pages;
@@ -839,7 +839,7 @@ PUBLIC int pt_checkrange(pt_t *pt, vir_bytes v, size_t bytes,
/*===========================================================================*
* pt_new *
*===========================================================================*/
PUBLIC int pt_new(pt_t *pt)
int pt_new(pt_t *pt)
{
/* Allocate a pagetable root. On i386, allocate a page-aligned page directory
* and set them to 0 (indicating no page tables are allocated). Lookup
@@ -877,7 +877,7 @@ PUBLIC int pt_new(pt_t *pt)
/*===========================================================================*
* pt_init *
*===========================================================================*/
PUBLIC void pt_init(phys_bytes usedlimit)
void pt_init(phys_bytes usedlimit)
{
/* By default, the kernel gives us a data segment with pre-allocated
* memory that then can't grow. We want to be able to allocate memory
@@ -1091,7 +1091,7 @@ PUBLIC void pt_init(phys_bytes usedlimit)
/*===========================================================================*
* pt_init_mem *
*===========================================================================*/
PUBLIC void pt_init_mem()
void pt_init_mem()
{
/* Architecture-specific memory initialization. Make sure all the pages
* shared with the kernel and VM's page tables are mapped above the stack,
@@ -1173,7 +1173,7 @@ PUBLIC void pt_init_mem()
/*===========================================================================*
* pt_bind *
*===========================================================================*/
PUBLIC int pt_bind(pt_t *pt, struct vmproc *who)
int pt_bind(pt_t *pt, struct vmproc *who)
{
int slot;
u32_t phys;
@@ -1217,7 +1217,7 @@ PUBLIC int pt_bind(pt_t *pt, struct vmproc *who)
/*===========================================================================*
* pt_free *
*===========================================================================*/
PUBLIC void pt_free(pt_t *pt)
void pt_free(pt_t *pt)
{
/* Free memory associated with this pagetable. */
int i;
@@ -1233,7 +1233,7 @@ PUBLIC void pt_free(pt_t *pt)
/*===========================================================================*
* pt_mapkernel *
*===========================================================================*/
PUBLIC int pt_mapkernel(pt_t *pt)
int pt_mapkernel(pt_t *pt)
{
int i;
@@ -1275,7 +1275,7 @@ PUBLIC int pt_mapkernel(pt_t *pt)
/*===========================================================================*
* pt_cycle *
*===========================================================================*/
PUBLIC void pt_cycle(void)
void pt_cycle(void)
{
vm_checkspares();
}

View File

@@ -30,7 +30,7 @@
/*===========================================================================*
* arch_map2vir *
*===========================================================================*/
PUBLIC vir_bytes arch_map2vir(struct vmproc *vmp, vir_bytes addr)
vir_bytes arch_map2vir(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
vir_bytes datastart = CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys);
@@ -46,7 +46,7 @@ PUBLIC vir_bytes arch_map2vir(struct vmproc *vmp, vir_bytes addr)
/*===========================================================================*
* arch_map2str *
*===========================================================================*/
PUBLIC char *arch_map2str(struct vmproc *vmp, vir_bytes addr)
char *arch_map2str(struct vmproc *vmp, vir_bytes addr)
{
static char bufstr[100];
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
@@ -70,7 +70,7 @@ PUBLIC char *arch_map2str(struct vmproc *vmp, vir_bytes addr)
/*===========================================================================*
* arch_map2info *
*===========================================================================*/
PUBLIC vir_bytes arch_map2info(struct vmproc *vmp, vir_bytes addr, int *seg,
vir_bytes arch_map2info(struct vmproc *vmp, vir_bytes addr, int *seg,
int *prot)
{
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
@@ -104,7 +104,7 @@ PUBLIC vir_bytes arch_map2info(struct vmproc *vmp, vir_bytes addr, int *seg,
/*===========================================================================*
* arch_addrok *
*===========================================================================*/
PUBLIC vir_bytes arch_addrok(struct vmproc *vmp, vir_bytes addr)
vir_bytes arch_addrok(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes textstart = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys);
vir_bytes textend = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys +
@@ -123,7 +123,7 @@ PUBLIC vir_bytes arch_addrok(struct vmproc *vmp, vir_bytes addr)
/*===========================================================================*
* arch_vir2map *
*===========================================================================*/
PUBLIC vir_bytes arch_vir2map(struct vmproc *vmp, vir_bytes addr)
vir_bytes arch_vir2map(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes datasegbase = CLICK2ABS(vmp->vm_arch.vm_seg[D].mem_phys -
vmp->vm_arch.vm_seg[D].mem_vir);
@@ -134,7 +134,7 @@ PUBLIC vir_bytes arch_vir2map(struct vmproc *vmp, vir_bytes addr)
/*===========================================================================*
* arch_vir2map_text *
*===========================================================================*/
PUBLIC vir_bytes arch_vir2map_text(struct vmproc *vmp, vir_bytes addr)
vir_bytes arch_vir2map_text(struct vmproc *vmp, vir_bytes addr)
{
vir_bytes textsegbase = CLICK2ABS(vmp->vm_arch.vm_seg[T].mem_phys -
vmp->vm_arch.vm_seg[T].mem_vir);