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_KMALLOC_H 13 #define MM_KMALLOC_H 14 15 #include <common/types.h> 16 17 void *_kmalloc(size_t size, bool is_record, size_t *real_size); 18 void *_get_pages(int order, bool is_record); 19 void _kfree(void *ptr, bool is_revoke_record); 20 21 void *kmalloc(unsigned long size); 22 void *kzalloc(unsigned long size); 23 void kfree(void *ptr); 24 25 /* Return vaddr of (1 << order) continous free physical pages */ 26 void *get_pages(int order); 27 void free_pages(void *addr); 28 29 void get_mem_usage_msg(void); 30 31 void free_pages_without_record(void *addr); 32 void get_mem_usage_msg(void); 33 34 #endif /* MM_KMALLOC_H */ 35