82 lines
2.4 KiB
C
82 lines
2.4 KiB
C
/* memory.h - describe the memory map */
|
|
/*
|
|
* VAS_EBOOT -- GRand Unified Bootloader
|
|
* Copyright (C) 2002,2007,2008,2009 Free Software Foundation, Inc.
|
|
*
|
|
* VAS_EBOOT is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* VAS_EBOOT is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef VAS_EBOOT_MEMORY_CPU_HEADER
|
|
#define VAS_EBOOT_MEMORY_CPU_HEADER 1
|
|
|
|
#define VAS_EBOOT_PAGE_SHIFT 12
|
|
#define VAS_EBOOT_PAGE_SIZE (1UL << VAS_EBOOT_PAGE_SHIFT)
|
|
|
|
/* The flag for protected mode. */
|
|
#define VAS_EBOOT_MEMORY_CPU_CR0_PE_ON 0x1
|
|
#define VAS_EBOOT_MEMORY_CPU_CR4_PAE_ON 0x00000020
|
|
#define VAS_EBOOT_MEMORY_CPU_CR4_PSE_ON 0x00000010
|
|
#define VAS_EBOOT_MEMORY_CPU_CR0_PAGING_ON 0x80000000
|
|
#define VAS_EBOOT_MEMORY_CPU_AMD64_MSR 0xc0000080
|
|
#define VAS_EBOOT_MEMORY_CPU_AMD64_MSR_ON 0x00000100
|
|
|
|
#define VAS_EBOOT_MEMORY_MACHINE_UPPER_START 0x100000 /* 1 MiB */
|
|
#define VAS_EBOOT_MEMORY_MACHINE_LOWER_SIZE VAS_EBOOT_MEMORY_MACHINE_UPPER_START
|
|
|
|
/* Some PTE definitions. */
|
|
#define VAS_EBOOT_PAGE_PRESENT 0x00000001
|
|
#define VAS_EBOOT_PAGE_RW 0x00000002
|
|
#define VAS_EBOOT_PAGE_USER 0x00000004
|
|
|
|
#ifndef ASM_FILE
|
|
|
|
#define VAS_EBOOT_MMAP_MALLOC_LOW 1
|
|
|
|
#include <VasEBoot/types.h>
|
|
|
|
struct VasEBoot_e820_mmap_entry
|
|
{
|
|
VasEBoot_uint64_t addr;
|
|
VasEBoot_uint64_t len;
|
|
VasEBoot_uint32_t type;
|
|
} VAS_EBOOT_PACKED;
|
|
|
|
VasEBoot_uint64_t VasEBoot_mmap_get_upper (void);
|
|
VasEBoot_uint64_t VasEBoot_mmap_get_lower (void);
|
|
VasEBoot_uint64_t VasEBoot_mmap_get_post64 (void);
|
|
|
|
typedef VasEBoot_addr_t VasEBoot_phys_addr_t;
|
|
|
|
static inline VasEBoot_phys_addr_t
|
|
VasEBoot_vtop (void *a)
|
|
{
|
|
return (VasEBoot_phys_addr_t) a;
|
|
}
|
|
|
|
static inline void *
|
|
VasEBoot_map_memory (VasEBoot_phys_addr_t a, VasEBoot_size_t size __attribute__ ((unused)))
|
|
{
|
|
return (void *) a;
|
|
}
|
|
|
|
static inline void
|
|
VasEBoot_unmap_memory (void *a __attribute__ ((unused)),
|
|
VasEBoot_size_t size __attribute__ ((unused)))
|
|
{
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* ! VAS_EBOOT_MEMORY_CPU_HEADER */
|