Commit Graph

2533 Commits

Author SHA1 Message Date
8ce58e9e30 Kernel/InitRD: Use %p with printf() 2022-10-08 18:16:55 +02:00
5fc543c179 Kernel/ACPI: Use printf() with %p 2022-10-08 18:15:08 +02:00
40099feb80 Apps: Use the new %p in printf() 2022-10-08 18:11:41 +02:00
3ee1f34bc4 Forgot to add break :)
And that, is why you test before pushing and commiting >.<
2022-10-08 18:08:50 +02:00
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
247645d301 Merge branch exit_status into main
Reviewed-on: #8
2022-10-08 15:58:51 +00: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
4a212b4c92 Modify shebangs to use /usr/bin/env bash instead of /bin/sh 2022-10-08 15:35:39 +02:00
aa5c1be945 Separate building a debug image and running it, and provide a script for GDB. 2022-10-08 15:32:48 +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
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