c67079dd74
Kernel, libc: Implement %p in *printf()
...
So we can avoid writing (unsigned long)ptr or (uint64_t)ptr everywhere when wanting to print a pointer.
2022-10-08 18:07:33 +02:00
f83a6ace51
Kernel, libc: Add support for providing a status code to exit()
...
The exit() libc function already accepted an integer, but didn't pass it on to the kernel since we had no mechanism for it to do that.
Now, the kernel stores a task's exit status to display it later (and in the future, return it to userspace via wait()/waitpid())
2022-10-08 17:56:40 +02:00
1e0c8c5fe7
Kernel: Strip kernel symbols when installing
...
Since we already extract the symbols into a separate file which the kernel then uses for backtraces, this only brings us a smaller kernel, with no downsides :)
2022-10-08 15:57:07 +02:00
309058888c
Bugfix: remove duplicate error check when loading a userspace ELF program
...
Also, remember to delete the allocated task, since we do not want memory leaks :)
2022-10-08 13:12:19 +00:00
159d025d9f
ACPI::get_rsdt_or_xsdt(): Use a temporary variable to do mappings, then set cache to it.
2022-10-08 15:05:59 +02:00
a5daa24fbf
Fix bug :)
2022-10-08 15:03:10 +02:00
533b7c9e71
Refactor ACPI::get_rsdt_or_xsdt()
...
Much better now.
Also, remove a FIXME in PMM.cpp, since we do map the page bitmap to virtual memory now.
2022-10-08 15:00:42 +02:00
abcf1b6118
Define PAGE_SIZE as 4096 and use it everywhere instead of using 4096 as a magic number
2022-10-08 14:52:28 +02:00
ce6ec3585c
Kernel, libc: Add ENOSYS
...
This error is returned by the kernel/C Library when an attempt is made to use a system call that doesn't exist.
2022-10-08 14:18:25 +02:00
a086ec514b
Remove the Superblock.h file which has never been used.
...
This file was included for a future Ext2 implementation. It should be included when said Ext2 implementation is actually started.
2022-10-08 13:28:30 +02:00
71e15e94af
Kernel, libc and userspace: Add basic errno support.
...
Kernel: Add an errno.h header with definitions for each header,
and return those, negated, from syscalls when there is an error.
mmap() returns an invalid address with errno encoded, instead of
returning a negated errno; this address is encoded as ffffffffffffffEE
where EE is errno in hex.
libc: make syscall() return -1 and set errno on error, instead of
returning the raw return value of the system call. Also, add mmap()
and munmap() wrappers in sys/mman.h :).
userspace: make the memeater program show the value of errno
when allocating memory fails.
Things to improve: add perror() and strerror() to make the errno
experience even better! >.<
2022-10-08 12:06:09 +02:00
1f655fabe2
The beginnings of Moon 0.10
...
Right now the kernel is the only thing with a version number, the user apps just fetch it from the kernel using the sys_getversion() syscall
2022-10-07 20:33:00 +02:00
028a1b1a3c
libc: Enable even more warnings
2022-10-07 18:19:06 +02:00
b7ee746da3
Kernel: Enable even more warnings
2022-10-07 18:10:20 +02:00
dc389da74e
Implement an ELFImage struct
...
This struct allows us to keep track of what memory is used by the loaded executable. For some reason, freeing this memory when the task exits triggers a kernel page fault, so I'm not doing that right now.
2022-10-07 17:54:05 +02:00
1ee5deb0f0
Remove unnecessary include
2022-10-06 19:51:16 +02:00
3fd24133e9
I'm so dumb
2022-10-06 18:04:32 +02:00
4a50a9e027
that was a dumb bug to fix
2022-10-06 18:02:57 +02:00
594d79143e
Kernel: enable -Wconversion
2022-10-06 17:13:34 +02:00
952d8fa294
Be more strict with warnings
2022-10-05 17:34:22 +02:00
3bfdad7a75
Kernel: Remove outdated rule in Makefile
2022-10-04 18:52:02 +02:00
25928a2a8d
Kernel: Always build config.cpp, even when it's not modified
2022-10-04 18:46:10 +02:00
7a998dda4d
Kernel: Do not stop interrupts by default in the interrupt handler
...
I always knew you can choose if interrupts are enabled for a specific ISR in the IDT entry, but at some moment there was a bug and I thought maybe that fixed it. Now reverting that doesn't break anything, so... let's do it :)
2022-10-04 18:45:46 +02:00
8f310dd307
PMM: Map the page bitmap to kernel heap once the PMM and VMM are both initialized
2022-10-04 18:36:09 +02:00
5d8b825659
Add a few example apps/demos in C, and make the kernel choose a random one to demonstrate every boot
2022-10-03 21:24:38 +02:00
fc9868819f
Moon 0.9-dev
2022-10-02 21:19:49 +02:00
dae2ff8d50
Add mmap and munmap syscalls, and thus, add malloc and free to libc!! (yet again, thanks to the wonderful liballoc)
2022-10-02 20:45:04 +02:00
38470724dc
Scheduler: adjust SSE saving conditions
2022-10-02 19:13:21 +02:00
1ecd24f5d6
Kernel: Add SSE support (enable SSE on boot and save context (user tasks only) on task switch)
2022-10-02 18:53:54 +02:00
8e6741ebd6
Rename SYS_version to SYS_getversion
2022-10-02 17:25:56 +02:00
c6b044acab
ELFLoader: show permissions of loadable segment
2022-10-02 17:10:24 +02:00
83d23ce8fe
Correct the syscall ABI
2022-10-02 17:01:46 +02:00
6bacded5cf
Update build system
2022-10-02 17:01:30 +02:00
f8a72f15c8
Adjust build system to be more flexible and to work with the new toolchain
2022-10-02 12:44:32 +02:00
c76ecdf07c
Moon 0.8-dev
2022-10-01 17:35:10 +02:00
ac6fdce737
Add 2 new syscalls (sys_version, sys_gettid)
2022-10-01 17:30:31 +02:00
ba4806f9d3
Syscall: do not send user programs' output to the serial console
2022-10-01 15:53:55 +02:00
87cb41e549
Separate the logging stack into toggleable backends, to disable console logging once boot finishes.
2022-10-01 15:35:11 +02:00
0e46ea8ada
Finally, a text renderer that actually works. We can now see the kernel messages without a serial port :)
2022-10-01 14:27:45 +02:00
008bdf505c
Rename gfx.cpp to paint.cpp
2022-10-01 13:09:43 +02:00
30411b4b78
Fix hackiness in converting a uint32_t to a Color, by providing a function to do so
2022-10-01 13:08:47 +02:00
03db57bbf9
Sanity checks
2022-10-01 12:32:09 +02:00
66bee86a8b
Scheduler: add a load_user_task function that directly loads a file from the initrd
2022-10-01 12:28:32 +02:00
1c4383dea4
Add an apps/ folder and build-system to build userspace apps which can now be loaded from the initrd
2022-10-01 12:17:16 +02:00
9012ccc49e
Remove _userspace and move the idle task to assembly
2022-10-01 12:16:30 +02:00
6e6cf5b2b0
Add an ELF Loader!!
2022-10-01 12:15:56 +02:00
53d36be339
Add a much-needed get_blocks_from_size function
2022-10-01 12:13:38 +02:00
e769cb45a7
MemoryManager: add get_page_at and get_pages_at functions to map any physical memory at a fixed virtual address (inverse of get_mapping and get_mappings)
2022-10-01 12:12:50 +02:00
87f67b255e
Moon 0.7-dev
2022-09-29 20:09:39 +02:00
ef5994e389
Proper userspace program
2022-09-29 20:06:18 +02:00