v2 initial commit
This commit is contained in:
parent
2c97dba9f7
commit
d2ef885e8d
118 changed files with 2420 additions and 9320 deletions
10
amd64/include/arch/msr.h
Normal file
10
amd64/include/arch/msr.h
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef _MSR_H_
|
||||
#define _MSR_H_
|
||||
|
||||
#include <kernel/types.h>
|
||||
|
||||
u64 rdmsr(u32 msr);
|
||||
void wrmsr(u32 msr, u64 val);
|
||||
|
||||
#endif /* _MSR_H_ */
|
||||
32
amd64/include/arch/page.h
Normal file
32
amd64/include/arch/page.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef _AMD64_PAGE_H_
|
||||
#define _AMD64_PAGE_H_
|
||||
|
||||
#include <kernel/page.h>
|
||||
|
||||
#define PAGE_SIZE 0x1000ull
|
||||
|
||||
#define PAGE_MASK_LOWER (~(PAGE_SIZE - 1))
|
||||
#define PAGE_MASK_UPPER ((PAGE_SIZE - 1))
|
||||
|
||||
#define PAGE_ALIGN (~(PAGE_SIZE - 1))
|
||||
|
||||
#define PAGE_PRESENT 0x001
|
||||
#define PAGE_RW 0x002
|
||||
#define PAGE_USER 0x004
|
||||
#define PAGE_WRITE_THRU 0x008
|
||||
#define PAGE_CACHE_DISABLE 0x010
|
||||
#define PAGE_ACCESSED 0x020
|
||||
#define PAGE_DIRTY 0x040
|
||||
#define PAGE_4MB_ENABLE 0x080
|
||||
|
||||
#define pgd_index(address) (((address) >> 39) & 0x1FF)
|
||||
#define pud_index(address) (((address) >> 30) & 0x1FF)
|
||||
#define pmd_index(address) (((address) >> 21) & 0x1FF)
|
||||
#define pte_index(address) (((address) >> 12) & 0x1FF)
|
||||
|
||||
void pgd_load(pgd_t *pgd);
|
||||
u64 *_pt_read(u64 *dir, size_t index, u64 *flags);
|
||||
void _pt_write(u64 *dir, size_t index, u64 *val, u64 flags);
|
||||
|
||||
#endif /* _AMD64_PAGE_H_ */
|
||||
Loading…
Reference in a new issue