From: Amelia Coutard Date: Tue, 1 Aug 2023 22:21:36 +0000 (+0200) Subject: Fixed code and doc a tiny bit X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=3ec078aa37cf7c0ba419f86aad7d83a5f042d06a;p=voyage-au-centre-des-fichiers.git Fixed code and doc a tiny bit --- diff --git a/doc.txt b/doc.txt index 307d7f8..142373f 100644 --- a/doc.txt +++ b/doc.txt @@ -41,9 +41,10 @@ struct handler { The system calls: -Input and output registers in order: %rdi, %rsi, %rdx, %r10, %r8, %r9. +Input registers in order: %rdi, %rsi, %rdx, %r10, %r8, %r9. In %rax, the syscall id is specified. If the operation succeeds, %rax contains the result (think SystemV ABI) (≥ 0). If it fails, %rax contains the opposite of the error code. (< 0) +The only registers clobbered are %rcx, %r11, %rax, %rdx. (The last two are the return registers.) sport_t make_sport(); Creates a server port, with no associated clients. diff --git a/kernel/src/elf64.cpp b/kernel/src/elf64.cpp index c129d07..88fbf29 100644 --- a/kernel/src/elf64.cpp +++ b/kernel/src/elf64.cpp @@ -36,8 +36,17 @@ void os::elf::load_elf(os::process& result, std::byte* start, std::size_t length result.PML4T = phys_ptr(os::paging::page_allocator.allocate(1).ptr.get_phys_addr()); result.rip = std::uint64_t(elf_header.entry); result.rsp = std::uint64_t(stack + stack_size); + result.rax = 0; result.rbx = 0; + result.rcx = 0; + result.rdx = 0; result.rbp = 0; + result.rsi = 0; + result.rdi = 0; + result.r8 = 0; + result.r9 = 0; + result.r10 = 0; + result.r11 = 0; result.r12 = 0; result.r13 = 0; result.r14 = 0; diff --git a/kernel/src/ring3.hpp b/kernel/src/ring3.hpp index 49069bf..32e17ed 100644 --- a/kernel/src/ring3.hpp +++ b/kernel/src/ring3.hpp @@ -80,9 +80,7 @@ struct process { std::uint64_t r15; std::uint64_t rip; port ports[2043]; - char padding[16]; }; -static_assert(sizeof(process) == 4096 * 16); static_assert(0xFFFF'C000'0000'0000 + sizeof(process) * 2048 < 0xFFFF'FFFF'8000'0000); extern "C" process& get_process(std::uint64_t pid);