1 /* 2 * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 #ifndef MM_MM_H 13 #define MM_MM_H 14 15 #include <common/util.h> 16 #include <mm/vmspace.h> 17 #include <mm/buddy.h> 18 19 #ifndef PAGE_SIZE 20 #define PAGE_SIZE BUDDY_PAGE_SIZE 21 #endif 22 23 extern void parse_mem_map(void *); 24 25 /* Execute once during kernel init. */ 26 void mm_init(void *physmem_info); 27 28 /* Return the size of free memory in the buddy and slab allocator. */ 29 unsigned long get_total_mem_size(void); 30 unsigned long get_free_mem_size(void); 31 32 /* Implementations differ on different architectures. */ 33 void set_page_table(paddr_t pgtbl); 34 void flush_tlb_by_range(struct vmspace *, vaddr_t start_va, size_t size); 35 void flush_tlb_by_vmspace(struct vmspace *); 36 void flush_idcache(void); 37 38 /* Only needed on SPARC */ 39 void sys_cache_config(unsigned option); 40 void plat_cache_config(unsigned option); 41 42 #endif /* MM_MM_H */