b4a6e4d56d
libluna/PathParser: Make dirname() and basename() static functions
...
continuous-integration/drone/push Build is passing
This avoids creating a PathParser to use them, which allocates memory that won't be used.
2023-06-19 11:21:58 +02:00
7efc3a6ea1
kernel: Show stack traces on page faults + crash the process instead of the whole system on GPFs
2023-06-19 10:45:08 +02:00
ae01a31104
kernel: Make sure the stack is 16-byte aligned on program startup
...
This is required by the System V ABI and fixes some movaps-related GPFs in ndisasm.
2023-06-19 10:41:32 +02:00
36e6787415
kernel: Make sure addresses allocated by mmap() are ALWAYS page-aligned
...
continuous-integration/drone/push Build is passing
Fixes a kernel crash. Thanks a lot, sysfuzz!
2023-06-18 20:29:32 +02:00
04322d9ff7
kernel: Add a customizable configuration file system
continuous-integration/drone/push Build is passing
2023-06-18 20:18:19 +02:00
b7bdec9ece
kernel: Add a bunch more config definitions and hide debug messages behind them
2023-06-18 20:18:00 +02:00
d45e9e2a8c
libluna: Simplify the API for Utf8StateDecoder by splitting it into multiple methods
continuous-integration/drone/push Build is passing
2023-06-18 18:38:01 +02:00
27d9cd0e87
kernel: Move TmpFS::*Inode into a separate file
continuous-integration/drone/push Build is passing
2023-06-18 11:33:40 +02:00
3a3473b9c2
kernel: Use memcpy() when cloning UserVM
...
continuous-integration/drone/push Build is passing
This way, any future fields in VMRegion get copied automatically.
2023-06-18 01:54:29 +02:00
67ed18629d
kernel: Update the VM allocator for userspace to use a linked list
...
continuous-integration/drone/push Build is passing
This can cover the entire address space at once in a more memory-efficient way.
Stress-tested using 'base64 /bin/ls' which allocates enough contiguous
virtual memory to store the entirety of /bin/ls :)
A couple of bugs and fixes later, here we are!
2023-06-18 01:48:48 +02:00
266fa4a0d4
kernel: Start counting partition numbers at 1
...
continuous-integration/drone/push Build is passing
This makes more sense for the end user.
2023-06-17 19:50:58 +02:00
7cace9a0d7
kernel: Provide more meaningful panic messages for critical failures
2023-06-17 19:43:25 +02:00
e79d4297ea
kernel: Make the root inode be a mountpoint as well + add pivot_root()
continuous-integration/drone/push Build is passing
2023-06-17 17:27:22 +02:00
b7a82fd895
kernel: Do not error out on zero-length reads/writes to bad addresses
2023-06-17 12:04:34 +02:00
592558d7ad
kernel: Add GUID partition table support
2023-06-17 12:03:37 +02:00
2be4880278
kernel: Name the scoped lock in ATADevice::read()
...
continuous-integration/drone/push Build is passing
Is that supposed to work without a name? Looks like it did!
2023-06-17 09:46:28 +02:00
7a78609a85
kernel: Preserve kernel threads' page directories when they differ from the regular kernel page directory
continuous-integration/drone/push Build is passing
2023-06-17 00:49:31 +02:00
c2cdb861c9
kernel/ATA: Fix buffer overflow in ATADevice::read() with small sizes and unaligned offsets
2023-06-17 00:48:53 +02:00
27b26f389c
kernel: Lock ATADevice::read_lba() using ATA::Channel's KMutex
continuous-integration/drone/push Build is passing
2023-06-17 00:22:38 +02:00
32d2e0e6b7
kernel: Remove register_special_device()'s name parameter
...
continuous-integration/drone/push Build is passing
This is now duplicate information that can be queried using device->device_path().
2023-06-16 21:46:51 +02:00
ba46399bbd
kernel/ATA: Remove debug messages
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-06-16 21:34:36 +02:00
738b218a49
kernel/ATA+MBR: Dynamically generate device names + create devices for MBR partitions
continuous-integration/drone/pr Build is passing
2023-06-16 21:30:50 +02:00
72b8ebe02c
kernel: Make the MBR code read from a device instead of an inode
continuous-integration/drone/pr Build is failing
2023-06-16 21:10:33 +02:00
72e798cedb
kernel: Do not automatically read the MBR partition table from /dev/cdrom
...
Since ff952cfe16
made /dev mounted from userspace, /dev/cdrom does not exist when ATA drives are scanned.
2023-06-16 21:10:33 +02:00
7593947c33
kernel/ATA: Route interrupts to the correct drive
2023-06-16 21:10:33 +02:00
93922932fa
kernel: Start reading the MBR partition table from the ATAPI drive
2023-06-16 21:10:33 +02:00
a3beaa4d53
ATA: Mark the CDROM as a block device
2023-06-16 21:10:33 +02:00
bb0db450b3
kernel/ATA: Pass extra information to DeviceRegistry
...
This is needed since merging e7d482e
from main.
2023-06-16 21:10:33 +02:00
a0fa1f2cfd
kernel+init: Create a device node in /dev to access the CDROM from userspace!
...
Still using PIO, though.
2023-06-16 21:10:33 +02:00
2fa11a5ae3
kernel/ATA: Read the CDROM's first sector using ATAPI PIO!!
...
Sadly, for some reason, DMA is not working right now.
This is a problem, as PIO is inconvenient. But hey, it works for now!
2023-06-16 21:10:32 +02:00
cc8450751c
kernel/x86_64: Implement writing to PCI fields
2023-06-16 21:10:32 +02:00
3762d3f959
kernel/PCI: Add bit enum for the Command field
2023-06-16 21:10:32 +02:00
a99c5e325d
kernel: Actually register interrupt handlers properly
2023-06-16 21:10:32 +02:00
82db0e39ea
kernel/ATA: Calculate block sizes for ATA devices as well
2023-06-16 21:10:32 +02:00
46c45068e0
kernel/ATA: Send a READ CAPACITY packet to an ATA drive on initialization
2023-06-16 21:10:32 +02:00
cfcde5af55
kernel/ATA: Read the PCI Busmaster registers and start preparing for DMA
2023-06-16 21:10:31 +02:00
268252c89e
kernel/ATA: Read the Busmaster base port and verify it
2023-06-16 21:10:31 +02:00
5d16754632
kernel: Handle device BARs properly
2023-06-16 21:10:31 +02:00
6307b01689
kernel/ATA: Read ATA strings properly instead of backwards
...
Now we can see the model string. What does it say...
"QEMU DVD-ROM". Let's go!
2023-06-16 21:10:31 +02:00
e118c9ea0d
kernel/ATA: Implement enough to send an IDENTIFY command and read the model number :)
2023-06-16 21:10:31 +02:00
ee691bbb0f
kernel/ATA: Handle drive IRQs in compatibility mode
2023-06-16 21:10:31 +02:00
739950e8f0
kernel/CPU: Allow passing arbitrary data to interrupt handlers
2023-06-16 21:10:31 +02:00
3a84127fd6
kernel/ATA: Start reading/writing registers and detecting drives
2023-06-16 21:10:30 +02:00
e8507d23ee
kernel: Warn if no ATA controller is found
2023-06-16 21:10:30 +02:00
d9a1e8a980
kernel: Add a KMutex class and use that for ATA::Controller locking
2023-06-16 21:10:30 +02:00
7efc6dc985
kernel/x86_64: Add basic ATA controller and channel identification
2023-06-16 21:10:30 +02:00
beeafb73e6
kernel/PCI: Add more PCI field types
2023-06-16 21:10:30 +02:00
f0caf010bf
kernel/x86_64: Add a way to register IRQ handlers from other kernel subsystems
2023-06-16 21:10:26 +02:00
d0b65674e6
kernel: Fix 0-delay sleeps blocking the thread forever
2023-06-08 19:57:38 +02:00
3283991ec6
kernel: Keep the old Timer::ticks_ms() API.
...
continuous-integration/drone/push Build is passing
Removing this API broke the ATA branch.
2023-06-03 21:02:18 +02:00
8bcec00a9d
kernel: Change the timer subsystem to use timespecs natively
continuous-integration/drone/push Build is passing
2023-06-03 13:15:10 +02:00
1090815c8d
kernel: Honor the sticky bit
2023-06-03 11:55:10 +02:00
ff952cfe16
kernel+init: Let userspace control devfs mountpoints
continuous-integration/drone/push Build is passing
2023-06-02 21:45:31 +02:00
11a4f8cc90
kernel: Wake the parent process when a child exits because of a page fault
2023-05-28 21:50:13 +02:00
88d1da59e8
kernel+libc: Add access()
continuous-integration/drone/push Build is passing
2023-05-27 12:04:27 +02:00
bd8aaa917f
kernel+libc+ln: Add support for userspace hard link creation
continuous-integration/drone/push Build is passing
2023-05-27 11:32:40 +02:00
a98e9e8009
kernel: Add /dev/full
continuous-integration/drone/push Build is passing
2023-05-27 10:42:45 +02:00
b0506bf88f
kernel: Add umask
continuous-integration/drone/push Build is passing
2023-05-26 22:27:49 +02:00
d89a823924
kernel: Return EACCES when trying to chdir to an unaccessible directory
2023-05-26 20:49:13 +02:00
cba0a23db9
kernel: Make the framebuffer a block device
continuous-integration/drone/push Build is passing
2023-05-26 20:36:35 +02:00
7cdb967730
kernel: compilation fix
continuous-integration/drone/push Build is passing
2023-05-26 20:30:39 +02:00
62e14e7580
kernel+libos+apps: Support block devices and disallow seeking character devices or pipes
continuous-integration/drone/push Build is failing
2023-05-26 20:27:47 +02:00
3a51807fa6
kernel+stat: Handle pipes correctly in stat()
continuous-integration/drone/push Build is passing
2023-05-23 20:54:25 +02:00
9cdfdbc6f9
kernel: Handle unnamed pipes in stat()
continuous-integration/drone/push Build is failing
2023-05-23 20:49:26 +02:00
1094042a7d
kernel: Implement st_dev and st_rdev
continuous-integration/drone/push Build is failing
2023-05-23 20:45:24 +02:00
1a6ad11462
kernel+libc+libos+ls: Add readlink()
continuous-integration/drone/push Build is passing
2023-05-23 15:42:38 +02:00
67a9d130e2
kernel: Add initial support for symbolic links :D
2023-05-20 21:49:24 +02:00
01111442d3
kernel: Add the getrusage() system call
2023-05-20 12:48:07 +02:00
1506331872
kernel+libc: Add the pstat() system call
...
Luna-specific, but I like it.
2023-05-18 21:48:47 +02:00
84bed3ceb3
kernel+libc: Remove mknod()
...
continuous-integration/drone/push Build is passing
Now that we automatically create files in /dev, mknod() is not needed anymore.
2023-05-18 19:42:14 +02:00
d7c563aebd
kernel: Add reference counting for mounts
...
continuous-integration/drone/push Build is passing
This will make sure we cannot unmount a file system while there is another one mounted inside it.
2023-05-18 16:22:31 +02:00
3a73d49aa1
kernel: Remove a mount from the mountpoint list after unmounting it
2023-05-18 16:18:09 +02:00
8f6bd29da3
kernel: Make file system reference counting work for current directories
...
continuous-integration/drone/push Build is passing
Also, make pipes usable again.
2023-05-17 20:37:01 +02:00
1f4c4928cc
kernel+libc+apps: Add mount and umount syscalls, libc wrappers, and utilities
continuous-integration/drone/push Build is passing
2023-05-17 20:30:15 +02:00
29174ca228
kernel/VFS: Add a way to unmount file systems
2023-05-17 19:52:26 +02:00
e7d482e78a
kernel+init: Add a VFS mount system and auto-populate the devfs
2023-05-17 19:40:37 +02:00
64d0f30bd9
kernel: Disallow write-related flags when opening a directory, not only when the directory flag is set
...
continuous-integration/drone/push Build is passing
Also return EISDIR instead of EINVAL as that is what Dr. POSIX mandates.
2023-05-11 21:29:49 +02:00
411c6c40cd
kernel: Add the fchmodat() and fchownat() system calls
continuous-integration/drone/push Build is passing
2023-05-11 19:49:03 +02:00
efc6d03f23
kernel+libc: Add support for unnamed pipes
continuous-integration/drone/push Build is passing
2023-05-10 22:48:31 +02:00
1a2fce5316
kernel+libc: Add the O_TMPFILE open flag and the tmpfile() function
continuous-integration/drone/push Build is passing
2023-05-09 22:04:34 +02:00
4753e80583
kernel: Make DeviceRegistry store the created devices instead of creating them when requested
continuous-integration/drone/push Build is passing
2023-05-09 18:31:27 +02:00
916a73ca95
kernel: Rework the timer subsystem to count in microseconds
continuous-integration/drone/push Build is passing
2023-05-07 21:51:36 +02:00
9bab4c62a1
kernel: Compilation fixes
continuous-integration/drone/push Build is passing
2023-05-07 21:42:03 +02:00
72dadc6706
kernel: Define a constant to check for default memory access
continuous-integration/drone/push Build is failing
2023-05-07 21:38:38 +02:00
b25e212880
kernel: Make a generic function for checking memory flags
continuous-integration/drone/push Build is failing
2023-05-07 21:37:01 +02:00
77560bbc3e
kernel+tools: Allow loading files with different owners + add a more dynamic install script
continuous-integration/drone/push Build is passing
2023-05-06 12:11:35 +02:00
9184bbfef6
kernel: Disallow passing O_WRONLY and O_DIRECTORY at the same time
continuous-integration/drone/push Build is passing
2023-05-05 18:53:50 +02:00
d9d8f7cdc7
kernel: Remove unused headers from main.cpp
continuous-integration/drone/push Build is passing
2023-05-04 23:59:46 +02:00
293a992133
kernel: Add a kernel_wait_for_event() function to avoid weird calls to kernel_wait in kthreads
continuous-integration/drone/push Build is passing
2023-05-04 23:43:00 +02:00
4a7f68b989
kernel: Add a convenience wake_up() function
2023-05-04 23:35:54 +02:00
3a1c22bb93
kernel: Add keyboard combinations for debug information dumps
...
Ctrl+Alt+E: Dump threads
Ctrl+Alt+M: Dump memory usage
Ctrl+Alt+H: Dump heap state
2023-05-04 23:32:48 +02:00
3ed9e578c7
kernel/x86_64: Wake the IO thread up only when there is an IO event, instead of polling every 10 ms
2023-05-04 23:07:09 +02:00
96f3d29d37
kernel: Tell the reap thread to run when it's needed, instead of checking every 200 ms
2023-05-04 23:06:00 +02:00
42eb0a1d74
kernel: Freeze waitpid()'s calling thread until a child tells us it's done, instead of polling it every 10 ms
2023-05-04 23:03:31 +02:00
4616997f5b
kernel: Store a thread's parent directly instead of its parent's PID
2023-05-04 22:58:04 +02:00
44e4ca804a
kernel: Make sure argument vectors passed to execve() are not too big
2023-05-04 16:36:24 +02:00
abaf24d0da
kernel/CPU: Move some stuff to StringView
2023-05-03 17:35:46 +02:00
7058ec945a
libluna: Use a String for name and handle prefix correctly in TarStream
2023-05-02 10:51:53 +02:00
3e277b5d6f
libos: Introduce os::Directory
2023-04-28 21:16:43 +02:00
0c1d33f2ec
kernel: Move some files into subdirectories
continuous-integration/drone/push Build is passing
2023-04-28 15:55:06 +02:00
52ce4b28aa
Scheduler: Remove redundant check in for_each_child
continuous-integration/drone/push Build is passing
2023-04-28 15:22:16 +02:00
7b4cfd52cd
Scheduler: Don't search threads spawned before the current thread to find children
...
continuous-integration/drone/push Build is passing
Children will always be spawned later (and thus have a higher PID) than their parent.
2023-04-28 15:19:01 +02:00
bcdec62f51
kernel: Allow returning early from Scheduler::for_each_child
2023-04-28 15:13:53 +02:00
77dcfab5ef
kernel: Run the initialization process in a thread
...
continuous-integration/drone/push Build is passing
This way we can give it more stack and also reclaim it later!
2023-04-28 13:23:07 +02:00
24f4ce9669
kernel: Only allow Ctrl+D on an empty line
2023-04-26 20:42:26 +02:00
099f6131d1
kernel: Avoid printing control characters that we don't have a special meaning for
2023-04-26 20:42:08 +02:00
97e9fceaa4
kernel+libc: Add dup2()
continuous-integration/drone/push Build is passing
2023-04-25 20:37:30 +02:00
403b0f6b94
kernel+libc+init: Add a way to modify the system hostname
continuous-integration/drone/push Build is passing
2023-04-24 21:20:44 +02:00
9eab0886b6
kernel+libc: Add uname()
continuous-integration/drone/push Build is passing
2023-04-24 20:34:44 +02:00
5d56638851
kernel: Ignore all non-bootstrap processors
continuous-integration/drone/push Build is passing
2023-04-22 12:25:43 +02:00
60694f651f
kernel/ELF: Remove unused include
continuous-integration/drone/push Build is passing
2023-04-22 12:20:30 +02:00
2acd2ed75d
kernel/ELF: Avoid zeroing out memory twice
continuous-integration/drone/push Build is passing
2023-04-22 12:19:22 +02:00
4f6e020196
kernel+libc: Add framebuffer ioctls
continuous-integration/drone/push Build is passing
2023-04-21 18:25:53 +02:00
841fc25137
kernel+init: Add a framebuffer special device file
continuous-integration/drone/push Build is passing
2023-04-21 18:18:15 +02:00
02f8a50b9d
kernel: Replace unlink() with unlinkat()
continuous-integration/drone/push Build is passing
2023-04-18 19:36:29 +02:00
e466c51e9f
kernel: Also zero out mmap-ed pages
continuous-integration/drone/push Build is passing
2023-04-17 22:16:27 +02:00
95659639e5
kernel: Zero out allocated memory for userspace to avoid leaking sensitive data
continuous-integration/drone/push Build is passing
2023-04-17 20:11:07 +02:00
949321932f
kernel: Do not forbid filenames starting with a hyphen
...
continuous-integration/drone/push Build is passing
Some programs on Linux seem to use those, better be careful.
2023-04-16 11:33:35 +02:00
e6954d2e49
kernel: Disallow problematic characters, control characters and invalid UTF-8 in filenames
2023-04-16 11:25:32 +02:00
82e7b0e860
kernel: Introduce *at() syscall framework, add openat() and fstatat()
continuous-integration/drone/push Build is passing
2023-04-15 20:26:15 +02:00
df95126ccd
kernel: Remove unneeded debug logs & random cleanups
continuous-integration/drone/push Build is passing
2023-04-14 21:10:38 +02:00
bd60c65e17
kernel: Make chown() search in the process's current directory
2023-04-13 18:20:07 +02:00
417e505750
kernel+libc: Add unlink(), rmdir(), remove()
2023-04-12 18:11:36 +02:00
427662d5f1
kernel+libc: Add getcwd()
2023-04-11 22:45:13 +02:00
7db215819e
exec: Respect the program's working directory
2023-04-11 22:44:25 +02:00
2a967f4b8b
kernel+libc: Add chdir()
2023-04-11 22:15:21 +02:00
2d30935fdb
kernel: Give each thread a working directory
2023-04-11 22:14:57 +02:00
79a96bf5af
kernel/ELF: Remove old FIXME
continuous-integration/drone/push Build is passing
2023-04-11 21:24:11 +02:00
13c9caa856
kernel+libc: Add stat() + fstat()
continuous-integration/drone/push Build is passing
2023-04-10 19:56:03 +02:00
fee33e7a14
kernel: Add ioctls() for termios stuff to ConsoleDevice
...
Only handles echoing for now.
2023-04-09 11:23:57 +02:00
76eb8cd129
kernel: Add an ioctl() system call
2023-04-09 11:22:57 +02:00
3887b98a7d
kernel: Support setuid binaries
...
continuous-integration/drone/push Build is passing
You still have to run "chmod 4755 /bin/su" as root inside Luna for now, as this is not done by the install scripts.
2023-04-08 16:32:56 +02:00
059c2bfa3f
kernel+libc: Add chown and chmod
2023-04-08 14:47:34 +02:00
3da1849c99
kernel+libc: Add set* and get* syscalls for UIDs and GIDs
2023-04-08 13:50:18 +02:00
f6f9254eb4
kernel: Add process and filesystem UIDs and GIDs
2023-04-08 13:12:49 +02:00
3a28771520
kernel+libc+apps: Add support for environment variables
2023-04-07 15:03:38 +02:00
3ef484b3f3
kernel: Add missing include
2023-04-07 14:37:06 +02:00
3a70accdeb
kernel: Move copy_string_vector_to_userspace to ThreadImage
2023-04-07 14:36:24 +02:00
b22bea84ec
kernel: Copy process name on fork()
continuous-integration/drone/push Build is passing
2023-04-07 14:02:36 +02:00
7b8260f3f6
all: Enable/disable debug symbols/optimization in COMMON_FLAGS
2023-04-07 12:07:08 +02:00
d07b00a892
all: Move all warning flags to a common CMake variable
2023-04-07 12:02:49 +02:00
1f0e185904
kernel: Use try_set_value(_or_error) in various places
2023-04-07 10:55:04 +02:00
ed0727332b
x86_64/CPU: Assign a proper IRQ number to the keyboard interrupt
...
continuous-integration/drone/push Build is passing
Ah, the dangers of copy-and-paste...
2023-04-04 12:13:34 +00:00
64bca780a7
kernel: Add /dev/zero
continuous-integration/drone/push Build is passing
2023-03-30 21:19:16 +02:00
2fbc6105d7
kernel+libc: Add O_DIRECTORY and use it in opendir()
continuous-integration/drone/push Build is passing
2023-03-29 22:23:52 +02:00
01813ff0dd
String: Rename from_string_literal to from_cstring
2023-03-29 17:34:30 +02:00
b6c35124d6
libluna: OwnedStringView -> String
...
Also with inline storage!
2023-03-29 17:28:22 +02:00
5623f3c699
tmpfs: Set the mode of the root directory on creation
2023-03-29 01:06:26 +02:00
0847cfcb65
kernel: Add a getdents() syscall
continuous-integration/drone/push Build is passing
2023-03-28 21:28:56 +02:00
8eb4d693ac
VFS: Add virtual method get() for getdents() and make existence checking occur in add_entry()
2023-03-28 21:15:26 +02:00
6239ed83c7
kernel+libc: Add F_GETFD, F_SETFD, F_GETFL and F_SETFL to fcntl
2023-03-28 20:55:38 +02:00
1635eaf992
kernel: Eliminate the splash screen
...
Userspace is free to show a splash if it wants, but the kernel shouldn't force it upon us.
2023-03-24 21:48:32 +01:00
770286a19d
kernel+libc: Implement fcntl() for F_DUPFD and F_DUPFD_CLOEXEC
continuous-integration/drone/push Build is passing
2023-03-24 21:33:20 +01:00
0de41410c6
kernel: Use path as the new process name instead of argv[0]
2023-03-24 21:26:45 +01:00
8b712b04c2
kernel: Build with optimizations only in debug mode
2023-03-24 21:25:26 +01:00
36e48b2ad2
kernel: Do not attempt to close non-existent FDs on exec()
2023-03-24 21:21:13 +01:00
374a9ff7b8
kernel+libc: Implement O_CLOEXEC
2023-03-24 21:19:24 +01:00
d48d0efb07
kernel: Add names to threads
continuous-integration/drone/push Build is passing
2023-03-24 21:05:38 +01:00
4d3050eaab
kernel: Retrieve all thread information before marking it as dead in waitpid()
...
continuous-integration/drone/push Build is passing
In case we get interrupted by the reaper thread.
2023-03-24 20:59:07 +01:00
e76ccd6c4c
kernel+libc+init: Add getppid() and wait()
continuous-integration/drone/push Build is passing
2023-03-24 17:39:55 +01:00
7efcc06090
kernel+init+sh: Implement parent processes and waitpid(-1, ...)
continuous-integration/drone/push Build is passing
2023-03-24 17:37:04 +01:00
f084b57f39
kernel+sh: Allow using Ctrl+D to send EOF
continuous-integration/drone/push Build is failing
2023-03-24 17:21:21 +01:00
d63c8abbfd
kernel/x86_64: Terminate page faults in a waitpid-friendly way
2023-03-24 00:52:17 +01:00
b6fb5f3dfe
kernel+libc: Implement waitpid()
continuous-integration/drone/push Build is passing
2023-03-23 22:42:24 +01:00
41c7e3780d
kernel: Add support for exit codes and start preparing for waitpid()
2023-03-23 22:25:56 +01:00
937802964c
kernel: Invert O_NONBLOCK to check whether a thread should block
2023-03-23 21:34:38 +01:00
95e884db97
kernel: Fix compilation
2023-03-23 21:34:09 +01:00
03adaa356c
kernel: Avoid printing keypresses twice
2023-03-23 21:33:50 +01:00
cda036ce70
ConsoleDevice: Use a temporary buffer for backspace handling
continuous-integration/drone/push Build is failing
2023-03-23 21:22:12 +01:00
d33fccc66f
kernel: Implement reading from /dev/console
2023-03-19 19:15:19 +01:00
51f0bdff0e
kernel+libc: Add O_NONBLOCK
continuous-integration/drone/push Build is passing
2023-03-19 11:25:14 +01:00
41514d9ad2
kernel: Add support for blocking reads
2023-03-19 11:21:50 +01:00
cd00e41f59
arch/x86_64: Decode keyboard scancodes
continuous-integration/drone/push Build is passing
2023-03-19 11:17:43 +01:00
54f2d35416
kernel: Add the fork() system call
2023-03-18 23:45:48 +01:00
a4ac3c85ed
kernel+libc: Copy argv to userspace
continuous-integration/drone/push Build is passing
2023-03-18 22:25:19 +01:00
0b00dc3fe4
kernel/exec: Rename item to string_addr
continuous-integration/drone/push Build is passing
2023-03-18 21:56:34 +01:00
7f50893786
kernel/exec: Copy argv from userspace
continuous-integration/drone/push Build is passing
2023-03-18 21:55:16 +01:00
49952320d6
kernel+libluna: Remove console_write entirely
continuous-integration/drone/push Build is passing
2023-03-18 20:12:59 +01:00
6a6a56a8b4
kernel: Make /dev/console actually respect the length parameter instead of trusting userspace's null terminators
2023-03-18 20:10:00 +01:00
d01ba20749
kernel/TextConsole: Add a write() function that accepts a fixed-size buffer instead of relying on null terminators
2023-03-18 20:09:10 +01:00
629ed9e43b
libc: Start switching to /dev/console for console IO and add a proper init
2023-03-18 19:23:18 +01:00
7173c05a22
kernel: Add support for special device files and add a mknod() syscall
2023-03-18 09:10:33 +01:00
b9e8030aac
kernel: Free the initial ramdisk memory after copying everything into the VFS
continuous-integration/drone/push Build is passing
2023-03-16 23:02:53 +01:00
59838f1225
kernel: Replace some raw divisions with get_blocks_from_size()
2023-03-16 23:01:35 +01:00
8c72e9a49a
kernel: Add an exec() system call
...
continuous-integration/drone/push Build is passing
Doesn't support arguments or environment for now.
2023-03-16 22:44:58 +01:00
08c888eaae
kernel+libc: Remove (de)allocate_memory and replace it with POSIX mmap
continuous-integration/drone/push Build is passing
2023-03-14 20:43:15 +01:00
d66506256d
kernel/VFS+libc: Introduce modes
continuous-integration/drone/push Build is passing
2023-03-12 16:55:46 +01:00
02dbcbbfa1
kernel: Add strdup_from_user()
continuous-integration/drone/push Build is passing
2023-03-12 16:30:36 +01:00
682d3c753e
kernel+libc: Add mkdir()
continuous-integration/drone/push Build is passing
2023-03-12 15:32:09 +01:00
354ffd033c
VFS: Add a size() method to inodes to implement seeking to the end of a file
continuous-integration/drone/push Build is passing
2023-03-12 14:49:21 +01:00
b54a7f3a80
kernel+libc: Add O_* flags and parse them in open()
...
continuous-integration/drone/push Build is passing
O_RDONLY, O_WRONLY, O_RDWR, O_TRUNC, O_CREAT and O_EXCL are fully implemented.
O_APPEND is partially implemented.
Other flags are not here yet.
2023-03-12 14:43:58 +01:00
bd572473ad
kernel: Remove FileDescriptorTable and add a helper to resolve fds to FileDescriptors
2023-03-12 13:57:38 +01:00
7e655e320a
kernel+libc: Add the lseek() syscall, and fseek, ftell, rewind, fsetpos, and fgetpos
continuous-integration/drone/push Build is passing
2023-03-12 13:15:24 +01:00
292433dc39
kernel+libc: Add the write() system call, and fwrite()
2023-03-12 11:37:41 +01:00
c0a7f6776f
kernel+libc: Add getpid()
continuous-integration/drone/push Build is passing
2023-03-11 22:19:58 +01:00
8fa72f3cf0
kernel+libc: Implement read()
continuous-integration/drone/push Build is passing
2023-03-11 18:02:50 +01:00
810c4bc257
kernel+libc: Start interfacing with the VFS from userspace (open & close)
...
This commit adds open and close syscalls to the kernel, and adds matching wrappers to libc.
No read/write support, so file descriptors are kind of useless for now.
2023-03-11 17:45:20 +01:00
ff468db675
kernel/ELF+Scheduler: Use VFS instead of TarStream
continuous-integration/drone/push Build is passing
2023-03-11 10:34:08 +01:00
c6aa2fe4ad
VFS: Populate the initial filesystem based on the initial ramdisk
2023-03-11 10:23:46 +01:00
ac304073b4
tmpfs: Disallow creating files/folders with already used names
2023-03-11 10:14:42 +01:00
d95ef110c9
vfs: Add support for creating directories given a full path
2023-03-11 01:13:44 +01:00
e5a41d2d52
tmpfs: Implement FileInode read() and write()
2023-03-11 00:52:39 +01:00
6fbf97292a
VFS: Implement resolve_path() using PathParser
...
continuous-integration/drone/push Build is passing
Already works better than old luna (handles .. correctly)
2023-03-10 22:18:48 +01:00
ff770b7328
VFS+TmpFS: Add support for creating subdirectories (mkdir)
continuous-integration/drone/push Build is passing
2023-03-10 21:09:08 +01:00
abdd460525
tmpfs: use adopt_shared_if_nonnull instead of plain adopt_shared in FileSystem::create()
2023-03-07 22:16:52 +01:00
e30eec4213
kernel/x86_64: Avoid kernel panics when a page fault occurs in a userspace thread
2023-03-07 21:08:05 +01:00
ca85a69442
kernel: Save floating-point environment when switching in and out of userspace threads
2023-03-07 20:59:11 +01:00
de38eb6877
luna: Remove pure_cstyle_format
...
continuous-integration/drone/push Build is passing
It was causing a lot of code duplication. If someone doesn't have errors, just return {} from the callback and unwrap the Result.
2023-03-02 13:38:21 +01:00
a595a77421
kernel: Print percentage in splash screen
continuous-integration/drone/push Build is passing
2023-02-27 16:27:59 +01:00
9afff7c544
kernel: Add a fun splash screen during boot :)
...
continuous-integration/drone/push Build is passing
Mostly for fun.
Has a lot of delay in order to see the actual splash screen.
2023-02-27 16:23:51 +01:00
65dd3cd7fb
TmpFS: Use StaticString<128> instead of char[128]
2023-02-27 15:22:39 +01:00
8ba571a30e
TmpFS: Use a fixed char array in DirInode's Entry instead of OwnedStringView
2023-02-27 15:22:39 +01:00
01b6294f76
kernel: Implement creating file inodes in tmpfs directories
2023-02-27 15:22:38 +01:00
a65f4311aa
tmpfs: make the root inode a DirInode instead of a FileInode
2023-02-27 15:22:38 +01:00
dd2f31d8d0
tmpfs: add DirInode skeleton
2023-02-27 15:22:38 +01:00
5fb292bc0e
tmpfs: rename tmpfs::Inode to tmpfs::FileInode
2023-02-27 15:22:37 +01:00
d3bda46325
tmpfs: Make m_next_inode_number atomic
2023-02-27 15:22:37 +01:00
ba9d725481
kernel: Rename FileSystem::root() to root_inode() and add a shortcut for the root filesystem's root inode
2023-02-27 15:22:37 +01:00
3a2b8bcfd7
kernel: Make a factory function for filesystem creation of inodes, and add inode numbers
...
Now every filesystem must provide fs->create_file_inode() for new inodes :)
2023-02-27 15:22:37 +01:00
a49555addc
kernel: Add a subclass of VFS::Inode to make it easier to implement file inodes
2023-02-27 15:22:36 +01:00
9274ad0404
kernel, luna: Move Spinlock.h to luna
2023-02-27 15:22:24 +01:00
c422d11682
kernel: Start working on a VFS implementation using OOP and SharedPtr
2023-02-27 15:22:24 +01:00
71b981175e
InitRD: Use MMU::translate_physical_address instead of allocating VM
...
continuous-integration/drone/push Build is passing
This one is a perfect candidate, since we're just mapping a fixed continuous range of physical memory to virtual memory.
2023-02-27 13:27:21 +01:00
f0a3f99cf9
MemoryManager: Initialize KernelVM at the end of init()
...
KernelVM is not needed for MMU's init process anymore.
2023-02-27 13:24:58 +01:00
519aa347dd
x86_64: Remove recursive mapping related things from MMU.h
continuous-integration/drone/push Build is passing
2023-02-27 13:07:52 +01:00
3ec54fafde
x86_64/MMU: Do not allocate level 1 page tables for huge page entries
...
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
This would leak memory, since we would never end up using them.
2023-02-27 12:55:15 +01:00
752dfdbf1c
MemoryManager: Reuse the existing mapping of physical memory that MMU has
continuous-integration/drone/pr Build is passing
2023-02-27 12:51:29 +01:00
8df441064f
x86_64/MMU: Map the physical address space using huge pages
2023-02-27 12:47:17 +01:00
426f6e4da8
x86_64: Allow mapping huge pages, but don't do it yet
2023-02-27 12:41:28 +01:00
837d483e0b
x86_64/MMU: Copy from the mapped kernel directory instead of the physical version
continuous-integration/drone/pr Build is passing
2023-02-27 12:30:52 +01:00
995d1bc36e
x86_64/MMU: Map all physical memory into the higher half instead of using recursive mapping
...
continuous-integration/drone/pr Build is passing
This still has a few problems. Notably, we are not using huge pages for this mapping, which would be a lot more efficient.
Right now, used memory is 8.1 MiB at boot for a 256MiB system.
But after improving it, this system will be much better than recursive mapping.
fork() will be MUCH easier to implement, for example.
2023-02-27 12:24:21 +01:00
0985b75057
kernel: Add a guard page to the bootstrap stack so that we can catch more stack overflows
continuous-integration/drone/push Build is passing
2023-02-25 17:42:32 +01:00
8352df5ee8
kernel: Enable UBSAN when building in debug mode
continuous-integration/drone/push Build is passing
2023-02-25 17:37:50 +01:00
794567327f
kernel, luna: Port non-VFS changes over from pull request #22
...
continuous-integration/drone/push Build is passing
OwnedPtr, SharedPtr: Add operator bool
Option, Result: Make try_move_value() non-const since it modifies the Option
kernel: Switch to a stack we control for the main task as soon as we leave early boot
Heap: Fix GPF caused when making many small allocations
Heap: Avoid accessing a block after it's potentially deleted
luna: Skip UBSAN.cpp in CMakeLists as that's not implemented yet
luna: Use spinlocks in the heap implementation
kernel, luna: Move Spinlock.h to luna
Option: Use __builtin_launder to ensure that the compiler doesn't label this as UB
SharedPtr: Implement make_shared using adopt_shared
SharedPtr: Delete ptr on failure in all adopt_shared* functions
2023-02-25 17:09:03 +01:00
89958fbc74
kernel: Show a more technical message on failure to remap kernel data sections
continuous-integration/drone/push Build is passing
2023-02-02 21:26:07 +01:00
c05a87c7ff
kernel: Reenable the text console on panic
continuous-integration/drone/push Build is passing
2023-02-01 22:58:31 +01:00
3a84e4998c
kernel/Thread: Add FIXME
continuous-integration/drone/push Build is passing
2023-01-31 17:02:49 +01:00
35501407c1
kernel: Stop shouting when creating threads
continuous-integration/drone/push Build is passing
2023-01-25 21:25:34 +01:00
fd0e29ede5
kernel: Add FIXME in copy_to_user()/copy_from_user()
continuous-integration/drone/push Build is passing
2023-01-25 21:22:14 +01:00
635437a4a4
luna: Add a new idiomatic way to mark unused parameters as used while keeping their names
...
Just call ignore(...)
2023-01-25 21:14:44 +01:00
39042cbbd4
kernel: PCI constness updates
continuous-integration/drone/push Build is passing
2023-01-25 21:01:45 +01:00
fa29d6e9b9
kernel: Rename PCI::callback_t to PCI::Callback
continuous-integration/drone/push Build is passing
2023-01-25 20:58:59 +01:00
15c89a3592
kernel: Implement filtered PCI scans
continuous-integration/drone/push Build is passing
2023-01-23 21:24:05 +01:00
3a4ca73df7
kernel: Sync log output
continuous-integration/drone/push Build is passing
2023-01-23 20:42:34 +01:00
6677c643a5
kernel: Start scanning the PCI bus for devices
continuous-integration/drone/push Build is passing
2023-01-23 20:07:17 +01:00
de04c094e7
x86_64: Skip enabling WP for now until I find how to check for its availability
2023-01-23 20:06:45 +01:00
7f8a8cdcaf
kernel, libc: Add an usleep() system call and use that to implement usleep() and sleep() in libc
continuous-integration/drone/push Build is passing
2023-01-22 15:00:20 +01:00
d5b1d72396
x86_64/MMU: Map the kernel page directory to virtual memory
...
This avoids depending on the kernel address space to create a new userspace one,
since there is no physical memory access.
This was fine for a single process, since its address space was created from the kernel one
and no more address spaces were created,
but for two or more, this started to become problematic, since we would create one address space
while being in another process's address space, which has no direct mapping of physical memory.
2023-01-22 14:46:03 +01:00
a7a38d3433
Bitmap: Add a fallible variant of match_region() that does not crash if arguments are out of range
...
continuous-integration/drone/push Build is passing
This lets us call deallocate_memory() with any address and it will not crash.
2023-01-22 14:25:51 +01:00
0126a8fb6e
luna: Add a new SourceLocation class and use that in check() and expect()
2023-01-22 11:43:48 +01:00