forked from xuos/xiuos
free memory based on tracer
This commit is contained in:
@@ -32,7 +32,6 @@ Modification:
|
||||
#include "list.h"
|
||||
#include "memlayout.h"
|
||||
#include "spinlock.h"
|
||||
#include "pagetable.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -34,6 +34,7 @@ Modification:
|
||||
bool module_phymem_init();
|
||||
char* kalloc(size_t size);
|
||||
bool kfree(char* vaddr);
|
||||
bool raw_kfree(char* paddr);
|
||||
|
||||
char* raw_alloc(size_t size);
|
||||
bool raw_free(char* paddr);
|
||||
|
||||
@@ -29,10 +29,14 @@ Modification:
|
||||
*************************************************/
|
||||
#pragma once
|
||||
|
||||
#include "actracer.h"
|
||||
#include "bitmap64.h"
|
||||
#include "buddy.h"
|
||||
#include "list.h"
|
||||
#include "share_page.h"
|
||||
|
||||
struct TopLevelPageDirectory {
|
||||
uintptr_t* pd_addr;
|
||||
};
|
||||
|
||||
struct ThreadStackPointer {
|
||||
int argc;
|
||||
@@ -42,6 +46,8 @@ struct ThreadStackPointer {
|
||||
};
|
||||
|
||||
struct MemSpace {
|
||||
/* trace node */
|
||||
TraceTag tag;
|
||||
/* task memory resources */
|
||||
struct TopLevelPageDirectory pgdir; // [phy] vm pgtbl base address
|
||||
uintptr_t heap_base; // mem size of proc used(allocated by kernel)
|
||||
|
||||
@@ -33,11 +33,12 @@ Modification:
|
||||
#include <string.h>
|
||||
|
||||
#include "memlayout.h"
|
||||
|
||||
#include "actracer.h"
|
||||
#include "mmu.h"
|
||||
#include "mmu_common.h"
|
||||
|
||||
#include "actracer.h"
|
||||
#include "memspace.h"
|
||||
|
||||
// clang-format off
|
||||
#define ALIGNUP(size, align) (((uintptr_t)(size) + (uintptr_t)(align) - 1) & ~((uintptr_t)(align) - 1))
|
||||
#define ALIGNDOWN(size, align) ((uintptr_t)(size) & ~((uintptr_t)(align) - 1))
|
||||
@@ -49,10 +50,6 @@ Modification:
|
||||
#define TOPLEVLE_PAGEDIR_SIZE sizeof(uintptr_t) * NUM_TOPLEVEL_PDE
|
||||
// clang-format on
|
||||
|
||||
struct TopLevelPageDirectory {
|
||||
uintptr_t* pd_addr;
|
||||
};
|
||||
|
||||
struct PagerRightGroup {
|
||||
struct TraceTag mmu_driver_tag;
|
||||
};
|
||||
@@ -60,10 +57,10 @@ struct PagerRightGroup {
|
||||
struct XiziPageManager {
|
||||
bool (*new_pgdir)(struct TopLevelPageDirectory* pgdir);
|
||||
void (*free_user_pgdir)(struct TopLevelPageDirectory* pgdir);
|
||||
bool (*map_pages)(uintptr_t* pd_addr, uintptr_t vaddr, uintptr_t paddr, int len, bool is_dev);
|
||||
bool (*map_pages)(struct MemSpace* pmemspace, uintptr_t vaddr, uintptr_t paddr, int len, bool is_dev);
|
||||
bool (*unmap_pages)(uintptr_t* pd_addr, uintptr_t vaddr, int len);
|
||||
|
||||
uintptr_t (*resize_user_pgdir)(struct TopLevelPageDirectory* pgdir, uintptr_t old_size, uintptr_t new_size);
|
||||
uintptr_t (*resize_user_pgdir)(struct MemSpace* pmemspace, uintptr_t old_size, uintptr_t new_size);
|
||||
uintptr_t (*address_translate)(struct TopLevelPageDirectory* pgdir, uintptr_t vaddr);
|
||||
uintptr_t (*cross_vspace_data_copy)(struct TopLevelPageDirectory* pgdir, uintptr_t cross_dest, uintptr_t src, uintptr_t len);
|
||||
};
|
||||
|
||||
@@ -109,6 +109,7 @@ struct SchedulerRightGroup {
|
||||
};
|
||||
|
||||
struct XiziTaskManager {
|
||||
TraceTag tag;
|
||||
/* thead schedule lists */
|
||||
struct double_list_node task_list_head[TASK_MAX_PRIORITY]; /* list of task control blocks that are allocated */
|
||||
struct double_list_node task_running_list_head;
|
||||
@@ -149,5 +150,4 @@ extern uint32_t ready_task_priority;
|
||||
extern struct Thread* next_task_emergency;
|
||||
extern struct XiziTaskManager xizi_task_manager;
|
||||
|
||||
int spawn_embedded_task(char* img_start, char* name, char** argv);
|
||||
bool module_task_manager_init(void);
|
||||
bool module_task_manager_init(TraceTag* softkernel_tag);
|
||||
|
||||
Reference in New Issue
Block a user