no more kprintf - kernel uses libsys printf now, only kputc is special

to the kernel.
This commit is contained in:
Ben Gras
2010-03-03 15:45:01 +00:00
parent 18924ea563
commit e6cb76a2e2
34 changed files with 213 additions and 224 deletions

View File

@@ -38,7 +38,7 @@ PUBLIC int do_copy(struct proc * caller, message * m_ptr)
if (first)
{
first= 0;
kprintf(
printf(
"do_copy: got request from %d (source %d, seg %d, destination %d, seg %d)\n",
m_ptr->m_source,
m_ptr->CP_SRC_ENDPT,
@@ -68,7 +68,7 @@ PUBLIC int do_copy(struct proc * caller, message * m_ptr)
vir_addr[i].proc_nr_e = m_ptr->m_source;
if (vir_addr[i].segment != PHYS_SEG) {
if(! isokendpt(vir_addr[i].proc_nr_e, &p)) {
kprintf("do_copy: %d: seg 0x%x, %d not ok endpoint\n",
printf("do_copy: %d: seg 0x%x, %d not ok endpoint\n",
i, vir_addr[i].segment, vir_addr[i].proc_nr_e);
return(EINVAL);
}

View File

@@ -33,15 +33,15 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
cprof_ctl_inst.reset = 1;
kprintf("CPROFILE notice: resetting tables:");
printf("CPROFILE notice: resetting tables:");
for (i=0; i<cprof_procs_no; i++) {
kprintf(" %s", cprof_proc_info[i].name);
printf(" %s", cprof_proc_info[i].name);
/* Test whether proc still alive. */
if (!isokendpt(cprof_proc_info[i].endpt, &proc_nr)) {
kprintf("endpt not valid %u (%s)\n",
printf("endpt not valid %u (%s)\n",
cprof_proc_info[i].endpt, cprof_proc_info[i].name);
continue;
}
@@ -51,7 +51,7 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
cprof_proc_info[i].endpt, cprof_proc_info[i].ctl_v,
sizeof(cprof_ctl_inst.reset));
}
kprintf("\n");
printf("\n");
return OK;
@@ -69,7 +69,7 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
cprof_mem_size = m_ptr->PROF_MEM_SIZE;
kprintf("CPROFILE notice: getting tables:");
printf("CPROFILE notice: getting tables:");
/* Copy control structs of profiled processes to calculate total
* nr of bytes to be copied to user program and find out if any
@@ -79,11 +79,11 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
for (i=0; i<cprof_procs_no; i++) {
kprintf(" %s", cprof_proc_info[i].name);
printf(" %s", cprof_proc_info[i].name);
/* Test whether proc still alive. */
if (!isokendpt(cprof_proc_info[i].endpt, &proc_nr)) {
kprintf("endpt not valid %u (%s)\n",
printf("endpt not valid %u (%s)\n",
cprof_proc_info[i].endpt, cprof_proc_info[i].name);
continue;
}
@@ -102,7 +102,7 @@ PUBLIC int do_cprofile(struct proc * caller, message * m_ptr)
/* Collect errors. */
cprof_info.err |= cprof_ctl_inst.err;
}
kprintf("\n");
printf("\n");
/* Do we have the space available? */
if (cprof_mem_size < cprof_info.mem_used) cprof_info.mem_used = -1;

View File

@@ -39,7 +39,7 @@ PUBLIC int do_devio(struct proc * caller, message * m_ptr)
privp= priv(caller);
if (!privp)
{
kprintf("no priv structure!\n");
printf("no priv structure!\n");
goto doit;
}
if (privp->s_flags & CHECK_IO_PORT)
@@ -53,7 +53,7 @@ PUBLIC int do_devio(struct proc * caller, message * m_ptr)
}
if (i >= nr_io_range)
{
kprintf("do_devio: port 0x%x (size %d) not allowed\n",
printf("do_devio: port 0x%x (size %d) not allowed\n",
m_ptr->DIO_PORT, size);
return EPERM;
}
@@ -62,7 +62,7 @@ PUBLIC int do_devio(struct proc * caller, message * m_ptr)
doit:
if (m_ptr->DIO_PORT & (size-1))
{
kprintf("do_devio: unaligned port 0x%x (size %d)\n",
printf("do_devio: unaligned port 0x%x (size %d)\n",
m_ptr->DIO_PORT, size);
return EPERM;
}

View File

@@ -120,7 +120,7 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr)
int bin = m_ptr->I_VAL_LEN2_E;
if(bin < 0 || bin >= RANDOM_SOURCES) {
kprintf("SYSTEM: GET_RANDOMNESS_BIN: %d out of range\n", bin);
printf("SYSTEM: GET_RANDOMNESS_BIN: %d out of range\n", bin);
return EINVAL;
}
@@ -176,7 +176,7 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr)
}
default:
kprintf("do_getinfo: invalid request %d\n", m_ptr->I_REQUEST);
printf("do_getinfo: invalid request %d\n", m_ptr->I_REQUEST);
return(EINVAL);
}

View File

@@ -62,7 +62,7 @@ PUBLIC int do_irqctl(struct proc * caller, message * m_ptr)
privp= priv(caller);
if (!privp)
{
kprintf("do_irqctl: no priv structure!\n");
printf("do_irqctl: no priv structure!\n");
return EPERM;
}
if (privp->s_flags & CHECK_IRQ)
@@ -74,7 +74,7 @@ PUBLIC int do_irqctl(struct proc * caller, message * m_ptr)
}
if (i >= privp->s_nr_irq)
{
kprintf(
printf(
"do_irqctl: IRQ check failed for proc %d, IRQ %d\n",
m_ptr->m_source, irq_vec);
return EPERM;

View File

@@ -38,7 +38,7 @@ PUBLIC int newmap(struct proc *caller, struct proc *rp, struct mem_map *map_ptr)
/* Fetch the memory map. */
if((r=data_copy(caller->p_endpoint, (vir_bytes) map_ptr,
KERNEL, (vir_bytes) rp->p_memmap, sizeof(rp->p_memmap))) != OK) {
kprintf("newmap: data_copy failed! (%d)\n", r);
printf("newmap: data_copy failed! (%d)\n", r);
return r;
}

View File

@@ -86,7 +86,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
*/
if ((i=get_priv(rp, priv_id)) != OK)
{
kprintf("do_privctl: unable to allocate priv_id %d: %d\n",
printf("do_privctl: unable to allocate priv_id %d: %d\n",
priv_id, i);
return(i);
}
@@ -135,7 +135,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
{
priv(rp)->s_irq_tab[i]= priv.s_irq_tab[i];
#if 0
kprintf("do_privctl: adding IRQ %d for %d\n",
printf("do_privctl: adding IRQ %d for %d\n",
priv(rp)->s_irq_tab[i], rp->p_endpoint);
#endif
}
@@ -150,7 +150,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
{
priv(rp)->s_io_tab[i]= priv.s_io_tab[i];
#if 0
kprintf("do_privctl: adding I/O range [%x..%x] for %d\n",
printf("do_privctl: adding I/O range [%x..%x] for %d\n",
priv(rp)->s_io_tab[i].ior_base,
priv(rp)->s_io_tab[i].ior_limit,
rp->p_endpoint);
@@ -167,7 +167,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
{
priv(rp)->s_mem_tab[i]= priv.s_mem_tab[i];
#if 0
kprintf("do_privctl: adding mem range [%x..%x] for %d\n",
printf("do_privctl: adding mem range [%x..%x] for %d\n",
priv(rp)->s_mem_tab[i].mr_base,
priv(rp)->s_mem_tab[i].mr_limit,
rp->p_endpoint);
@@ -219,7 +219,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
if (strcmp(rp->p_name, "fxp") == 0 ||
strcmp(rp->p_name, "rtl8139") == 0)
{
kprintf("setting ipc_stats_target to %d\n", rp->p_endpoint);
printf("setting ipc_stats_target to %d\n", rp->p_endpoint);
ipc_stats_target= rp->p_endpoint;
}
#endif
@@ -303,7 +303,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr)
return EPERM;
}
default:
kprintf("do_privctl: bad request %d\n", m_ptr->CTL_REQUEST);
printf("do_privctl: bad request %d\n", m_ptr->CTL_REQUEST);
return EINVAL;
}
}

View File

@@ -54,12 +54,12 @@ endpoint_t *e_granter; /* new granter (magic grants) */
* grant id.
*/
if(!isokendpt(granter, &proc_nr) ) {
kprintf(
printf(
"grant verify failed: invalid granter %d\n", (int) granter);
return(EINVAL);
}
if(!GRANT_VALID(grant)) {
kprintf(
printf(
"grant verify failed: invalid grant %d\n", (int) grant);
return(EINVAL);
}
@@ -72,7 +72,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
if(!HASGRANTTABLE(granter_proc)) return EPERM;
if(priv(granter_proc)->s_grant_entries <= grant) {
kprintf(
printf(
"verify_grant: grant verify failed in ep %d "
"proc %d: grant %d out of range "
"for table size %d\n",
@@ -89,7 +89,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
if((r=data_copy(granter,
priv(granter_proc)->s_grant_table + sizeof(g)*grant,
KERNEL, (vir_bytes) &g, sizeof(g))) != OK) {
kprintf(
printf(
"verify_grant: grant verify: data_copy failed\n");
return EPERM;
}
@@ -97,7 +97,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/* Check validity. */
if((g.cp_flags & (CPF_USED | CPF_VALID)) !=
(CPF_USED | CPF_VALID)) {
kprintf(
printf(
"verify_grant: grant failed: invalid (%d flags 0x%lx)\n",
grant, g.cp_flags);
return EPERM;
@@ -111,7 +111,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
if((g.cp_flags & CPF_INDIRECT)) {
/* Stop after a few iterations. There may be a loop. */
if (depth == MAX_INDIRECT_DEPTH) {
kprintf(
printf(
"verify grant: indirect grant verify "
"failed: exceeded maximum depth\n");
return ELOOP;
@@ -122,7 +122,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
if(g.cp_u.cp_indirect.cp_who_to != grantee &&
grantee != ANY &&
g.cp_u.cp_indirect.cp_who_to != ANY) {
kprintf(
printf(
"verify_grant: indirect grant verify "
"failed: bad grantee\n");
return EPERM;
@@ -137,7 +137,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/* Check access of grant. */
if(((g.cp_flags & access) != access)) {
kprintf(
printf(
"verify_grant: grant verify failed: access invalid; want 0x%x, have 0x%x\n",
access, g.cp_flags);
return EPERM;
@@ -149,7 +149,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
*/
if(MEM_TOP - g.cp_u.cp_direct.cp_len <
g.cp_u.cp_direct.cp_start - 1) {
kprintf(
printf(
"verify_grant: direct grant verify failed: len too long\n");
return EPERM;
}
@@ -157,7 +157,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/* Verify actual grantee. */
if(g.cp_u.cp_direct.cp_who_to != grantee && grantee != ANY
&& g.cp_u.cp_direct.cp_who_to != ANY) {
kprintf(
printf(
"verify_grant: direct grant verify failed: bad grantee\n");
return EPERM;
}
@@ -165,7 +165,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/* Verify actual copy range. */
if((offset_in+bytes < offset_in) ||
offset_in+bytes > g.cp_u.cp_direct.cp_len) {
kprintf(
printf(
"verify_grant: direct grant verify failed: bad size or range. "
"granted %d bytes @ 0x%lx; wanted %d bytes @ 0x%lx\n",
g.cp_u.cp_direct.cp_len,
@@ -182,7 +182,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
* magic grants.
*/
if(granter != FS_PROC_NR) {
kprintf(
printf(
"verify_grant: magic grant verify failed: granter (%d) "
"is not FS (%d)\n", granter, FS_PROC_NR);
return EPERM;
@@ -191,7 +191,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/* Verify actual grantee. */
if(g.cp_u.cp_magic.cp_who_to != grantee && grantee != ANY
&& g.cp_u.cp_direct.cp_who_to != ANY) {
kprintf(
printf(
"verify_grant: magic grant verify failed: bad grantee\n");
return EPERM;
}
@@ -199,7 +199,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
/* Verify actual copy range. */
if((offset_in+bytes < offset_in) ||
offset_in+bytes > g.cp_u.cp_magic.cp_len) {
kprintf(
printf(
"verify_grant: magic grant verify failed: bad size or range. "
"granted %d bytes @ 0x%lx; wanted %d bytes @ 0x%lx\n",
g.cp_u.cp_magic.cp_len,
@@ -212,7 +212,7 @@ endpoint_t *e_granter; /* new granter (magic grants) */
*offset_result = g.cp_u.cp_magic.cp_start + offset_in;
*e_granter = g.cp_u.cp_magic.cp_who_from;
} else {
kprintf(
printf(
"verify_grant: grant verify failed: unknown grant type\n");
return EPERM;
}
@@ -260,7 +260,7 @@ int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE
/* Verify permission exists. */
if((r=verify_grant(granter, grantee, grantid, bytes, access,
g_offset, &v_offset, &new_granter)) != OK) {
kprintf(
printf(
"grant %d verify to copy %d->%d by %d failed: err %d\n",
grantid, *src, *dst, grantee, r);
return r;
@@ -394,7 +394,7 @@ PUBLIC int do_vsafecopy(struct proc * caller, message * m_ptr)
access = CPF_READ;
granter = vec[i].v_from;
} else {
kprintf("vsafecopy: %d: element %d/%d: no SELF found\n",
printf("vsafecopy: %d: element %d/%d: no SELF found\n",
caller->p_endpoint, i, els);
return EINVAL;
}

View File

@@ -128,14 +128,14 @@ PUBLIC int map_invoke_vm(struct proc * caller,
lin_src = umap_local(src, seg_s, off_s, size);
lin_dst = umap_local(dst, seg_d, off_d, size);
if(lin_src == 0 || lin_dst == 0) {
kprintf("map_invoke_vm: error in umap_local.\n");
printf("map_invoke_vm: error in umap_local.\n");
return EINVAL;
}
/* Make sure the linear addresses are both page aligned. */
if(lin_src % CLICK_SIZE != 0
|| lin_dst % CLICK_SIZE != 0) {
kprintf("map_invoke_vm: linear addresses not page aligned.\n");
printf("map_invoke_vm: linear addresses not page aligned.\n");
return EINVAL;
}
@@ -199,7 +199,7 @@ PUBLIC int do_safemap(struct proc * caller, message * m_ptr)
r = verify_grant(grantor, caller->p_endpoint, gid, bytes, access,
offset, &offset_result, &new_grantor);
if(r != OK) {
kprintf("verify_grant for gid %d from %d to %d failed: %d\n",
printf("verify_grant for gid %d from %d to %d failed: %d\n",
gid, grantor, caller->p_endpoint, r);
return r;
}
@@ -227,7 +227,7 @@ PRIVATE int safeunmap(struct proc * caller, struct map_info_s *p)
r = verify_grant(p->grantor, p->grantee, p->gid, p->bytes,
CPF_MAP, p->offset, &offset_result, &new_grantor);
if(r != OK) {
kprintf("safeunmap: error in verify_grant.\n");
printf("safeunmap: error in verify_grant.\n");
return r;
}
@@ -237,7 +237,7 @@ PRIVATE int safeunmap(struct proc * caller, struct map_info_s *p)
p->bytes, 0);
clear_info(p);
if(r != OK) {
kprintf("safeunmap: error in map_invoke_vm.\n");
printf("safeunmap: error in map_invoke_vm.\n");
return r;
}
return OK;

View File

@@ -119,8 +119,8 @@ PUBLIC int do_sigsend(struct proc * caller, message * m_ptr)
rp->p_misc_flags &= ~MF_FPU_INITIALIZED;
if(!RTS_ISSET(rp, RTS_PROC_STOP)) {
kprintf("system: warning: sigsend a running process\n");
kprintf("caller stack: ");
printf("system: warning: sigsend a running process\n");
printf("caller stack: ");
proc_stacktrace(caller);
}

View File

@@ -37,7 +37,7 @@ PUBLIC int do_sprofile(struct proc * caller, message * m_ptr)
* Turn on profiling.
*/
if (sprofiling) {
kprintf("SYSTEM: start s-profiling: already started\n");
printf("SYSTEM: start s-profiling: already started\n");
return EBUSY;
}
@@ -71,7 +71,7 @@ PUBLIC int do_sprofile(struct proc * caller, message * m_ptr)
* Stop CMOS timer. Copy info struct to user process.
*/
if (!sprofiling) {
kprintf("SYSTEM: stop s-profiling: not started\n");
printf("SYSTEM: stop s-profiling: not started\n");
return EBUSY;
}

View File

@@ -23,13 +23,13 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr)
buf = (vir_bytes) m_ptr->SYSCTL_ARG1;
len = (vir_bytes) m_ptr->SYSCTL_ARG2;
if(len < 1 || len > DIAG_BUFSIZE) {
kprintf("do_sysctl: diag for %d: len %d out of range\n",
printf("do_sysctl: diag for %d: len %d out of range\n",
caller->p_endpoint, len);
return EINVAL;
}
if((s=data_copy_vmcheck(caller, caller->p_endpoint, buf, KERNEL,
(vir_bytes) mybuf, len)) != OK) {
kprintf("do_sysctl: diag for %d: len %d: copy failed: %d\n",
printf("do_sysctl: diag for %d: len %d: copy failed: %d\n",
caller->p_endpoint, len, s);
return s;
}
@@ -43,7 +43,7 @@ PUBLIC int do_sysctl(struct proc * caller, message * m_ptr)
proc_stacktrace(proc_addr(proc_nr));
return OK;
default:
kprintf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE);
printf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE);
return(EINVAL);
}

View File

@@ -60,14 +60,13 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr)
if(verify_grant(targetpr->p_endpoint, ANY, grant, count, 0, 0,
&newoffset, &newep) != OK) {
kprintf("SYSTEM: do_umap: verify_grant in %s, grant %d, bytes 0x%lx, failed, caller %s\n",
targetpr->p_name, (int) grant, count, caller->p_name);
printf("SYSTEM: do_umap: verify_grant in %s, grant %d, bytes 0x%lx, failed, caller %s\n", targetpr->p_name, offset, count, caller->p_name);
proc_stacktrace(caller);
return EFAULT;
}
if(!isokendpt(newep, &new_proc_nr)) {
kprintf("SYSTEM: do_umap: isokendpt failed\n");
printf("SYSTEM: do_umap: isokendpt failed\n");
return EFAULT;
}
@@ -80,15 +79,15 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr)
if(seg_index == T || seg_index == D || seg_index == S) {
phys_addr = lin_addr = umap_local(targetpr, seg_index, offset, count);
} else {
kprintf("SYSTEM: bogus seg type 0x%lx\n", seg_index);
printf("SYSTEM: bogus seg type 0x%lx\n", seg_index);
return EFAULT;
}
if(!lin_addr) {
kprintf("SYSTEM:do_umap: umap_local failed\n");
printf("SYSTEM:do_umap: umap_local failed\n");
return EFAULT;
}
if(vm_lookup(targetpr, lin_addr, &phys_addr, NULL) != OK) {
kprintf("SYSTEM:do_umap: vm_lookup failed\n");
printf("SYSTEM:do_umap: vm_lookup failed\n");
return EFAULT;
}
if(phys_addr == 0)
@@ -102,16 +101,16 @@ PUBLIC int do_umap(struct proc * caller, message * m_ptr)
}
if(vm_running && !vm_contiguous(targetpr, lin_addr, count)) {
kprintf("SYSTEM:do_umap: not contiguous\n");
printf("SYSTEM:do_umap: not contiguous\n");
return EFAULT;
}
m_ptr->CP_DST_ADDR = phys_addr;
if(naughty || phys_addr == 0) {
kprintf("kernel: umap 0x%x done by %d / %s, pc 0x%lx, 0x%lx -> 0x%lx\n",
printf("kernel: umap 0x%x done by %d / %s, pc 0x%lx, 0x%lx -> 0x%lx\n",
seg_type, caller->p_endpoint, caller->p_name,
caller->p_reg.pc, offset, phys_addr);
kprintf("caller stack: ");
printf("caller stack: ");
proc_stacktrace(caller);
}
return (phys_addr == 0) ? EFAULT: OK;

View File

@@ -9,7 +9,7 @@
*===========================================================================*/
PUBLIC int do_unused(struct proc * caller, message * m_ptr)
{
kprintf("SYSTEM: got unused request %d from %d\n",
printf("SYSTEM: got unused request %d from %d\n",
m_ptr->m_type, m_ptr->m_source);
return(EBADREQUEST); /* illegal message type */
}

View File

@@ -92,7 +92,7 @@ PUBLIC int do_vdevio(struct proc * caller, message * m_ptr)
}
if (j >= nr_io_range)
{
kprintf(
printf(
"do_vdevio: I/O port check failed for proc %d, port 0x%x\n",
m_ptr->m_source, port);
return EPERM;

View File

@@ -25,7 +25,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
if(ep == SELF) { ep = m_ptr->m_source; }
if(!isokendpt(ep, &proc_nr)) {
kprintf("do_vmctl: unexpected endpoint %d from VM\n", ep);
printf("do_vmctl: unexpected endpoint %d from VM\n", ep);
return EINVAL;
}
@@ -113,7 +113,7 @@ PUBLIC int do_vmctl(struct proc * caller, message * m_ptr)
vmassert(p->p_vmrequest.vmresult != VMSUSPEND);
#if DEBUG_VMASSERT
if(p->p_vmrequest.vmresult != OK)
kprintf("SYSTEM: VM replied %d to mem request\n",
printf("SYSTEM: VM replied %d to mem request\n",
p->p_vmrequest.vmresult);
printf("memreq reply: vm request sent by: %s / %d about %d; 0x%lx-0x%lx, wr %d, stack: %s ",