mirror of
https://github.com/tailix/kernel.git
synced 2025-04-07 17:32:34 -04:00
Do not take care of basic memory info
This commit is contained in:
parent
acd5eb1611
commit
a3a3d57ab4
4 changed files with 10 additions and 55 deletions
|
@ -22,14 +22,6 @@ unsigned char kernelmq_info_validate_and_copy(
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (src->mem_lower_base + src->mem_lower_size != src->mem_lower_limit + 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (src->mem_upper_base + src->mem_upper_size != src->mem_upper_limit + 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (src->kernel_size == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,20 +2,16 @@
|
|||
|
||||
#include <kernelmq/stdlib.h>
|
||||
|
||||
#define MULTIBOOT_TAG_TYPE_END 0
|
||||
#define MULTIBOOT_TAG_TYPE_CMDLINE 1
|
||||
#define MULTIBOOT_TAG_TYPE_MODULE 3
|
||||
#define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
|
||||
#define MULTIBOOT_TAG_TYPE_MMAP 6
|
||||
#define MULTIBOOT_TAG_TYPE_END 0
|
||||
#define MULTIBOOT_TAG_TYPE_CMDLINE 1
|
||||
#define MULTIBOOT_TAG_TYPE_MODULE 3
|
||||
#define MULTIBOOT_TAG_TYPE_MMAP 6
|
||||
|
||||
#define MULTIBOOT_MEMORY_AVAILABLE 1
|
||||
#define MULTIBOOT_MEMORY_RESERVED 2
|
||||
#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
|
||||
#define MULTIBOOT_MEMORY_NVS 4
|
||||
|
||||
#define MEM_LOWER_BASE ((unsigned long)0)
|
||||
#define MEM_UPPER_BASE ((unsigned long)(1 * 1024 * 1024 * 1024)) // 1 MB
|
||||
|
||||
struct multiboot_mmap_entry
|
||||
{
|
||||
unsigned long long addr;
|
||||
|
@ -49,14 +45,6 @@ struct multiboot_tag_module
|
|||
char cmdline[0];
|
||||
};
|
||||
|
||||
struct multiboot_tag_basic_meminfo
|
||||
{
|
||||
unsigned int type;
|
||||
unsigned int size;
|
||||
unsigned int mem_lower;
|
||||
unsigned int mem_upper;
|
||||
};
|
||||
|
||||
struct multiboot_tag_mmap
|
||||
{
|
||||
unsigned int type;
|
||||
|
@ -68,10 +56,9 @@ struct multiboot_tag_mmap
|
|||
|
||||
static unsigned char print_multiboot_tag(struct KernelMQ_Info *kinfo, const struct multiboot_tag *tag);
|
||||
|
||||
static unsigned char print_multiboot_tag_cmdline (struct KernelMQ_Info *kinfo, const struct multiboot_tag_string *tag);
|
||||
static unsigned char print_multiboot_tag_module (struct KernelMQ_Info *kinfo, const struct multiboot_tag_module *tag);
|
||||
static unsigned char print_multiboot_tag_basic_meminfo(struct KernelMQ_Info *kinfo, const struct multiboot_tag_basic_meminfo *tag);
|
||||
static unsigned char print_multiboot_tag_mmap (struct KernelMQ_Info *kinfo, const struct multiboot_tag_mmap *tag);
|
||||
static unsigned char print_multiboot_tag_cmdline(struct KernelMQ_Info *kinfo, const struct multiboot_tag_string *tag);
|
||||
static unsigned char print_multiboot_tag_module (struct KernelMQ_Info *kinfo, const struct multiboot_tag_module *tag);
|
||||
static unsigned char print_multiboot_tag_mmap (struct KernelMQ_Info *kinfo, const struct multiboot_tag_mmap *tag);
|
||||
|
||||
unsigned char multiboot_parse(struct KernelMQ_Info *kinfo, unsigned long addr)
|
||||
{
|
||||
|
@ -107,9 +94,6 @@ unsigned char print_multiboot_tag(struct KernelMQ_Info *kinfo, const struct mult
|
|||
case MULTIBOOT_TAG_TYPE_MODULE:
|
||||
return print_multiboot_tag_module(kinfo, (struct multiboot_tag_module*)tag);
|
||||
|
||||
case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO:
|
||||
return print_multiboot_tag_basic_meminfo(kinfo, (struct multiboot_tag_basic_meminfo*)tag);
|
||||
|
||||
case MULTIBOOT_TAG_TYPE_MMAP:
|
||||
return print_multiboot_tag_mmap(kinfo, (struct multiboot_tag_mmap*)tag);
|
||||
}
|
||||
|
@ -157,19 +141,6 @@ unsigned char print_multiboot_tag_module(struct KernelMQ_Info *kinfo, const stru
|
|||
return 1;
|
||||
}
|
||||
|
||||
unsigned char print_multiboot_tag_basic_meminfo(struct KernelMQ_Info *kinfo, const struct multiboot_tag_basic_meminfo *const tag)
|
||||
{
|
||||
kinfo->mem_lower_base = MEM_LOWER_BASE;
|
||||
kinfo->mem_lower_size = tag->mem_lower * 1024;
|
||||
kinfo->mem_lower_limit = kinfo->mem_lower_base + kinfo->mem_lower_size - 1;
|
||||
|
||||
kinfo->mem_upper_base = MEM_UPPER_BASE;
|
||||
kinfo->mem_upper_size = tag->mem_upper * 1024;
|
||||
kinfo->mem_upper_limit = kinfo->mem_upper_base + kinfo->mem_upper_size - 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned char print_multiboot_tag_mmap(struct KernelMQ_Info *kinfo, const struct multiboot_tag_mmap *const tag)
|
||||
{
|
||||
for (
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <kernelmq/stdlib.h>
|
||||
|
||||
#define MEM_UPPER_BASE ((unsigned long)(1 * 1024 * 1024 * 1024)) // 1 MB
|
||||
|
||||
#define I386_VM_PT_ENTRIES 1024
|
||||
|
||||
#define I386_PAGE_SIZE 4096
|
||||
|
@ -94,8 +96,6 @@ void paging_clear()
|
|||
|
||||
void paging_identity(const struct KernelMQ_Info *const kinfo)
|
||||
{
|
||||
assert(kinfo->mem_upper_base);
|
||||
|
||||
for (int i = 0; i < I386_VM_PT_ENTRIES; ++i) {
|
||||
unsigned int flags = I386_VM_PRESENT |
|
||||
I386_VM_BIGPAGE |
|
||||
|
@ -104,7 +104,7 @@ void paging_identity(const struct KernelMQ_Info *const kinfo)
|
|||
|
||||
unsigned long phys = i * I386_BIG_PAGE_SIZE;
|
||||
|
||||
if ((kinfo->mem_upper_base & I386_VM_ADDR_MASK_4MB) <=
|
||||
if ((MEM_UPPER_BASE & I386_VM_ADDR_MASK_4MB) <=
|
||||
(phys & I386_VM_ADDR_MASK_4MB)
|
||||
) {
|
||||
flags |= I386_VM_PWT | I386_VM_PCD;
|
||||
|
|
|
@ -35,14 +35,6 @@ struct KernelMQ_Info {
|
|||
struct KernelMQ_Info_Area areas[KERNELMQ_INFO_AREAS_MAX];
|
||||
unsigned int areas_count;
|
||||
|
||||
unsigned long mem_lower_base;
|
||||
unsigned long mem_lower_size;
|
||||
unsigned long mem_lower_limit;
|
||||
|
||||
unsigned long mem_upper_base;
|
||||
unsigned long mem_upper_size;
|
||||
unsigned long mem_upper_limit;
|
||||
|
||||
unsigned long kernel_offset;
|
||||
|
||||
unsigned long kernel_phys_base;
|
||||
|
|
Loading…
Add table
Reference in a new issue