4021cb3ac0
KernelHeap: do not crash the entire system
...
Previously, calling free_virtual_page(s) would cause an assertion fail if the address was not in the kernel heap range.
Now, we just return.
2022-10-12 14:28:48 +02:00
ad9c7af0bf
VMM: add FIXME
2022-10-12 14:27:47 +02:00
950f4ef608
VMM: Add support for larger pages
...
getPhysical() now stops at a larger page, unmap() can unmap a larger page, but map() just transforms it into a normal page.
getFlags() larger pages support is still pending.
At least now we don't page fault because we're trying to free a larger page.
2022-10-12 14:27:26 +02:00
525d567af6
VMM: When unmapping a page, invalidate the TLB for that page
2022-10-12 14:24:34 +02:00
c9ebe89899
Kernel/KernelHeap: Add MODULE #define
2022-10-12 14:04:41 +02:00
cf160d1260
Scheduler: Use misc/utils.h instead of doing everything manually.
...
That way the code is cleaner + we have one single point of failure.
2022-10-12 13:18:35 +02:00
66add380cf
Kernel/Utilities: add a new get_top_of_stack convenience function
2022-10-12 13:17:58 +02:00
cf3f61e373
Kernel: More GDT refactoring
2022-10-12 13:12:46 +02:00
c1f9d3323f
Kernel: Refactor TSS loading to make it cleaner >.<
2022-10-12 13:07:28 +02:00
97eacc027e
Kernel: Use PAGE_SIZE in more places
2022-10-12 13:05:57 +02:00
f5deb1048a
Kernel: Add functions to push and pop the interrupt state
...
This can be useful when you want to disable interrupts, but then only enable them back if they were previously enabled.
2022-10-12 12:58:56 +02:00
b3e16068ef
Kernel: Add Utilities::get_rflags(), and thus Interrupts::are_enabled()
2022-10-12 12:56:55 +02:00
e90b90c556
Kernel, libc: Round up to nearest page-aligned size instead of down
2022-10-12 12:15:12 +02:00
a8eb7a6b66
Merge branch descriptive_headers into main
...
Reviewed-on: #11
2022-10-12 10:11:45 +00:00
d89685bb36
libc: Document sys/types.h
2022-10-12 12:07:42 +02:00
1e16a78106
libc: Document functions in sys/mman.h
2022-10-12 12:06:45 +02:00
a3362429d3
libc: Update strerror()
2022-10-12 12:01:18 +02:00
0d3e7d4463
libc: Document errno.h
2022-10-12 12:01:07 +02:00
b42c866db8
Correct description for fopen()
2022-10-12 11:58:07 +02:00
9f5b3b76d2
libc: Document the function in fcntl.h
2022-10-12 11:57:49 +02:00
f44411aa46
libc: Document the functions in luna.h
2022-10-12 11:54:29 +02:00
6aabe19fb4
libc: Document the functions in stdio.h
2022-10-12 11:51:32 +02:00
ffc223c2cf
libc: Document functions in stdlib.h
...
Also, add prototypes for calloc() and realloc(), which were already implemented but not in the header.
2022-10-12 11:30:21 +02:00
c8c4d31cca
Add a FIXME to string.cpp
2022-10-12 11:20:48 +02:00
19ee20b6f5
libc: Document the functions in string.h
2022-10-12 11:19:14 +02:00
38e87d8f8f
libc: Document the functions in unistd.h
2022-10-12 11:02:18 +02:00
96b1d1c2f2
Devices: Tell a device which name you want it to be instantiated with
...
This allows us to create a device in any path, with any filename.
2022-10-12 10:54:46 +02:00
eb03ae91e0
Devices: Add a new Serial device
...
This device permits userspace to interface with the serial port.
2022-10-12 10:44:30 +02:00
89cbe5957b
Update .gdbconf to point to the non-stripped kernel executable
2022-10-12 10:17:49 +02:00
44834b8a0f
libc: Implement fputs, fputc, putc and putchar
2022-10-12 10:05:14 +02:00
eaf7a1620b
Next version!
2022-10-11 21:42:23 +02:00
e145690db8
apps: Remove demo programs (except for init)
...
We no longer need those, and they just make the initrd larger.
2022-10-11 21:37:27 +02:00
25ab31c7ce
Remove unnecessary comments
2022-10-11 21:32:28 +02:00
d3ac590e24
Kernel: Remove the sys_getversion() syscall
...
User programs can now acquire this information by reading /dev/version.
2022-10-11 21:31:28 +02:00
112e375b5e
Kernel: Add a FIXME
2022-10-11 21:21:27 +02:00
c30041b733
fix naming
2022-10-11 21:17:07 +02:00
88a01fcfc7
libc: make perror output to stderr
2022-10-11 21:13:38 +02:00
b67011c626
libc: Use the new write() syscall
...
The new one is write(fd, buf, count).
The old one was write(buf, count).
So the old one tries to pass buf as a file descriptor, and write() complains that 4000000 is too large of a file descriptor and throws EBADF.
We now use the new syscall, through the wrapper that fwrite() provides us.
2022-10-11 21:12:19 +02:00
0f47f59364
libc: make fprintf actually write to the chosen file
...
Also, printf now is kind of an alias for fprintf(stdout,...), as it should be.
2022-10-11 21:10:19 +02:00
2f46e46aa4
libc: Implement fwrite()
...
Now that we have the write() syscall and libc wrapper, fwrite can finally be implemented.
2022-10-11 21:09:30 +02:00
80ab982fe4
libc: make stdout and stderr functional
...
what were before one extern FILE* without reference now are opened by libc on program initialization, to point to /dev/console by default.
2022-10-11 21:08:46 +02:00
53a4b3b85e
libc: Add new flags to open()
...
Since we now have write support, we can add O_WRONLY and O_RDWR to fcntl.h :)
2022-10-11 21:07:21 +02:00
12cf37d0a7
Kernel/syscalls: Modify sys_write to accept a file descriptor and write to it
...
Previously, sys_write only wrote to the tty. Now, it uses the VFS interface, as it should.
2022-10-11 21:06:12 +02:00
e764647133
Devices: add a new ConsoleDevice
...
This new device is the userspace interface to the text console/tty.
2022-10-11 21:04:50 +02:00
b1fcfd0d74
VersionDevice: Ignore offset instead of erroring out + set flags to 0
2022-10-11 21:04:14 +02:00
e67ef7778c
VFS: Support writing to files
2022-10-11 21:03:30 +02:00
f6e783ea45
init: do not show 'read n bytes' when printing version
...
that was to debug why reading /dev/version returned 'versionmoon 0.10-' instead of 'moon 0.10-fffffff'
it works now, so...
2022-10-11 20:13:00 +02:00
8e57df518f
apps: build with optimizations enabled
2022-10-11 19:57:24 +02:00
0c451e504e
Kernel: Mounting /dev MUST succeed
2022-10-11 19:53:55 +02:00
04da26bff5
kernel: add a few comments
2022-10-11 19:51:24 +02:00