/* Memory from the end of the kernel through the end of memory
is free. Give it to the page allocator. */
- palloc_init ((void *) (KERN_BASE + kernel_pages * NBPG),
- (void *) (PHYS_BASE + ram_pages * NBPG));
+ palloc_init ((void *) (KERN_BASE + kernel_pages * PGSIZE),
+ (void *) (PHYS_BASE + ram_pages * PGSIZE));
paging_init ();
gdt_init ();
#ifdef FILESYS
filesys_init (false);
- filesys_self_test ();
#endif
thread_init ();
uint32_t e0 = ((limit & 0xffff) /* Limit 15:0. */
| (base << 16)); /* Base 15:0. */
uint32_t e1 = (((base >> 16) & 0xff) /* Base 23:16. */
- | ( system << 12) /* 0=system, 1=code/data. */
- | ( type << 8) /* Segment type. */
+ | (system << 12) /* 0=system, 1=code/data. */
+ | (type << 8) /* Segment type. */
| (dpl << 13) /* Descriptor privilege. */
| (1 << 15) /* Present. */
| (limit & 0xf0000) /* Limit 16:19. */
| (1 << 22) /* 32-bit segment. */
- | ( granularity << 23) /* Byte/page granularity. */
+ | (granularity << 23) /* Byte/page granularity. */
| (base & 0xff000000)); /* Base 31:24. */
return e0 | ((uint64_t) e1 << 32);
}
}
static uint64_t
-make_tss_desc (uint32_t base)
+make_tss_desc (void *vaddr)
{
- return make_seg_desc (base, 0x67, SYS_SYSTEM, TYPE_TSS_32_A, 0, GRAN_BYTE);
+ return make_seg_desc ((uint32_t) vaddr,
+ 0x67, SYS_SYSTEM, TYPE_TSS_32_A, 0, GRAN_BYTE);
}
uint64_t gdt[SEL_CNT];
gdt[SEL_KDSEG / sizeof *gdt] = make_data_desc (0);
gdt[SEL_UCSEG / sizeof *gdt] = make_code_desc (3);
gdt[SEL_UDSEG / sizeof *gdt] = make_data_desc (3);
- gdt[SEL_TSS / sizeof *gdt] = make_tss_desc (vtop (tss));
+ gdt[SEL_TSS / sizeof *gdt] = make_tss_desc (tss);
/* Load GDTR, TR. */
gdtr_operand = make_dtr_operand (sizeof gdt - 1, gdt);