提交 d6b9af47 编写于 作者: Y Yanyan Jiang

fix boot bugs

上级 2d6f29a8
......@@ -31,7 +31,7 @@ enum {
#define _PROT_WRITE 4 // can write
#define _PROT_EXEC 8 // can execute
// A memory area of [@start, @end)
// Memory area for [@start, @end)
typedef struct _Area {
void *start, *end;
} _Area;
......
......@@ -40,10 +40,10 @@ void _halt(int code) {
static void sys_init() {
for (char *st = (char *)0xf0000; st != (char *)0xffffff; st ++) {
if (*(uint32_t *)st == MP_MAGIC) {
MPConf *conf = ((MPDesc *)st)->conf;
if (*(volatile uint32_t *)st == MP_MAGIC) {
volatile MPConf *conf = ((volatile MPDesc *)st)->conf;
lapic = conf->lapicaddr;
for (char *ptr = (char *)(conf + 1);
for (volatile char *ptr = (char *)(conf + 1);
ptr < (char *)conf + conf->length; ) {
if (*ptr == MP_PROC) {
ptr += 20;
......@@ -60,7 +60,7 @@ static void sys_init() {
panic("seems not an x86-qemu machine");
}
void memory_init() {
static void memory_init() {
extern char end;
uintptr_t st, ed, step = 1L << 20; // probe step: 1 MB
st = ed = (((uintptr_t)&end) & ~(step - 1)) + step;
......
NAME = mptest
SRCS = main.cpp
SRCS = main.c
LIBS += klib
include $(AM_HOME)/Makefile.app
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册