Commit Graph

929 Commits

Author SHA1 Message Date
4a5db1dca7 libc: Add lseek() 2022-10-12 15:37:29 +02:00
928ade123c libc: Add support for the new seek() system call 2022-10-12 15:32:09 +02:00
e40304f2f1 libc: Add off_t to sys/types.h 2022-10-12 15:30:41 +02:00
854f585e1a Kernel: Add a seek() system call
Now, time for libc support!!
2022-10-12 15:28:52 +02:00
97b7572933 VFS: Implement a new type of Node, VFS_DEVICE
This is used to differentiate normal files from devices.
2022-10-12 15:22:34 +02:00
0f5910add7 Kernel/Utilities: Add new round_{up,down}_to_nearest_page functions 2022-10-12 14:51:04 +02:00
baa71b09cc Kernel: Build with -fstack-protector-strong instead of -fstack-protector-all
We lose a LITTLE bit of security, while allowing the compiler to optimize MUCH more.

Very simple functions, like most functions in misc/utils.cpp, were being made very big when some of them can just be "jmp thingy" or "and rax, something" and waste much less space.

This change makes more sense, I think.
2022-10-12 14:50:31 +02:00
4768d5fc12 ELFLoader: Consider the offset when calculating how many pages to map
If a section needs to be mapped at 0x50f50 and its size is 0x200, then that address space exceeds one page.
But since 0x200 is less than one page, we only map one page.

If we count the offset, 0xf50 + 0x200 need two pages. So we can map the right amount of memory.
2022-10-12 14:40:06 +02:00
bbd9f1d187 VMM: Add FIXME 2022-10-12 14:35:34 +02:00
15f340dbbe VMM: Do not map recursively 2022-10-12 14:34:12 +02:00
8daffa876c Make some shell scripts executable 2022-10-12 14:31:50 +02:00
28469497e9 Change build system to accept arbitrary CFLAGS during the build process
For the kernel, at least.
2022-10-12 14:31:41 +02:00
d3cb642e5f Scheduler: add FIXME 2022-10-12 14:30:57 +02:00
0ee9bd7290 Scheduler: free a task's ELF image.
Now that we have support for larger pages, this works!!
2022-10-12 14:30:46 +02:00
eaea4603c6 MemoryManager: Fix logging when built with debug logging
That is to say, -DMM_DEBUG
2022-10-12 14:29:30 +02:00
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