summaryrefslogtreecommitdiff
path: root/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'documentation')
-rw-r--r--documentation/memory.txt17
-rw-r--r--documentation/syscalls.txt27
2 files changed, 39 insertions, 5 deletions
diff --git a/documentation/memory.txt b/documentation/memory.txt
index e820034..581bd71 100644
--- a/documentation/memory.txt
+++ b/documentation/memory.txt
@@ -1,7 +1,14 @@
only the first 32GiB of physical memory are considered. this can be changed
-with pram_pages in paging.cpp. as for virtual memory, the top 1GiB is reserved
-for the kernel. the top 1MiB of that is reserved for the kernel stack, with an
-unmapped guard page at the top and bottom of the kernel stack.
+with pram_pages in paging.cpp. vram layout is as follows:
-if any of these facts change, the linker script and paging code should be
-checked closely.
+0x0000.0000.0000 - 0x0000.001f.ffff: always unmapped
+0x0000.0020.0000 - 0x0000.3fbf.ffff: available to user process
+0x0000.3fc0.0000 - 0x0000.3fdf.ffff: always unmapped
+0x0000.3fe0.0000 - 0x0000.3fff.ffff: user stack
+0x0000.4000.0000 - 0xffff.bfff.ffff: always unmapped
+0xffff.c000.0000 - 0xffff.ffdf.ffff: available to kernel
+0xffff.ffe0.0000 - 0xffff.ffe0.0fff: always unmapped
+0xffff.ffe0.1000 - 0xffff.ffef.efff: interrupt stack
+0xffff.ffef.f000 - 0xffff.fff0.0fff: always unmapped
+0xffff.fff0.1000 - 0xffff.ffff.efff: syscall stack / kernel init stack
+0xffff.ffff.f000 - 0xffff.ffff.ffff: always unmapped
diff --git a/documentation/syscalls.txt b/documentation/syscalls.txt
new file mode 100644
index 0000000..cbba5e3
--- /dev/null
+++ b/documentation/syscalls.txt
@@ -0,0 +1,27 @@
+on application entry:
+ there is a 1MiB - 8KiB area mapped writable and not
+ executable with guard pages on either side, and rsp is
+ set to the top of that. all other registers are set to 0.
+
+for all system calls:
+ rax, rdi, rsi, rdx are in/out paramters.
+ rbx, rbp, rsp, r12-r15 are preserved.
+ rcx, rflags, r8-r11 are clobbered.
+
+encode color:
+ rax in: 0
+ edi in: r + g * 256 + b * 65536
+ eax out: encoded color
+
+get framebuffer:
+ rax in: 1
+ rax out: pointer to framebuffer
+ rdi out: width + height * 2 ** 32
+ esi out: pitch
+ framebuffer is always 32 bpp. use the encode color syscall
+ to encode colors. pitch is in dwords, not in bytes.
+
+draw framebuffer:
+ rax in: 2
+ this draws changes to the framebuffer gotten by the get framebuffer
+ system call. (currently, the entire thing is copied, not just changes.)