mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-09 19:36:47 +00:00
🐛 修复空指针错误的问题
This commit is contained in:
parent
dee231d9b8
commit
e03cdea153
@ -11,6 +11,8 @@
|
|||||||
#include "../common/printk.h"
|
#include "../common/printk.h"
|
||||||
#include "gate.h"
|
#include "gate.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 保存函数调用现场的寄存器
|
// 保存函数调用现场的寄存器
|
||||||
#define SAVE_ALL_REGS \
|
#define SAVE_ALL_REGS \
|
||||||
"cld; \n\t" \
|
"cld; \n\t" \
|
||||||
|
@ -126,10 +126,10 @@ typedef struct
|
|||||||
} irq_desc_t;
|
} irq_desc_t;
|
||||||
|
|
||||||
#define IRQ_NUM 24
|
#define IRQ_NUM 24
|
||||||
|
// 这两个表一定要放在这里,否则在HPET初始化后收到中断,会产生page fault
|
||||||
irq_desc_t interrupt_desc[IRQ_NUM] = {0};
|
irq_desc_t interrupt_desc[IRQ_NUM] = {0};
|
||||||
|
|
||||||
|
irq_desc_t SMP_IPI_desc[SMP_IRQ_NUM] = {0};
|
||||||
irq_desc_t SMP_IPI_desc[SMP_IRQ_NUM];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 中断注册函数
|
* @brief 中断注册函数
|
||||||
|
@ -16,8 +16,9 @@ void mm_init()
|
|||||||
memory_management_struct.kernel_data_end = (ul)&_edata;
|
memory_management_struct.kernel_data_end = (ul)&_edata;
|
||||||
memory_management_struct.kernel_end = (ul)&_end;
|
memory_management_struct.kernel_end = (ul)&_end;
|
||||||
|
|
||||||
struct multiboot_mmap_entry_t *mb2_mem_info;
|
struct multiboot_mmap_entry_t mb2_mem_info[512];
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
multiboot2_iter(multiboot2_get_memory, mb2_mem_info, &count);
|
multiboot2_iter(multiboot2_get_memory, mb2_mem_info, &count);
|
||||||
|
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
@ -27,15 +28,15 @@ void mm_init()
|
|||||||
Total_Memory += mb2_mem_info->len;
|
Total_Memory += mb2_mem_info->len;
|
||||||
|
|
||||||
// 保存信息到mms
|
// 保存信息到mms
|
||||||
memory_management_struct.e820[i].BaseAddr = mb2_mem_info->addr;
|
memory_management_struct.e820[i].BaseAddr = mb2_mem_info[i].addr;
|
||||||
memory_management_struct.e820[i].Length = mb2_mem_info->len;
|
memory_management_struct.e820[i].Length = mb2_mem_info[i].len;
|
||||||
memory_management_struct.e820[i].type = mb2_mem_info->type;
|
memory_management_struct.e820[i].type = mb2_mem_info[i].type;
|
||||||
memory_management_struct.len_e820 = i;
|
memory_management_struct.len_e820 = i;
|
||||||
|
|
||||||
++mb2_mem_info;
|
|
||||||
|
|
||||||
// 脏数据
|
// 脏数据
|
||||||
if (mb2_mem_info->type > 4 || mb2_mem_info->len == 0 || mb2_mem_info->type < 1)
|
if (mb2_mem_info[i].type > 4 || mb2_mem_info[i].len == 0 || mb2_mem_info[i].type < 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printk("[ INFO ] Total amounts of RAM : %ld bytes\n", Total_Memory);
|
printk("[ INFO ] Total amounts of RAM : %ld bytes\n", Total_Memory);
|
||||||
@ -200,6 +201,7 @@ void mm_init()
|
|||||||
|
|
||||||
kinfo("Memory management unit initialize complete!");
|
kinfo("Memory management unit initialize complete!");
|
||||||
|
|
||||||
|
|
||||||
flush_tlb();
|
flush_tlb();
|
||||||
// 初始化slab内存池
|
// 初始化slab内存池
|
||||||
slab_init();
|
slab_init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user