Commit Graph

1834 Commits

Author SHA1 Message Date
Bananymous 99270e96a9 Kernel: Lock debug lock while printing fault details
This allows multiprocessor to dump clean output on concurrent faults
2024-05-29 15:49:24 +03:00
Bananymous 4bf7a08c80 Kernel: Allow SYS_PSELECT to work with timeout of zero 2024-05-29 15:32:18 +03:00
Bananymous 3823de6552 Kernel: Add templated get function for Random 2024-05-29 15:32:00 +03:00
Bananymous 30592b27ce BAN: Add comparison operators for RefPtr 2024-05-29 13:50:03 +03:00
Bananymous 8bc6c2eb20 Kernel: Move KeyEvent/MouseEvent from kernel to LibInput 2024-05-28 23:30:08 +03:00
Bananymous 87d52e5ebe Kernel: Fix timer early wake message
When printing early return message, current time was read twice. This
could lead to early return check failing, but when printing and reading
the time again subtraction overflow would happen.
2024-05-28 16:04:18 +03:00
Bananymous 598a09c13d Kernel: Allow select to work on any type of inode 2024-05-28 16:03:54 +03:00
Bananymous 54db4ab215 BAN: Increase BAN::Function storage size to 8 pointers 2024-05-28 16:01:41 +03:00
Bananymous 5b5ccba247 LibC: Define PATH_MAX in limits.h 2024-05-28 01:08:25 +03:00
Bananymous 18e2559b1e Kernel/LibC: Add SYS_TRUNCATE 2024-05-28 01:08:04 +03:00
Bananymous f5987b68ff BAN: Mark some class methods as constexpr 2024-05-28 01:07:29 +03:00
Bananymous a1ab44d39f Kernel: Optimize disk reads to read multiple sectors at once
Old StorageDevice::read_sectors() read each sector separately if the
underlying disk had a disk cache. This patch allows multiple sectors to
be read even if the disk cache exists and contains some of the sectors.

Only sectors that could not be found from the disk cache are actually
read from the disk. This optimization is not done for writing, which
still will write each sector separately, if disk cache has no memory to
store new sectors. It would feel kind of unnecessary optimization as you
have greater problems if disk cache cannot allocate a single page.
2024-05-27 15:52:34 +03:00
Bananymous 8b1514e575 Kernel: Make all storage devices readable and writable
I only had a {read,write}_impl defined for ATABaseDevice. This patch
moves that implmentation to general storage device.
2024-05-27 13:41:55 +03:00
Bananymous 2d3810874d Kernel: Fix thread signal handling
Threads will now only handle signals once they are not holding any
mutexes. This removes some dead locks.
2024-05-26 20:08:35 +03:00
Bananymous a4c634e4bf Sysroot: Fix us keymap bracket keys 2024-05-26 16:08:29 +03:00
Bananymous 2a4d986da5 Kernel: Add preliminary support for PCIe
Only segment 0 is supported, but devices can now be accessed through
mmio.

Adding more segments would require adding argument to every PCI API so
it is left for later.
2024-05-25 20:50:07 +03:00
Bananymous 3b18730af6 BuildSystem: Don't build libstdc++ as libc is not complete enough 2024-05-25 19:17:13 +03:00
Bananymous df260fe0e8 Kernel: Process::validate_pointer_access now maps the whole range
This fixes a bug where userspace provided address is not fully mapped
and the kernel tries to read/write it while using PageTable fast page.

In the future userspace input should be copied on syscall entry, so
userspace could not modify the input during syscall. Currently there
is change that userspace input passes kernel syscall validation and
after that userspace could modify the input before the value is
actually used.
2024-05-24 14:14:17 +03:00
Bananymous 2be4fe8404 Kernel: Make PageTable::s_fast_page_lock non-recursive
This lock is only used in wrapper of PageTable. There is no possiblity
of taking the lock outside of these wrappers.
2024-05-24 14:12:35 +03:00
Bananymous 7db7cfe20f BuildSystem: Only use kvm if user has rw access 2024-05-24 11:09:04 +03:00
Bananymous cc2cc2849e Whoami: Rewrite whoami using getlogin 2024-05-23 15:44:21 +03:00
Bananymous 06f4b0b29a BAN: Make String and StringView header only
This allows linking with libc without having to link ban
2024-05-23 15:43:26 +03:00
Bananymous e22821799b LibC: Implement getlogin() 2024-05-23 15:07:21 +03:00
Bananymous 14dd9294aa LibC: Add _POSIX constants to limits.h 2024-05-23 15:04:59 +03:00
Bananymous 83e3409bd8 Kernel/LibC: Update SYS_SEEK to return new offset and implement lseek 2024-05-23 14:49:23 +03:00
Bananymous 7630170ed6 LibC: Implement qsort as quick sort 2024-05-23 14:44:48 +03:00
Bananymous 0af74fccda Kernel/LibC: Rework dirent structure
dirent now contains statically sized d_name. This allows using
sizeof on the name and dirent properly, which some programs seem
to be using.
2024-05-22 20:19:59 +03:00
Bananymous e77de1804f Kernel: Fix some race conditions in TCP stack
Remove race condition if two acks are to be sent one after another.

