Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode Rename the debug printf's to use a thunk_ ...



details:   https://anonhg.NetBSD.org/src/rev/8611d843ae8d
branches:  trunk
changeset: 772421:8611d843ae8d
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Tue Jan 03 12:05:00 2012 +0000

description:
Rename the debug printf's to use a thunk_ prefix to avoid confusion.

diffstat:

 sys/arch/usermode/dev/cpu.c          |   30 +++++----
 sys/arch/usermode/dev/ld_thunkbus.c  |    8 +-
 sys/arch/usermode/include/thunk.h    |    5 +-
 sys/arch/usermode/usermode/pmap.c    |  102 +++++++++++++++++-----------------
 sys/arch/usermode/usermode/syscall.c |   12 ++--
 sys/arch/usermode/usermode/thunk.c   |   29 ++++++---
 sys/arch/usermode/usermode/trap.c    |   34 +++++-----
 7 files changed, 118 insertions(+), 102 deletions(-)

diffs (truncated from 768 to 300 lines):

diff -r 717d4828754c -r 8611d843ae8d sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Tue Jan 03 10:53:46 2012 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Tue Jan 03 12:05:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.57 2011/12/27 14:55:31 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "opt_hz.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.57 2011/12/27 14:55:31 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -164,7 +164,7 @@
        struct cpu_info *ci = curcpu();
 
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_switchto [%s,pid=%d,lid=%d] -> [%s,pid=%d,lid=%d]\n",
+       thunk_printf_debug("cpu_switchto [%s,pid=%d,lid=%d] -> [%s,pid=%d,lid=%d]\n",
            oldlwp ? oldlwp->l_name : "none",
            oldlwp ? oldlwp->l_proc->p_pid : -1,
            oldlwp ? oldlwp->l_lid : -1,
@@ -172,14 +172,14 @@
            newlwp ? newlwp->l_proc->p_pid : -1,
            newlwp ? newlwp->l_lid : -1);
        if (oldpcb) {
-               dprintf_debug("    oldpcb uc_link=%p, uc_stack.ss_sp=%p, "
+               thunk_printf_debug("    oldpcb uc_link=%p, uc_stack.ss_sp=%p, "
                    "uc_stack.ss_size=%d\n",
                    oldpcb->pcb_ucp.uc_link,
                    oldpcb->pcb_ucp.uc_stack.ss_sp,
                    (int)oldpcb->pcb_ucp.uc_stack.ss_size);
        }
        if (newpcb) {
-               dprintf_debug("    newpcb uc_link=%p, uc_stack.ss_sp=%p, "
+               thunk_printf_debug("    newpcb uc_link=%p, uc_stack.ss_sp=%p, "
                    "uc_stack.ss_size=%d\n",
                    newpcb->pcb_ucp.uc_link,
                    newpcb->pcb_ucp.uc_stack.ss_sp,
@@ -203,7 +203,7 @@
        }
 
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_switchto: returning %p (was %p)\n", ci->ci_stash, oldlwp);
+       thunk_printf_debug("cpu_switchto: returning %p (was %p)\n", ci->ci_stash, oldlwp);
 #endif
        return ci->ci_stash;
 }
@@ -212,7 +212,7 @@
 cpu_dumpconf(void)
 {
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_dumpconf\n");
+       thunk_printf_debug("cpu_dumpconf\n");
 #endif
 }
 
@@ -228,7 +228,7 @@
        ucontext_t *ucp = &pcb->pcb_userret_ucp;
 
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_getmcontext\n");
+       thunk_printf_debug("cpu_getmcontext\n");
 #endif
        memcpy(mcp, &ucp->uc_mcontext, sizeof(mcontext_t));
        return;
@@ -241,7 +241,7 @@
        ucontext_t *ucp = &pcb->pcb_userret_ucp;
 
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_setmcontext\n");
+       thunk_printf_debug("cpu_setmcontext\n");
 #endif
        memcpy(&ucp->uc_mcontext, mcp, sizeof(mcontext_t));
        return 0;
@@ -262,7 +262,7 @@
 cpu_lwp_free(struct lwp *l, int proc)
 {
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_lwp_free (dummy)\n");
+       thunk_printf_debug("cpu_lwp_free (dummy)\n");
 #endif
 }
 
@@ -272,7 +272,7 @@
        struct pcb *pcb = lwp_getpcb(l);
 
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_lwp_free2\n");
+       thunk_printf_debug("cpu_lwp_free2\n");
 #endif
 
        if (pcb == NULL)
@@ -301,7 +301,7 @@
 cpu_lwp_trampoline(ucontext_t *ucp, void (*func)(void *), void *arg)
 {
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_lwp_trampoline called with func %p, arg %p\n", (void *) func, arg);
+       thunk_printf_debug("cpu_lwp_trampoline called with func %p, arg %p\n", (void *) func, arg);
 #endif
        /* init lwp */
        lwp_startup(curcpu()->ci_stash, curlwp);
@@ -320,7 +320,7 @@
        void *stack_ucp, *stack_syscall_ucp, *stack_pagefault_ucp;
 
 #ifdef CPU_DEBUG
-       dprintf_debug("cpu_lwp_fork [%s/%p] -> [%s/%p] stack=%p stacksize=%d\n",
+       thunk_printf_debug("cpu_lwp_fork [%s/%p] -> [%s/%p] stack=%p stacksize=%d\n",
            l1 ? l1->l_name : "none", l1,
            l2 ? l2->l_name : "none", l2,
            stack, (int)stacksize);
@@ -338,6 +338,10 @@
        stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT);
        pcb2->pcb_needfree = true;
 
+       KASSERT(stack_ucp);
+       KASSERT(stack_syscall_ucp);
+       KASSERT(stack_pagefault_ucp);
+
        if (thunk_getcontext(&pcb2->pcb_ucp))
                panic("getcontext failed");
 
diff -r 717d4828754c -r 8611d843ae8d sys/arch/usermode/dev/ld_thunkbus.c
--- a/sys/arch/usermode/dev/ld_thunkbus.c       Tue Jan 03 10:53:46 2012 +0000
+++ b/sys/arch/usermode/dev/ld_thunkbus.c       Tue Jan 03 12:05:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_thunkbus.c,v 1.24 2011/12/14 21:22:24 jmcneill Exp $ */
+/* $NetBSD: ld_thunkbus.c,v 1.25 2012/01/03 12:05:01 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.24 2011/12/14 21:22:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_thunkbus.c,v 1.25 2012/01/03 12:05:01 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -182,9 +182,9 @@
        }
 
 done:
-       dprintf_debug("\tfin\n");
+       thunk_printf_debug("\tfin\n");
        if (bp->b_error)
-               dprintf_debug("error!\n");
+               thunk_printf_debug("error!\n");
 
        sc->busy = false;
        lddone(&sc->sc_ld, bp);
diff -r 717d4828754c -r 8611d843ae8d sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Tue Jan 03 10:53:46 2012 +0000
+++ b/sys/arch/usermode/include/thunk.h Tue Jan 03 12:05:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.54 2011/12/31 21:31:15 christos Exp $ */
+/* $NetBSD: thunk.h,v 1.55 2012/01/03 12:05:01 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -70,7 +70,8 @@
 
 struct aiocb;
 
-void   dprintf_debug(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
+void   thunk_printf_debug(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
+void   thunk_printf(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
 
 int    thunk_setitimer(int, const struct thunk_itimerval *, struct thunk_itimerval *);
 int    thunk_gettimeofday(struct thunk_timeval *, void *);
diff -r 717d4828754c -r 8611d843ae8d sys/arch/usermode/usermode/pmap.c
--- a/sys/arch/usermode/usermode/pmap.c Tue Jan 03 10:53:46 2012 +0000
+++ b/sys/arch/usermode/usermode/pmap.c Tue Jan 03 12:05:00 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.89 2012/01/02 09:49:12 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.90 2012/01/03 12:05:00 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <reinoud%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.89 2012/01/02 09:49:12 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.90 2012/01/03 12:05:00 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -154,13 +154,13 @@
        vm_min_addr = thunk_get_vm_min_address();
        vm_min_addr = vm_min_addr < PAGE_SIZE ? PAGE_SIZE : vm_min_addr;
 
-       dprintf_debug("Information retrieved from system and elf image\n");
-       dprintf_debug("min VM address      at %p\n", (void *) vm_min_addr);
-       dprintf_debug("start kernel        at %p\n", _start);
-       dprintf_debug("  end kernel        at %p\n", &etext);
-       dprintf_debug("  end of init. data at %p\n", &edata);
-       dprintf_debug("1st end of data     at %p\n", &end);
-       dprintf_debug("CUR end data        at %p\n", thunk_sbrk(0));
+       thunk_printf_debug("Information retrieved from system and elf image\n");
+       thunk_printf_debug("min VM address      at %p\n", (void *) vm_min_addr);
+       thunk_printf_debug("start kernel        at %p\n", _start);
+       thunk_printf_debug("  end kernel        at %p\n", &etext);
+       thunk_printf_debug("  end of init. data at %p\n", &edata);
+       thunk_printf_debug("1st end of data     at %p\n", &end);
+       thunk_printf_debug("CUR end data        at %p\n", thunk_sbrk(0));
 
        /* calculate kernel section (R-X) */
        kmem_k_start = (vaddr_t) PAGE_SIZE * (atop(_start)    );
@@ -217,7 +217,7 @@
                panic("pmap_bootstrap: kvm uvm space protection "
                        "failed (%d)\n", thunk_geterrno());
 
-       dprintf_debug("Creating memory mapped backend\n");
+       thunk_printf_debug("Creating memory mapped backend\n");
 
        /* create memory file since mmap/maccess only can be on files */
        strlcpy(mem_name, "/tmp/netbsd.XXXXXX", sizeof(mem_name));
@@ -274,14 +274,14 @@
        /* calculate pv table size */
        phys_npages = (free_end - free_start) / PAGE_SIZE;
        pv_table_size = round_page(phys_npages * sizeof(struct pv_entry));
-       dprintf_debug("claiming %"PRIu64" KB of pv_table for "
+       thunk_printf_debug("claiming %"PRIu64" KB of pv_table for "
                "%"PRIdPTR" pages of physical memory\n",
                (uint64_t) pv_table_size/1024, (uintptr_t) phys_npages);
 
        /* calculate number of pmap entries needed for a complete map */
        pm_nentries = (VM_MAX_KERNEL_ADDRESS - VM_MIN_ADDRESS) / PAGE_SIZE;
        pm_entries_size = round_page(pm_nentries * sizeof(struct pv_entry *));
-       dprintf_debug("tlb va->pa lookup table is %"PRIu64" KB for "
+       thunk_printf_debug("tlb va->pa lookup table is %"PRIu64" KB for "
                "%d logical pages\n", pm_entries_size/1024, pm_nentries);
 
        /* calculate how big the l1 tables are going to be */
@@ -300,7 +300,7 @@
 
        memset(pv_table, 0, pv_table_size);     /* test and clear */
 
-       dprintf_debug("pv_table initialiased correctly, mmap works\n");
+       thunk_printf_debug("pv_table initialiased correctly, mmap works\n");
 
        /* advance */
        kmem_ext_cur_start += pv_table_size;
@@ -318,7 +318,7 @@
 
        memset(tlb, 0, pm_entries_size);        /* test and clear */
 
-       dprintf_debug("kernel tlb entries initialized correctly\n");
+       thunk_printf_debug("kernel tlb entries initialized correctly\n");
 
        /* advance */
        kmem_ext_cur_start += pm_entries_size;
@@ -341,7 +341,7 @@
 
        memset(pmap->pm_l1, 0, pm_l1_size);     /* test and clear */
 
-       dprintf_debug("kernel pmap l1 table initialiased correctly\n");
+       thunk_printf_debug("kernel pmap l1 table initialiased correctly\n");
 
        /* advance for l1 tables */
        kmem_ext_cur_start += round_page(pm_l1_size);
@@ -379,25 +379,25 @@
                va = (vaddr_t) pv_table + pg;
                pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
        }
-       dprintf_debug("pv_table mem added to the kernel pmap\n");
+       thunk_printf_debug("pv_table mem added to the kernel pmap\n");
        for (pg = 0; pg < pm_entries_size; pg += PAGE_SIZE) {
                pa = tlb_fpos + pg;
                va = (vaddr_t) tlb + pg;
                pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
        }
-       dprintf_debug("kernel tlb entries mem added to the kernel pmap\n");
+       thunk_printf_debug("kernel tlb entries mem added to the kernel pmap\n");
        for (pg = 0; pg < pm_l1_size; pg += PAGE_SIZE) {
                pa = pm_l1_fpos + pg;
                va = (vaddr_t) pmap->pm_l1 + pg;
                pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
        }
-       dprintf_debug("kernel pmap l1 mem added to the kernel pmap\n");
+       thunk_printf_debug("kernel pmap l1 mem added to the kernel pmap\n");
        for (pg = 0; pg < pm_entries_size; pg += PAGE_SIZE) {
                pa = pm_fpos + pg;
                va = (vaddr_t) kernel_pm_entries + pg;
                pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, 0);
        }
-       dprintf_debug("kernel pmap entries mem added to the kernel pmap\n");
+       thunk_printf_debug("kernel pmap entries mem added to the kernel pmap\n");
 
        /* add file space to uvm's FREELIST */
        /* XXX really from 0? or from fpos to have better stats */
@@ -456,7 +456,7 @@
                pmap_initialised = 1;



Home | Main Index | Thread Index | Old Index