aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-23 01:13:32 -0700
committerChristian Cunningham <cc@localhost>2022-01-23 01:13:32 -0700
commit2e9921c5c3a28ec5d6733c1794d7f92bd24b1104 (patch)
treea2e6a22fdedf0c7618ff53c91c6b849e5b18d2b3 /src
parent603b795d7978b7ac53e458f9ab5ec7d73a55c3a5 (diff)
Free threads from memory after finishing
Diffstat (limited to 'src')
-rw-r--r--src/boot.S3
-rw-r--r--src/cpu/irq.c12
2 files changed, 13 insertions, 2 deletions
diff --git a/src/boot.S b/src/boot.S
index aedc957..e97ddcb 100644
--- a/src/boot.S
+++ b/src/boot.S
@@ -155,6 +155,9 @@ svc:
ldr r3, =stacks_table
mov r0, #0
strb r0, [r3, r1]
+ // Free the thread after freeing the stack
+ mov r0, r2
+ bl free
1:
ldmfd sp!, {r0-r12,pc}^
io_halt_prefetch:
diff --git a/src/cpu/irq.c b/src/cpu/irq.c
index 729a58d..830c1ba 100644
--- a/src/cpu/irq.c
+++ b/src/cpu/irq.c
@@ -77,6 +77,13 @@ void c_irq_handler(void)
//_start(); // Trigger reset
uart_scheduler();
//heap_info_u();
+ } else if (data == 0x63) {
+ cmd[off] = (char) data;
+ off += 1;
+ //_start(); // Trigger reset
+ //uart_scheduler();
+ heap_info();
+ //heap_info_u();
// Else output
} else {
cmd[off] = (char) data;
@@ -220,12 +227,12 @@ unsigned long c_fiq_handler(void)
} else if (source & (1 << 3)) {
c_timer();
counter++;
- if (counter % 0x60 == 0) {
+ if (counter % 0x100 == 0) {
add_thread(localtest, 0, 0);
} else if (counter % 0x6000 == 0) {
counter = 0;
}
- if (counter % 0x10 == 0) {
+ if (counter % 0x60 == 0) {
//uart_scheduler();
return 1;
}
@@ -236,4 +243,5 @@ unsigned long c_fiq_handler(void)
void localtest(void)
{
+ uart_char('.');
}