Closed cgbahk closed 5 years ago
and following lines seems problem. So it is related to memory
These seems important:
thread/
start.S
loader.S
init.c
seems like 'division by 0' occurs
(gdb) bt
#0 udiv64 (n=3968, d=0) at ../../lib/arithmetic.c:79
#1 0xc00280a1 in umod64 (d=0, n=3968) at ../../lib/arithmetic.c:134
#2 __umoddi3 (n=3968, d=0) at ../../lib/arithmetic.c:188
#3 0xc0026605 in format_integer (value=3968, is_signed=is_signed@entry=false, negative=false,
b=0xc0039550 <base_d>, c=0xc000ef20, output=0xc002a41d <vprintf_helper>, aux=0xc000ef6c)
at ../../lib/stdio.c:510
#4 0xc002700c in __vprintf (format=<optimized out>,
args=0xc000efa8 "\200\226\003\300\217\004\002\300\304", <incomplete sequence \357>,
output=<optimized out>, aux=<optimized out>) at ../../lib/stdio.c:279
#5 0xc002a575 in vprintf (format=0xc002e36c "Pintos booting with %'u kB RAM...\n",
args=0xc000efa4 "\200\017") at ../../lib/kernel/console.c:131
#6 0xc00268e8 in printf (format=0xc002e36c "Pintos booting with %'u kB RAM...\n")
at ../../lib/stdio.c:85
#7 0xc00204c0 in pintos_init () at ../../threads/init.c:94
#8 0xc002015d in start () at ../../threads/start.S:180
So printing format of integer(like) seems erroneous.
After this patch, I can see a Boot complete
diff --git a/src/devices/timer.c b/src/devices/timer.c
index befaaae..0d71724 100644
--- a/src/devices/timer.c
+++ b/src/devices/timer.c
@@ -62,8 +62,6 @@ timer_calibrate (void)
for (test_bit = high_bit >> 1; test_bit != high_bit >> 10; test_bit >>= 1)
if (!too_many_loops (high_bit | test_bit))
loops_per_tick |= test_bit;
-
- printf ("%'"PRIu64" loops/s.\n", (uint64_t) loops_per_tick * TIMER_FREQ);
}
/* Returns the number of timer ticks since the OS booted. */
diff --git a/src/threads/init.c b/src/threads/init.c
index 9e2d3ae..497290c 100644
--- a/src/threads/init.c
+++ b/src/threads/init.c
@@ -90,10 +90,6 @@ pintos_init (void)
thread_init ();
console_init ();
- /* Greet user. */
- printf ("Pintos booting with %'"PRIu32" kB RAM...\n",
- init_ram_pages * PGSIZE / 1024);
-
/* Initialize memory system. */
palloc_init (user_page_limit);
malloc_init ();
diff --git a/src/threads/palloc.c b/src/threads/palloc.c
index 4fc8394..f86ed8b 100644
--- a/src/threads/palloc.c
+++ b/src/threads/palloc.c
@@ -161,8 +161,6 @@ init_pool (struct pool *p, void *base, size_t page_cnt, const char *name)
PANIC ("Not enough memory in %s for bitmap.", name);
page_cnt -= bm_pages;
- printf ("%zu pages available in %s.\n", page_cnt, name);
-
/* Initialize the pool. */
lock_init (&p->lock);
p->used_map = bitmap_create_in_buf (page_cnt, base, bm_pages * PGSIZE);
So the booting is completed. Further issue will be on #4
This line does not work properly:
Output:
This should be sth like this https://github.com/james5233/PintOS