Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added halt to infinite loops
Jack Lange [Fri, 19 Dec 2008 07:29:55 +0000 (01:29 -0600)]
geekos/include/geekos/kassert.h
geekos/src/geekos/lowlevel.asm
geekos/src/geekos/main.c

index 434a8a8..65e2db3 100644 (file)
@@ -19,6 +19,7 @@ extern struct Kernel_Thread* g_currentThread;
 
 #define KASSERT(cond)                                  \
 do {                                                   \
+  extern void Halt();                                  \
     if (!(cond)) {                                     \
        Set_Current_Attr(ATTRIB(RED, GRAY|BRIGHT));     \
        Print("Failed assertion in %s: %s at %s, line %d, RA=%lx, thread=%p\n",\
@@ -26,16 +27,17 @@ do {                                                        \
                (ulong_t) __builtin_return_address(0),  \
                g_currentThread);                       \
        while (1)                                       \
-          ;                                            \
+         Halt();                                       \
     }                                                  \
 } while (0)
 
 #define TODO(message)                                  \
-do {                                                   \
+  do {                                                 \
+    extern void Halt();                                        \
     Set_Current_Attr(ATTRIB(BLUE, GRAY|BRIGHT));       \
     Print("Unimplemented feature: %s\n", (message));   \
     while (1)                                          \
-       ;                                               \
+      Halt();                                          \
 } while (0)
 
 /*
@@ -66,7 +68,7 @@ do {                                  \
  * Its behavior does not depend on whether or not this
  * is a debug build.
  */
-#define STOP() while (1)
+#define STOP() while (1) {Halt();}
 
 /*
  * Panic function.
@@ -75,7 +77,7 @@ do {                                  \
 do {                                           \
     Set_Current_Attr(ATTRIB(RED, GRAY|BRIGHT));        \
     Print(args);                               \
-    while (1) ;                                        \
+    while (1) Halt();                          \
 } while (0)
 
 #endif  /* GEEKOS_KASSERT_H */
index 2c64e8a..c8d0b8d 100644 (file)
@@ -160,6 +160,9 @@ EXPORT Get_ESP
 ; EBP
 EXPORT Get_EBP
 
+; Halt machine
+EXPORT Halt
+
 ; Virtual memory support.
 EXPORT Enable_Paging
 EXPORT Set_PDBR
@@ -381,6 +384,11 @@ Get_MSR:
 
 
 align 8
+Halt:
+       hlt
+
+
+align 8
 Get_CR2:
        mov     eax, cr2
        ret
index 5d71341..1fbd1c9 100644 (file)
 
 
 
+extern void Halt();
 
 void Spin()
 {
   // hack - competing thread
-  while (1) {};
+  while (1) {Halt();};
 
 }
 
@@ -276,7 +277,7 @@ void Main(struct Boot_Info* bootInfo)
 
 
   SerialPrint("RunVMM returned, spinning\n");
-  while (1) {} 
+  while (1) {Halt();} 
 
 
   TODO("Write a Virtual Machine Monitor");