🔧 使cpu支持SSE(目前会出现#GP)

This commit is contained in:
fslongjin
2022-01-27 14:58:14 +08:00
parent ae52d9c2d2
commit 40a551d154
9 changed files with 198 additions and 16 deletions

29
kernel/mm/mm.c Normal file
View File

@ -0,0 +1,29 @@
#include "mm.h"
#include "../common/printk.h"
ul Total_Memory = 0;
void mm_init()
{
// 实模式下获取到的信息的起始地址转换为ARDS指针
struct ARDS *ards_ptr = (struct ARDS *)0xffff800000007e00;
for (int i = 0; i < 32; ++i)
{
printk("Addr = %#10lx,%8lx\tLength = %#10lx,%8lx\tType = %#10lx\n",
ards_ptr->BaseAddrH, ards_ptr->BaseAddrL, ards_ptr->LengthH, ards_ptr->LengthL, ards_ptr->type);
//可用的内存
if (ards_ptr->type == 1)
{
Total_Memory += ards_ptr->LengthL;
Total_Memory += ((ul)(ards_ptr->LengthH)) << 32;
}
++ards_ptr;
// 脏数据
if (ards_ptr->type > 4)
break;
}
printk_color(ORANGE, BLACK, "Total amount of RAM DragonOS can use: %ld bytes\n", Total_Memory);
}

21
kernel/mm/mm.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include"../common/glib.h"
// Address Range Descriptor Structure 地址范围描述符
struct ARDS
{
unsigned int BaseAddrL; // 基地址低32位
unsigned int BaseAddrH; // 基地址高32位
unsigned int LengthL; // 内存长度低32位 以字节为单位
unsigned int LengthH; // 内存长度高32位
unsigned int type; // 本段内存的类型
// type=1 表示可以被操作系统使用
// type=2 ARR - 内存使用中或被保留,操作系统不能使用
// 其他 未定义操作系统需要将其视为ARR
};
void mm_init();