Fix: page state

This commit is contained in:
2025-04-15 15:12:07 +08:00
parent f25758031a
commit 89ff8a018d
2 changed files with 8 additions and 4 deletions

View File

@@ -47,10 +47,11 @@ void _pull(int idx, size_t sz)
{
if (LCH->state == PAGE_FREE && RCH->state == PAGE_FREE) {
if (CUR->state != PAGE_FREE) {
LOG("node merged");
LOG("free page merged");
DEBUG_MEM((uint64_t)idx);
}
CUR->state = PAGE_FREE;
CUR->size = sz;
}
if (LCH->state != PAGE_FREE || RCH->state != PAGE_FREE)
CUR->state = PAGE_DIVIDED;
@@ -124,6 +125,9 @@ uint64_t _allocate_page(size_t req, int idx, uint64_t l, uint64_t r)
CUR->size = 0;
return l;
}
LOG("page divided");
LOG(l);
DEBUG(r);
LCH->state = RCH->state = PAGE_FREE;
LCH->size = m - l;
RCH->size = r - m;
@@ -239,6 +243,8 @@ void _reserve_page(uint64_t ql, uint64_t qr, int idx, uint64_t l, uint64_t r)
uint64_t m = l + ((msb64(sz) == sz) ? (sz >> 1) : msb64(sz));
if (CUR->state == PAGE_FREE) {
LOG("page divided"); LOG(l); DEBUG_MEM(r);
CUR->state = PAGE_DIVIDED;
LCH->state = RCH->state = PAGE_FREE;
LCH->size = m - l;
RCH->size = r - m;

View File

@@ -95,11 +95,9 @@ void timer_irq_handler(void)
{
_enable_timer_irq(false);
LOG("timer irq");
uint64_t cntpct_el0;
R_SYSREG(cntpct_el0, cntpct_el0);
DEBUG_EXCEP(cntpct_el0);
LOG("timer irq"); DEBUG_EXCEP(cntpct_el0);
if (global_timer) {
add_interrupt_task(20, global_timer->data.func, global_timer->data.param);