0c873923e8
kernel: Make OpenFileDescription shareable
continuous-integration/drone/pr Build is passing
2023-07-30 11:33:46 +02:00
bb3127c212
kernel: Implement listen(), connect() and accept()
2023-07-30 11:33:06 +02:00
7a7ae086f5
kernel: Use a did_close callback for UnixSockets
2023-07-30 11:33:06 +02:00
fb08594a18
kernel: Separate FileDescriptors and OpenFileDescription
...
Also, add a did_close() callback for OpenFileDescriptions losing all their references.
2023-07-30 11:33:06 +02:00
a12b018b03
kernel+libc: Add basic Unix sockets (creation and binding)
2023-07-30 11:33:06 +02:00
c4e30c3029
kernel: Add functionality to allow external inodes (such as sockets) to acquire an inode number from a file system
...
This is only implemented in tmpfs.
2023-07-30 11:33:06 +02:00
c1d08b904e
kernel+libluna: Add Buffer::dequeue_data()
2023-07-30 11:33:05 +02:00
200bb6c240
kernel+libc+libos: Add inode type for sockets
2023-07-30 11:33:05 +02:00
4ed7ec5e93
libluna: Store SharedPtr's ref count in the object itself
continuous-integration/drone/push Build is passing
2023-07-30 11:32:46 +02:00
28cc4b2306
kernel: Add default action for SIGWINCH
continuous-integration/drone/push Build is passing
2023-07-27 14:00:30 +02:00
11df5a2ec3
kernel: Use pid_t internally for process IDs
...
continuous-integration/drone/push Build is passing
This removes a bunch of casts between pid_t and u64, and makes more sense since pid_t is literally the data type for process IDs.
2023-07-26 21:32:00 +02:00
5aad7d3154
kernel/x86_64: Fail on invalid interrupts instead of calling FIXME_UNHANDLED_INTERRUPT
...
continuous-integration/drone/push Build is passing
A FIXME is something that should be changed later,
this is a check for something that should never happen.
2023-07-25 18:23:33 +02:00
28dd8194af
kernel: Include waited-for grandchildren in RUSAGE_CHILDREN's times
continuous-integration/drone/push Build is passing
2023-07-25 17:50:15 +02:00
b88da4811f
kernel: Remove debug message in readlink
continuous-integration/drone/push Build is passing
2023-07-25 17:30:56 +02:00
105ed79f8f
kernel: Reenable userspace stack tracing, but hidden behind a config flag
...
continuous-integration/drone/push Build is passing
Sometimes this is needed for userspace program debugging (such as ports),
but sometimes it can crash, so we leave it off by default.
2023-07-25 17:02:09 +02:00
ad3f3bf4db
kernel: Log the release name and build date in the boot log
2023-07-24 11:48:01 +02:00
358493a7bc
kernel: Add a system for release names in uname(), call alpha releases "Mercury"
continuous-integration/drone/push Build is passing
2023-07-22 12:21:01 +02:00
36a74fd8d6
kernel/x86_64: Provide an alternate kernel stack for exceptions
...
continuous-integration/drone/push Build is passing
This avoids stack-related triple faults, hopefully.
Closes #33 .
2023-07-21 15:14:52 +02:00
310b325af8
kernel: Avoid some more -Wconversion errors in TextConsole
2023-07-21 15:14:05 +02:00
cd6bf745a7
tests+kernel+init: Run tests automatically in a headless way
continuous-integration/drone/push Build is failing
2023-07-21 14:09:37 +02:00
bcfee628cb
kernel: Remove outdated FIXME
continuous-integration/drone/push Build is passing
2023-07-15 13:19:47 +02:00
0d41e1f7b6
kernel/ext2: Change outdated FIXME
continuous-integration/drone/push Build is passing
2023-07-15 13:17:58 +02:00
f9003d7a58
kernel: Mask away unsafe bits in rflags when restoring state after a signal
continuous-integration/drone/push Build is passing
2023-07-15 11:54:48 +02:00
89786d8be2
kernel: Save/restore the SSE/FPU state when executing signal handlers
2023-07-15 11:53:50 +02:00
de6fe7f7c2
kernel+libc+sh: Make the TTY device actually follow termios rules
...
continuous-integration/drone/push Build is passing
Like, so much more termios compatibility!
2023-07-13 20:33:20 +02:00
efd5bae7a5
kernel: Implement querying the terminal window size
continuous-integration/drone/push Build is failing
2023-07-12 22:09:28 +02:00
546d900454
libc+apps: Start implementing POSIX-compliant termios.h wrappers around tty ioctls
continuous-integration/drone/push Build is passing
2023-07-12 19:23:06 +02:00
5f698b4774
kernel: Don't create a new kernel stack on exec()
...
continuous-integration/drone/push Build is passing
The old one was not getting freed, creating a memory leak every exec(),
which can get huge over time.
Plus, there was no need for a new stack.
And we couldn't just free the old one, since sys_execve() runs on the old stack...
2023-07-12 16:06:56 +02:00
f629e17ff4
kernel/x86_64: Only show kernel addresses in backtraces
...
This avoids walking off into userspace memory where we don't know what could happen.
2023-07-12 16:04:45 +02:00
81e1fdf81e
kernel+libc+login+sh+su: Implement foreground and background process groups in the default console
...
continuous-integration/drone/push Build is passing
Also, the console sends SIGINT to the foreground process group when ^C is pressed!
2023-07-12 13:49:37 +02:00
9f45026cc2
kernel+sh: Implement interruptible syscalls
2023-07-12 13:48:43 +02:00
71ff763dd9
kernel+libc: Add the SIGTTIN and SIGTTOU signals
2023-07-12 13:45:36 +02:00
b64093dee5
kernel+libc: Implement getpgid()
2023-07-12 13:44:25 +02:00
d27ffce5db
kernel: Move the signal handling logic to after a syscall sets its return value
...
When a signal was caught after a syscall, it was doing so without preserving the return value of the syscall.
2023-07-12 13:34:30 +02:00
69f9701097
kernel+libc: Implement isatty()
continuous-integration/drone/push Build is failing
2023-07-11 12:05:09 +02:00
7328cfe734
kernel: Add basic process groups
continuous-integration/drone/push Build is passing
2023-07-11 11:51:07 +02:00
86d14e0d0e
kernel+libc: Add the SA_NODEFER and SA_RESETHAND flags for sigaction()
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-07-10 21:54:04 +02:00
fe9827bbeb
kernel: Fix fallthrough in switch statement
continuous-integration/drone/pr Build is passing
2023-07-10 21:09:12 +02:00
8066e8f1d8
kernel+libc: Implement sigprocmask() and friends
continuous-integration/drone/pr Build is failing
2023-07-10 21:01:59 +02:00
015419b8f5
kernel: Generate signals when children exit / when faults occur
...
Userspace can now catch segfaults!
2023-07-10 20:49:22 +02:00
60d68b74e1
kernel: Define a good set of default signals
...
Most of these have POSIX-defined numbers.
2023-07-10 20:30:37 +02:00
cde467ee46
kernel: Support returning termination signals from waitpid
continuous-integration/drone/pr Build is passing
2023-07-10 20:16:06 +02:00
fc3fdc2b87
kernel: Add default actions for signals
2023-07-10 19:59:01 +02:00
bdcb690a7a
kernel: Avoid processing unregistered signals for init
2023-07-10 19:48:46 +02:00
15d6aae701
kernel+libc: Implement basic signals
2023-07-10 19:46:57 +02:00
56f3d26969
kernel+libluna: Fix the CRC32 algorithm and use it to verify the GPT header
continuous-integration/drone/push Build is passing
2023-07-10 14:54:55 +02:00
16b0531d42
kernel+apps+base+tools: Use Ext2 for the root partition file system
...
continuous-integration/drone/push Build is passing
init is now split into two parts: preinit, which lives in the initrd and prepares the root file system for init,
and the actual /usr/bin/init, which lives in the root partition and starts services and reaps zombies.
The kernel now looks for /bin/preinit instead of /bin/init as the executable for the init process.
All configuration files in initrd/etc have been moved to base/etc. (The plan is to have only moon and preinit in the initrd.)
Since the current Ext2 implementation is read-only (and it's on a CDROM so it would be read-only anyways),
/home/selene is a tmpfs (as well as /tmp), to allow for a writable home directory.
The system is slower now, but that's to expect since the Ext2 code doesn't use caching and the ATA code still uses PIO.
2023-07-10 13:05:06 +02:00
40413eee18
kernel: Panic when PID 1 exits/crashes
2023-07-10 13:04:47 +02:00
e3552d9df0
kernel: Log hostname changes
2023-07-10 13:04:40 +02:00
a1b92fcc3f
kernel: Add the MOUNT_DEBUG flag
2023-07-10 13:04:34 +02:00
0b488c1232
kernel: Actually use config.cmake
...
Looks like file(EXISTS) needs a full path.
2023-07-10 13:04:26 +02:00
b920ffee42
kernel: Don't use an active directory for the idle thread
...
Just take the currently used directory.
2023-07-10 13:04:18 +02:00
503dc72686
kernel: Set kernel threads' initial active directories to avoid taking the first directory they use
...
This ends up being init's directory, which is fine when init's directory doesn't change...
but a little less fine when the init process calls exec()...
which is what it does in the new configuration I'm testing...
2023-07-10 13:04:00 +02:00
7908c5a63e
kernel/ATA: Do not discard the controller if at least one channel initialized properly
...
This was causing problems in VirtualBox.
2023-07-10 13:01:43 +02:00
ae0cd155c3
kernel: Fix AddressSpace's move assignment operator
continuous-integration/drone/push Build is passing
2023-07-09 20:43:03 +02:00
c599251d2a
kernel: Rename UserVM to AddressSpace
...
continuous-integration/drone/push Build is passing
This is a more appropriate name now that it does more stuff than allocate virtual memory.
To be fair, the name was a bit awkward anyway. Should have been UserVMAllocator I guess.
2023-07-09 20:38:04 +02:00
5e564e9ae3
kernel: Move Thread::self_directory to UserVM
...
Since this is only used by user threads, UserVM is a convenient/related place to store the PageDirectory in a RAII manner.
2023-07-09 20:32:42 +02:00
af26dce038
kernel: Zero physical frames instead of virtual pages
...
continuous-integration/drone/push Build is passing
The memset() happens a bit earlier, and we don't have to remap the
mapped virtual memory.
2023-07-04 00:49:26 +02:00
3b1219ecf2
kernel/ext2: Make the inner extended superblock struct packed as well
continuous-integration/drone/push Build is passing
2023-07-02 19:50:27 +02:00
bd757d204e
kernel+libos+libluna: Avoid copying and reallocation when creating Strings
...
continuous-integration/drone/push Build is passing
This is done by reusing the existing buffers in Vector and Buffer instances.
2023-07-02 19:30:25 +02:00
d363d5e915
kernel/ext2: Make sure we don't crash when accessing the last inode
continuous-integration/drone/push Build is passing
2023-07-02 17:30:14 +02:00
dd914b16d1
kernel: Stop showing memory stats at boot
...
continuous-integration/drone/push Build is passing
No userspace interface yet, but this can be shown using Shift+Ctrl+M.
2023-07-02 16:02:38 +02:00
e9e7b22323
kernel: Separate a thread's page directory into two
...
continuous-integration/drone/pr Build is passing
The self directory, and the active directory. The active directory is the one the thread is currently using,
and the self directory is the one the thread owns.
This lets us keep track of both, which fixes ext2 executables crashing the system.
2023-06-25 20:35:40 +02:00
5f4103251a
kernel: Preserve the new page directory while exec() is running
2023-06-25 20:35:40 +02:00
da689dd1a7
kernel/ext2: Allow reading up to 4 MB of data from files
...
This is done by scanning the singly indirect pointer of the inode.
2023-06-25 20:35:39 +02:00
41f578aa18
kernel/ext2: Add support for symbolic links
2023-06-25 20:35:38 +02:00
34e1ef36b1
kernel: Make pivot_root() reset the parent entry of the new root directory
...
Otherwise it would just be pointing to the old parent fs, and we don't want that.
2023-06-25 20:35:38 +02:00
a62265b504
kernel/ext2: Implement directory traversal
2023-06-25 20:35:37 +02:00
4fe6c506ec
kernel/ext2: Implement Inode::read()
2023-06-25 20:35:37 +02:00
77686b26f8
kernel/Ext2: Read the root inode metadata from the disk
2023-06-25 20:35:36 +02:00
a9460469d9
kernel+libc+apps: Add a source parameter to the mount() system call
2023-06-25 20:35:35 +02:00
707f64acb5
kernel: Add an Ext2 filesystem skeleton
2023-06-25 20:35:35 +02:00
ddf63471a8
kernel: Add missing debug flag to debug.cmake
continuous-integration/drone/push Build is passing
2023-06-25 20:35:15 +02:00
3b6f5b28fc
kernel: Make the configurable filename restrictions actually compile
continuous-integration/drone/push Build is passing
2023-06-22 20:24:33 +02:00
fdf2bb2501
kernel: Make the filename restrictions configurable
continuous-integration/drone/push Build is passing
2023-06-22 20:22:43 +02:00
3d157b760c
kernel: Make the stack and loaded program code regions persistent
...
continuous-integration/drone/push Build is passing
This way, they can't be modified by mmap() or munmap().
2023-06-19 12:44:49 +02:00
54a1998d42
kernel: Also move children's parent to PID 1 in the common thread exit function
continuous-integration/drone/push Build is passing
2023-06-19 12:35:31 +02:00
e60b2a3d2f
kernel: Move thread exit code into a separate common function
continuous-integration/drone/push Build is passing
2023-06-19 12:33:25 +02:00
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