AP, kmalloc
This commit is contained in:
27
kernel/include/cls.h
Normal file
27
kernel/include/cls.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __HEADER_CLS_H
|
||||
#define __HEADER_CLS_H
|
||||
/*
|
||||
* CPU Local Storage (cls)
|
||||
*/
|
||||
|
||||
struct malloc_header {
|
||||
struct malloc_header *next;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
struct cpu_local_var {
|
||||
/* malloc */
|
||||
struct malloc_header free_list;
|
||||
/* Align to 64-byte */
|
||||
} __attribute__((aligned(64)));
|
||||
|
||||
|
||||
struct cpu_local_var *get_cpu_local_var(int id);
|
||||
static struct cpu_local_var *get_this_cpu_local_var(void)
|
||||
{
|
||||
return get_cpu_local_var(aal_mc_get_processor_id());
|
||||
}
|
||||
|
||||
#define cpu_local_var(name) get_this_cpu_local_var()->name
|
||||
|
||||
#endif
|
||||
7
kernel/include/kmalloc.h
Normal file
7
kernel/include/kmalloc.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef __HEADER_KMALLOC_H
|
||||
#define __HEADER_KMALLOC_H
|
||||
|
||||
void *kmalloc(int size, int flag);
|
||||
void kfree(void *ptr);
|
||||
|
||||
#endif
|
||||
7
kernel/include/page.h
Normal file
7
kernel/include/page.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef __HEADER_PAGE_H
|
||||
#define __HEADER_PAGE_H
|
||||
|
||||
void *allocate_pages(int npages, enum aal_mc_ap_flag flag);
|
||||
void free_pages(void *va, int npages);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user