fix memlayout and sys_kill

This commit is contained in:
lr 2024-07-20 15:48:49 +08:00
parent ae7992d429
commit fbd7aa46f5
4 changed files with 16 additions and 5 deletions

View File

@ -36,8 +36,8 @@ Modification:
/* A55 physical memory layout */ /* A55 physical memory layout */
#define PHY_MEM_BASE (0x0000000010000000ULL) #define PHY_MEM_BASE (0x0000000010000000ULL)
#define PHY_USER_FREEMEM_BASE (0x0000000040000000ULL) #define PHY_USER_FREEMEM_BASE (0x0000000040000000ULL)
#define PHY_USER_FREEMEM_TOP (0x0000000050000000ULL) #define PHY_USER_FREEMEM_TOP (0x0000000080000000ULL)
#define PHY_MEM_STOP (0x0000000050000000ULL) #define PHY_MEM_STOP (0x0000000080000000ULL)
/* PTE-PAGE_SIZE */ /* PTE-PAGE_SIZE */
#define LEVEL4_PTE_SHIFT 12 #define LEVEL4_PTE_SHIFT 12

View File

@ -37,7 +37,7 @@ Modification:
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#define MAX_BUDDY_ORDER (10) #define MAX_BUDDY_ORDER (12)
#define FREE_LIST_INDEX(order) \ #define FREE_LIST_INDEX(order) \
(1 << order) (1 << order)

View File

@ -51,7 +51,7 @@ static bool _new_pgdir(struct TopLevelPageDirectory* pgdir)
return true; return true;
} }
static bool _map_pages(uintptr_t* pgdir, uintptr_t vaddr, uintptr_t paddr, int len, uintptr_t attr) static bool _map_pages(uintptr_t* pgdir, uintptr_t vaddr, uintptr_t paddr, intptr_t len, uintptr_t attr)
{ {
assert(len >= 0); assert(len >= 0);
vaddr = ALIGNDOWN(vaddr, LEVEL4_PTE_SIZE); vaddr = ALIGNDOWN(vaddr, LEVEL4_PTE_SIZE);
@ -140,7 +140,7 @@ static bool _map_user_pages(uintptr_t* pgdir, uintptr_t vaddr, uintptr_t paddr,
_p_pgtbl_mmu_access->MmuUsrDevPteAttr(&mem_attr); _p_pgtbl_mmu_access->MmuUsrDevPteAttr(&mem_attr);
} }
return _map_pages(pgdir, vaddr, paddr, len, mem_attr); return _map_pages(pgdir, vaddr, paddr, (intptr_t)len, mem_attr);
} }
/// assume that a user pagedir is allocated from [0, size) /// assume that a user pagedir is allocated from [0, size)

View File

@ -53,6 +53,17 @@ int sys_kill(int id)
} }
} }
struct ksemaphore* sem = NULL;
DOUBLE_LIST_FOR_EACH_ENTRY(sem, &xizi_task_manager.semaphore_pool.sem_list_guard, sem_list_node)
{
task = NULL;
DOUBLE_LIST_FOR_EACH_ENTRY(task, &sem->wait_list_guard, node)
{
sys_exit(task);
return 0;
}
}
// check if task is a ready one // check if task is a ready one
for (int prio = 0; prio < TASK_MAX_PRIORITY; prio++) { for (int prio = 0; prio < TASK_MAX_PRIORITY; prio++) {
DOUBLE_LIST_FOR_EACH_ENTRY(task, &xizi_task_manager.task_list_head[prio], node) DOUBLE_LIST_FOR_EACH_ENTRY(task, &xizi_task_manager.task_list_head[prio], node)