if( gaPageDir[Addr>>22] & PF_PRESENT )
Log("gaPageTable[0x%x] = 0x%x", Addr>>12, gaPageTable[Addr>>12]);
+ Log("Code at %p accessed %p\n", Regs->eip, Addr);
+
MM_DumpTables(0, -1);
Panic("Page Fault at 0x%x\n", Regs->eip);
Start >>= 12; End >>= 12;
+ #if 0
Log("Directory Entries:");
for(page = Start >> 10;
page < (End >> 10)+1;
);
}
}
+ #endif
Log("Table Entries:");
for(page = Start, curPos = Start<<12;
#define _stdout 1\r
#define _stdin 0\r
\r
-// === IMPORTS ===\r
-extern int fprintfv(FILE *fp, const char *format, va_list args);\r
-\r
// === PROTOTYPES ===\r
EXPORT int atoi(const char *str);\r
EXPORT void exit(int status);\r
}\r
\r
/**\r
+ * \fn EXPORT void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))\r
+ * \brief Sort an array\r
+ * \note Uses a selection sort\r
+ */\r
+EXPORT void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *))\r
+{\r
+ int i, j, min;\r
+ for( i = 0; i < (nmemb-1); i++ )\r
+ {\r
+ min = i;\r
+ for( j = i+1; j < nmemb; j++ )\r
+ {\r
+ if(compar(base+size*j, base + size*min) < 0) {\r
+ min = j;\r
+ }\r
+ }\r
+ if (i != min) {\r
+ char swap[size];\r
+ memcpy(swap, base+size*i, size);\r
+ memcpy(base+size*i, base+size*min, size);\r
+ memcpy(base+size*i, swap, size);\r
+ }\r
+ }\r
+}\r
+\r
+/**\r
+ * \fn EXPORT int atoi(const char *str)\r
+ * \brief Convert a string to an integer\r
*/\r
EXPORT int atoi(const char *str)\r
{\r
# define NULL ((void*)0)\r
#endif\r
\r
+#define EXIT_FAILURE 1\r
+#define EXIT_SUCCESS 0\r
+\r
typedef unsigned int size_t;\r
\r
// --- Spinlock Macros ---\r
// --- StdLib ---\r
extern int atoi(const char *ptr);\r
extern void exit(int status) __attribute__((noreturn));\r
+extern void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));\r
\r
// --- Environment ---\r
extern char *getenv(const char *name);\r