Kernel messages infrastructure
[akaros.git] / kern / arch / sparc / cpuinfo.c
index 3609f51..a1a9198 100644 (file)
@@ -6,6 +6,10 @@
 #include <smp.h>
 #include <pmap.h>
 
+#ifdef __SHARC__
+#pragma nosharc
+#endif
+
 #ifdef __DEPUTY__
 #pragma nodeputy
 #endif
@@ -15,8 +19,8 @@ static_asserts_can_go_here()
 {
        static_assert(SIZEOF_TRAPFRAME_T == sizeof(trapframe_t));
        static_assert(SIZEOF_TRAPFRAME_T % 8 == 0);
-       static_assert(SIZEOF_ACTIVE_MESSAGE_T == sizeof(active_message_t));
-       static_assert(SIZEOF_ACTIVE_MESSAGE_T % 8 == 0);
+       static_assert(SIZEOF_KERNEL_MESSAGE_T == sizeof(kernel_message_t));
+       static_assert(SIZEOF_KERNEL_MESSAGE_T % 8 == 0);
        static_assert(offsetof(env_t,env_tf) % 8 == 0);
        static_assert(offsetof(env_t,env_ancillary_state) % 8 == 0);
 }
@@ -36,6 +40,7 @@ print_cpuinfo(void)
 
        cprintf("CPU Info:\n");
        cprintf("ISA:             SPARC V8\n");
+       cprintf("Number of cores: %d\n",num_cores());
        cprintf("Implementation:  0x%x\n",(psr >> 28) & 0xF);
        cprintf("Version:         0x%x\n",(psr >> 24) & 0xF);
        cprintf("Number of Cores: %d\n",num_cpus);
@@ -70,7 +75,7 @@ void show_mapping(uintptr_t start, size_t size)
                {
                        cprintf("%08p  %1d %1d %1d  %1x  %1d\n",page2pa(page),
                                !!(*pte & PTE_C),!!(*pte & PTE_M),
-                               !!(*pte & PTE_R),PTE_ACC(*pte),
+                               !!(*pte & PTE_R),(*pte & PTE_ACC) >> 2,
                                !!(*pte & PTE_PTE));
                }
                else
@@ -82,7 +87,6 @@ void
 backtrace(void)
 {
        int i = 0, j;
-       env_t* curenv = curenvs[core_id()];
 
        flush_windows();
 
@@ -115,11 +119,11 @@ backtrace(void)
                        newsp = *((void**)sp+14);
                        pc = *((void**)sp+15);
                }
-               else if(curenv)
+               else if(current)
                {
                        error_t ret;
-                       ret  = memcpy_from_user(curenv,&newsp,(void**)sp+14,sizeof(void*));
-                       ret |= memcpy_from_user(curenv,&pc,(void**)sp+15,sizeof(void*));
+                       ret  = memcpy_from_user(current,&newsp,(void**)sp+14,sizeof(void*));
+                       ret |= memcpy_from_user(current,&pc,(void**)sp+15,sizeof(void*));
                        if(ret)
                        {
                                warn("Backtrace would have caused access exception; corrupt user stack?");
@@ -128,7 +132,7 @@ backtrace(void)
                }
                else
                {
-                       warn("Can't backtrace from user with curenv == NULL!");
+                       warn("Can't backtrace from user with current == NULL!");
                        break;
                }
        }