Working PIT irqs, fix GDT bugs
This commit is contained in:
@ -36,6 +36,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <sys/multiboot.h>
|
||||
#include <sys/serialdbg.h>
|
||||
#include <sys/mm.h>
|
||||
#include <sys/pic.h>
|
||||
#include <sys/pit.h>
|
||||
#include <mm/pmm.h>
|
||||
#include <mm/bba.h>
|
||||
#include <mm/liballoc.h>
|
||||
@ -56,13 +58,22 @@ static void dump_multiboot_header(void) {
|
||||
static void mregmap_init1(void) {
|
||||
struct multiboot *mb = multiboot_get();
|
||||
|
||||
mregmap_init();
|
||||
|
||||
struct multiboot_mmap_entry *mmap;
|
||||
usize_t i = 0;
|
||||
for (mmap = (struct multiboot_mmap_entry *)(mb->mmap_addr + VIRT_BASE);
|
||||
(uptr_t)mmap < (mb->mmap_addr + VIRT_BASE + mb->mmap_length);
|
||||
mmap = (struct multiboot_mmap_entry *)((uptr_t)mmap + mmap->size + sizeof(mmap->size))) {
|
||||
dbgf("mmap entry: size=%08x, addr=%08x, len=%08x, type=%u\n",
|
||||
mmap->size, mmap->addr1, mmap->len1, mmap->type);
|
||||
|
||||
/* always skip the first memory map region, because we can't use it */
|
||||
if (i == 0) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
static int type_map[] = {
|
||||
[1] = MREG_AVAIL_RAM,
|
||||
[2] = MREG_I386_PC_RESERVED,
|
||||
@ -78,6 +89,7 @@ static void mregmap_init1(void) {
|
||||
};
|
||||
|
||||
mregmap_add_region(&mreg);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +101,7 @@ static void pmm_init1(void) {
|
||||
usize_t usable_ram_bytes = avail_ram->size;
|
||||
dbgf("usable ram = %08x\n", usable_ram_bytes);
|
||||
|
||||
uptr_t ram_start = ALIGN_UP((uptr_t)&__kernel_end - VIRT_BASE, 0x1000);
|
||||
uptr_t ram_start = ALIGN_UP((uptr_t)&__kernel_end + 0x1000 - VIRT_BASE, 0x1000);
|
||||
uptr_t ram_end = ALIGN_DOWN(0x100000 + usable_ram_bytes, 0x1000);
|
||||
|
||||
usize_t block_size = CFG_I386_PC_PMM_BLOCK_SIZE;
|
||||
@ -122,6 +134,9 @@ void bootmain(void *mbootptr) {
|
||||
pmm_init1();
|
||||
bba_init();
|
||||
mm_init();
|
||||
pit_init();
|
||||
pic_unmask();
|
||||
__asm__ volatile("sti");
|
||||
|
||||
char *string = malloc(12);
|
||||
memset(string, 0, 12);
|
||||
|
||||
Reference in New Issue
Block a user