pmap tlb shootdowns
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <zinnia/sched.h>
|
||||
#include <zinnia/usercopy.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// # On using per-CPU data
|
||||
//
|
||||
@@ -37,8 +38,20 @@ struct percpu {
|
||||
struct scheduler sched; // Scheduler information.
|
||||
};
|
||||
|
||||
extern uint8_t __ld_percpu_start[];
|
||||
extern uint8_t __ld_percpu_end[];
|
||||
|
||||
static inline size_t percpu_stride() {
|
||||
return __ld_percpu_end - __ld_percpu_start;
|
||||
}
|
||||
|
||||
static inline struct percpu* percpu_cpu(size_t id) {
|
||||
return (struct percpu*)(__ld_percpu_start + id * percpu_stride());
|
||||
}
|
||||
|
||||
struct percpu* percpu_new();
|
||||
size_t percpu_max_cpus();
|
||||
size_t percpu_count();
|
||||
struct percpu* percpu_get();
|
||||
void percpu_bsp_init();
|
||||
void percpu_init(struct boot_info* info);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <zinnia/utils.h>
|
||||
#include <bits/pmap.h>
|
||||
|
||||
struct percpu;
|
||||
|
||||
enum pte_flags : uint8_t {
|
||||
PTE_READ = 1 << 0, // Can read from this page.
|
||||
PTE_WRITE = 1 << 1, // Can write to this page.
|
||||
@@ -33,10 +35,16 @@ errno_t pmap_new_user(struct pmap* pt, enum alloc_flags flags);
|
||||
errno_t pmap_map(struct pmap* pt, uintptr_t vaddr, phys_t paddr, enum pte_flags flags, enum cache_mode cache);
|
||||
errno_t pmap_protect(struct pmap* pt, uintptr_t vaddr, enum pte_flags flags);
|
||||
errno_t pmap_unmap(struct pmap* pt, uintptr_t vaddr);
|
||||
errno_t pmap_extract(struct pmap* pt, uintptr_t vaddr, phys_t* out);
|
||||
void pmap_destroy(struct pmap* pt);
|
||||
void pmap_set(struct pmap* pt);
|
||||
void pmap_shootdown(struct pmap* pt);
|
||||
void pmap_shootdown_handle();
|
||||
|
||||
void pte_clear(pte_t* pte);
|
||||
void pte_flush(uintptr_t vaddr);
|
||||
void pte_flush_all();
|
||||
void pte_shootdown_kick(struct percpu* cpu);
|
||||
pte_t pte_build(phys_t addr, enum pte_flags flags, enum cache_mode cache);
|
||||
bool pte_is_present(pte_t* pte);
|
||||
bool pte_is_dir(pte_t* pte);
|
||||
|
||||
Reference in New Issue
Block a user