]> Zhao Yanbai Git Server - minix.git/commitdiff
really revert endpoint_t -> int
authorBen Gras <ben@minix3.org>
Mon, 5 Oct 2009 15:47:23 +0000 (15:47 +0000)
committerBen Gras <ben@minix3.org>
Mon, 5 Oct 2009 15:47:23 +0000 (15:47 +0000)
debugging info on panic: decode segment selectors and descriptors, now moved
to arch-specific part, prototypes added; sanity checking in debug.h made
optional with vmassert().

include/minix/type.h
kernel/Makefile
kernel/arch/i386/memory.c
kernel/arch/i386/proto.h
kernel/arch/i386/system.c
kernel/debug.h
kernel/start.c
kernel/utility.c

index 1dadb528b49e88c55e5265e52af07175fe729105..b14a98f13ba60d31f4600af16649fc4d882bc7de 100755 (executable)
@@ -13,7 +13,7 @@
 typedef unsigned int vir_clicks;       /*  virtual addr/length in clicks */
 typedef unsigned long phys_bytes;      /* physical addr/length in bytes */
 typedef unsigned int phys_clicks;      /* physical addr/length in clicks */
-typedef u32_t endpoint_t;                      /* process identifier */
+typedef int endpoint_t;                        /* process identifier */
 
 #if (_MINIX_CHIP == _CHIP_INTEL)
 typedef long unsigned int vir_bytes;   /* virtual addresses/lengths in bytes */
index 407731a77535b4c06bf9226dc08d4cd59f5c7f3b..b4e9f81ab8ed94fd4fc8caed42d9f154828af0da 100755 (executable)
@@ -13,7 +13,7 @@ a = arch/$(ARCH)
 CC =   exec cc
 CPP =  $l/cpp
 LD =   $(CC) -.o
-CPPFLAGS=-I$i -I$a/include
+CPPFLAGS=-I$i -I$a/include -I$a
 CFLAGS=$(CPROFILE) $(CPPFLAGS) $(EXTRA_OPTS)
 LDFLAGS=-i 
 
index 013e609db25eeb177b35df0e59f279a537c0403e..a875a590bf8d74cd080b424d7211a23dc244e3ae 100644 (file)
@@ -37,6 +37,7 @@ PRIVATE int nfreepdes = 0, freepdes[WANT_FREEPDES], inusepde = NOPDE;
 
 FORWARD _PROTOTYPE( u32_t phys_get32, (vir_bytes v)                    );
 FORWARD _PROTOTYPE( void vm_enable_paging, (void)                      );
+FORWARD _PROTOTYPE( void set_cr3, (void)                       );
 
        
 /* *** Internal VM Functions *** */
index dccb92256d10227a28520480b74cace3786c3e13..bb3390b9249e47c38e5c53ac990e67fb4095a5f3 100644 (file)
@@ -84,6 +84,7 @@ _PROTOTYPE( void phys_memset, (phys_bytes ph, u32_t c, phys_bytes bytes)      );
 
 /* protect.c */
 _PROTOTYPE( void prot_init, (void)                                             );
