本文整理汇总了C++中bufinit函数的典型用法代码示例。如果您正苦于以下问题:C++ bufinit函数的具体用法?C++ bufinit怎么用?C++ bufinit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bufinit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cpu_startup
void
cpu_startup()
{
vaddr_t minaddr, maxaddr;
/*
* Good {morning,afternoon,evening,night}.
*/
printf(version);
printf("real mem = %lu (%luMB)\n", ptoa(physmem),
ptoa(physmem)/1024/1024);
/*
* Grab machine dependent memory spaces
*/
platform->startup();
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
minaddr = vm_map_min(kernel_map);
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
/*
* Allocate map for physio.
*/
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
ptoa(uvmexp.free)/1024/1024);
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
/*
* Configure the system.
*/
if (boothowto & RB_CONFIG) {
#ifdef BOOT_CONFIG
user_config();
#else
printf("kernel does not support -c; continuing..\n");
#endif
}
}
开发者ID:toddfries,项目名称:OpenBSD-sys-patches,代码行数:50,代码来源:machdep.c
示例2: print_mdoc_head
/* ARGSUSED */
static void
print_mdoc_head(MDOC_ARGS)
{
print_gen_head(h);
bufinit(h);
bufcat_fmt(h, "%s(%s)", m->title, m->msec);
if (m->arch)
bufcat_fmt(h, " (%s)", m->arch);
print_otag(h, TAG_TITLE, 0, NULL);
print_text(h, h->buf);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:15,代码来源:mdoc_html.c
示例3: STARTUP
/*
* initialisation function
* We start here as soon as we have a stack.
* Here we initialize the various systems
* and devices that need to be initialized.
*/
STARTUP(void kmain())
{
// TODO: move these to the appropriate headers
void vtinit();
void grayinit();
void loadavinit();
void battinit();
void usageinit();
void bogomips();
calloutinit();
lcdinit();
meminit();
grayinit();
vtinit();
linkinit();
audioinit();
sched_init();
procinit();
bufinit();
flashinit();
inodeinit();
loadavinit();
battinit();
usageinit();
#if 1
kprintf("%s build %s\n", uname_sysname, uname_version);
#else
kprintf("%s v%s\n", uname_sysname, uname_release);
kputs(
"Copyright 2005-2011 Christopher Williams <[email protected]>\n"
"Some portions copyright 2003, 2005 PpHd\n"
"\n"
"This program comes with ABSOLUTELY NO WARRANTY.\n"
"You may redistribute copies of this program\n"
"under the terms of the GNU General Public License.\n"
"\n");
#endif
if (realtime.tv_sec < 1000000000L) { /* before ~2001 */
extern const unsigned long build_date;
realtime.tv_sec = build_date;
realtime.tv_nsec = 0;
}
G.seconds = realtime.tv_sec;
uptime.tv_sec = uptime.tv_nsec = 0;
spl0();
bogomips();
}
开发者ID:abbrev,项目名称:punix,代码行数:55,代码来源:main.c
示例4: mdoc_nm_pre
static int
mdoc_nm_pre(MDOC_ARGS)
{
struct htmlpair tag;
struct roffsu su;
int len;
switch (n->type) {
case MDOC_ELEM:
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "name");
print_otag(h, TAG_B, 1, &tag);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
case MDOC_HEAD:
print_otag(h, TAG_TD, 0, NULL);
if (NULL == n->child && meta->name)
print_text(h, meta->name);
return(1);
case MDOC_BODY:
print_otag(h, TAG_TD, 0, NULL);
return(1);
default:
break;
}
synopsis_pre(h, n);
PAIR_CLASS_INIT(&tag, "synopsis");
print_otag(h, TAG_TABLE, 1, &tag);
for (len = 0, n = n->child; n; n = n->next)
if (MDOC_TEXT == n->type)
len += html_strlen(n->string);
if (0 == len && meta->name)
len = html_strlen(meta->name);
SCALE_HS_INIT(&su, len);
bufinit(h);
bufcat_su(h, "width", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_COL, 1, &tag);
print_otag(h, TAG_COL, 0, NULL);
print_otag(h, TAG_TBODY, 0, NULL);
print_otag(h, TAG_TR, 0, NULL);
return(1);
}
开发者ID:cemeyer,项目名称:freebsd-base-graphics,代码行数:48,代码来源:mdoc_html.c
示例5: errhandler
static void errhandler(struct muth *muth, va_list args)
{
vavar(FILE *, in);
char buf[1024];
char *p;
bufinit(buf);
while(fgets(buf, sizeof(buf), in) != NULL) {
p = buf + strlen(buf) - 1;
while((p >= buf) && (*p == '\n'))
*(p--) = 0;
if(buf[0])
flog(LOG_INFO, "child said: %s", buf);
}
fclose(in);
}
开发者ID:dolda2000,项目名称:ashd,代码行数:16,代码来源:callfcgi.c
示例6: x86_64_bufinit
/*
* XXX Finish up the deferred buffer cache allocation and initialization.
*/
void
x86_64_bufinit()
{
int i, base, residual;
base = bufpages / nbuf;
residual = bufpages % nbuf;
for (i = 0; i < nbuf; i++) {
vsize_t curbufsize;
vaddr_t curbuf;
struct vm_page *pg;
/*
* Each buffer has MAXBSIZE bytes of VM space allocated. Of
* that MAXBSIZE space, we allocate and map (base+1) pages
* for the first "residual" buffers, and then we allocate
* "base" pages for the rest.
*/
curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base);
while (curbufsize) {
/*
* Attempt to allocate buffers from the first
* 16M of RAM to avoid bouncing file system
* transfers.
*/
pg = uvm_pagealloc_strat(NULL, 0, NULL, 0,
UVM_PGA_STRAT_FALLBACK, VM_FREELIST_FIRST16);
if (pg == NULL)
panic("cpu_startup: not enough memory for "
"buffer cache");
pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
VM_PROT_READ|VM_PROT_WRITE);
curbuf += PAGE_SIZE;
curbufsize -= PAGE_SIZE;
}
}
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
}
开发者ID:MarginC,项目名称:kame,代码行数:47,代码来源:machdep.c
示例7: mdoc_sx_pre
/* ARGSUSED */
static int
mdoc_sx_pre(MDOC_ARGS)
{
struct htmlpair tag[2];
bufinit(h);
bufcat(h, "#x");
for (n = n->child; n; n = n->next) {
bufcat_id(h, n->string);
if (n->next)
bufcat_id(h, " ");
}
PAIR_CLASS_INIT(&tag[0], "link-sec");
PAIR_HREF_INIT(&tag[1], h->buf);
print_otag(h, TAG_I, 1, tag);
print_otag(h, TAG_A, 2, tag);
return(1);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:21,代码来源:mdoc_html.c
示例8: cpu_startup
static void
cpu_startup(void *dummy)
{
if (boothowto & RB_VERBOSE)
bootverbose++;
printf("real memory = %ju (%juK bytes)\n", ptoa((uintmax_t)realmem),
ptoa((uintmax_t)realmem) / 1024);
/*
* Display any holes after the first chunk of extended memory.
*/
if (bootverbose) {
int indx;
printf("Physical memory chunk(s):\n");
for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
vm_paddr_t size1 = phys_avail[indx + 1] - phys_avail[indx];
printf("0x%08jx - 0x%08jx, %ju bytes (%ju pages)\n",
(uintmax_t)phys_avail[indx],
(uintmax_t)phys_avail[indx + 1] - 1,
(uintmax_t)size1,
(uintmax_t)size1 / PAGE_SIZE);
}
}
vm_ksubmap_init(&kmi);
printf("avail memory = %ju (%juMB)\n",
ptoa((uintmax_t)cnt.v_free_count),
ptoa((uintmax_t)cnt.v_free_count) / 1048576);
cpu_init_interrupts();
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
vm_pager_bufferinit();
}
开发者ID:wulf7,项目名称:freebsd,代码行数:41,代码来源:machdep.c
示例9: man_RS_pre
static int
man_RS_pre(MAN_ARGS)
{
struct htmlpair tag;
struct roffsu su;
if (MAN_HEAD == n->type)
return(0);
else if (MAN_BODY == n->type)
return(1);
SCALE_HS_INIT(&su, INDENT);
if (n->head->child)
a2width(n->head->child, &su);
bufinit(h);
bufcat_su(h, "margin-left", &su);
PAIR_STYLE_INIT(&tag, h);
print_otag(h, TAG_DIV, 1, &tag);
return(1);
}
开发者ID:jashank,项目名称:freebsd,代码行数:21,代码来源:man_html.c
示例10: cpu_booke_startup
static void
cpu_booke_startup(void *dummy)
{
int indx;
unsigned long size;
/* Initialise the decrementer-based clock. */
decr_init();
/* Good {morning,afternoon,evening,night}. */
cpu_setup(PCPU_GET(cpuid));
printf("real memory = %lu (%ld MB)\n", ptoa(physmem),
ptoa(physmem) / 1048576);
realmem = physmem;
/* Display any holes after the first chunk of extended memory. */
if (bootverbose) {
printf("Physical memory chunk(s):\n");
for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
size = phys_avail[indx + 1] - phys_avail[indx];
printf("0x%08x - 0x%08x, %lu bytes (%lu pages)\n",
phys_avail[indx], phys_avail[indx + 1] - 1,
size, size / PAGE_SIZE);
}
}
vm_ksubmap_init(&kmi);
printf("avail memory = %lu (%ld MB)\n", ptoa(vm_cnt.v_free_count),
ptoa(vm_cnt.v_free_count) / 1048576);
/* Set up buffers, so they can be used to read disk labels. */
bufinit();
vm_pager_bufferinit();
/* Cpu supports execution permissions on the pages. */
elf32_nxstack = 1;
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:40,代码来源:machdep.c
示例11: sendreq2
int sendreq2(int sock, struct hthead *req, int fd, int flags)
{
int ret, i;
struct charbuf buf;
bufinit(buf);
bufcatstr2(buf, req->method);
bufcatstr2(buf, req->url);
bufcatstr2(buf, req->ver);
bufcatstr2(buf, req->rest);
for(i = 0; i < req->noheaders; i++) {
bufcatstr2(buf, req->headers[i][0]);
bufcatstr2(buf, req->headers[i][1]);
}
bufcatstr2(buf, "");
ret = sendfd2(sock, fd, buf.b, buf.d, flags);
buffree(buf);
if(ret < 0)
return(-1);
else
return(0);
}
开发者ID:dolda2000,项目名称:ashd,代码行数:22,代码来源:req.c
示例12: mdoc_ss_pre
/* ARGSUSED */
static int
mdoc_ss_pre(MDOC_ARGS)
{
struct htmlpair tag;
if (MDOC_BLOCK == n->type) {
PAIR_CLASS_INIT(&tag, "subsection");
print_otag(h, TAG_DIV, 1, &tag);
return(1);
} else if (MDOC_BODY == n->type)
return(1);
bufinit(h);
for (n = n->child; n; n = n->next) {
bufcat_id(h, n->string);
if (n->next)
bufcat_id(h, " ");
}
PAIR_ID_INIT(&tag, h->buf);
print_otag(h, TAG_H2, 1, &tag);
return(1);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:24,代码来源:mdoc_html.c
示例13: buffmt_includes
void
buffmt_includes(struct html *h, const char *name)
{
const char *p, *pp;
pp = h->base_includes;
bufinit(h);
while (NULL != (p = strchr(pp, '%'))) {
bufncat(h, pp, (size_t)(p - pp));
switch (*(p + 1)) {
case('I'):
bufcat(h, name);
break;
default:
bufncat(h, p, 2);
break;
}
pp = p + 2;
}
if (pp)
bufcat(h, pp);
}
开发者ID:Stichting-MINIX-Research-Foundation,项目名称:minix,代码行数:23,代码来源:html.c
示例14: bsd_bufferinit
void
bsd_bufferinit()
{
kern_return_t ret;
cons.t_dev = makedev(12, 0);
bsd_startupearly();
ret = kmem_suballoc(kernel_map,
(vm_offset_t *) &mbutl,
(vm_size_t) (nmbclusters * MCLBYTES),
FALSE,
TRUE,
&mb_map);
if (ret != KERN_SUCCESS)
panic("Failed to allocate mb_map\n");
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
}
开发者ID:OpenDarwin-CVS,项目名称:SEDarwin,代码行数:24,代码来源:unix_startup.c
示例15: cpu_startup
//.........这里部分代码省略.........
case 0: p = "1.0"; break;
case 4: p = "1.1"; break;
case 8: p = "2.0"; break;
default: p = "?.?"; break;
}
/* my babe said: 6010, 481, 0, 0, 77b657b1, 0, 4 */
sprintf(cpu_model, "HP9000/%s PA-RISC %s",
bip->bi_name, p);
} else
sprintf(cpu_model, "HP9000/(UNKNOWN %x)", i);
printf("%s\n", cpu_model);
}
printf("real mem = %d (%d reserved for PROM, %d used by OpenBSD)\n",
ctob(totalphysmem), ctob(resvmem), ctob(physmem));
/*
* Now allocate buffers proper. They are different than the above
* in that they usually occupy more virtual memory than physical.
*/
size = MAXBSIZE * nbuf;
buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
&maxaddr, size, TRUE);
minaddr = (vm_offset_t)buffers;
if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
&minaddr, size, FALSE) != KERN_SUCCESS)
panic("cpu_startup: cannot allocate buffers");
base = bufpages / nbuf;
residual = bufpages % nbuf;
for (i = 0; i < nbuf; i++) {
/*
* First <residual> buffers get (base+1) physical pages
* allocated for them. The rest get (base) physical pages.
*
* The rest of each buffer occupies virtual space,
* but has no physical memory allocated for it.
*/
vm_map_pageable(buffer_map, minaddr, minaddr +
CLBYTES * (base + (i < residual)), FALSE);
vm_map_simplify(buffer_map, minaddr);
minaddr += MAXBSIZE;
}
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, TRUE);
/*
* Allocate a submap for physio
*/
phys_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, TRUE);
/*
* Finally, allocate mbuf pool. Since mclrefcnt is an off-size
* we use the more space efficient malloc in place of kmem_alloc.
*/
mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
M_MBUF, M_NOWAIT);
bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
* Initialize callouts
*/
callfree = callout;
for (i = 1; i < ncallout; i++)
callout[i-1].c_next = &callout[i];
callout[i-1].c_next = NULL;
#ifdef DEBUG
pmapdebug = opmapdebug;
#endif
printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
/*
* Configure the system.
*/
if (boothowto & RB_CONFIG) {
#ifdef BOOT_CONFIG
user_config();
#else
printf("kernel does not support -c; continuing..\n");
#endif
}
hppa_malloc_ok = 1;
configure();
}
开发者ID:MarginC,项目名称:kame,代码行数:101,代码来源:machdep.c
示例16: cpu_startup
/*
* Machine-dependent startup code
*/
void
cpu_startup()
{
#ifdef DEBUG
extern int pmapdebug;
int opmapdebug = pmapdebug;
#endif
vaddr_t minaddr, maxaddr;
paddr_t msgbufpa;
extern struct user *proc0paddr;
#ifdef DEBUG
pmapdebug = 0;
#endif
if (CPU_ISSUN4M)
stackgap_random = STACKGAP_RANDOM_SUN4M;
/*
* Re-map the message buffer from its temporary address
* at KERNBASE to MSGBUF_VA.
*/
/* Get physical address of the message buffer */
pmap_extract(pmap_kernel(), (vaddr_t)KERNBASE, &msgbufpa);
/* Invalidate the current mapping at KERNBASE. */
pmap_kremove((vaddr_t)KERNBASE, PAGE_SIZE);
pmap_update(pmap_kernel());
/* Enter the new mapping */
pmap_map(MSGBUF_VA, msgbufpa, msgbufpa + PAGE_SIZE,
PROT_READ | PROT_WRITE);
/* Re-initialize the message buffer. */
initmsgbuf((caddr_t)(MSGBUF_VA + (CPU_ISSUN4 ? 4096 : 0)), MSGBUFSIZE);
proc0.p_addr = proc0paddr;
/*
* Good {morning,afternoon,evening,night}.
*/
printf(version);
/*identifycpu();*/
printf("real mem = %lu (%luMB)\n", ptoa(physmem),
ptoa(physmem)/1024/1024);
/*
* uvm_km_init() has allocated all the virtual memory below the
* end of the kernel image. If VM_MIN_KERNEL_ADDRESS is below
* KERNBASE, we need to reclaim that range.
*/
if (vm_min_kernel_address < (vaddr_t)KERNBASE) {
uvm_unmap(kernel_map, vm_min_kernel_address, (vaddr_t)KERNBASE);
}
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
minaddr = vm_map_min(kernel_map);
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
/*
* Set up userland PIE limits. PIE is disabled on sun4/4c/4e due
* to the limited address space.
*/
if (CPU_ISSUN4M) {
vm_pie_max_addr = VM_MAXUSER_ADDRESS / 4;
}
dvma_init();
#ifdef DEBUG
pmapdebug = opmapdebug;
#endif
printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
ptoa(uvmexp.free)/1024/1024);
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
}
开发者ID:mosconi,项目名称:openbsd,代码行数:88,代码来源:machdep.c
示例17: sysinit
/*------------------------------------------------------------------------
*
* sysinit - Initialize all Xinu data structures and devices
*
*------------------------------------------------------------------------
*/
static void sysinit()
{
int32 i;
struct procent *prptr; /* Ptr to process table entry */
struct sentry *semptr; /* Ptr to semaphore table entry */
/* Platform Specific Initialization */
platinit();
/* kprintf("\033[39;49m\n\r%s\n\n\r", VERSION);*/
/* Initialize the interrupt vectors */
initevec();
/* Initialize free memory list */
meminit();
/* Initialize system variables */
/* Count the Null process as the first process in the system */
prcount = 1;
/* Scheduling is not currently blocked */
Defer.ndefers = 0;
/* Initialize process table entries free */
for (i = 0; i < NPROC; i++) {
prptr = &proctab[i];
prptr->prstate = PR_FREE;
prptr->prname[0] = NULLCH;
prptr->prstkbase = NULL;
prptr->prprio = 0;
}
/* Initialize the Null process entry */
prptr = &proctab[NULLPROC];
prptr->prstate = PR_CURR;
prptr->prprio = 0;
strncpy(prptr->prname, "prnull", 7);
prptr->prstkbase = getstk(NULLSTK);
prptr->prstklen = NULLSTK;
prptr->prstkptr = 0;
currpid = NULLPROC;
/* Initialize semaphores */
for (i = 0; i < NSEM; i++) {
semptr = &semtab[i];
semptr->sstate = S_FREE;
semptr->scount = 0;
semptr->squeue = newqueue();
}
/* Initialize buffer pools */
bufinit();
/* Create a ready list for processes */
readylist = newqueue();
/* Initialize the real time clock */
clkinit();
for (i = 0; i < NDEVS; i++) {
init(i);
}
return;
}
开发者ID:ismaellc,项目名称:SOTR,代码行数:84,代码来源:initialize.c
示例18: cpu_startup
//.........这里部分代码省略.........
#ifdef DEBUG
pmapdebug = 0;
#endif
proc0.p_addr = proc0paddr;
/*
* Good {morning,afternoon,evening,night}.
*/
printf(version);
/*identifycpu();*/
printf("total memory = %d\n", physmem * PAGE_SIZE);
/*
* Find out how much space we need, allocate it,
* and then give everything true virtual addresses.
*/
sz = (long)allocsys(NULL);
if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)
panic("startup: no room for %lx bytes of tables", sz);
if (allocsys(v) - v != sz)
panic("startup: table size inconsistency");
/*
* allocate virtual and physical memory for the buffers.
*/
size = MAXBSIZE * nbuf; /* # bytes for buffers */
/* allocate VM for buffers... area is not managed by VM system */
if (uvm_map(kernel_map, (vaddr_t *) &buffers, round_page(size),
NULL, UVM_UNKNOWN_OFFSET,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
UVM_ADV_NORMAL, 0)) != 0)
panic("cpu_startup: cannot allocate VM for buffers");
minaddr = (vaddr_t) buffers;
if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
bufpages = btoc(MAXBSIZE) * nbuf; /* do not overallocate RAM */
}
base = bufpages / nbuf;
residual = bufpages % nbuf;
/* now allocate RAM for buffers */
for (i = 0 ; i < nbuf ; i++) {
vaddr_t curbuf;
vsize_t curbufsize;
struct vm_page *pg;
/*
* each buffer has MAXBSIZE bytes of VM space allocated. of
* that MAXBSIZE space we allocate and map (base+1) pages
* for the first "residual" buffers, and then we allocate
* "base" pages for the rest.
*/
curbuf = (vaddr_t) buffers + (i * MAXBSIZE);
curbufsize = NBPG * ((i < residual) ? (base+1) : base);
while (curbufsize) {
pg = uvm_pagealloc(NULL, 0, NULL, 0);
if (pg == NULL)
panic("cpu_startup: "
"not enough RAM for buffer cache");
pmap_enter(kernel_map->pmap, curbuf,
VM_PAGE_TO_PHYS(pg), VM_PROT_READ|VM_PROT_WRITE,
VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
curbuf += PAGE_SIZE;
curbufsize -= PAGE_SIZE;
}
}
pmap_update();
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
/*
* Finally, allocate mbuf cluster submap.
*/
mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL);
#ifdef DEBUG
pmapdebug = opmapdebug;
#endif
printf("avail memory = %ld\n", (long)uvmexp.free * PAGE_SIZE);
printf("using %d buffers containing %ld of memory\n", nbuf,
(long)bufpages * PAGE_SIZE);
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
#if 0
pmap_redzone();
#endif
}
开发者ID:MarginC,项目名称:kame,代码行数:101,代码来源:machdep.c
示例19: kinitlong
void
kinitlong(unsigned long pmemsz)
{
#if (NEWTMR)
uint32_t tmrcnt = 0;
#endif
/* initialise interrupt management */
#if (VBE)
trapinitprot();
#endif
/* initialise virtual memory */
vminitlong((uint64_t *)kernpagemapl4tab);
#if 0
/* FIXME: map possible device memory */
vmmapseg((uint32_t *)&_pagetab, DEVMEMBASE, DEVMEMBASE, 0xffffffffU,
PAGEPRES | PAGEWRITE | PAGENOCACHE);
#endif
// schedinit();
/* zero kernel BSS segment */
kbzero(&_bssvirt, (uint32_t)&_ebssvirt - (uint32_t)&_bssvirt);
/* set kernel I/O permission bitmap to all 1-bits */
kmemset(&kerniomap, 0xff, sizeof(kerniomap));
/* INITIALIZE CONSOLES AND SCREEN */
#if (VBE)
vbeinitscr();
#endif
#if (VBE) && (NEWFONT)
consinit(768 / vbefontw, 1024 / vbefonth);
#elif (VBE)
consinit(768 >> 3, 1024 >> 3);
#endif
/* TODO: use memory map from GRUB? */
// vminitphys((uintptr_t)&_epagetab, pmemsz);
vminitphys((uintptr_t)&_epagetab, pmemsz);
meminit(pmemsz);
tssinit(0);
#if (VBE) && (NEWFONT)
// consinit(768 / vbefontw, 1024 / vbefonth);
#elif (VBE)
consinit(768 >> 3, 1024 >> 3);
#endif
#if (SMBIOS)
smbiosinit();
#endif
#if (PS2DRV)
ps2init();
#endif
#if (VBE) && (PLASMA)
plasmaloop();
#endif
#if (VBE)
vbeprintinfo();
#endif
logoprint();
// vminitphys((uintptr_t)&_ebss, pmemsz - (unsigned long)&_ebss);
/* HID devices */
#if (PCI)
/* initialise PCI bus driver */
pciinit();
#endif
#if (ATA)
/* initialise ATA driver */
atainit();
#endif
#if (SB16)
/* initialise Soundblaster 16 driver */
sb16init();
#endif
#if (ACPI)
/* initialise ACPI subsystem */
acpiinit();
#endif
/* initialise block I/O buffer cache */
if (!bufinit()) {
kprintf("failed to allocate buffer cache\n");
while (1) {
;
}
}
/* allocate unused device regions (in 3.5G..4G) */
// pageaddzone(DEVMEMBASE, &vmshmq, 0xffffffffU - DEVMEMBASE + 1);
#if (SMP) || (APIC)
//#if (SMP)
/* multiprocessor initialisation */
// mpinit();
//#endif
if (mpncpu == 1) {
kprintf("found %ld processor\n", mpncpu);
} else {
kprintf("found %ld processors\n", mpncpu);
}
#if (HPET)
/* initialise high precision event timers */
hpetinit();
#endif
#if (NEWTMR)
tmrcnt = apicinitcpu(0);
#else
//.........这里部分代码省略.........
开发者ID:SpiritGun,项目名称:OS-Zero,代码行数:101,代码来源:longmode.c
示例20: bufinit
static struct hthead *parsereq(struct bufio *in)
{
struct hthead *req;
struct charbuf method, url, ver;
int c;
req = NULL;
bufinit(method);
bufinit(url);
bufinit(ver);
while(1) {
c = biogetc(in);
if(c == ' ') {
break;
} else if((c == EOF) || (c < 32) || (c >= 128)) {
goto fail;
} else {
bufadd(method, c);
if(method.d >= 128)
goto fail;
}
}
while(1) {
c = biogetc(in);
if(c == ' ') {
break;
} else if((c == EOF) || (c < 32)) {
goto fail;
} else {
bufadd(url, c);
if(url.d >= 65536)
goto fail;
}
}
while(1) {
c = biogetc(in);
if(c == 10) {
break;
} else if(c == 13) {
} else if((c == EOF) || (c < 32) || (c >= 128)) {
goto fail;
} else {
bufadd(ver, c);
if(ver.d >= 128)
goto fail;
}
}
bufadd(method, 0);
bufadd(url, 0);
bufadd(ver, 0);
req = mkreq(method.b, url.b, ver.b);
if(parseheadersb(req, in))
goto fail;
trimx(req);
goto out;
fail:
if(req != NULL) {
freehthead(req);
req = NULL;
}
out:
buffree(method);
buffree(url);
buffree(ver);
return(req);
}
开发者ID:dolda2000,项目名称:ashd,代码行数:67,代码来源:htparser.c
注:本文中的bufinit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论