Synced up RISC-V build
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>
Wed, 1 Jun 2011 02:21:33 +0000 (19:21 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:36:03 +0000 (17:36 -0700)
kern/arch/riscv/Makefrag
kern/arch/riscv/cpuinfo.c
kern/arch/riscv/kdebug.c [new file with mode: 0644]
kern/arch/riscv/kdebug.h [new file with mode: 0644]
kern/arch/riscv/trap.c
kern/src/testing.c

index 54ec04d..a4709fa 100644 (file)
@@ -26,3 +26,4 @@ KERN_ARCH_SRCFILES := $(KERN_ARCH_SRC_DIR)/boot.S \
                       $(KERN_ARCH_SRC_DIR)/process.c \
                       $(KERN_ARCH_SRC_DIR)/env.c \
                       $(KERN_ARCH_SRC_DIR)/init.c \
+                      $(KERN_ARCH_SRC_DIR)/kdebug.c \
index cfe56b9..066c05b 100644 (file)
@@ -43,9 +43,3 @@ void show_mapping(uintptr_t start, size_t size)
                        cprintf("%016p\n",0);
        }
 }
-
-void
-backtrace(void)
-{
-  panic("No backtrace yet!");
-}
diff --git a/kern/arch/riscv/kdebug.c b/kern/arch/riscv/kdebug.c
new file mode 100644 (file)
index 0000000..1fb4785
--- /dev/null
@@ -0,0 +1,30 @@
+#ifdef __SHARC__
+#pragma nosharc
+#endif
+
+#include <stab.h>
+#include <string.h>
+#include <assert.h>
+#include <kdebug.h>
+#include <pmap.h>
+#include <process.h>
+
+#include <ros/memlayout.h>
+
+int debuginfo_eip(uintptr_t eip, struct eipdebuginfo *info)
+{
+       // DWARF-2 works for RISC-V, so in principle this is implementable.
+       
+       static bool once = TRUE;
+       if (once) {
+               warn("Not implemented for RISC-V");
+               once = FALSE;
+       }
+       return 0;
+}
+
+void
+backtrace(void)
+{
+  panic("No backtrace yet!");
+}
diff --git a/kern/arch/riscv/kdebug.h b/kern/arch/riscv/kdebug.h
new file mode 100644 (file)
index 0000000..4d13768
--- /dev/null
@@ -0,0 +1,22 @@
+/* Copyright (c) 2011 The Regents of the University of California
+ * Barret Rhoden <brho@cs.berkeley.edu>
+ * See LICENSE for details.
+ *
+ * x86-specific Kernel debugging headers and static inlines */
+
+#ifndef ROS_KERN_ARCH_KDEBUG_H
+#define ROS_KERN_ARCH_KDEBUG_H
+
+#include <ros/common.h>
+#include <arch/arch.h>
+
+#include <stdio.h>
+
+/* Returns a PC/EIP in the function that called us, preferably near the call
+ * site.  Returns 0 when we can't jump back any farther. */
+static inline uintptr_t get_caller_pc(void)
+{
+       return read_pc();
+}
+
+#endif /* ROS_KERN_ARCH_KDEBUG_H */
index 2cf08ae..5492ebf 100644 (file)
@@ -435,3 +435,8 @@ handle_trap(trapframe_t* tf)
        
        env_pop_tf(tf);
 }
+
+/* We don't have NMIs now. */
+void send_nmi(uint32_t os_coreid)
+{
+}
index 884828a..fe02daf 100644 (file)
@@ -1322,7 +1322,7 @@ void test_atomics(void)
                        if (attempt == 0) 
                                old_num++;
                        attempt++;      
-               } while (!atomic_comp_swap((uint32_t*)&actual_num, old_num, old_num + 10));
+               } while (!atomic_comp_swap((uintptr_t*)&actual_num, old_num, old_num + 10));
                if (actual_num != init_val + 10)
                        printk("FUCK, CAS test failed for %d\n", init_val);
        }