| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /* arch/x86/include/arch/mm.h
- *
- * This file is part of evx.
- *
- * evx 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.
- *
- * evx 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 evx. If not, see <https://www.gnu.org/licenses/>
- */
- #ifndef __ARCH_MM_H
- #define __ARCH_MM_H
- #ifndef __ASSEMBLER__
- #include <arch/archinfo.h>
- #include <config.h>
- #define E820_ADDR ((struct e820_entry *) 0x90000)
- #define E820_TYPE_RAM 1
- #define E820_TYPE_ROM 2
- #define E820_TYPE_MAX 5
- struct e820_entry {
- __uint32_t addrl, addrh;
- __uint32_t lenl, lenh;
- __uint32_t type;
- } __attribute__ ((packed));
- #define LVL1_PT ((__archptr_t *) 0)
- /* rwup */
- #define DEFAULT_PAGE_ATTR 7
- void *mapto(void *src, void *dest);
- #if CONFIG_64BIT
- static inline u64 HIGH_AND_LOW(u32 high, u32 low, int bits) {
- u64 res = (u64) high;
- res <<= bits;
- res += low;
- return res;
- }
- #else
- #define HIGH_AND_LOW(high, low, bits) (low)
- #endif
- #if CONFIG_64BIT
- #define invalidate() __asm__ volatile ("movq %%cr3, %%rax;movq %%rax, %%cr3;" ::: "ax")
- #else
- #define invalidate() __asm__ volatile ("movl %%cr3, %%eax;movl %%eax, %%cr3;" ::: "ax")
- #endif
- #define real_addr(a) ((a) & ~KERNEL_OFFSET)
- #define page_descr(addr) (kmem_pages + PAGE_NR(real_addr(addr) & ~PAGE_MASK))
- #define page_nr(page) ((page) - kmem_pages)
- #define page_addr(p) ((void *) (page_nr(p) << PAGE_SHIFT))
- #endif
- #endif
|