Always unblock semaphore once TCP thread has done something. This
allows better chance of TCP sending to succeed.

There are multiple places in the networking code that would require
thread-safe entering to blocking mode. I should add some API for this
so that a lot of race conditions could be removed.
2024-05-21 01:53:45 +03:00
Bananymous e00b92225d Kernel: Fix E1000 interrupt handling condition
I had written the ICR register check backwards which lead to interrupt
handling only when it was not needed, and no handling when it was
needed. This somehow still worked, just much slower often requiring tcp
resends from the server.
2024-05-21 01:52:19 +03:00
Bananymous ee8fca9439 General: Update discord badge 2024-05-20 21:07:15 +03:00
Bananymous adc562feb8 General: Add simple contribution guide lines
README now contains simple contribution guide lines that should be
followed. I am now more open for public contributions to the repo
if people are interested.

Create a discord server and link it to the README. Discord seems to be
a nice platform for general messaging.
2024-05-20 20:44:34 +03:00
Bananymous af8fa4014f BuildSystem: Always download cmake instead of using host's
If cmake was installed from snap, build system would cause an error
because some libfakeroot GLIBC requirement.
2024-05-20 20:11:13 +03:00
Bananymous 08415b0e8f General: Remove submodule info from README
Submodules are no longer needed as I now use my own AML interpreter instead of lai
2024-05-12 02:14:46 +03:00
Bananymous 967f9a9174 Shell: Ignore tab as that just fucks up formatting 2024-05-07 14:16:17 +03:00
Bananymous d255141bd4 BuildSystem: Cleanup image creation 2024-04-24 01:27:59 +03:00
Bananymous e7e1dd91c7 Kernel: Implement ACPI reset 2024-04-22 21:12:13 +03:00
Bananymous 195c5e92a4 Kernel: Add floating bus detection for ATA Bus 2024-04-22 21:12:13 +03:00
Bananymous 47dafe62b8 BuildSystem: Make port build script use bash as shell
pushd and popd don't work in sh
2024-04-22 21:12:13 +03:00
Bananymous 26922ebb51 Kernel: Remove stack size check for keyboard layout initialization
Keyboard layout loading can take around 1 KB of stack for i686 target
2024-04-22 21:11:04 +03:00
Bananymous 7480e71801 BuildSystem: Download binutils and gcc as tar balls
I am not sure why I changed this earlier. This is much cleaner and
faster as git doesn't have to recieve all patches and resolve deltas
2024-04-22 19:54:57 +03:00
Bananymous 9ac3f48fcb Bootloader: Implement better memset and memcpy for 32 bit addresses 2024-04-20 18:14:05 +03:00
Bananymous 0e405755ad General: Update README badge
Tokei's own badge was kind unreliable and slow. I now parse the tokei output into json on server side and make shields.io query it.
2024-04-20 10:39:50 +03:00
Bananymous 693f90449f Kernel: Rework AML package and implement indexing in to packages 2024-04-19 11:26:48 +03:00
Bananymous 0bf45069bd General: Add link to online demo in README.md 2024-04-18 15:35:31 +03:00
Bananymous 34b10f61ce Kernel: Make PIT reserve its IRQ
PIT did not reserve IRQ leading to kernel panic if it was being
initialized.
2024-04-18 13:34:28 +03:00
Bananymous 1479b42112 Kernel: Don't even loop over processor when system has only BSP 2024-04-18 13:33:52 +03:00
Bananymous bb061d2a0a Kernel: Make 32bit not use large pages during boot
There is no guarantee that they are supported
2024-04-18 13:33:15 +03:00
Bananymous 061012a268 Kernel: Fix signal trampoline
32 bit did not even support it and 64 bit did not align stack
2024-04-18 13:32:40 +03:00
Bananymous a698f91db4 Kernel: Fix PriorityMutex::try_lock()
Forgot to check this when I updated Mutex::try_lock()
2024-04-18 01:36:15 +03:00
Bananymous 30d12a76bc Kernel: Fix 32 bit compilation 2024-04-18 01:35:56 +03:00