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

@@ -47,7 +47,7 @@
addr_avl addravl;
/* Used for sanity check. */
PRIVATE phys_bytes mem_low, mem_high;
static phys_bytes mem_low, mem_high;
struct hole {
struct hole *h_next; /* pointer to next entry on the list */
@@ -60,24 +60,24 @@ struct hole {
#define _NR_HOLES (_NR_PROCS*2) /* No. of memory holes maintained by VM */
PRIVATE struct hole hole[_NR_HOLES];
static struct hole hole[_NR_HOLES];
PRIVATE struct hole *hole_head; /* pointer to first hole */
PRIVATE struct hole *free_slots;/* ptr to list of unused table slots */
static struct hole *hole_head; /* pointer to first hole */
static struct hole *free_slots;/* ptr to list of unused table slots */
FORWARD void del_slot(struct hole *prev_ptr, struct hole *hp);
FORWARD void merge(struct hole *hp);
FORWARD void free_pages(phys_bytes addr, int pages);
FORWARD phys_bytes alloc_pages(int pages, int flags, phys_bytes *ret);
static void del_slot(struct hole *prev_ptr, struct hole *hp);
static void merge(struct hole *hp);
static void free_pages(phys_bytes addr, int pages);
static phys_bytes alloc_pages(int pages, int flags, phys_bytes *ret);
#if SANITYCHECKS
FORWARD void holes_sanity_f(char *fn, int line);
static void holes_sanity_f(char *fn, int line);
#define CHECKHOLES holes_sanity_f(__FILE__, __LINE__)
#define PAGESPERGB (1024*1024*1024/VM_PAGE_SIZE) /* 1GB of memory */
#define MAXPAGES (2*PAGESPERGB)
#define CHUNKS BITMAP_CHUNKS(MAXPAGES)
PRIVATE bitchunk_t pagemap[CHUNKS];
static bitchunk_t pagemap[CHUNKS];
#else
#define CHECKHOLES
@@ -88,7 +88,7 @@ PRIVATE bitchunk_t pagemap[CHUNKS];
/*===========================================================================*
* holes_sanity_f *
*===========================================================================*/
PRIVATE void holes_sanity_f(file, line)
static void holes_sanity_f(file, line)
char *file;
int line;
{
@@ -158,7 +158,7 @@ int line;
/*===========================================================================*
* alloc_mem *
*===========================================================================*/
PUBLIC phys_clicks alloc_mem(phys_clicks clicks, u32_t memflags)
phys_clicks alloc_mem(phys_clicks clicks, u32_t memflags)
{
/* Allocate a block of memory from the free list using first fit. The block
* consists of a sequence of contiguous bytes, whose length in clicks is
@@ -202,7 +202,7 @@ CHECKHOLES;
/*===========================================================================*
* free_mem *
*===========================================================================*/
PUBLIC void free_mem(phys_clicks base, phys_clicks clicks)
void free_mem(phys_clicks base, phys_clicks clicks)
{
/* Return a block of free memory to the hole list. The parameters tell where
* the block starts in physical memory and how big it is. The block is added
@@ -255,7 +255,7 @@ CHECKHOLES;
/*===========================================================================*
* del_slot *
*===========================================================================*/
PRIVATE void del_slot(prev_ptr, hp)
static void del_slot(prev_ptr, hp)
/* pointer to hole entry just ahead of 'hp' */
register struct hole *prev_ptr;
/* pointer to hole entry to be removed */
@@ -279,7 +279,7 @@ register struct hole *hp;
/*===========================================================================*
* merge *
*===========================================================================*/
PRIVATE void merge(hp)
static void merge(hp)
register struct hole *hp; /* ptr to hole to merge with its successors */
{
/* Check for contiguous holes and merge any found. Contiguous holes can occur
@@ -313,7 +313,7 @@ register struct hole *hp; /* ptr to hole to merge with its successors */
/*===========================================================================*
* mem_init *
*===========================================================================*/
PUBLIC void mem_init(chunks)
void mem_init(chunks)
struct memory *chunks; /* list of free memory chunks */
{
/* Initialize hole lists. There are two lists: 'hole_head' points to a linked
@@ -358,7 +358,7 @@ struct memory *chunks; /* list of free memory chunks */
}
#if SANITYCHECKS
PRIVATE void sanitycheck(void)
static void sanitycheck(void)
{
pagerange_t *p, *prevp = NULL;
addr_iter iter;
@@ -375,7 +375,7 @@ PRIVATE void sanitycheck(void)
}
#endif
PUBLIC void memstats(int *nodes, int *pages, int *largest)
void memstats(int *nodes, int *pages, int *largest)
{
pagerange_t *p;
addr_iter iter;
@@ -399,7 +399,7 @@ PUBLIC void memstats(int *nodes, int *pages, int *largest)
/*===========================================================================*
* alloc_pages *
*===========================================================================*/
PRIVATE PUBLIC phys_bytes alloc_pages(int pages, int memflags, phys_bytes *len)
static phys_bytes alloc_pages(int pages, int memflags, phys_bytes *len)
{
addr_iter iter;
pagerange_t *pr;
@@ -525,7 +525,7 @@ PRIVATE PUBLIC phys_bytes alloc_pages(int pages, int memflags, phys_bytes *len)
/*===========================================================================*
* free_pages *
*===========================================================================*/
PRIVATE void free_pages(phys_bytes pageno, int npages)
static void free_pages(phys_bytes pageno, int npages)
{
pagerange_t *pr, *p;
addr_iter iter;
@@ -602,7 +602,7 @@ PRIVATE void free_pages(phys_bytes pageno, int npages)
#define NR_DMA 16
PRIVATE struct dmatab
static struct dmatab
{
int dt_flags;
endpoint_t dt_proc;
@@ -619,7 +619,7 @@ PRIVATE struct dmatab
/*===========================================================================*
* do_adddma *
*===========================================================================*/
PUBLIC int do_adddma(message *msg)
int do_adddma(message *msg)
{
endpoint_t target_proc_e;
int i, proc_n;
@@ -671,7 +671,7 @@ PUBLIC int do_adddma(message *msg)
/*===========================================================================*
* do_deldma *
*===========================================================================*/
PUBLIC int do_deldma(message *msg)
int do_deldma(message *msg)
{
endpoint_t target_proc_e;
int i, j;
@@ -729,7 +729,7 @@ PUBLIC int do_deldma(message *msg)
/*===========================================================================*
* do_getdma *
*===========================================================================*/
PUBLIC int do_getdma(message *msg)
int do_getdma(message *msg)
{
int i;
@@ -760,7 +760,7 @@ PUBLIC int do_getdma(message *msg)
/*===========================================================================*
* release_dma *
*===========================================================================*/
PUBLIC void release_dma(struct vmproc *vmp)
void release_dma(struct vmproc *vmp)
{
#if 0
int i, found_one;

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);

View File

@@ -44,7 +44,7 @@
/*===========================================================================*
* do_brk *
*===========================================================================*/
PUBLIC int do_brk(message *msg)
int do_brk(message *msg)
{
/* Perform the brk(addr) system call.
* The parameter, 'addr' is the new virtual address in D space.
@@ -62,7 +62,7 @@ PUBLIC int do_brk(message *msg)
/*===========================================================================*
* adjust *
*===========================================================================*/
PUBLIC int adjust(rmp, data_clicks, sp)
int adjust(rmp, data_clicks, sp)
struct vmproc *rmp; /* whose memory is being adjusted? */
vir_clicks data_clicks; /* how big is data segment to become? */
vir_bytes sp; /* new value of sp */
@@ -163,7 +163,7 @@ vir_bytes sp; /* new value of sp */
/*===========================================================================*
* real_brk *
*===========================================================================*/
PUBLIC int real_brk(vmp, v)
int real_brk(vmp, v)
struct vmproc *vmp;
vir_bytes v;
{

View File

@@ -31,14 +31,14 @@
#include "memory.h"
FORWARD int new_mem(struct vmproc *vmp, vir_bytes text_addr, vir_bytes
static int new_mem(struct vmproc *vmp, vir_bytes text_addr, vir_bytes
text_bytes, vir_bytes data_addr, vir_bytes data_bytes, vir_bytes
stk_bytes, phys_bytes tot_bytes, vir_bytes *stack_top, int is_elf);
/*===========================================================================*
* exec_newmem *
*===========================================================================*/
PUBLIC int do_exec_newmem(message *msg)
int do_exec_newmem(message *msg)
{
int r, proc_e, proc_n;
vir_bytes stack_top;
@@ -129,7 +129,7 @@ SANITYCHECK(SCL_DETAIL);
/*===========================================================================*
* new_mem *
*===========================================================================*/
PRIVATE int new_mem(
static int new_mem(
struct vmproc *rmp, /* process to get a new memory map */
vir_bytes text_addr, /* text segement load address */
vir_bytes text_bytes, /* text segment size in bytes */
@@ -256,7 +256,7 @@ SANITYCHECK(SCL_DETAIL);
/*===========================================================================*
* find_kernel_top *
*===========================================================================*/
PUBLIC phys_bytes find_kernel_top(void)
phys_bytes find_kernel_top(void)
{
/* Find out where the kernel is, so we know where to start mapping
* user processes.
@@ -276,7 +276,7 @@ PUBLIC phys_bytes find_kernel_top(void)
/*===========================================================================*
* proc_new *
*===========================================================================*/
PUBLIC int proc_new(struct vmproc *vmp,
int proc_new(struct vmproc *vmp,
phys_bytes vstart, /* where to start the process in page table */
phys_bytes text_addr, /* address at which to load code */
phys_bytes text_bytes, /* how much code, in bytes but page aligned */

View File

@@ -24,7 +24,7 @@
#include "util.h"
#include "sanitycheck.h"
PUBLIC void free_proc(struct vmproc *vmp)
void free_proc(struct vmproc *vmp)
{
map_free_proc(vmp);
if(vmp->vm_flags & VMF_HASPT) {
@@ -38,7 +38,7 @@ PUBLIC void free_proc(struct vmproc *vmp)
#endif
}
PUBLIC void clear_proc(struct vmproc *vmp)
void clear_proc(struct vmproc *vmp)
{
region_init(&vmp->vm_regions_avl);
vmp->vm_region_top = 0;
@@ -54,7 +54,7 @@ PUBLIC void clear_proc(struct vmproc *vmp)
/*===========================================================================*
* do_exit *
*===========================================================================*/
PUBLIC int do_exit(message *msg)
int do_exit(message *msg)
{
int proc;
struct vmproc *vmp;
@@ -97,7 +97,7 @@ SANITYCHECK(SCL_FUNCTIONS);
/*===========================================================================*
* do_willexit *
*===========================================================================*/
PUBLIC int do_willexit(message *msg)
int do_willexit(message *msg)
{
int proc;
struct vmproc *vmp;

View File

@@ -32,7 +32,7 @@
/*===========================================================================*
* do_fork *
*===========================================================================*/
PUBLIC int do_fork(message *msg)
int do_fork(message *msg)
{
int r, proc, childproc, fullvm;
struct vmproc *vmp, *vmc;

View File

@@ -58,18 +58,18 @@ struct {
(c) < VM_RQ_BASE + ELEMENTS(vm_calls)) ? \
((c) - VM_RQ_BASE) : -1)
FORWARD int map_service(struct rprocpub *rpub);
FORWARD int vm_acl_ok(endpoint_t caller, int call);
static int map_service(struct rprocpub *rpub);
static int vm_acl_ok(endpoint_t caller, int call);
/* SEF functions and variables. */
FORWARD void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo);
static void sef_local_startup(void);
static int sef_cb_init_fresh(int type, sef_init_info_t *info);
static void sef_cb_signal_handler(int signo);
/*===========================================================================*
* main *
*===========================================================================*/
PUBLIC int main(void)
int main(void)
{
message msg;
int result, who_e, rcv_sts;
@@ -148,7 +148,7 @@ PUBLIC int main(void)
/*===========================================================================*
* sef_local_startup *
*===========================================================================*/
PRIVATE void sef_local_startup()
static void sef_local_startup()
{
/* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -166,7 +166,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================*
* sef_cb_init_fresh *
*===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{
/* Initialize the vm server. */
int s, i;
@@ -396,7 +396,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/*===========================================================================*
* sef_cb_signal_handler *
*===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo)
static void sef_cb_signal_handler(int signo)
{
/* Check for known kernel signals, ignore anything else. */
switch(signo) {
@@ -420,7 +420,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================*
* map_service *
*===========================================================================*/
PRIVATE int map_service(rpub)
static int map_service(rpub)
struct rprocpub *rpub;
{
/* Map a new service by initializing its call mask. */
@@ -440,7 +440,7 @@ struct rprocpub *rpub;
/*===========================================================================*
* vm_acl_ok *
*===========================================================================*/
PRIVATE int vm_acl_ok(endpoint_t caller, int call)
static int vm_acl_ok(endpoint_t caller, int call)
{
int n, r;

View File

@@ -35,7 +35,7 @@
/*===========================================================================*
* do_mmap *
*===========================================================================*/
PUBLIC int do_mmap(message *m)
int do_mmap(message *m)
{
int r, n;
struct vmproc *vmp;
@@ -113,7 +113,7 @@ PUBLIC int do_mmap(message *m)
/*===========================================================================*
* map_perm_check *
*===========================================================================*/
PUBLIC int map_perm_check(endpoint_t caller, endpoint_t target,
int map_perm_check(endpoint_t caller, endpoint_t target,
phys_bytes physaddr, phys_bytes len)
{
int r;
@@ -141,7 +141,7 @@ PUBLIC int map_perm_check(endpoint_t caller, endpoint_t target,
/*===========================================================================*
* do_map_phys *
*===========================================================================*/
PUBLIC int do_map_phys(message *m)
int do_map_phys(message *m)
{
int r, n;
struct vmproc *vmp;
@@ -199,7 +199,7 @@ PUBLIC int do_map_phys(message *m)
/*===========================================================================*
* do_unmap_phys *
*===========================================================================*/
PUBLIC int do_unmap_phys(message *m)
int do_unmap_phys(message *m)
{
int r, n;
struct vmproc *vmp;
@@ -234,7 +234,7 @@ PUBLIC int do_unmap_phys(message *m)
/*===========================================================================*
* do_remap *
*===========================================================================*/
PUBLIC int do_remap(message *m)
int do_remap(message *m)
{
int dn, sn;
vir_bytes da, sa, startv;
@@ -303,7 +303,7 @@ PUBLIC int do_remap(message *m)
/*===========================================================================*
* do_shared_unmap *
*===========================================================================*/
PUBLIC int do_shared_unmap(message *m)
int do_shared_unmap(message *m)
{
int r, n;
struct vmproc *vmp;
@@ -346,7 +346,7 @@ PUBLIC int do_shared_unmap(message *m)
/*===========================================================================*
* do_get_phys *
*===========================================================================*/
PUBLIC int do_get_phys(message *m)
int do_get_phys(message *m)
{
int r, n;
struct vmproc *vmp;
@@ -372,7 +372,7 @@ PUBLIC int do_get_phys(message *m)
/*===========================================================================*
* do_get_refcount *
*===========================================================================*/
PUBLIC int do_get_refcount(message *m)
int do_get_refcount(message *m)
{
int r, n;
struct vmproc *vmp;
@@ -398,7 +398,7 @@ PUBLIC int do_get_refcount(message *m)
/*===========================================================================*
* do_munmap *
*===========================================================================*/
PUBLIC int do_munmap(message *m)
int do_munmap(message *m)
{
int r, n;
struct vmproc *vmp;
@@ -447,7 +447,7 @@ int unmap_ok = 0;
/*===========================================================================*
* munmap_lin (used for overrides for VM) *
*===========================================================================*/
PRIVATE int munmap_lin(vir_bytes addr, size_t len)
static int munmap_lin(vir_bytes addr, size_t len)
{
if(addr % VM_PAGE_SIZE) {
printf("munmap_lin: offset not page aligned\n");
@@ -471,7 +471,7 @@ PRIVATE int munmap_lin(vir_bytes addr, size_t len)
/*===========================================================================*
* munmap (override for VM) *
*===========================================================================*/
PUBLIC int minix_munmap(void *addr, size_t len)
int minix_munmap(void *addr, size_t len)
{
vir_bytes laddr;
if(!unmap_ok)
@@ -483,7 +483,7 @@ PUBLIC int minix_munmap(void *addr, size_t len)
/*===========================================================================*
* munmap_text (override for VM) *
*===========================================================================*/
PUBLIC int minix_munmap_text(void *addr, size_t len)
int minix_munmap_text(void *addr, size_t len)
{
vir_bytes laddr;
if(!unmap_ok)

View File

@@ -51,7 +51,7 @@ char *pf_errstr(u32_t err)
/*===========================================================================*
* do_pagefaults *
*===========================================================================*/
PUBLIC void do_pagefaults(message *m)
void do_pagefaults(message *m)
{
endpoint_t ep = m->m_source;
u32_t addr = m->VPF_ADDR;
@@ -118,7 +118,7 @@ PUBLIC void do_pagefaults(message *m)
/*===========================================================================*
* do_memory *
*===========================================================================*/
PUBLIC void do_memory(void)
void do_memory(void)
{
endpoint_t who, who_s, requestor;
vir_bytes mem, mem_s;

View File

@@ -36,7 +36,7 @@ static struct query_exit_struct array[NR_PROCS];
/*===========================================================================*
* do_query_exit *
*===========================================================================*/
PUBLIC int do_query_exit(message *m)
int do_query_exit(message *m)
{
int i, nr;
endpoint_t ep = NONE;
@@ -65,7 +65,7 @@ PUBLIC int do_query_exit(message *m)
/*===========================================================================*
* do_notify_sig *
*===========================================================================*/
PUBLIC int do_notify_sig(message *m)
int do_notify_sig(message *m)
{
int i, avails = 0;
endpoint_t ep = m->VM_NOTIFY_SIG_ENDPOINT;
@@ -118,7 +118,7 @@ out:
/*===========================================================================*
* do_watch_exit *
*===========================================================================*/
PUBLIC int do_watch_exit(message *m)
int do_watch_exit(message *m)
{
endpoint_t e = m->VM_WE_EP;
struct vmproc *vmp;
@@ -133,7 +133,7 @@ PUBLIC int do_watch_exit(message *m)
/*===========================================================================*
* init_query_exit *
*===========================================================================*/
PUBLIC void init_query_exit(void)
void init_query_exit(void)
{
int i;

View File

@@ -32,7 +32,7 @@
#include "memlist.h"
/* LRU list. */
PRIVATE yielded_t *lru_youngest = NULL, *lru_oldest = NULL;
static yielded_t *lru_youngest = NULL, *lru_oldest = NULL;
/* Should a physblock be mapped writable? */
#define WRITABLE(r, pb) \
@@ -40,32 +40,32 @@ PRIVATE yielded_t *lru_youngest = NULL, *lru_oldest = NULL;
(((r)->flags & (VR_DIRECT | VR_SHARED)) || \
(pb)->refcount == 1))
FORWARD int map_new_physblock(struct vmproc *vmp, struct vir_region
static int map_new_physblock(struct vmproc *vmp, struct vir_region
*region, vir_bytes offset, vir_bytes length, phys_bytes what, u32_t
allocflags, int written);
FORWARD int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
static int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
struct phys_region *pr);
FORWARD phys_bytes freeyieldednode(yielded_t *node, int freemem);
static phys_bytes freeyieldednode(yielded_t *node, int freemem);
FORWARD struct vir_region *map_copy_region(struct vmproc *vmp, struct
static struct vir_region *map_copy_region(struct vmproc *vmp, struct
vir_region *vr);
FORWARD struct phys_region *map_clone_ph_block(struct vmproc *vmp,
static struct phys_region *map_clone_ph_block(struct vmproc *vmp,
struct vir_region *region, struct phys_region *ph, physr_iter *iter);
#if SANITYCHECKS
FORWARD void lrucheck(void);
static void lrucheck(void);
#endif
/* hash table of yielded blocks */
#define YIELD_HASHSIZE 65536
PRIVATE yielded_avl vm_yielded_blocks[YIELD_HASHSIZE];
static yielded_avl vm_yielded_blocks[YIELD_HASHSIZE];
PRIVATE int avl_inited = 0;
static int avl_inited = 0;
PUBLIC void map_region_init(void)
void map_region_init(void)
{
int h;
assert(!avl_inited);
@@ -74,7 +74,7 @@ PUBLIC void map_region_init(void)
avl_inited = 1;
}
PRIVATE yielded_avl *get_yielded_avl(block_id_t id)
static yielded_avl *get_yielded_avl(block_id_t id)
{
u32_t h;
@@ -89,7 +89,7 @@ PRIVATE yielded_avl *get_yielded_avl(block_id_t id)
return &vm_yielded_blocks[h];
}
PRIVATE char *map_name(struct vir_region *vr)
static char *map_name(struct vir_region *vr)
{
static char name[100];
char *typename, *tag;
@@ -128,7 +128,7 @@ PRIVATE char *map_name(struct vir_region *vr)
return name;
}
PUBLIC void map_printregion(struct vmproc *vmp, struct vir_region *vr)
void map_printregion(struct vmproc *vmp, struct vir_region *vr)
{
physr_iter iter;
struct phys_region *ph;
@@ -149,7 +149,7 @@ PUBLIC void map_printregion(struct vmproc *vmp, struct vir_region *vr)
/*===========================================================================*
* map_printmap *
*===========================================================================*/
PUBLIC void map_printmap(vmp)
void map_printmap(vmp)
struct vmproc *vmp;
{
struct vir_region *vr;
@@ -164,7 +164,7 @@ struct vmproc *vmp;
}
}
PRIVATE struct vir_region *getnextvr(struct vir_region *vr)
static struct vir_region *getnextvr(struct vir_region *vr)
{
struct vir_region *nextvr;
region_iter v_iter;
@@ -187,7 +187,7 @@ PRIVATE struct vir_region *getnextvr(struct vir_region *vr)
/*===========================================================================*
* map_sanitycheck_pt *
*===========================================================================*/
PRIVATE int map_sanitycheck_pt(struct vmproc *vmp,
static int map_sanitycheck_pt(struct vmproc *vmp,
struct vir_region *vr, struct phys_region *pr)
{
struct phys_block *pb = pr->ph;
@@ -217,7 +217,7 @@ PRIVATE int map_sanitycheck_pt(struct vmproc *vmp,
/*===========================================================================*
* map_sanitycheck *
*===========================================================================*/
PUBLIC void map_sanitycheck(char *file, int line)
void map_sanitycheck(char *file, int line)
{
struct vmproc *vmp;
@@ -305,7 +305,7 @@ PUBLIC void map_sanitycheck(char *file, int line)
#define LRUCHECK lrucheck()
PRIVATE void lrucheck(void)
static void lrucheck(void)
{
yielded_t *list;
@@ -365,7 +365,7 @@ void blockstats(void)
/*=========================================================================*
* map_ph_writept *
*=========================================================================*/
PRIVATE int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
static int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
struct phys_region *pr)
{
int rw;
@@ -403,7 +403,7 @@ PRIVATE int map_ph_writept(struct vmproc *vmp, struct vir_region *vr,
/*===========================================================================*
* region_find_slot_range *
*===========================================================================*/
PRIVATE vir_bytes region_find_slot_range(struct vmproc *vmp,
static vir_bytes region_find_slot_range(struct vmproc *vmp,
vir_bytes minv, vir_bytes maxv, vir_bytes length)
{
struct vir_region *firstregion;
@@ -490,7 +490,7 @@ PRIVATE vir_bytes region_find_slot_range(struct vmproc *vmp,
/*===========================================================================*
* region_find_slot *
*===========================================================================*/
PRIVATE vir_bytes region_find_slot(struct vmproc *vmp,
static vir_bytes region_find_slot(struct vmproc *vmp,
vir_bytes minv, vir_bytes maxv, vir_bytes length)
{
vir_bytes v, hint = vmp->vm_region_top;
@@ -512,7 +512,7 @@ PRIVATE vir_bytes region_find_slot(struct vmproc *vmp,
/*===========================================================================*
* map_page_region *
*===========================================================================*/
PUBLIC struct vir_region *map_page_region(vmp, minv, maxv, length,
struct vir_region *map_page_region(vmp, minv, maxv, length,
what, flags, mapflags)
struct vmproc *vmp;
vir_bytes minv;
@@ -604,7 +604,7 @@ USE(newregion,
/*===========================================================================*
* pb_unreferenced *
*===========================================================================*/
PUBLIC void pb_unreferenced(struct vir_region *region, struct phys_region *pr)
void pb_unreferenced(struct vir_region *region, struct phys_region *pr)
{
struct phys_block *pb;
@@ -644,7 +644,7 @@ PUBLIC void pb_unreferenced(struct vir_region *region, struct phys_region *pr)
}
}
PRIVATE struct phys_region *reset_physr_iter(struct vir_region *region,
static struct phys_region *reset_physr_iter(struct vir_region *region,
physr_iter *iter, vir_bytes offset)
{
struct phys_region *ph;
@@ -660,7 +660,7 @@ PRIVATE struct phys_region *reset_physr_iter(struct vir_region *region,
/*===========================================================================*
* map_subfree *
*===========================================================================*/
PRIVATE int map_subfree(struct vmproc *vmp,
static int map_subfree(struct vmproc *vmp,
struct vir_region *region, vir_bytes len)
{
struct phys_region *pr;
@@ -730,7 +730,7 @@ PRIVATE int map_subfree(struct vmproc *vmp,
/*===========================================================================*
* map_free *
*===========================================================================*/
PRIVATE int map_free(struct vmproc *vmp, struct vir_region *region)
static int map_free(struct vmproc *vmp, struct vir_region *region)
{
int r;
@@ -749,7 +749,7 @@ PRIVATE int map_free(struct vmproc *vmp, struct vir_region *region)
/*===========================================================================*
* yielded_block_cmp *
*===========================================================================*/
PUBLIC int yielded_block_cmp(struct block_id *id1, struct block_id *id2)
int yielded_block_cmp(struct block_id *id1, struct block_id *id2)
{
if(id1->owner < id2->owner)
return -1;
@@ -762,7 +762,7 @@ PUBLIC int yielded_block_cmp(struct block_id *id1, struct block_id *id2)
/*===========================================================================*
* free_yielded_proc *
*===========================================================================*/
PRIVATE vir_bytes free_yielded_proc(struct vmproc *vmp)
static vir_bytes free_yielded_proc(struct vmproc *vmp)
{
vir_bytes total = 0;
int h;
@@ -796,7 +796,7 @@ PRIVATE vir_bytes free_yielded_proc(struct vmproc *vmp)
}
PRIVATE phys_bytes freeyieldednode(yielded_t *node, int freemem)
static phys_bytes freeyieldednode(yielded_t *node, int freemem)
{
yielded_t *older, *younger, *removed;
vir_bytes len;
@@ -859,7 +859,7 @@ PRIVATE phys_bytes freeyieldednode(yielded_t *node, int freemem)
/*========================================================================*
* free_yielded *
*========================================================================*/
PUBLIC vir_bytes free_yielded(vir_bytes max_bytes)
vir_bytes free_yielded(vir_bytes max_bytes)
{
/* PRIVATE yielded_t *lru_youngest = NULL, *lru_oldest = NULL; */
@@ -878,7 +878,7 @@ PUBLIC vir_bytes free_yielded(vir_bytes max_bytes)
/*========================================================================*
* map_free_proc *
*========================================================================*/
PUBLIC int map_free_proc(vmp)
int map_free_proc(vmp)
struct vmproc *vmp;
{
struct vir_region *r;
@@ -909,7 +909,7 @@ struct vmproc *vmp;
/*===========================================================================*
* map_lookup *
*===========================================================================*/
PUBLIC struct vir_region *map_lookup(vmp, offset)
struct vir_region *map_lookup(vmp, offset)
struct vmproc *vmp;
vir_bytes offset;
{
@@ -932,7 +932,7 @@ vir_bytes offset;
return NULL;
}
PRIVATE u32_t vrallocflags(u32_t flags)
static u32_t vrallocflags(u32_t flags)
{
u32_t allocflags = 0;
@@ -951,7 +951,7 @@ PRIVATE u32_t vrallocflags(u32_t flags)
/*===========================================================================*
* map_new_physblock *
*===========================================================================*/
PRIVATE int map_new_physblock(vmp, region, start_offset, length,
static int map_new_physblock(vmp, region, start_offset, length,
what_mem, allocflags, written)
struct vmproc *vmp;
struct vir_region *region;
@@ -1075,7 +1075,7 @@ int written;
/*===========================================================================*
* map_clone_ph_block *
*===========================================================================*/
PRIVATE struct phys_region *map_clone_ph_block(vmp, region, ph, iter)
static struct phys_region *map_clone_ph_block(vmp, region, ph, iter)
struct vmproc *vmp;
struct vir_region *region;
struct phys_region *ph;
@@ -1166,7 +1166,7 @@ physr_iter *iter;
/*===========================================================================*
* map_pf *
*===========================================================================*/
PUBLIC int map_pf(vmp, region, offset, write)
int map_pf(vmp, region, offset, write)
struct vmproc *vmp;
struct vir_region *region;
vir_bytes offset;
@@ -1236,7 +1236,7 @@ int write;
/*===========================================================================*
* map_pin_memory *
*===========================================================================*/
PUBLIC int map_pin_memory(struct vmproc *vmp)
int map_pin_memory(struct vmproc *vmp)
{
struct vir_region *vr;
int r;
@@ -1257,7 +1257,7 @@ PUBLIC int map_pin_memory(struct vmproc *vmp)
/*===========================================================================*
* map_handle_memory *
*===========================================================================*/
PUBLIC int map_handle_memory(vmp, region, offset, length, write)
int map_handle_memory(vmp, region, offset, length, write)
struct vmproc *vmp;
struct vir_region *region;
vir_bytes offset, length;
@@ -1397,7 +1397,7 @@ static int count_phys_regions(struct vir_region *vr)
/*===========================================================================*
* map_copy_region *
*===========================================================================*/
PRIVATE struct vir_region *map_copy_region(struct vmproc *vmp, struct vir_region *vr)
static struct vir_region *map_copy_region(struct vmproc *vmp, struct vir_region *vr)
{
/* map_copy_region creates a complete copy of the vir_region
* data structure, linking in the same phys_blocks directly,
@@ -1463,7 +1463,7 @@ PRIVATE struct vir_region *map_copy_region(struct vmproc *vmp, struct vir_region
/*===========================================================================*
* copy_abs2region *
*===========================================================================*/
PUBLIC int copy_abs2region(phys_bytes abs, struct vir_region *destregion,
int copy_abs2region(phys_bytes abs, struct vir_region *destregion,
phys_bytes offset, phys_bytes len)
{
@@ -1509,7 +1509,7 @@ PUBLIC int copy_abs2region(phys_bytes abs, struct vir_region *destregion,
/*=========================================================================*
* map_writept *
*=========================================================================*/
PUBLIC int map_writept(struct vmproc *vmp)
int map_writept(struct vmproc *vmp)
{
struct vir_region *vr;
struct phys_region *ph;
@@ -1545,7 +1545,7 @@ PUBLIC int map_writept(struct vmproc *vmp)
/*========================================================================*
* map_proc_copy *
*========================================================================*/
PUBLIC int map_proc_copy(dst, src)
int map_proc_copy(dst, src)
struct vmproc *dst;
struct vmproc *src;
{
@@ -1558,7 +1558,7 @@ struct vmproc *src;
/*========================================================================*
* map_proc_copy_from *
*========================================================================*/
PUBLIC int map_proc_copy_from(dst, src, start_src_vr)
int map_proc_copy_from(dst, src, start_src_vr)
struct vmproc *dst;
struct vmproc *src;
struct vir_region *start_src_vr;
@@ -1640,7 +1640,7 @@ struct vir_region *start_src_vr;
/*========================================================================*
* map_proc_kernel *
*========================================================================*/
PUBLIC struct vir_region *map_proc_kernel(struct vmproc *vmp)
struct vir_region *map_proc_kernel(struct vmproc *vmp)
{
struct vir_region *vr;
@@ -1668,7 +1668,7 @@ PUBLIC struct vir_region *map_proc_kernel(struct vmproc *vmp)
/*========================================================================*
* map_region_extend *
*========================================================================*/
PUBLIC int map_region_extend(struct vmproc *vmp, struct vir_region *vr,
int map_region_extend(struct vmproc *vmp, struct vir_region *vr,
vir_bytes delta)
{
vir_bytes end;
@@ -1700,7 +1700,7 @@ PUBLIC int map_region_extend(struct vmproc *vmp, struct vir_region *vr,
/*========================================================================*
* map_region_shrink *
*========================================================================*/
PUBLIC int map_region_shrink(struct vir_region *vr, vir_bytes delta)
int map_region_shrink(struct vir_region *vr, vir_bytes delta)
{
assert(vr);
assert(vr->flags & VR_ANON);
@@ -1713,7 +1713,7 @@ PUBLIC int map_region_shrink(struct vir_region *vr, vir_bytes delta)
return OK;
}
PUBLIC struct vir_region *map_region_lookup_tag(vmp, tag)
struct vir_region *map_region_lookup_tag(vmp, tag)
struct vmproc *vmp;
u32_t tag;
{
@@ -1730,12 +1730,12 @@ u32_t tag;
return NULL;
}
PUBLIC void map_region_set_tag(struct vir_region *vr, u32_t tag)
void map_region_set_tag(struct vir_region *vr, u32_t tag)
{
USE(vr, vr->tag = tag;);
}
PUBLIC u32_t map_region_get_tag(struct vir_region *vr)
u32_t map_region_get_tag(struct vir_region *vr)
{
return vr->tag;
}
@@ -1743,7 +1743,7 @@ PUBLIC u32_t map_region_get_tag(struct vir_region *vr)
/*========================================================================*
* map_unmap_region *
*========================================================================*/
PUBLIC int map_unmap_region(struct vmproc *vmp, struct vir_region *r,
int map_unmap_region(struct vmproc *vmp, struct vir_region *r,
vir_bytes len)
{
/* Shrink the region by 'len' bytes, from the start. Unreference
@@ -1808,7 +1808,7 @@ PUBLIC int map_unmap_region(struct vmproc *vmp, struct vir_region *r,
/*========================================================================*
* map_remap *
*========================================================================*/
PUBLIC int map_remap(struct vmproc *dvmp, vir_bytes da, size_t size,
int map_remap(struct vmproc *dvmp, vir_bytes da, size_t size,
struct vir_region *region, vir_bytes *r, int readonly)
{
struct vir_region *vr;
@@ -1878,7 +1878,7 @@ PUBLIC int map_remap(struct vmproc *dvmp, vir_bytes da, size_t size,
/*========================================================================*
* map_get_phys *
*========================================================================*/
PUBLIC int map_get_phys(struct vmproc *vmp, vir_bytes addr, phys_bytes *r)
int map_get_phys(struct vmproc *vmp, vir_bytes addr, phys_bytes *r)
{
struct vir_region *vr;
struct phys_region *ph;
@@ -1905,7 +1905,7 @@ PUBLIC int map_get_phys(struct vmproc *vmp, vir_bytes addr, phys_bytes *r)
/*========================================================================*
* map_get_ref *
*========================================================================*/
PUBLIC int map_get_ref(struct vmproc *vmp, vir_bytes addr, u8_t *cnt)
int map_get_ref(struct vmproc *vmp, vir_bytes addr, u8_t *cnt)
{
struct vir_region *vr;
struct phys_region *ph;
@@ -1932,7 +1932,7 @@ PUBLIC int map_get_ref(struct vmproc *vmp, vir_bytes addr, u8_t *cnt)
/*========================================================================*
* get_stats_info *
*========================================================================*/
PUBLIC void get_stats_info(struct vm_stats_info *vsi)
void get_stats_info(struct vm_stats_info *vsi)
{
yielded_t *yb;
@@ -1945,7 +1945,7 @@ PUBLIC void get_stats_info(struct vm_stats_info *vsi)
/*========================================================================*
* get_usage_info *
*========================================================================*/
PUBLIC void get_usage_info(struct vmproc *vmp, struct vm_usage_info *vui)
void get_usage_info(struct vmproc *vmp, struct vm_usage_info *vui)
{
struct vir_region *vr;
physr_iter iter;
@@ -1982,7 +1982,7 @@ PUBLIC void get_usage_info(struct vmproc *vmp, struct vm_usage_info *vui)
/*===========================================================================*
* get_region_info *
*===========================================================================*/
PUBLIC int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
int max, vir_bytes *nextp)
{
struct vir_region *vr;
@@ -2029,7 +2029,7 @@ PUBLIC int get_region_info(struct vmproc *vmp, struct vm_region_info *vri,
/*========================================================================*
* regionprintstats *
*========================================================================*/
PUBLIC void printregionstats(struct vmproc *vmp)
void printregionstats(struct vmproc *vmp)
{
struct vir_region *vr;
struct phys_region *pr;
@@ -2058,7 +2058,7 @@ PUBLIC void printregionstats(struct vmproc *vmp)
/*===========================================================================*
* do_map_memory *
*===========================================================================*/
PRIVATE int do_map_memory(struct vmproc *vms, struct vmproc *vmd,
static int do_map_memory(struct vmproc *vms, struct vmproc *vmd,
struct vir_region *vrs, struct vir_region *vrd,
vir_bytes offset_s, vir_bytes offset_d,
vir_bytes length, int flag)
@@ -2149,7 +2149,7 @@ PRIVATE int do_map_memory(struct vmproc *vms, struct vmproc *vmd,
/*===========================================================================*
* unmap_memory *
*===========================================================================*/
PUBLIC int unmap_memory(endpoint_t sour, endpoint_t dest,
int unmap_memory(endpoint_t sour, endpoint_t dest,
vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag)
{
struct vmproc *vmd;
@@ -2196,7 +2196,7 @@ PUBLIC int unmap_memory(endpoint_t sour, endpoint_t dest,
/*===========================================================================*
* split_phys *
*===========================================================================*/
PRIVATE int split_phys(struct phys_region *pr, vir_bytes point)
static int split_phys(struct phys_region *pr, vir_bytes point)
{
struct phys_region *newpr, *q, *prev = NULL;
struct phys_block *newpb;
@@ -2244,7 +2244,7 @@ PRIVATE int split_phys(struct phys_region *pr, vir_bytes point)
/*===========================================================================*
* clean_phys_regions *
*===========================================================================*/
PRIVATE void clean_phys_regions(struct vir_region *region,
static void clean_phys_regions(struct vir_region *region,
vir_bytes offset, vir_bytes length)
{
/* Consider @offset as the start address and @offset+length as the end address.
@@ -2279,7 +2279,7 @@ PRIVATE void clean_phys_regions(struct vir_region *region,
/*===========================================================================*
* rm_phys_regions *
*===========================================================================*/
PRIVATE void rm_phys_regions(struct vir_region *region,
static void rm_phys_regions(struct vir_region *region,
vir_bytes begin, vir_bytes length)
{
/* Remove all phys regions between @begin and @begin+length.
@@ -2303,7 +2303,7 @@ PRIVATE void rm_phys_regions(struct vir_region *region,
/*===========================================================================*
* map_memory *
*===========================================================================*/
PUBLIC int map_memory(endpoint_t sour, endpoint_t dest,
int map_memory(endpoint_t sour, endpoint_t dest,
vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag)
{
/* This is the entry point. This function will be called by handle_memory() when
@@ -2380,7 +2380,7 @@ map_lookup_phys(struct vmproc *vmp, u32_t tag)
/*===========================================================================*
* get_clean_phys_region *
*===========================================================================*/
PRIVATE struct phys_region *
static struct phys_region *
get_clean_phys_region(struct vmproc *vmp, vir_bytes vaddr, vir_bytes length,
struct vir_region **ret_region)
{
@@ -2441,7 +2441,7 @@ get_clean_phys_region(struct vmproc *vmp, vir_bytes vaddr, vir_bytes length,
return ph;
}
PRIVATE int getblock(struct vmproc *vmp, u64_t id,
static int getblock(struct vmproc *vmp, u64_t id,
vir_bytes vaddr, vir_bytes len)
{
yielded_t *yb;
@@ -2491,7 +2491,7 @@ PRIVATE int getblock(struct vmproc *vmp, u64_t id,
return OK;
}
PRIVATE int yieldblock(struct vmproc *vmp, u64_t id,
static int yieldblock(struct vmproc *vmp, u64_t id,
vir_bytes vaddr, vir_bytes len, yielded_t **retyb)
{
yielded_t *newyb;
@@ -2580,7 +2580,7 @@ PRIVATE int yieldblock(struct vmproc *vmp, u64_t id,
/*===========================================================================*
* do_forgetblocks *
*===========================================================================*/
PUBLIC int do_forgetblocks(message *m)
int do_forgetblocks(message *m)
{
int n;
struct vmproc *vmp;
@@ -2605,7 +2605,7 @@ PUBLIC int do_forgetblocks(message *m)
/*===========================================================================*
* do_forgetblock *
*===========================================================================*/
PUBLIC int do_forgetblock(message *m)
int do_forgetblock(message *m)
{
int n;
struct vmproc *vmp;
@@ -2641,7 +2641,7 @@ PUBLIC int do_forgetblock(message *m)
/*===========================================================================*
* do_yieldblockgetblock *
*===========================================================================*/
PUBLIC int do_yieldblockgetblock(message *m)
int do_yieldblockgetblock(message *m)
{
u64_t yieldid, getid;
int n;

View File

@@ -31,7 +31,7 @@
/*===========================================================================*
* do_rs_set_priv *
*===========================================================================*/
PUBLIC int do_rs_set_priv(message *m)
int do_rs_set_priv(message *m)
{
int r, n, nr;
struct vmproc *vmp;
@@ -59,7 +59,7 @@ PUBLIC int do_rs_set_priv(message *m)
/*===========================================================================*
* do_rs_update *
*===========================================================================*/
PUBLIC int do_rs_update(message *m_ptr)
int do_rs_update(message *m_ptr)
{
endpoint_t src_e, dst_e, reply_e;
int src_p, dst_p;
@@ -115,7 +115,7 @@ PUBLIC int do_rs_update(message *m_ptr)
/*===========================================================================*
* rs_memctl_make_vm_instance *
*===========================================================================*/
PRIVATE int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
static int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
{
int r;
u32_t flags;
@@ -164,7 +164,7 @@ PRIVATE int rs_memctl_make_vm_instance(struct vmproc *new_vm_vmp)
/*===========================================================================*
* do_rs_memctl *
*===========================================================================*/
PUBLIC int do_rs_memctl(message *m_ptr)
int do_rs_memctl(message *m_ptr)
{
endpoint_t ep;
int req, r, proc_nr;

View File

@@ -30,7 +30,7 @@
/*===========================================================================*
* do_push_sig *
*===========================================================================*/
PUBLIC int do_push_sig(message *msg)
int do_push_sig(message *msg)
{
int r, n;
endpoint_t ep;

View File

@@ -77,7 +77,7 @@
#define MAXSIZE (SLABSIZES-1+MINSIZE)
#define USEELEMENTS (1+(VM_PAGE_SIZE/MINSIZE/8))
PRIVATE int pages = 0;
static int pages = 0;
typedef u8_t element_t;
#define BITS_FULL (~(element_t)0)
@@ -123,14 +123,14 @@ struct sdh {
#define LIST_FULL 3
#define LIST_NUMBER 4
PRIVATE struct slabheader {
static struct slabheader {
struct slabdata {
struct sdh sdh;
u8_t data[DATABYTES];
} *list_head[LIST_NUMBER];
} slabs[SLABSIZES];
FORWARD int objstats(void *, int, struct slabheader **, struct slabdata
static int objstats(void *, int, struct slabheader **, struct slabdata
**, int *);
#define GETSLAB(b, s) { \
@@ -218,7 +218,7 @@ struct slabdata *newslabdata(int list)
/*===========================================================================*
* checklist *
*===========================================================================*/
PRIVATE int checklist(char *file, int line,
static int checklist(char *file, int line,
struct slabheader *s, int l, int bytes)
{
struct slabdata *n = s->list_head[l];
@@ -254,7 +254,7 @@ PRIVATE int checklist(char *file, int line,
/*===========================================================================*
* void slab_sanitycheck *
*===========================================================================*/
PUBLIC void slab_sanitycheck(char *file, int line)
void slab_sanitycheck(char *file, int line)
{
int s;
for(s = 0; s < SLABSIZES; s++) {
@@ -268,7 +268,7 @@ PUBLIC void slab_sanitycheck(char *file, int line)
/*===========================================================================*
* int slabsane *
*===========================================================================*/
PUBLIC int slabsane_f(char *file, int line, void *mem, int bytes)
int slabsane_f(char *file, int line, void *mem, int bytes)
{
struct slabheader *s;
struct slabdata *f;
@@ -285,7 +285,7 @@ static int nojunkwarning = 0;
/*===========================================================================*
* void *slaballoc *
*===========================================================================*/
PUBLIC void *slaballoc(int bytes)
void *slaballoc(int bytes)
{
int i;
int count = 0;
@@ -387,7 +387,7 @@ PUBLIC void *slaballoc(int bytes)
/*===========================================================================*
* int objstats *
*===========================================================================*/
PRIVATE int objstats(void *mem, int bytes,
static int objstats(void *mem, int bytes,
struct slabheader **sp, struct slabdata **fp, int *ip)
{
#if SANITYCHECKS
@@ -448,7 +448,7 @@ PRIVATE int objstats(void *mem, int bytes,
/*===========================================================================*
* void *slabfree *
*===========================================================================*/
PUBLIC void slabfree(void *mem, int bytes)
void slabfree(void *mem, int bytes)
{
int i;
struct slabheader *s;
@@ -515,7 +515,7 @@ PUBLIC void slabfree(void *mem, int bytes)
/*===========================================================================*
* void *slablock *
*===========================================================================*/
PUBLIC void slablock(void *mem, int bytes)
void slablock(void *mem, int bytes)
{
int i;
struct slabheader *s;
@@ -532,7 +532,7 @@ PUBLIC void slablock(void *mem, int bytes)
/*===========================================================================*
* void *slabunlock *
*===========================================================================*/
PUBLIC void slabunlock(void *mem, int bytes)
void slabunlock(void *mem, int bytes)
{
int i;
struct slabheader *s;
@@ -550,7 +550,7 @@ PUBLIC void slabunlock(void *mem, int bytes)
/*===========================================================================*
* void slabstats *
*===========================================================================*/
PUBLIC void slabstats(void)
void slabstats(void)
{
int s, total = 0, totalbytes = 0;
static int n;

View File

@@ -41,7 +41,7 @@
/*===========================================================================*
* get_mem_map *
*===========================================================================*/
PUBLIC int get_mem_map(proc_nr, mem_map)
int get_mem_map(proc_nr, mem_map)
int proc_nr; /* process to get map of */
struct mem_map *mem_map; /* put memory map here */
{
@@ -58,7 +58,7 @@ struct mem_map *mem_map; /* put memory map here */
/*===========================================================================*
* get_mem_chunks *
*===========================================================================*/
PUBLIC void get_mem_chunks(mem_chunks)
void get_mem_chunks(mem_chunks)
struct memory *mem_chunks; /* store mem chunks here */
{
/* Initialize the free memory list from the 'memory' boot variable. Translate
@@ -92,7 +92,7 @@ struct memory *mem_chunks; /* store mem chunks here */
/*===========================================================================*
* reserve_proc_mem *
*===========================================================================*/
PUBLIC void reserve_proc_mem(mem_chunks, map_ptr)
void reserve_proc_mem(mem_chunks, map_ptr)
struct memory *mem_chunks; /* store mem chunks here */
struct mem_map *map_ptr; /* memory to remove */
{
@@ -139,7 +139,7 @@ struct mem_map *map_ptr; /* memory to remove */
/*===========================================================================*
* vm_isokendpt *
*===========================================================================*/
PUBLIC int vm_isokendpt(endpoint_t endpoint, int *proc)
int vm_isokendpt(endpoint_t endpoint, int *proc)
{
*proc = _ENDPOINT_P(endpoint);
if(*proc < 0 || *proc >= NR_PROCS)
@@ -157,7 +157,7 @@ struct proc mytmpproc;
/*===========================================================================*
* get_stack_ptr *
*===========================================================================*/
PUBLIC int get_stack_ptr(proc_nr_e, sp)
int get_stack_ptr(proc_nr_e, sp)
int proc_nr_e; /* process to get sp of */
vir_bytes *sp; /* put stack pointer here */
{
@@ -172,7 +172,7 @@ vir_bytes *sp; /* put stack pointer here */
/*===========================================================================*
* do_info *
*===========================================================================*/
PUBLIC int do_info(message *m)
int do_info(message *m)
{
struct vm_stats_info vsi;
struct vm_usage_info vui;
@@ -256,7 +256,7 @@ PUBLIC int do_info(message *m)
/*===========================================================================*
* swap_proc_slot *
*===========================================================================*/
PUBLIC int swap_proc_slot(struct vmproc *src_vmp, struct vmproc *dst_vmp)
int swap_proc_slot(struct vmproc *src_vmp, struct vmproc *dst_vmp)
{
struct vmproc orig_src_vmproc, orig_dst_vmproc;
@@ -292,7 +292,7 @@ PUBLIC int swap_proc_slot(struct vmproc *src_vmp, struct vmproc *dst_vmp)
/*===========================================================================*
* swap_proc_dyn_data *
*===========================================================================*/
PUBLIC int swap_proc_dyn_data(struct vmproc *src_vmp, struct vmproc *dst_vmp)
int swap_proc_dyn_data(struct vmproc *src_vmp, struct vmproc *dst_vmp)
{
int is_vm;
int r;