+_PROTOTYPE( void idt_init, (void)                                      );
 _PROTOTYPE( void init_codeseg, (struct segdesc_s *segdp, phys_bytes base,
                 vir_bytes size, int privilege)                          );
 _PROTOTYPE( void init_dataseg, (struct segdesc_s *segdp, phys_bytes base,
@@ -91,6 +92,9 @@ _PROTOTYPE( void init_dataseg, (struct segdesc_s *segdp, phys_bytes base,
 _PROTOTYPE( void enable_iop, (struct proc *pp)                          );
 _PROTOTYPE( int prot_set_kern_seg_limit, (vir_bytes limit)             );
 _PROTOTYPE( void printseg, (char *banner, int iscs, struct proc *pr, u32_t selector)             );
+_PROTOTYPE( u32_t, read_cs(void));
+_PROTOTYPE( u32_t, read_ds(void));
+_PROTOTYPE( u32_t, read_ss(void));
 
 /* prototype of an interrupt vector table entry */
 struct gate_table_s {
index 9aef4ea2dd32827d2fc26480ea26a2be6c7b7cf2..bfdd3f6f19420b840308646304458dff320a0053 100644 (file)
@@ -30,6 +30,17 @@ PUBLIC void arch_shutdown(int how)
        /* Mask all interrupts, including the clock. */
        outb( INT_CTLMASK, ~0);
 
+       if(minix_panicing) {
+               /* We're panicing? Then retrieve and decode currently
+                * loaded segment selectors.
+                */
+               printseg("cs: ", 1, proc_ptr, read_cs());
+               printseg("ds: ", 0, proc_ptr, read_ds());
+               if(read_ds() != read_ss()) {
+                       printseg("ss: ", 0, NULL, read_ss());
+               }
+       }
+
        if(how != RBT_RESET) {
                /* return to boot monitor */
 
index 978a311bc0167e3229ee1aac869940704bc811c7..24ce893bad4e230b21f67581c7552ad6b2ef5d3d 100644 (file)
@@ -25,7 +25,7 @@
 #define DEBUG_TIME_LOCKS               1
 
 /* Runtime sanity checking. */
-#define DEBUG_VMASSERT                 0
+#define DEBUG_VMASSERT                 1
 #define DEBUG_SCHED_CHECK              0
 #define DEBUG_STACK_CHECK              0
 #define DEBUG_TRACE                    0
 #define ENTERED                0xBA5E1514
 #define NOTENTERED     0x1415BEE1
 
-#define NOREC_ENTER(varname) \
-       static int varname = NOTENTERED;        \
-       int mustunlock = 0; \
-       if(!intr_disabled()) { lock; mustunlock = 1; } \
-       if(varname != ENTERED && varname != NOTENTERED) { \
-               printf("magictest: 0x%lx local: 0x%lx\n", magictest, varname);\
-               minix_panic(#varname " bogus value on enter", varname); \
-       }       \
-       if(magictest != MAGICTEST) {    \
-               printf("magictest: 0x%lx local: 0x%lx\n", magictest, varname);\
-               minix_panic(#varname " magictest failed", __LINE__); \
-       }       \
-       if(varname == ENTERED) {        \
-               minix_panic(#varname " recursive enter", __LINE__); \
-       } \
+#define NOREC_ENTER(varname)                                   \
+       static int varname = NOTENTERED;                        \
+       int mustunlock = 0;                                     \
+       if(!intr_disabled()) { lock; mustunlock = 1; }          \
+       vmassert(varname == ENTERED || varname == NOTENTERED);  \
+       vmassert(magictest == MAGICTEST);                       \
+       vmassert(varname != ENTERED);                           \
        varname = ENTERED;
 
-#define NOREC_RETURN(varname, v) do {  \
-       if(!intr_disabled())    \
-               minix_panic(#varname " interrupts on", __LINE__); \
-       if(magictest != MAGICTEST) {    \
-               printf("magictest: 0x%lx local: 0x%lx\n", magictest, varname);\
-               minix_panic(#varname " magictest failed", __LINE__); \
-       }       \
-       if(varname != ENTERED && varname != NOTENTERED) { \
-               printf("magictest: 0x%lx local: 0x%lx\n", magictest, varname);\
-               minix_panic(#varname " bogus value on return", varname); \
-       }       \
-       varname = NOTENTERED;   \
-       if(mustunlock)  { unlock;       } \
-       return v;       \
-       } while(0)
+#define NOREC_RETURN(varname, v) do {                          \
+       vmassert(intr_disabled());                              \
+       vmassert(magictest == MAGICTEST);                       \
+       vmassert(varname == ENTERED || varname == NOTENTERED);  \
+       varname = NOTENTERED;                                   \
+       if(mustunlock)  { unlock;       }                       \
+       return v;                                               \
+} while(0)
 
 #if DEBUG_VMASSERT
 #define vmassert(t) { \
index a1a2b5cb89ac26e785ffbb609dee277cf6aa139b..3580eea7d52d3de3cdb04fce391d532709e1b379 100755 (executable)
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <archconst.h>
+#include <proto.h>
 
 FORWARD _PROTOTYPE( char *get_value, (_CONST char *params, _CONST char *key));
 /*===========================================================================*
index 67a17f338d3eba641ce1c6c8a051cd0ed6537426..fa31cf3fe779e3d004585adc9a9dc39760d7a3a9 100755 (executable)
@@ -48,12 +48,6 @@ if (minix_panicing++) {
        kprintf("\n");
   }
 
-  printseg("cs: ", 1, NULL, read_cs());
-  printseg("ds: ", 0, NULL, read_ds());
-  if(read_ds() != read_ss()) {
-         printseg("ss: ", 0, NULL, read_ss());
-  }
-
   kprintf("kernel: ");
   util_stacktrace();