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
1e16a78106
libc: Document functions in sys/mman.h
2022-10-12 12:06:45 +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
eaf7a1620b
Next version!
2022-10-11 21:42:23 +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
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
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
0131193379
ELFLoader, Scheduler: Transition to use VFS
...
We should start to drop the old InitRD API, which only allows for files to be loaded from the initrd, and which forces pathnames to be relative (bin/init)
With VFS, we can load any kind of file from any kind of filesystem, and using paths that make sense (/bin/init)
2022-10-11 19:33:48 +02:00
86b50a6aa0
Remove random demos
...
Cool, but cumbersome in practice: have to continually restart until I get the demo I want.
So let's stick to init for now.
2022-10-11 19:25:19 +02:00
0a7d4a530d
VFS, DeviceFS: Implement a device filesystem
...
For now, we just have a version device. (this will allow us to get rid of sys_getversion!!)
More should be implemented soon.
2022-10-11 19:21:16 +02:00
a198cf8d8d
Add initrd_mkdir to registered directories in the initrd
2022-10-11 18:25:11 +02:00
4aa3da8c12
VFS: Add basic mount(), unmount() and mkdir() functions (not accessible to userspace yet)
2022-10-11 18:23:00 +02:00
1278cec065
VFS: Add a 'type' flag to Nodes, implement EISDIR
2022-10-11 17:48:11 +02:00
7a097f16ea
apps: add a new example app which does all kinds of stdio misbehaving >.<
2022-10-11 17:31:06 +02:00
667d308fc3
kernel/main.cpp: remove obsolete reference to _userspace
2022-10-11 17:30:40 +02:00
6088031c49
stdio: log stuff more
2022-10-11 17:19:03 +02:00
81815a0bdd
Refactor sys/stdio.cpp
2022-10-11 17:10:44 +02:00
2a755fcd93
sys_open(): actually return EMFILE if the process has used all of its file slots
2022-10-11 17:03:16 +02:00
1b84c443fe
Merge branch VFS into main
...
Reviewed-on: #10
2022-10-10 18:25:43 +00:00
da2ede3450
Kernel, libc, userspace: Implement file descriptors
...
Kernel: Implement a descriptor struct which stores the opened node and read offset, and give each task 8 of those.
Implement three syscalls: sys_read, sys_open and sys_close (sys_write still writes to the console instead of using a fd, for now)
Implement three new errors: ENOENT, EBADF and EMFILE.
libc: Implement the new errors, and the new syscalls in syscall().
Also fix _RETURN_WITH_ERRNO() to set errno correctly, which was making strerror() return null, thus crashing perror().
userspace: make init demonstrate the new file API.
2022-10-10 20:21:39 +02:00
63b2de4e3c
Basic FDs
2022-10-10 19:00:24 +02:00
da84f1713c
InitRD: Use get_blocks_from_size()
2022-10-10 18:45:49 +02:00
bbe7c6e658
VFS: Implement resolve_path and form the initial ramdisk's VFS properly
...
Finally, resolve_path: a function which takes a path (/etc/fstab for example), and walks the VFS:
In this case, it would start with the root FS node, and ask it: "do you have a directory/file named etc?"
The node could say 'yes', 'no', or 'i'm not a directory, I'm a file' (should not be the case for the VFS root, but for the other ones it could be)
If it says yes, we continue and ask the child if it has a file named fstab. Etc...
2022-10-10 18:44:43 +02:00
2be70d0bc1
VFS: Use 64-bit numbers in read()
...
There is no need for any kind of 32-bit compatibility.
2022-10-09 21:30:38 +02:00
8158ddc94f
VFS: be more verbose
2022-10-09 21:19:22 +02:00
b38c52f8c7
more vfs stuff
2022-10-08 21:35:19 +02:00
f3d7e220ac
The beginnings of a VFS implementation!!
2022-10-08 21:22:46 +02:00
3686e03bb7
Cast %p usage to void*
...
Apparently, %p only accepts void*, and not any pointer type. Still better than casting a pointer to uint64_t.
2022-10-08 18:27:05 +02:00
3feb7782bc
Kernel/mmap, munmap: Use %p in printf
2022-10-08 18:24:05 +02:00