summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthewsot@outlook.com>2022-05-11 17:36:59 -0700
committerMatthew Sotoudeh <matthewsot@outlook.com>2022-05-11 17:36:59 -0700
commit4ceb7ec7236bb75ed6e03375bdd010bc9765932f (patch)
treee19deb19dd6ec535b76ba2e63d8103f087d0b7bf
parent5b77b718cef0726a54b63902fd339fa68b7f5f81 (diff)
-rw-r--r--hello_os/start.s4
-rw-r--r--kern/kern.c5
-rw-r--r--kern/prog.c4
3 files changed, 6 insertions, 7 deletions
diff --git a/hello_os/start.s b/hello_os/start.s
index f8500a6..7d0a80c 100644
--- a/hello_os/start.s
+++ b/hello_os/start.s
@@ -12,7 +12,7 @@ _start:
swi 0 // result in r0
mov r1, #STACK_ADDR // virtual page
- sub r1, r1, #4096 // start of page for stack
+ sub r1, r1, #(1024*1024) // start of page for stack
mov r2, r0 // physical page
mov r3, #0 // flags
mov r4, #SYSCALL_ARG_PAGE_1MB // size
@@ -24,8 +24,8 @@ _start:
bl main
+ mov r1, r0
mov r0, #SYSCALL_EXIT
- mov r1, #24
swi 0
.globl syscall
diff --git a/kern/kern.c b/kern/kern.c
index 2160f17..6005b0c 100644
--- a/kern/kern.c
+++ b/kern/kern.c
@@ -61,7 +61,8 @@ void syscall(user_regs_t* regs) {
assert(regs->r2 == SYSCALL_ARG_PAGE_1MB);
printf("Got alloc page syscall for any page, 1MB long.\n");
heap_end += align_off(heap_end, 1024*1024);
- regs->r0 = heap_end;
+ regs->r0 = ka2pa(heap_end);
+ printf("Giving back physical page %x\n", regs->r0);
heap_end += 1024*1024;
break;
case SYSCALL_VM_MAP:;
@@ -87,8 +88,6 @@ void kernel_start() {
register_irq_vec(IRQ_VEC_SOFTWARE_IRQ, (void*)syscall);
enable_interrupts();
- asm volatile("swi 0");
-
// pick physical space for prog. eventually we should use an allocator, for
// now let's just put it right at the end of the heap.
// I guess we don't really need to align this, but why not
diff --git a/kern/prog.c b/kern/prog.c
index 1c09fa9..6bfe23e 100644
--- a/kern/prog.c
+++ b/kern/prog.c
@@ -1,12 +1,12 @@
char prog[] = {
0x01, 0x00, 0xa0, 0xe3, 0x00, 0x10, 0xe0, 0xe3,
0x01, 0x20, 0xa0, 0xe3, 0x00, 0x00, 0x00, 0xef,
- 0x02, 0x13, 0xa0, 0xe3, 0x01, 0x1a, 0x41, 0xe2,
+ 0x02, 0x13, 0xa0, 0xe3, 0x01, 0x16, 0x41, 0xe2,
0x00, 0x20, 0xa0, 0xe1, 0x00, 0x30, 0xa0, 0xe3,
0x01, 0x40, 0xa0, 0xe3, 0x03, 0x00, 0xa0, 0xe3,
0x00, 0x00, 0x00, 0xef, 0x02, 0xd3, 0xa0, 0xe3,
0x04, 0xd0, 0x4d, 0xe2, 0x04, 0x00, 0x00, 0xeb,
- 0x00, 0x00, 0xa0, 0xe3, 0x18, 0x10, 0xa0, 0xe3,
+ 0x00, 0x10, 0xa0, 0xe1, 0x00, 0x00, 0xa0, 0xe3,
0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0xef,
0x1e, 0xff, 0x2f, 0xe1, 0x07, 0x40, 0x2d, 0xe9,
0x44, 0x30, 0x9f, 0xe5, 0x44, 0x20, 0x9f, 0xe5,
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback