Commit Graph

2422 Commits

Author SHA1 Message Date
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
1235ce8b32 Avoid magic numbers 2022-10-08 14:44:48 +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
ac72d64490 Make (v)fprintf alias to (v)printf instead of throwing an error
We don't have files :) (yet)
But if someone wants to fprintf(stderr), then fine. Do it. Except it won't be any different from fprintf(stdout) or printf().
2022-10-08 13:45:57 +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
9b778254f1 Merge branch perror into main
Reviewed-on: #6
2022-10-08 10:46:02 +00:00
e76d903642 apps: make memeater use perror 2022-10-08 12:42:46 +02:00
ee7558a9b7 Add a perror() function 2022-10-08 12:42:25 +02:00
d6f45c284e Merge branch strerror into main
Reviewed-on: #5
2022-10-08 10:32:12 +00:00
21e8ea1486 apps: make memeater use strerror() 2022-10-08 12:29:19 +02:00
8f0b6d80b2 libc: Implement strerror() 2022-10-08 12:29:06 +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
ad115e9bab libc: Correct include guards 2022-10-08 11:32:01 +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
8bf1aac961 Finally, add a README.
It's perhaps too long, but that's better than it being too short.
2022-10-07 20:16:44 +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
b2d43d66c4 Remove boot/font.psf from the initrd
This font file is not being used, since we are using an embedded font and that seems to work (should be loaded from the initrd in the future though)
2022-10-07 15:38:08 +02:00
13f69bc4fc Add LICENSE
I knew from the beginning this should be BSD-2 (my favorite license at the moment), but hadn't made a license file yet. Here it is!
2022-10-07 13:27:01 +00: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
560b0a1705 libc: Rename the _ folder to bits, as used internally by libraries 2022-10-04 19:11:54 +02:00
48b858af5a libc: Add strncpy and strncat, and deprecate strcpy and strcat (which, since we're building with -Werror, is an instant ban from using these functions) 2022-10-04 19:08:59 +02:00
a050ed9133 libc: add an internal macros.h header with headers to make attributes less verbose 2022-10-04 19:06:56 +02:00
c6ed8d2abb libc: remove duplicate declaration of strcpy 2022-10-04 18:59:13 +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
885e39f60f libc: fix printf to actually print correct more-than-one-digit numbers (hint: the bugfix was a very stupid one) 2022-10-03 20:30:12 +02:00
cb60e418b2 Add vprintf, (v)sprintf and (v)snprintf to libc + move the non v-printfs to stdio.cpp, since they can now call their v-variants and thus don't depend on internal_printf 2022-10-03 19:59:33 +02:00
9420484c9b Do not use __builtin_alloca in puts (could overflow the stack for large strings) 2022-10-03 19:05:04 +02:00
34aa953dbc Add printf() and puts(), quite primitive, looks like hex printing isn't there yet... 2022-10-03 19:00:10 +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
ee31a3458d Fix setup-binutils and setup-gcc 2022-10-02 19:58:52 +02:00
db9e1ba17c Add a memclr() SSE-optimized function 2022-10-02 19:13:33 +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
d2f9e17c86 Use __luna_abort in init 2022-10-02 18:16:27 +02:00
ae95a528f2 Make function stubs in libc loudly abort instead of silently failing 2022-10-02 18:10:53 +02:00
8e6741ebd6 Rename SYS_version to SYS_getversion 2022-10-02 17:25:56 +02:00