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 */
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
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 *** */
/* 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,
_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 {
/* 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 */
#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) { \
#include <stdlib.h>
#include <string.h>
#include <archconst.h>
+#include <proto.h>
FORWARD _PROTOTYPE( char *get_value, (_CONST char *params, _CONST char *key));
/*===========================================================================*
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();