Bananymous
a89fd95864
aoc2024: Implement day14 solution
2024-12-14 23:52:22 +02:00
Bananymous
9ba9469bb1
aoc2024: Optimize day12
...
There is actually no need for hash maps
2024-12-14 03:58:11 +02:00
Bananymous
4dbf173ed4
aoc2024: Implement day13 solution
2024-12-14 03:17:55 +02:00
Bananymous
8936cca9cf
aoc2024: Implement day12 solution
2024-12-12 17:03:31 +02:00
Bananymous
1c704680a8
aoc2024: Implement day11 solution
...
Finally we got a problem where trivial solution does not work
2024-12-11 09:05:52 +02:00
Bananymous
3e36834751
aoc2024: Implement day10 solution
2024-12-10 17:26:39 +02:00
Bananymous
581caff638
BuildSystem: Install base sysroot only once
...
Base sysroot is not only installed when creating the syroot directory
for the first time. To get it installed again, you have to either delete
the old sysroot diretory or run clean target
This makes it so its actually possible to edit files specified in the
base sysroot without random hacks.
2024-12-10 16:44:59 +02:00
Bananymous
8b612ba547
aoc2024: Implement day9 solution
...
part2 is kinda unoptimized, it should not use expanded input, but I did
not feel like rewriting my parsing code :)
2024-12-09 16:20:21 +02:00
Bananymous
90820f24a4
BAN: Make HashMap::{insert,emplace}{,_or_assign} return an iterator
...
This reduces the number of lookups done into the hash map :)
2024-12-09 03:37:13 +02:00
Bananymous
12a37500b0
Kernel: Fix triple-fault in vitual tty
...
This was happening when printing non-utf8 data while having virtual tty
as the debug console.
2024-12-09 03:35:51 +02:00
Bananymous
3ae6ffdb01
ports/tcc: Create usr/include/sys/ucontext.h
...
This file does not have to contain anything, tcc just requires that it
exists.
2024-12-08 20:42:04 +02:00
Bananymous
c4e76b391e
aoc2024: Implement day8 solution
...
I did not feel like optimizing this one, so its a O(n^2) looking over
every cell in the grid. Performs way faster than my optimized day6
solution tho :DD
2024-12-08 16:14:39 +02:00
Bananymous
cf9ba737f0
aoc2024: Implement day7 solution
2024-12-07 07:34:21 +02:00
Bananymous
2d0690ae2d
Kernel: Cleanup most of syscalls dealing with files
2024-12-07 05:33:04 +02:00
Bananymous
71a2d0971f
Kernel: Remove unnecessary reverse from VFS file search
2024-12-07 01:41:23 +02:00
Bananymous
3bf57e0748
Kernel: Add . and .. entries to /proc/<pid> directories
...
This allows to run `cd ..` in one of these directories
2024-12-07 01:37:40 +02:00
Bananymous
fbc0319cb6
aoc2024: Implement day6 solution
2024-12-07 01:08:08 +02:00
Bananymous
e8bc3c2d80
General: Add intructions to run doom to README
2024-12-06 20:25:09 +02:00
Bananymous
fe192e07fb
General: Update README feature list
2024-12-05 19:49:38 +02:00
Bananymous
51b6329c86
Kernel: Make backspace \b and delete 0x7F
...
This is what `vim` seems to expect and imo makes way more sense.
2024-12-05 17:34:37 +02:00
Bananymous
72d9e4c1e7
Kernel: Remove accidental debug prints from fcntl syscall
2024-12-05 17:34:32 +02:00
Bananymous
cb7d5c9d09
userspace: Implement `dirname` utility
2024-12-05 08:30:30 +02:00
Bananymous
097ab82529
userspace: Implement `basename` utility
2024-12-05 08:30:06 +02:00
Bananymous
ccb603d77f
aoc2024: Implement day5 solution
2024-12-05 08:16:34 +02:00
Bananymous
d7b02db832
aoc2024: Implement day4 solution
2024-12-05 08:16:12 +02:00
Bananymous
56cc5da9fb
userspace: Implement `ln` utility
2024-12-05 08:14:45 +02:00
Bananymous
1903079f96
LibC: Fix popen to return correct return value instead of -1
2024-12-05 06:47:10 +02:00
Bananymous
b6d0950ee9
LibC: Fix strftime implementation
...
This implementation now passes every musl-libc test :)
2024-12-05 06:46:31 +02:00
Bananymous
c1a32a4041
LibC: Implement mktime
2024-12-05 06:43:35 +02:00
Bananymous
8fa443879c
ports: Add working tcc port!
...
You can actually now compile programs within banan-os!!
2024-12-04 21:23:09 +02:00
Bananymous
3a465cb94f
DynamicLoader: Don't write to pltgot if it does not exist
...
This makes `tcc` compile runnable executables
2024-12-04 21:11:43 +02:00
Bananymous
49133dce48
Kernel: Make pipe check data every 100ms
...
This prevents dead lock if read-end does not detect data before blocking
why write-end already notified.
2024-12-03 21:54:27 +02:00
Bananymous
3b7b6beca5
ports: Allow using banan-os cmake toolchain file for ports
2024-12-03 20:29:38 +02:00
Bananymous
0dd81328ff
ports: Unconditionally compile banan-os before building ports
...
This allows ports to use any banan-os library cleanly. Ninja is fast on
when everything is already compiled, so it doesn't add too much
overhead.
2024-12-03 20:29:38 +02:00
Bananymous
a668593e6b
ports: Don't update ports on every build
...
This makes using ports much less painful :)
2024-12-03 20:29:38 +02:00
Bananymous
3a5a22511a
aoc2024: Implement day3 solution
2024-12-03 20:29:38 +02:00
Bananymous
86859267f0
ports/curl: remove libcurl.la file and use /dev/urandom
2024-12-03 20:29:38 +02:00
Bananymous
88c9f6d233
LibC: Make environ a weak alias
...
If user program defines its own global `environ` variable it will still
work :)
2024-12-03 20:29:38 +02:00
Bananymous
176693dd5a
LibC: Implement wcscmp and wcsncmp
2024-12-03 16:21:54 +02:00
Bananymous
62bee04fc0
LibC: Implement dummy utime that just checks file existance
2024-12-03 16:21:18 +02:00
Bananymous
0a5aacfd87
Kernel: Allow open with O_CREAT bypass file permission checks
...
call to open(path, O_CREAT|O_EXCL|O_RDWR, 0444) should open file as
read-write although file is created as read-only on filesystem.
2024-12-03 16:17:34 +02:00
Bananymous
2dec3a6c95
Kernel: Add some sanity checks for existanse of threads
2024-12-03 16:16:50 +02:00
Bananymous
fcc2814199
Kernel: Remove process from alarm list after it dies
2024-12-03 16:16:08 +02:00
Bananymous
bc93d238dd
LibC: Fix fread argument order in gethostname
2024-12-03 16:15:16 +02:00
Bananymous
79e2c5d48c
LibC: Make FILE* reading buffered
...
There was no reason to perform a syscall for every byte read
2024-12-03 16:13:48 +02:00
Bananymous
0fab7ad63b
Kernel: Fix SYS_FCNTL command handling :)
...
I had misunderstood how these work
2024-12-03 16:12:26 +02:00
Bananymous
e6a2f55a59
Kernel: Closing file backed mmap wont expand the file size
2024-12-03 16:12:26 +02:00
Bananymous
67e9ca56ac
Kernel: Create /dev/urandom -> /dev/random symlink
...
Most software uses urandom instead of random so this allows it work
normally.
2024-12-03 16:12:26 +02:00
Bananymous
713daf6cd3
Kernel/LibC: Add support for creating hardlinks
2024-12-03 16:12:26 +02:00
Bananymous
12abe81c6d
ports/openssl: Add support for shared libraries
2024-12-03 01:46:59 +02:00
Bananymous
fbcf10c86d
LibC: Implement closelog and make syslog print to stddbg
2024-12-03 01:45:54 +02:00
Bananymous
415b20f884
LibC: Remove errno EEXISTS
...
I don't know why I had added this. It doesn't seem to be a thing on
either POSIX or linux. This was literally equivalent to EXIST
2024-12-02 20:13:38 +02:00
Bananymous
d58ca5f37a
Kernel/LibC: Implement symlink{,at}
2024-12-02 20:13:38 +02:00
Bananymous
11b6ee423e
LibC: Define timezone structure
2024-12-02 20:13:37 +02:00
Bananymous
a10ca47657
Kernel/LibC: Implement {,f}statvfs
2024-12-02 20:13:37 +02:00
Bananymous
ad1f175a39
Kernel/LibC: Implement getppid
2024-12-02 20:13:37 +02:00
Bananymous
fd3246113a
LibC: Implement missing execlp and cleanup exec code
2024-12-02 20:13:37 +02:00
Bananymous
b8013c883c
LibC: Implement getpass
2024-12-02 20:13:37 +02:00
Bananymous
ffcc4fd03a
init: Make tty owned by logged in user
2024-12-02 20:13:37 +02:00
Bananymous
9d97964998
LibC: Fix getpwend gid field :)
2024-12-02 20:13:37 +02:00
Bananymous
f0e54cdd51
LibC: Implement {asctime,ctime,gmtime,localtime}_r
...
Old non _r prefixed functions are now just wrappers around these new
functions :)
2024-12-02 20:13:37 +02:00
Bananymous
0360fd1efe
LibC: Implement mk{,d,s}temp
2024-12-02 20:13:37 +02:00
Bananymous
4508e099ff
LibC: Implement getpagesize
2024-12-02 20:13:37 +02:00
Bananymous
6ed1435aeb
Kernel/LibC: Implement tcgetpgrp
2024-12-02 20:13:37 +02:00
Bananymous
6346e288ad
LibC: Implement getrlimit
2024-12-02 20:13:37 +02:00
Bananymous
d2b503910f
userspace: fix aoc2023 and aoc2024 linking
...
This patch makes aoc projects not link against system libc but the cmake
libc target. This allows compilation before libc is installed
2024-12-02 20:13:37 +02:00
Bananymous
747c3b2a4b
Kernel/LibC: Implement fsync
2024-12-02 20:13:37 +02:00
Bananymous
cccb4e6d5e
LibC: Implement basename and dirname
2024-12-02 20:13:37 +02:00
Bananymous
f4c6afbdae
LibC: Add definitions to LibC that are used by some ports
2024-12-02 20:13:37 +02:00
Bananymous
d1ef380e6b
LibC: Add missing definitions for ifreq members
2024-12-02 20:13:37 +02:00
Bananymous
c02de2580d
Kernel: Add support for SIOCGIFNAME ioctl
2024-12-02 20:13:37 +02:00
Bananymous
a231f8587e
aoc2024: Implement day2 solution
2024-12-02 20:13:37 +02:00
Bananymous
4149748766
Kernel: Add missing include in ACPI headers
2024-12-01 21:32:34 +02:00
Bananymous
783627c315
LibC: Fix time.h sigevent defition
2024-12-01 21:31:27 +02:00
Bananymous
1ff6aa1748
aoc2024: cleanup day1 solution
2024-12-01 07:58:40 +02:00
Bananymous
6662dc4a8d
aoc2024: fix `full` runner search path for solutions
2024-12-01 07:58:40 +02:00
Bananymous
d6b170e274
aoc2024: implement day1 solution
2024-12-01 07:41:25 +02:00
Bananymous
11cac7a646
aoc2024: prepare programming environment
2024-12-01 07:41:25 +02:00
Bananymous
9c2fcd745c
ports/doom: Fix patch calling exit() to actually do what it says
2024-12-01 02:28:50 +02:00
Bananymous
04f49a6819
LibC: Implement {,v}dprintf
2024-11-27 21:33:10 +02:00
Bananymous
d465ea2a67
LibC: Fix headers :)
2024-11-27 21:32:10 +02:00
Bananymous
1f5073d0ac
ports/doom: Allow doomgeneric to write directly to window framebuffer
...
This prevents an unnecessary `malloc` of the framebuffer and a copy
every frame.
2024-11-27 13:39:21 +02:00
Bananymous
8dbbbc1a1a
Kernel: Add command line option `readonly`
...
This prevents calls to write_sectors_impl and all dirty pages are always
kept in RAM.
2024-11-27 13:31:55 +02:00
Bananymous
f985673dc3
LibGUI: Add API to retrieve Window's underlying framebuffer
2024-11-27 13:29:42 +02:00
Bananymous
a6fc3cf7a6
Kernel: Clear AHCI pending interrupts
...
I have no idea why I did not have this in. All devices were just
constatly spamming interrupts like crazy :D
2024-11-26 01:39:11 +02:00
Bananymous
1941885cfd
Kernel: Disable USB Mass Storage writing until I get it fixed
...
This prevented real hw from running for over 10-20 seconds. When first
disk sync happens after 10 secods, USB storage would enter faulty state
and not allow any io operations.
I have no idea what the problem is. If I don't send Reset command to the
USB device writing seems to work fine. I also don't think its part of
the Reset process either as reading works just fine.
2024-11-26 01:01:25 +02:00
Bananymous
88a86a9927
Kernel: Fix Thread destruction after sys_exit
...
This had undefined behaviour as Thread's (Processes's) PageTable was
destroyed before Thread had the change to destroy its own stacks that
lived on the PageTable.
2024-11-26 00:59:34 +02:00
Bananymous
48e030bca3
Kernel: Make PageTable non-copyable and non-movable
...
Also PageTable destructor now verifies that is has allocated something
instead of assuming paddr of 0.
2024-11-26 00:58:35 +02:00
Bananymous
6f118c1be1
BAN: Make HashMap key move constructible
...
This allows using non-copyable types as keys
2024-11-26 00:57:11 +02:00
Bananymous
7316eb87b8
BAN: Add requires expression for BAN::Formatter
...
This allows seeing syntax errors before compilation :)
2024-11-26 00:55:58 +02:00
Bananymous
5376236ab6
BAN: Make ErrorOr non-copyable
...
This makes avoiding accidentals copies easier :)
2024-11-26 00:55:12 +02:00
Bananymous
0af80d48ee
BAN: Mark ByteSpan::slice as [[nodiscard]]
2024-11-26 00:54:35 +02:00
Bananymous
793c0368f2
Kernel: Refactor USB mass storage code
...
Also increment command timeout to 10 seconds so commands don't timeout
when they are not supposted to :)
2024-11-23 01:24:32 +02:00
Bananymous
076001462e
Kernel: Implement AML ConcatOp
2024-11-22 22:23:07 +02:00
Bananymous
d2e1d8ec13
Kernel: Implement AML NotOp
2024-11-22 22:22:44 +02:00
Bananymous
30ceaa6bef
Kernel: Implement AML ToHexStringOp
2024-11-22 22:22:27 +02:00
Bananymous
0247d47a3d
Kernel: Make USBMassStorage send_scsi_command templated
...
This allows passing ConstByteSpan when data will not be modified
2024-11-22 22:21:19 +02:00
Bananymous
480368c878
Kernel: Cleanup and fix xHCI interrupt handling
...
Always clear EventHandlerBusy bit and remove unnecessary nesting
2024-11-22 22:19:53 +02:00
Bananymous
c1d8790623
Kernel: Don't allow sending commands to halted xHCI
2024-11-22 22:19:29 +02:00
Bananymous
fb1ffec5bb
Kernel: Remove unused mutex from xHCI
...
This was preventing multiple xHCI controllers to do parallel device
initialization
2024-11-22 22:18:38 +02:00
Bananymous
1bdabe693f
Kernel: Preserve RsvdP bits in xHCI controller initialization
2024-11-22 22:18:09 +02:00
Bananymous
ce09f35275
Kernel: Fix PCI 64 bit MSI msg_data offset
2024-11-22 22:17:25 +02:00
Bananymous
40c13043b3
Kernel: Add support for scratchpad buffers in xHCI
2024-11-22 22:16:57 +02:00
Bananymous
e620068416
Kernel: Allow USB devices to handle STALL conditions
2024-11-22 22:15:22 +02:00
Bananymous
8e624ca85a
Kernel: Don't panic if uninitialized AHCI device gets an interrupt
2024-11-21 20:41:13 +02:00
Bananymous
c7afd46016
Kernel: Don't log spurious interrupts
...
Some PCs seem to be spamming a lot of int 7
2024-11-21 20:40:29 +02:00
Bananymous
3573656244
Kernel: Make PARTUUID matching case insensitive
...
Case sensitivity made it super annoying to work with :)
2024-11-21 20:39:27 +02:00
Bananymous
1de6de975a
Kernel: Rename cmdline UUID= to PARTUUID=
...
This makes more sense and behaves more like existing software.
2024-11-21 20:38:50 +02:00
Bananymous
15c55b8c7d
BuildSystem: Don't hardcode partition UUID
...
That was dumb :D I can just read the UUID parted assigned...
2024-11-21 20:37:42 +02:00
Bananymous
865061b492
Kernel: Temporary fix to make tmpfs more stable
...
whole TmpFS will have to be rewritten at some point :)
2024-11-21 18:13:26 +02:00
Bananymous
39313e1737
BuildSystem: Add option to boot using IDE or USB drives
2024-11-21 18:09:35 +02:00
Bananymous
70880636f4
Kernel: Implement basic USB Mass Storage support
...
I finally decided to do this :D
2024-11-21 18:08:37 +02:00
Bananymous
96a5ba0ed3
BuildSystem: Make root partition UUID fixed
...
This allows specifying root as UUID which makes booting nicer experience
on real hardware
2024-11-21 17:59:38 +02:00
Bananymous
8054f6c618
Kernel: Wait 10 seconds to find root device
...
If root device is initialized asynchronously it may not be ready when
main initialization thread is finished. This patch adds searching for
root device every 500 ms for 10 seconds.
2024-11-21 17:56:58 +02:00
Bananymous
658ea68d04
Kernel: Check max packet size for all USB devices
...
Spec says that this has to be done. Most cases can be probably skipped
as I used to do, but this is less error prone and adds practically no
overhead
2024-11-21 13:46:42 +02:00
Bananymous
5750f87396
Kernel: Fix unaligned access in xHCI controller initialization
2024-11-21 13:46:09 +02:00
Bananymous
1253e2a458
Kernel: Add support for bulk endpoints and update endpoint API
...
USB device now sets its own data buffers for IN/OUT endpoints. This
allows more customization and parallelism as data buffer does not have
to be shared.
2024-11-21 13:44:21 +02:00
Bananymous
857b3e92f8
Kernel: Support initializing USB 3 devices
2024-11-21 13:40:16 +02:00
Bananymous
8bf14d542e
Kernel: Move SCSI device rdev allocation out of ATA code
2024-11-21 13:36:59 +02:00
Bananymous
31d2a39540
BAN: Add default constructors for BAN::{Little,Big}Endian
2024-11-21 13:34:12 +02:00
Bananymous
97718b4046
Kernel: Don't launch init process twice
...
I had accidentrally left the old init process launch in when replacing
it with the new one.
2024-11-19 20:43:38 +02:00
Bananymous
c07fd265f0
Kernel: Add support for ATA CHS addressing and cleanup code
...
I thought that I had an PC without LBA support so I implement support
for CHS. Turns out that my ATA device detection was broken and was no
device on that port and initialize data was just garbage.
Now that I added CHS, I guess I should just keep it in :)
Both ATA read and write are now combined into a single function to avoid
code duplication.
2024-11-19 20:39:32 +02:00
Bananymous
1de50a2a94
Kernel: Improve ATA device initialization
...
This does better detection of empty ports and fixes floating bus
read-value from 0x00 to 0xFF.
2024-11-19 00:25:42 +02:00
Bananymous
627ca432cc
Kernel: Make PS/2 controller not hang if device keeps sending resend
2024-11-19 00:18:48 +02:00
Bananymous
f8ef11b4d2
BAN: Make PlacementNew.h only include <new> if it exists
...
Otherwise it will define the functions itself. This allows compiling
toolchain as stdlibc++ depends on BAN.
2024-11-19 00:16:44 +02:00
Bananymous
71563034a7
Kernel: Remove accidentally left debug prints
2024-11-18 03:45:07 +02:00
Bananymous
aaff5a65e1
Kernel/init: /dev/tty is now custom symlink to controlling terminal
...
kernel now passes the name of default console to init process so init
knows which file to open as stdio. before /dev/tty was referencing the
system wide current terminal which was inherited from cmdline. This
doesn't work anymore as we have pseudo terminals implemented that can
chage the current terminal during runtime :D
2024-11-17 22:38:52 +02:00
Bananymous
458a362f98
Kernel: Allow kernel to pass arguments to init process
2024-11-17 22:38:02 +02:00
Bananymous
36d07065fb
WindowServer: Optimize msync calls to synchronize less bytes
...
This *probably* makes framebuffer much faster :D Window server does not
have to do page aligned and page sized syncs which used way too many
pixels.
2024-11-17 20:15:28 +02:00
Bananymous
f206e72447
Kernel: Don't require msync addresses to be page aligned
...
Inodes implementing msync can require page aligned addresses, but are
also allowed to not :) This reduces sizes of framebuffer msyncs!
2024-11-17 20:15:28 +02:00
Bananymous
58e45fb394
Kernel: Print process name on exceptions if it is available
2024-11-17 20:15:28 +02:00
Bananymous
411f32c766
WindowServer: Make select timeout more precise to hit target FPS
...
Previously window server was only running at around 40 FPS while
targetting 60. This makes the select timeout properly sleep so that
target FPS is reached!
2024-11-17 20:15:28 +02:00
Bananymous
e1b82e4e43
WindowServer: Don't allow focusing unfocusable windows after closing
2024-11-17 20:15:28 +02:00
Bananymous
df613775b6
WindowServer: Alpha blend background image in fullscreen mode
2024-11-17 20:15:28 +02:00
Bananymous
5e8fdc997a
Kernel: Prevent userspace from overwriting CPU load memory
2024-11-17 20:15:28 +02:00
Bananymous
51bfe4252d
ports/doom: download doom1.wad to common directory between archs
2024-11-15 20:50:40 +02:00
Bananymous
c96aee5740
WindowServer: Make mod+f toggle focused window fullscreen state
2024-11-15 20:45:56 +02:00
Bananymous
1c08849667
WindowServer: Draw cursor in fullscreen mode
2024-11-15 20:45:01 +02:00
Bananymous
73349e5e75
WindowServer: don't set window location to (0,0) when fullscreening
2024-11-15 20:43:41 +02:00
Bananymous
74ae411b69
WindowServer: Skip invalidation on other windows in fullscreen mode
2024-11-15 20:42:07 +02:00
Bananymous
d458592fb1
WindowServer: Don't focus unfocusable windows on window creation
2024-11-15 20:41:42 +02:00
Bananymous
627c89a62d
LibGUI: Actually set window attributes when creating a window
2024-11-14 23:33:12 +02:00
Bananymous
0228cd4f31
Kernel: Increase userspace stack size and decrease kernel stack
...
Quake II needs a lot of stack, it was overflowing my 256 KiB stack so
this patch doubles that, so Quake II can run!
Also every thread had 256 KiB kernel stack. This is unnecessarily large
and now dropped to 32 KiB.
2024-11-14 21:03:04 +02:00
Bananymous
a859558840
LibGUI: Window Creation takes attributes as an argument
...
This reduces windows showing/moving once they are opened and setting
their attributes.
2024-11-14 20:57:34 +02:00
Bananymous
04eee2ea75
ports: Add quake2 port (+two years of banan-os!)
...
This patch adds software rendered quake2 port. I was supposted to push
this as two days ago as two years of banan-os, but I was too sick to do
any programming.
2024-11-14 12:47:30 +02:00
Bananymous
bda2c663da
WindowServer: Implement fullscreen windows
...
If window size does not match framebuffer size, window data will be
scaled to framebuffer using nearest sampling for best performance.
2024-11-13 19:10:15 +02:00
Bananymous
5e041e6e5a
WindowServer: Make all terminating signals exit cleanly
...
This allows window server to restore input handling to TTY if window
server crashes on page fault or some other unexpected exception.
2024-11-13 17:32:13 +02:00
Bananymous
d19264eea8
WindowServer: Implement partial window resizing
...
This patch adds support for client side resizing, so clients can request
the server to resize their windows. WindowServer will respond with
resize event when and if the resizing is complete.
2024-11-13 17:30:12 +02:00
Bananymous
64c52012df
Kernel: Fix MemoryRegion overlap comparison
...
This made some calls to `munmap` unmap extra regions.
2024-11-13 17:26:42 +02:00
Bananymous
7542e55cb2
LibC: Add option to debug userspace malloc family calls
2024-11-10 14:03:25 +02:00
Bananymous
6bd51ac345
LibGUI: Client window now exits if it loses connection from server
...
This can be prevented by installing callback for socket errors.
2024-11-10 14:02:23 +02:00
Bananymous
cf21eb4b39
TaskBar: Cleanup TaskBar string generation
2024-11-08 02:57:35 +02:00
Bananymous
da8170c5b6
LibGUI: Add support for focusable windows and mouse capturing
...
These are essential parts of a window server! This allows making TaskBar
non-focusable.
2024-11-08 02:55:10 +02:00
Bananymous
12bc7480e0
LibC: Implement _Exit
...
This just calls _exit as POSIX says they can be equivalent
2024-11-08 02:52:12 +02:00
Bananymous
92862fdf39
LibC: Implement nan{,f,l} as functions
...
One port was using function pointers to these functions so macros don't
work.
2024-11-08 02:49:21 +02:00
Bananymous
4417268ecc
BAN: only include <new> in PlacementNew.h
...
I was getting annoying multiple definitions for placement new and my
build system requires that c++ libraries are compiled. I guess this is
the easiest and cleanest solution
2024-11-08 02:48:07 +02:00
Bananymous
346853ee55
BAN: Implement sincos to math
...
This function calculates both sin and cos fast (hopefully)
2024-11-04 17:42:01 +02:00
Bananymous
a82f00cb70
BAN: Fix HashMap::{insert,emplace}_or_assign to actually assing value
...
I seemed to completely forgotten to do the assignment itself :D
2024-11-04 15:42:04 +02:00
Bananymous
1838ea5c30
Kernel: Fix pseudo terminal leaks
2024-11-04 15:35:07 +02:00
Bananymous
a356d90445
LibC: Fix libc compilation for 32 bit target
2024-11-04 10:51:31 +02:00
Bananymous
a3f41fd4d9
Kernel: Cleanup disk cache
...
Add missing include and cleanup code calling automatic disk sync.
2024-11-03 20:28:15 +02:00
Bananymous
f4be37700f
Kernel/userspace: rework floating point math
...
SSE is now unconditionally enabled any where and most of math.h is now
actually implemented. using __builtin_<func> lead to many hangs where
the builtin function would just call itself.
2024-11-03 20:28:15 +02:00
Bananymous
ed19bb11fe
Kernel: Cleanup thread default sse initialization
2024-11-03 20:22:28 +02:00
Bananymous
07275ecb5f
BAN: Implement floating point constants in Numbers.h
2024-11-03 20:19:45 +02:00
Bananymous
2464fccadd
LibC: Fix *scanf consuming extra characters
2024-10-19 12:43:23 +03:00
Bananymous
5fde2cf91a
TaskBar: Ignore window close events and exit on connection close
...
This prevents user from killing the task bar with keyboard shortcuts
2024-10-18 17:19:05 +03:00
Bananymous
d57e797147
WindowServer: Don't kill window on key event, instead send close event
...
This allows notifying the client about window close and let client
handle it as it wants
2024-10-18 17:17:58 +03:00
Bananymous
988f7b0561
ports: Fix doom port to use the new GUI events
2024-10-18 03:45:15 +03:00
Bananymous
e99a271465
Userspace: Implement basic task bar
...
This bar only shows current time but its something to work on later!
2024-10-18 03:36:03 +03:00
Bananymous
d266c7f93b
LibGUI: Implement attributes for windows
...
Windows can now change whether they have title bar, rounded corners,
alpha channel and whether they are movable. Also windows can also change
their own position
2024-10-18 03:32:12 +03:00
Bananymous
d7e5c56e94
userspace: Use SOCK_STREAM instead of SOCK_SEQPACKET for WindowServer
...
This makes more sense if we have longer packages
2024-10-17 01:44:48 +03:00
Bananymous
ddd3b4c093
BAN: Implement is_pod type traits
2024-10-17 01:35:42 +03:00
Bananymous
3a6fc4c197
BAN: Add proper error messages for `MUST()` in userspace
2024-10-17 01:32:55 +03:00
Bananymous
91381546d5
Shell: Don't crash if history file does not exist :D
2024-10-16 00:41:28 +03:00
Bananymous
41e2b898ab
Shell: Implement history file for persistent history storage
2024-10-16 00:21:58 +03:00
Bananymous
6e981d1222
Shell: Add support for inline environment variables
...
e.g. `foo=$(echo lol) Shell -c 'echo $foo'` will now print lol!
2024-10-15 23:45:08 +03:00
Bananymous
8317bb13ca
Shell: Cleanup code by defining argument types as nested types
2024-10-15 23:44:06 +03:00
Bananymous
c40f244dff
Shell: remove `env` builtin and add `type`
...
other shells don't seem to implement as a builtin, so i won't either
2024-10-15 23:42:01 +03:00
Bananymous
a6aa048be0
userspace: Implement `env` as an executable
2024-10-15 23:42:01 +03:00
Bananymous
8fd0162393
Kernel: Rewrite x86_64 page tables to use HHDM instead of kmalloc
...
This allows page tables to not crash the kernel once kmalloc runs out of
its (limited) static memory.
2024-10-14 11:40:30 +03:00
Bananymous
f0b18da881
Kernel: Add kmalloc helper APIs
2024-10-14 11:39:04 +03:00
Bananymous
5f63ea8f8a
Kernel: Add CPUID check for 1 GiB page support
2024-10-14 11:38:03 +03:00
Bananymous
2b43569927
Kernel: Use enums in boot info instead of magic values
2024-10-14 11:36:51 +03:00
Bananymous
4ba33175cf
Kernel: Don't leak memory when preparing fast page
...
For some reason I was allocating memory for page table entry...
2024-10-14 11:34:48 +03:00
Bananymous
3edc1af560
Kernel: Don't map main bios area in page table initialization
...
This is only needed for RSDP lookup so it can be done with fast pages
2024-10-14 11:32:54 +03:00
Bananymous
55fbd09e45
Kernel: Rewrite physical memory allocation with PageTable::fast_pages
2024-10-14 11:32:54 +03:00
Bananymous
6a46a25f48
image: Add benchmark flag to measure performance of image operations
2024-10-13 22:05:13 +03:00
Bananymous
88b8ca5b29
LibC: Fix some string functions
...
I was not casting some required values to char or handling length of
zero
2024-10-13 22:04:08 +03:00
Bananymous
fdddb556ae
LibC: Implement system() more properly
...
Old implementation did not ignore and block needed signals
2024-10-13 22:03:15 +03:00
Bananymous
d36b64e0c8
LibImage: name color to u32 function to to_argb from to_rgba
...
This is the actual format that it returns
2024-10-13 22:01:46 +03:00
Bananymous
8adc97980a
Shell: rewrite the whole shell to use tokens instead of raw strings
...
tab completion is still running with raw strings and that has to be
fixed in the future.
2024-10-13 22:00:16 +03:00
Bananymous
dab6e5a60f
BAN: Cleanup HashMap implementation and add {insert,emplace}_or_assign
2024-10-13 22:00:16 +03:00
Bananymous
0b05e9827b
BAN: Use memmove instead of memcpy on overlapping data
...
I was accidentally using memcpy where memmove was needed
2024-10-13 22:00:16 +03:00
Bananymous
1c1a76d6d7
BAN: Member function pointers now use references instead of pointers
...
This seems cleaner as class pointer cannot be null anymore
2024-10-13 22:00:16 +03:00
Bananymous
df4f37d68d
BAN: only define placement new operators for banan-os targets
...
This allows building and using BAN library outside of banan-os!
2024-10-10 21:55:25 +03:00
Bananymous
44629ba5dd
BAN: Allow userspace to use string literals with BAN::Error
2024-10-10 21:54:52 +03:00
Bananymous
2da6776451
BAN: Update {Byte}Span API with better constness
...
const BAN::Span<int> is now allowed to modify its underlying data, but
the container itself is const.
BAN::Span<const int> can be used for spans over constant data.
2024-10-10 21:53:23 +03:00
Bananymous
a68f411024
BAN: Add requires clauses for Container::emplace{,_back} functions
...
This allows syntax highlighters to report errors!
2024-10-10 21:51:44 +03:00
Bananymous
166550fbba
Kernel: Ext2 check if file exists before creating it
2024-10-07 18:21:05 +03:00
Bananymous
3e68981b0b
userspace: Remove start-gui from shell builtins and make it an alias
...
This makes way more sense :D
2024-10-07 18:01:33 +03:00
Bananymous
6fd76e8d1e
Shell: Rewrite alias parsing to allow chained commands
...
You can now have "chained" commands in alias
e.g. `alias foo='echo hello && ls`
2024-10-07 18:01:33 +03:00
Bananymous
dfcd15e7c4
Shell: Implement background processes with &
2024-10-07 18:01:33 +03:00
Bananymous
5fa359c28d
ls: Print file name in quotes if it contains spaces
2024-10-07 18:01:32 +03:00
Bananymous
5bcfc9dd50
Shell: Always print prompt to new line
...
This is only done on non banan-os targets if terminal is detected to
support cursor position querying
2024-10-07 18:01:32 +03:00
Bananymous
f67cad326a
Shell: Don't crash when there are no tab completions available :D
2024-10-07 14:26:07 +03:00
Bananymous
9775e83374
Shell: Fix tab space escaping in tab completion
2024-10-07 04:19:36 +03:00
Bananymous
264d1798dc
Shell: Clenup code and fix some bugs
...
Don't list tab completion multiple times, allow `clear` to work even
when ANSI CSI 3K is not supported, reset buffer index when cancelling
command with ctrl+c
2024-10-07 04:10:25 +03:00
Bananymous
1824988b9a
Shell: Add support for simple aliases
...
Aliases do not support chained commands with pipes, &&, ... but this is
a good start.
2024-10-07 04:09:38 +03:00
Bananymous
c54d9b3f60
Shell: Implement simple tab completion for commands and files
2024-10-07 01:44:44 +03:00
Bananymous
f432d3fcf8
BAN: Cleanup Optional casting for value getters
2024-10-07 01:44:44 +03:00
Bananymous
4f7828bab9
Shell: Allow escaping spaces in commands
2024-10-07 01:44:44 +03:00
Bananymous
ae073a336d
Shell: Move builtin commands to a hash map
...
This allows accessing builtin commands outside of `execute_builtin`
2024-10-07 01:44:44 +03:00
Bananymous
6f90974896
BAN: Fix StringView::starts_with
...
I have no idea what i had been thinking when writing this code :D
2024-10-06 06:23:25 +03:00
Bananymous
4f3c05851c
Shell: Expand ~ to home if its at the start of non quoted argument
2024-10-06 01:38:43 +03:00
Bananymous
4b13055125
Shell: Make builtin exit command read exit value from argument
...
Shell used to unconditionally return with exit code of 0
2024-10-06 01:24:34 +03:00
Bananymous
d542cd811d
Shell: Add support for &&, || and ;
2024-10-06 01:24:24 +03:00
Bananymous
f75cebac7e
Shell: Mark all functions as static
2024-10-05 19:11:58 +03:00
Bananymous
e302b6b635
Shell: Use sigaction instead of signal
...
This allows ctrl-c to work on linux :D
2024-10-05 19:07:59 +03:00
Bananymous
f709e88994
Shell: Cleanup argument handling and exiting
2024-10-04 17:54:01 +03:00
Bananymous
ab9a6d583b
Userspace: Set SHELL environment variable in init instead of shell
2024-10-04 17:24:37 +03:00
Bananymous
26d6bf338e
Shell: Ignore SIGTTOU and set pgroup from parent instead of child
...
This allows using the shell in linux!
2024-10-04 17:23:31 +03:00
Bananymous
b6e040dfc2
Kernel/Shell: Fix backspace and delete key byte sequences
2024-10-04 04:14:47 +03:00
Bananymous
f5802ca3e5
General: Update screenshot in README
2024-09-30 18:28:16 +03:00
Bananymous
7223e581a2
WindowServer: Fix 32 bit compilation with -Werror
...
There was a always false statement on 32 bit that the compliler was
warning about.
2024-09-27 15:33:25 +03:00
Bananymous
2d11ce9669
Kernel: Fix interrupt system
...
I had not understood how MSIs work and I was unnecessarily routing them
through IOAPIC. This is not necessary and should not be done :D
Also MSIs were reserving interrupts that IOAPIC was capable of
generating. Now IOAPIC and MSIs use different set of interrupts so
IOAPIC can use more interrupts if needed.
2024-09-27 15:31:31 +03:00
Bananymous
e4982a1a5c
LibC: Fix printf with alternate format and zero values
2024-09-26 15:25:16 +03:00
Bananymous
cea6dedccc
Userspace: Compile programs and libraries with -Wall -Wextra -Werror
2024-09-26 15:20:07 +03:00
Bananymous
e6ed5a388d
BuildSystem: Export compile commands for clangd
2024-09-26 15:14:54 +03:00
Bananymous
b89fc3fe87
Kernel: Implement ANSI SGR 7 to invert colors
...
This allows vim's visual selection to show up
2024-09-26 15:08:11 +03:00
Bananymous
57ae74f908
Terminal: Implement more ANSI escape handling
...
This patch adds L and M codes for inserting and deleting lines and SGR 7
for inverting colors
2024-09-26 15:07:08 +03:00
Bananymous
1a6804b4b4
Terminal: Make Terminal::handle_csi() return invalidated rectangle
...
When I updated Terminal to only do a single invalidation after all of
input text was printed, I forgot to change handle_csi
2024-09-26 15:05:11 +03:00
Bananymous
82e6a3582d
LibGUI: cleanup Window::shift_vertical and add copy_horizontal_slice
2024-09-26 15:00:14 +03:00
Bananymous
11a4e4faa2
LibImage: Add Adam7 support for PNG decoder
2024-09-26 11:47:34 +03:00
Bananymous
50a3533322
LibInput: Add value for ESC in key_to_utf8_ansi
...
This allows exiting vim when using this function for key mappings :D
2024-09-24 18:08:34 +03:00
Bananymous
4e9f39384a
LibC: Initialize libc only once
...
This was breaking stuff with dynamic loader initializing libc and main
executable reinitializing it later :D
2024-09-24 17:56:12 +03:00
Bananymous
39802b56c1
Kernel: Allow SYS_EXEC to fail at any point
...
This patch builds new executable image to another pml4 structure and
only after everything is validated will current context be replaced.
This allows exec to fail "late" where previously it would panic the
kernel or kill the process. This allows graceful handling of exec
failures in userspace!
2024-09-24 16:29:38 +03:00
Bananymous
ebb87ccdde
Kernel: Add asserts for overflow checks with ms -> ns conversions
2024-09-24 16:28:44 +03:00
Bananymous
f0e55938c1
Kernel: Allow initial binding of threads to specific processor
2024-09-24 16:27:40 +03:00
Bananymous
348d04f7f5
Kernel: Implement static Process::kill()
...
This allows killing processes even when there does not exist a current
thread.
2024-09-24 13:16:43 +03:00
Bananymous
1b0086217c
Terminal: Do scrolling in putchar if necessary
...
I overlooked that handling *newline* scrolls would be enough. You can
definitely scroll more if printing a lot of text which wraps to the next
line.
2024-09-23 15:00:47 +03:00
Bananymous
d395cf38b7
Kernel: Binding to port 0 will always find unused port
2024-09-22 17:30:01 +03:00
Bananymous
57aec2a733
Kernel: Validate pointer's when printing stack trace
...
There was an kernel panic if stack trace contained uncanonical
addresses.
2024-09-22 17:16:01 +03:00
Bananymous
ae89237453
Kernel: Disable warning when calling syscall
...
This warning is only generated when compiling with UBSAN and I don't see
how the value would even be uninitialzed.
2024-09-22 17:15:07 +03:00
Bananymous
60d5257678
Kenrel: Add __builtin_unreachable support for UBSAN
2024-09-22 17:14:36 +03:00
Bananymous
d59463d11b
Kernel: Fix TTY reading one keyevent after disabling input handling
2024-09-22 17:13:10 +03:00
Bananymous
1280528e4e
BuildSystem: Use -O2 for all libraries
...
I don't know why I had not specified optimization level for libraries.
Only LibImage was using explicit -O3. LibImage doesn't need O3 anymore
as O2 seems to be around the same speed.
2024-09-20 20:04:49 +03:00
Bananymous
23d6205659
Kernel: Move DEBUG_* macros to centralized Debug.h
...
This makes toggling debug info much easier
2024-09-20 11:00:07 +03:00
Bananymous
bc0acc6f44
Kernel: Validate network packet sizes before casting
...
This caused a lot of crashes on invalid packets :D
2024-09-20 10:46:59 +03:00
Bananymous
b8622f2b4b
Kernel: Implement simple RTL8169 driver
...
This allows me to use internet when running banan-os on my hardware!
2024-09-19 22:58:03 +03:00
Bananymous
7f0c39fe91
Kernel: Don't crash the kernel if packet is smaller than ethernet hdr
2024-09-19 22:51:55 +03:00
Bananymous
a489be0e05
Kernel: Allow parallel LAPIC timer initialization with HPET
...
HPET supports reading LAPIC counter without locks, so it can be done in
parallel. This makes booting much faster. Previously initializing every
timer took 100 ms, so 16 CPUs took total of 1.6 seconds. This allows
doing it all in 100 ms.
2024-09-19 14:41:59 +03:00
Bananymous
8e08046519
Kernel: Add asserts about having locked TTY's write lock
...
This for some reason fixes booting on real hardware? :D
2024-09-18 00:56:48 +03:00
Bananymous
999eb53364
Kernel: Release debug lock if its locked during kernel panic
...
Also kernel panic now prints if it had lock
2024-09-18 00:56:02 +03:00
Bananymous
f7e549e412
Toolchain: Run `strip` after installing toolchain
...
This drops installed toolchain size to around fifth :D
2024-09-17 22:30:40 +03:00
Bananymous
fbb99de728
ls: Show symlink target with `-l`
2024-09-17 19:12:34 +03:00
Bananymous
0620ed3d4f
Kernel: Fix file open permissions for some syscalls
2024-09-17 19:11:48 +03:00
Bananymous
b779b3cf2d
Kernel: Move file finding code to a helper
2024-09-17 18:52:52 +03:00
Bananymous
a6b973003b
WindowServer: chmod the correct file
2024-09-17 18:35:27 +03:00
Bananymous
e431e90b20
Kernel/LibC: Implement all chown family function with fchownat
2024-09-17 18:35:01 +03:00
Bananymous
4aa466b948
Kernel/LibC: Implement all chmod family functions using fchmodat
2024-09-17 17:19:26 +03:00
Bananymous
04ae53b6df
Shell: Add back accidentally deleted `cd` and `time` builtins
2024-09-17 16:38:45 +03:00
Bananymous
3666525d24
Kernel/LibC: Implement `readlink` in terms of `readlinkat`
2024-09-17 16:38:15 +03:00
Bananymous
f1a4bbce53
Kernel/LibC: Implement all stat family functions with fstatat
...
This patch gets rid of 2 unnecessary syscalls!
2024-09-17 16:38:01 +03:00
Bananymous
708a720d9d
Kernel: Remove SYS_OPEN
...
This can be done with SYS_OPENAT with fd set to AT_FDCWD
2024-09-17 16:16:47 +03:00
Bananymous
7177da7d62
LibC: Implement dummy get_rusage
...
One port seems to use this function. This dummy just reports no used CPU
time for current process nor children
2024-09-17 15:59:22 +03:00
Bananymous
5e4aa75e03
Kernel: Perform access checks when creating a file or a directory
...
Also SYS_CREATE_DIR now uses correct relative path. It used to always
create files relative to root. And as no permission checks were tested,
file creation succeeded to root as long as path did not contain '/' :D
2024-09-17 15:57:07 +03:00
Bananymous
d88ee5c9ee
Kernel/LibC: Implement `creat` with `open`
...
This allows getting rid of unnecessary SYS_CREATE. Directory creation
still has its own syscall, but I could combine it with SYS_OPEN also.
2024-09-17 15:55:53 +03:00
Bananymous
d4ea720239
Kernel: Don't crash the kernel if ext2 encounters disk error
...
This will most likely result in a corrupted filesystem, but crashing the
kernel is too much :D
2024-09-17 15:54:33 +03:00
Bananymous
97ee370ffe
Kernel: Allow listing files even if one of directories blocks are empty
2024-09-17 15:53:14 +03:00
Bananymous
a084f83f4c
Kernel: Rework kernel-side ELF loading
...
ELFs are now loaded as MemoryRegions so they don't need special handling
anywhere. This also allows file backed COW optimizations to work. This
was not the case before.
This patch removes now obsolete LoadableELF and unused ELF files from
LibElf.
2024-09-15 23:57:34 +03:00
Bananymous
54732edff4
Kernel: Fix bugs in memory regions
...
MemoryRegion::initialize() required size to be page aligned, this is not
necessary.
MemoryBackedRegion::copy_data_to_region() required user-write
permissions for underlying data. This did not matter as memory backed
regions dont support COW memory, but it could lead to bugs later on.
2024-09-15 23:18:05 +03:00
Bananymous
1a24d1839f
LibInput: KeyEvent to ansi string now handles delete key
...
This allows Terminal emulator to also handle delete key.
The value of `\0x7F` may be wrong as qemu's serial console seems to be
sending `\e[3~`
2024-09-15 03:13:21 +03:00
Bananymous
c3040a04a3
Terminal: Optimize printing a lot
...
Terminal used to run `yes` at around 400 lines per second
This patch pumps that to over 100'000 lines per second!
There are 2 optimizations done:
1. only invalidate window once after rendering is done
2. if printing more than `rows()` newlines skip prior data
2024-09-15 03:12:26 +03:00
Bananymous
7feb4c4ebd
Kernel: VFS::file_from_absolute_path now used root_file() API
2024-09-15 02:38:25 +03:00
Bananymous
2911d1f018
Kernel: Cleanup and fix pseudo terminals
2024-09-15 02:38:07 +03:00
Bananymous
d68ad893f0
Kernel/Shell: Add support for delete key
2024-09-14 22:45:48 +03:00
Bananymous
4ca147699d
Shell: use printf and putchar instead of fprintf and fputc
2024-09-14 22:37:09 +03:00
Bananymous
abed41b8fa
Shell: Remove builtin tests
...
Test should be programs in /bin instead
2024-09-14 22:28:33 +03:00
Bananymous
2604a55f80
Shell: Make ctrl+c start a new command
2024-09-14 22:27:32 +03:00
Bananymous
39667de662
Kernel: Fix sizeof check for sys_tc{set,get}attr
2024-09-14 21:17:03 +03:00
Bananymous
8956835d95
Kernel: Make sys_.*at use VFS relative path finding
2024-09-14 21:15:58 +03:00
Bananymous
ea4ec2eafc
Kernel: Make OpenFileDescrptor store VFS::File instead of inode+path
2024-09-14 20:10:21 +03:00
Bananymous
3a352078de
Kernel: Make VirtualFileSystem::File non copyable
2024-09-14 20:09:28 +03:00
Bananymous
6060b39548
Kernel: Implement relative file searching in VFS
2024-09-14 19:44:20 +03:00
Bananymous
dce2436b2c
BAN: Implement Vector::reverse()
2024-09-14 19:44:20 +03:00
Bananymous
2b52ea4c6f
Kernel: Make Inode::can_access const
2024-09-14 19:39:41 +03:00
Bananymous
b41738b47b
Kernel: Fix ACPI name formatting functions
2024-09-14 19:39:13 +03:00
Bananymous
57e76a65a4
Kernel: Null terminate ext2 directory entries
...
This fixes a weird bug with `ls /bin`
2024-09-12 23:55:34 +03:00
Bananymous
7f25ddc229
userspace: Add missing alpha channels
2024-09-12 20:53:45 +03:00
Bananymous
163961df4f
ports/doom: Add alpha channel for framebuffer access
2024-09-12 20:16:17 +03:00
Bananymous
97da386ed6
WindowServer: Make focused window bounce by pressing F2
...
This was an awesome idea by [@Dcraftbg](https://github.com/Dcraftbg )
2024-09-12 20:09:23 +03:00
Bananymous
c706829a91
WindowServer: Make corner-radius a variable in config file!
2024-09-12 20:07:30 +03:00
Bananymous
6cd246a38e
WindowServer: Add support for rounded corners and transparency
2024-09-12 19:35:44 +03:00
Bananymous
43e88c0ae0
Terminal: Add alpha channel to colors
...
This doesn't do anything yet, but will when I add transparency support
for WindowServer
2024-09-12 19:34:25 +03:00
Bananymous
bf01b935bd
WindowServer: Start Terminal with Super+Enter
...
this allows doing something in GUI after Terminal is closed
also WindowServer is now stopped with Super+Shift+E
2024-09-11 22:18:08 +03:00
Bananymous
98c011e6a6
WindowServer: Open all fds as CLOEXEC
...
This will allow forking the window server cleanly :D
2024-09-11 22:17:31 +03:00
Bananymous
86dcb5c471
init: Don't leak pwent fd to child processes
2024-09-11 22:11:05 +03:00
Bananymous
467ac6c365
Kernel/LibC: Implement SOCK_CLOEXEC and SOCK_NONBLOCK
...
This removes the need for fcntl after creating a socket :)
2024-09-11 21:59:11 +03:00
Bananymous
c77ad5fb34
Kernel: Implement copy-on-write memory for file backed `mmap`s
2024-09-11 19:33:50 +03:00
Bananymous
4006a04817
DynamicLoader: Don't do file backed mapping over file bounds
2024-09-11 19:30:35 +03:00
Bananymous
4189a1c729
LibC: Make _init and _fini weak symbols
...
These seem to be missing sometimes when making shared executables
2024-09-11 14:39:07 +03:00
Bananymous
a07cbabcb3
LibC: Define function sizes for setjmp and longjmp
...
dynamic linking was complaining about these not existing
2024-09-10 16:21:20 +03:00
Bananymous
64a3893f6f
Kernel: Add command line option to disable AML parsing
...
This can be handy if my broken AML parser crashes or hangs while parsing
AML :D
2024-09-10 16:20:24 +03:00
Bananymous
eabe759ebf
Kernel: Don't require APs that are not started to start :D
2024-09-10 16:19:43 +03:00
Bananymous
a4838386e6
Kernel: Remove unnecessary branch from uncanonicalizing addresses
2024-09-10 16:19:16 +03:00
Bananymous
c65613901f
Kernel: Fix AML aliases and package elements
2024-09-10 16:18:42 +03:00
Bananymous
19d16620a6
DynamicLoader: Don't do file backed mapping for filesz == 0
2024-09-05 14:50:05 +03:00
Bananymous
4e15b9cdfa
Ports: Add explicit -libgcc-shared for ports on 32 bit
2024-09-05 14:49:23 +03:00
Bananymous
de35cec2e1
Kernel: Allow private file mappings past file end
...
This is just to make memory mapping ELF files easier :D
2024-09-05 14:48:42 +03:00
Bananymous
e8bcebfb8e
DynamicLoader: Use file backed mmap when possible
2024-09-05 13:59:39 +03:00
Bananymous
2f241e1b61
Kernel: Implement FileBackedRegion::clone
2024-09-05 13:59:09 +03:00
Bananymous
6affef76b1
test-shared: Add more shared tests
2024-09-05 12:59:48 +03:00
Bananymous
32ba4d07e2
Userspace: Remove unnecessary mov instruction from crt0
2024-09-05 12:59:05 +03:00
Bananymous
ddaaf89c87
BuildSystem: Make default libc a shared library
2024-09-05 12:58:35 +03:00
Bananymous
9aed8dbe6b
Toolchain: Build crtbeginS.o crtendS.o and shared libgcc
2024-09-05 12:58:21 +03:00
Bananymous
aa7e92b275
Userspace: Write a dynamic loader
...
This allows running executing dynamically linked executables!
2024-09-05 12:58:21 +03:00
Bananymous
f30947336a
BuildSystem: Cleanup cmake files
2024-09-05 12:52:25 +03:00
Bananymous
0bb44d7b75
LibC: Fix errno to work with shared libraries
2024-09-04 21:16:04 +03:00
Bananymous
1138ec77ca
Kernel: Fix MemoryBackedRegion cloning for non page aligned size
2024-09-04 21:14:26 +03:00
Bananymous
c4dadd27ac
BAN: Fix refenrece -> reference typo
2024-09-03 16:39:21 +03:00
Bananymous
04c715d314
BuildSystem: Build all libraries in root build directory
...
I could not figure out how to use cmake's rpath to build libraries with
DT_NEEDED only containing the library name, not a relative path.
2024-09-02 21:31:08 +03:00
Bananymous
35743cc8e6
LibC: Compile both static and shared version of LibC
...
libc target is now set as an alias for libc-static
2024-09-02 21:28:02 +03:00
Bananymous
5f92807fdd
userspace: Allow building without SSE
...
I had added changes that had broken compilation without sse support
2024-09-02 21:25:00 +03:00
Bananymous
700c3444f5
LibELF: Add more values and macros for interpreting fields
2024-09-02 20:40:38 +03:00
Bananymous
ddf1babfe1
Kernel: Cleanup constructor calls
2024-08-31 02:23:08 +03:00
Bananymous
2ae2ede0b2
LibELF: Add value definitions for DT_
2024-08-30 15:35:01 +03:00
Bananymous
ef5af384e7
Kernel: Print userspace invalid pointer access address
2024-08-30 15:34:37 +03:00
Bananymous
a134d16070
Kernel: Fix MemoryRegion test for contains_fully
2024-08-30 15:33:58 +03:00
Bananymous
827eec6af0
Kernel: Make .rodata read-only and add -orphan-handling=error
...
I don't really know why .rodata was marked writable :D
2024-08-30 15:33:02 +03:00
Bananymous
8da2f12ba6
Kernel: Only load program headers of interpreter if its present
...
I was loading program headers of both executable and interpreter but
that is incorrect. The interpreter will itself load the program headers
of the executable.
2024-08-28 21:19:37 +03:00
Bananymous
50ab391133
test-globals: print something when calling main
...
This shows that constructors and destructors are called in correct order
2024-08-28 17:09:07 +03:00
Bananymous
991647bc8f
Userspace: Add shared library test
...
I will use this while testing my dynamic loader
2024-08-28 17:08:37 +03:00
Bananymous
57300687ff
LibC: Cleanup and fix missing LibC headers
2024-08-28 17:07:58 +03:00
Bananymous
d559339f5f
LibC: Compile shared libc as well as static
2024-08-28 17:07:15 +03:00
Bananymous
2bf65ef512
Kernel: Invoke ELF interpreter instead if it is specified
2024-08-28 17:06:32 +03:00
Bananymous
d20752c318
Kernel: Make OpenFileDescritorSet::open take rvalue
...
This gets rid of some implicit allocations from copy constructors
2024-08-28 16:36:10 +03:00
Bananymous
5f66ef34dd
Kernel: map userspace arguments after the entry point
...
This allows cleaner memory layout for processes that are not loaded to
default location
2024-08-27 22:46:08 +03:00
Bananymous
da0b4cd40e
Kernel: Allow MAP_FIXED in mmap
2024-08-27 22:45:49 +03:00
Bananymous
68f9dc1f8a
Toolchain: Add support for building shared libraries
2024-08-27 17:36:09 +03:00
Bananymous
5121d0d934
Kernel: Allow loading PIEs
...
This is initial work towards implementing dynamic loader and shared
library support.
2024-08-27 17:32:22 +03:00
Bananymous
2c520391eb
Kernel/LibC: Add support for init_array and fini_array
2024-08-27 00:47:03 +03:00
Bananymous
7c4b9218f2
Kernel: VirtualTTY now resets ansi state before printing anything
2024-08-25 17:56:06 +03:00
Bananymous
72f8138ca1
Kernel: Disable scheduler load balancing until I get it fixed
...
Scheduler keeps crashing all the time when running on multiple cores.
This patch disabled the load balancer, which seems to get rid of most
scheduler crashes.
2024-08-25 15:37:17 +03:00
Bananymous
991ae4383a
Kernel/LibC: Implement fchmod
2024-08-25 15:07:42 +03:00
Bananymous
2ce7205c80
Kernel: Add command line option to disable debug printing
...
The whole system can crash when debug output and tty output are done at
the same time. This patch is just a hack to prevent the crash :D
2024-08-25 15:02:15 +03:00
Bananymous
bec3e8654f
Shell: Implement escaping quotes in quoted strings
2024-08-24 17:13:50 +03:00
Bananymous
14fdcb892d
Ports: Make curl port use openssl
...
Curl now works with https!
2024-08-22 15:10:41 +03:00
Bananymous
d6d062841d
Ports: Add openssl port
2024-08-22 15:10:41 +03:00
Bananymous
06d0985bba
Ports: Add zlib port
2024-08-22 15:10:41 +03:00
Bananymous
9ea969be1f
Ports: Add port that downloads and install cacert to system
2024-08-22 15:10:41 +03:00
Bananymous
500f774b7f
LibC: Add a lot of stub implementations for different libc functions
...
some ports want to link against these, but they are not ever called
based on simple testing
This patch adds stubs for
- openlog
- syslog
- getrusage
- mlock
- mprotect
- getpeername
- shutdown
- tzset
- mktime
2024-08-22 15:10:41 +03:00
Bananymous
ca8832c0e1
LibC: Implement getaddrinfo and freeaddrinfo, add stub for getnameinfo
2024-08-22 15:10:41 +03:00
Bananymous
1cbba113fd
LibC: Add and cleanup some networking structures and definitions
2024-08-22 15:10:41 +03:00
Bananymous
45b4b33a3d
LibC: Add definitions for some integer sizes to limits.h
2024-08-22 15:10:41 +03:00
Bananymous
c453a8e2dc
LibC: Implement poll() using select
2024-08-22 15:10:41 +03:00
Bananymous
e59772a58d
General: Cleanup build scripts
2024-08-22 15:10:41 +03:00
Bananymous
fb35f06cf5
Kernel: Add better support for bootloaders loading the kernel
...
Before I assumed that bootloaders loaded the kernel at physical address
0, but this patch kinda allows loading to different addresses. This
still doesn't fully work as kernel bootstrap paging relies on kernel
being loaded at 0
2024-08-22 14:48:21 +03:00
Bananymous
abc788c756
Kernel: Improve output message when dumping all syscalls
2024-08-22 14:48:21 +03:00
Bananymous
63b616dc2e
Kernel: Hack non-blocking support for sockets
...
This is not thread safe and can still block if two programs refering to
the same socket try to read data at the same time
2024-08-22 14:48:14 +03:00
Bananymous
72f3fe0b12
LibC: Add empty files sys/param.h and sys/file.h
...
For some reason some ports include these files even when they detect
that they are not available
2024-08-22 14:47:59 +03:00
Bananymous
cba12efeb1
Kernel: Ignore optional_actions in SYS_TCSETATTR
...
Currently all terminals are syncronous, so the actions don't do anything
2024-08-22 14:47:54 +03:00
Bananymous
37cd4ed504
Kernel: Add support for CSI @, b, d to VirtualTerminal
2024-08-22 14:04:45 +03:00
Bananymous
869bba4dad
Kernel: Add check for panic in timer interrupt handler
...
Previously processors would not get notified about kernel panic if they
were idling
2024-08-22 14:03:03 +03:00
Bananymous
23194d1f53
Kernel: Implement basic random device to /dev/random
2024-08-22 14:02:26 +03:00
Bananymous
969563c06a
Kernel: Don't load AP init code to 0xF000, but relocate it later
...
This cleans up the kernel executable as bootloaders don't have to
load AP init code straight to 0xF000, but it will be moved there once
kernel is doing the AP initialization.
2024-08-21 13:37:50 +03:00
Bananymous
066e8e1cc2
Kernel: Remove unnecessary debug logging from VFS initialization
2024-08-18 20:51:10 +03:00
Bananymous
5cd7b40165
Kernel: Make BananBootloader info struct header compatible with C
2024-08-18 20:51:10 +03:00
Bananymous
c7b134ba4b
Kernel: Fix NVMe controller namespace numbering
...
namespace numbers were incrementing globally instead of per controller.
This led to two single namespace controllers creating nvme0n1 and
nvme1n2
2024-08-18 20:51:10 +03:00
Bananymous
ff62c262fe
Kernel: Fix PS/2 scancode set 2 keycodes for the bottom row keys
2024-08-18 20:51:10 +03:00
Bananymous
42e2c15e0c
Kernel: Add ps2=<scancode set> command line argument
...
This allows forcing specific scancode set on broken PS/2 emulations
2024-08-18 20:51:10 +03:00
Bananymous
40c6989374
Kernel: Implement AML ObjectTypeOp
2024-08-18 20:51:10 +03:00
Bananymous
71dc373610
Kernel: "Fix" AML _OSI string to return true for windows strings
...
This is the way its supposed to be done as other code paths are
untested...
2024-08-18 20:51:10 +03:00
Bananymous
0fa16cf982
Kernel: Fix and add some AML to_underlying functions
2024-08-18 20:44:51 +03:00
Bananymous
8902032b42
BuildSystem: Cleanup kernel cmake file
2024-08-18 20:44:12 +03:00
Bananymous
368f5e9799
Kernel: Add command lineoption `nousb` that will disable usb controller
2024-08-16 22:09:24 +03:00
Bananymous
46b34817d2
snake: Remove random goto statements when regenerating apple's position
2024-08-16 17:36:37 +03:00
Bananymous
b1fe24bb57
Kernel: Hack AML integers to work better
...
Something is trying to store into a constant integers. Just by copying
not returning any integers as constants fixes it xD
2024-08-16 13:04:52 +03:00
Bananymous
490a28ee7a
Kernel/AML: General cleanup and compliance improvements
2024-08-15 23:14:13 +03:00
Bananymous
75884ca6b8
Kernel/AML: Allow calling method through named objects
2024-08-15 23:13:32 +03:00
Bananymous
d729d7f570
Kernel: Implement AML storing to Buffer
2024-08-15 23:12:52 +03:00
Bananymous
6408bb2efa
Kernel: Add AML API for getting underlying value of nodes
2024-08-15 23:11:59 +03:00
Bananymous
d8dabab4fb
Kernel: Implement AML CopyObjectOp
2024-08-15 20:55:55 +03:00
Bananymous
4dc107f77a
Kernel: Fix AML Register/Reference accesses
2024-08-15 20:55:18 +03:00
Bananymous
eaf06d239c
Kernel: Cleanup and fix AML Method calls
2024-08-15 20:54:55 +03:00
Bananymous
d9b3a4bf77
Kernel: Add more conversions for AML Integer, Register, String
2024-08-15 20:51:04 +03:00
Bananymous
cf970d5914
Kernel: Add better conversion for AML Alias, Name and Reference
2024-08-15 20:48:35 +03:00
Bananymous
1cfe3dd4da
Kernel: Implement AML BreakOp and ContinueOp
2024-08-15 19:08:00 +03:00
Bananymous
51d1e47bfe
Kernel: Fix AML CreateFieldOp to take bit index instead of byte index
2024-08-15 19:05:58 +03:00
Bananymous
e0a447bfaf
Kernel: Add _GL to ACPI root namespace
2024-08-15 02:28:22 +03:00
Bananymous
3f5ee6f414
Kernel: Rewrite the AML conversion API
...
This doesn't currently make the interpreter any better, but it will make
further implementation easier to be spec (or hardware...) compliant
2024-08-15 02:25:45 +03:00
Bananymous
44d5c8c4b4
Kernel: Implement AML To{Buffer,Integer,String}Op
2024-08-14 20:28:32 +03:00
Bananymous
17b7e9e772
Kernel: Allow all named objects to fail cleanly if name exists
2024-08-14 20:28:00 +03:00
Bananymous
8a2a444f33
BAN: Make formatting functions inline
2024-08-14 20:26:55 +03:00
Bananymous
957df08932
Kernel: root command line option can be specified as an UUID
...
Format is the same as in linux
root=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
This makes it easier to boot when computer has multiple disks installed
2024-08-14 13:23:27 +03:00
Bananymous
fd018b32d0
BAN: Implement GUID::to_string
2024-08-14 13:23:27 +03:00
Bananymous
e000c7d818
BAN: Use static_cast instead of C-style cast in RefPtr deletion
2024-08-14 13:23:27 +03:00
Bananymous
bb40069773
Kernel: Add nice debug prints for device addition/removal
2024-08-14 13:23:27 +03:00
Bananymous
37d5b60f5c
Kernel: Implement AML {Event,Reset,Signal,Wait}Op
2024-08-14 11:59:34 +03:00
Bananymous
37e6cd6500
General: Update README contribution information
2024-08-14 10:34:41 +03:00
Bananymous
feadea0e91
Kernel: Fix AML unaligned integer reads and buffer shifts over 32
2024-08-13 23:44:17 +03:00
Bananymous
f71a29b6c4
Kernel: Implement AliasOp for AML interpreter
2024-08-13 22:42:37 +03:00
Bananymous
ec4cfdee23
Kernel: Fix and cleanup a lot of AML code
...
Node now have APIs to convert them to buffer, integer and string. This
allows possibility to handle methods that need explicitly use one of the
overloads instead of integer.
This patch also adds handling of DebugOp. This is used quite heavily in
uACPIs test suite.
2024-08-13 22:42:37 +03:00
Bananymous
dd79db6383
Kernel: AML implement CreateFieldOp
2024-08-13 18:52:48 +03:00
Bananymous
723e458bd7
Kernel/Terminal: Update terminal color themes and fix TTY bright/dark
2024-08-12 21:15:55 +03:00
Bananymous
25a47f0df3
LibC: Implement ungetc()
...
I didn't really test this, but I think this implementation does what it
needs to :)
2024-08-12 19:14:55 +03:00
Bananymous
39be57424c
Kernel: Fix SYS_SEEK with SEEK_END
...
I was subtracting the offset from file end when I should have added it.
2024-08-12 19:13:27 +03:00
Bananymous
45ffa1b79c
General: Update README feature list
...
README did not contain anything about GUI or USB which I have had for
maybe a month now :D
2024-08-12 15:14:04 +03:00
Bananymous
f37e1c2229
Kernel: Map .rodata as read only instead of read-write
2024-08-12 14:28:52 +03:00
Bananymous
1bd7b86e60
Terminal: Implement cursor blinking
...
This looks much nicer than the old static cursor
2024-08-12 14:24:17 +03:00
Bananymous
18e7cf2069
Terminal: Add cursor rendering
...
Cursor is now shown at the current position. It can be hidden (or shown)
with the ansi `\033[?25h` or `\033[?25l`
2024-08-12 00:50:06 +03:00
Bananymous
60b4d90608
LibGUI: Add Window::get_pixel()
...
This is fine as its not reading from video memory
2024-08-12 00:49:35 +03:00
Bananymous
5197000124
LibC: Fix qsort for types bigger than 64 bytes
2024-08-11 18:00:05 +03:00
Bananymous
71d4060993
Ports: Update port building instructions
2024-08-11 17:58:10 +03:00
Bananymous
34c6ad7277
Base: Add sample png image and make it the default GUI background
2024-08-11 01:16:23 +03:00
Bananymous
9e79ef2a91
Terminal: Use pseudo terminal instead of pipes
...
Terminal can now send signals from keyboard (ctrl+c) to programs running
in the terminal!
2024-08-11 01:02:59 +03:00
Bananymous
4d1b32f770
Kernel: open does not need TTY_INIT to set the controlling terminal
2024-08-11 01:02:59 +03:00
Bananymous
a5a097fa4a
Kernel/LibC: Add initial pseudo terminal support
...
This patch implements posix_openpt() and ptsname()
grantpt() and unlockpt() are left in LibC as stubs, as posix_openpt
currently does all of the needed work.
2024-08-11 01:02:59 +03:00
Bananymous
ad645f31d0
Kernel/LibC: Add setsid()
2024-08-11 00:58:12 +03:00
Bananymous
f08d429851
Terminal: Add utf8 parsing for input
...
This patch adds possibility to render multibyte utf8 codepoints!
2024-08-11 00:54:51 +03:00
Bananymous
bac3219a01
Kernel: Fix `Pipe::can_read_impl()`
...
The logic was inversed, which made all select calls report incorrectly
for pipes. This made terminal emulator just freeze.
2024-08-10 18:18:25 +03:00
Bananymous
09a527fb12
Kernel: Fix scheduler thread counter
...
I was actually never incrementing the counter :D
2024-08-10 18:18:25 +03:00
Bananymous
58a3a480b9
Ports: Update the port system once again!
2024-08-10 18:18:25 +03:00
Bananymous
a12bfe4639
LibC: Don't crash when calling tcflush()
2024-08-09 17:03:21 +03:00
Bananymous
6cda639869
LibC: Add stubs for tmpfile, mktemp and fchmod
2024-08-09 17:02:49 +03:00
Bananymous
2797fe116f
LibC: Add stubs for some functions in {dlfcn,ftw,utime,wchar}.h
2024-08-09 17:01:41 +03:00
Bananymous
e768cd53fb
LibC: Add definition for SIGWINCH
...
This is actually not yet sent, but programs can install signal handlers
for it!
2024-08-09 17:00:13 +03:00
Bananymous
83e2ad40d6
LibC: Implement gai_strerror and add stubs for {get,free}addrinfo
2024-08-09 16:59:49 +03:00
Bananymous
7ebd0699e3
LibC: Add _PC* definitions to unistd.h
...
These are not used for anything yet
2024-08-09 16:58:58 +03:00
Bananymous
46b1d4d194
LibC: Remove cxx abi stuff from libc
...
These will cause multiple definitions when linking with libstdc++
2024-08-09 16:58:11 +03:00
Bananymous
f60e265397
LibC: Add ldexp to math.cpp
2024-08-09 16:57:16 +03:00
Bananymous
2e642327ea
LibC: Implement localeconv()
2024-08-09 16:56:48 +03:00
Bananymous
a87ce41030
LibC: rename fd_set internal variable
...
binutils seems to need access to the internal type and uses this name
for lookup.
2024-08-09 16:55:52 +03:00
Bananymous
0c8cae4cc3
LibC: Move ioctl to <sys/ioctl.h>
...
Some ports seem to be assuming that ioctl exists there and not in
stropts.h
2024-08-09 16:54:30 +03:00
Bananymous
ed325b4a45
Kernel: Fix typo in userspace address validation
2024-08-09 16:52:57 +03:00
Bananymous
1c67b5e812
Kernel: Fix wait syscall to report status of exited children
2024-08-09 16:52:35 +03:00
Bananymous
b6c964c444
Kernel: Rewrite pipes
...
Pipes have now a fixed size buffer and pipe clone and close is working
again.
2024-08-09 16:50:19 +03:00
Bananymous
6fedf06150
LibC: Implement {sig,_,}{longjmp,setjmp}
2024-08-09 15:58:56 +03:00
Bananymous
91d513a672
2000th COMMIT: userspace: Implement basic fetch program bananfetch
...
This patch adds a obligatory fetch program to banan-os!
This program (`bananfetch`) fetches some basic information about the
operating system and the hardware its running on!
2024-08-09 15:58:56 +03:00
Bananymous
44f0ec601f
Kernel: Expose /proc/meminfo and fix /proc/<pid>/meminfo
...
Thread was unconditionally calling <stack>->size() without validating
that the stack actually exists
2024-08-09 15:58:56 +03:00
Bananymous
2a659a9d03
BuildSystem: Fix enable sse definition
...
__enable_sse was never actually defined for any targets. This also adds
__arch definition for libc (so `utsname` works).
2024-08-09 15:52:42 +03:00
Bananymous
7e7c3a1bb3
Kernel: VirtualTTY now handles dark colors
...
I have seemingly forgot to add these before
2024-08-09 15:52:42 +03:00
Bananymous
3b23458ecc
LibC: Start work on locales
...
This patch adds 2 locales, POSIX locale and UTF8 locale.
functions `mbstowcs()` and `strcoll()` use locales to do convertions and
comparison respectively.
2024-08-09 15:52:42 +03:00
Bananymous
7afdfb150f
LibC: Rewrite sigprocmask in terms of pthread_sigmask
...
Also don't fail SYS_SIGPROCMASK if how is invalid and set is NULL.
2024-08-07 17:01:35 +03:00
Bananymous
2ca7886f88
Ports: remove architecture from .compile_hash files
...
This is was over complicating things and there can be only one banan-os
build at a given time.
2024-08-07 16:34:28 +03:00
Bananymous
5aca6c7c1f
Ports: Fix bugs in the port system
...
Fix some bugs and add pkg-config for the port system. Also ncurses is
now downloaded from the gnu mirror in the hope that it works better
2024-08-07 01:57:44 +03:00
Bananymous
fe94d6cf89
LibC: Implement dummy rename() so vim can save files
...
vim calls rename when saving a file. This patch adds dummy
implementation that only works for regular files and does a copy instead
of proper rename.
2024-08-05 20:16:05 +03:00
Bananymous
0a7c316ffb
Kernel: Fix race condition when blocking threads
...
If thread was blocked, but had not reached block queue, you might
already get an unblock request which would fail on an assertion.
If blocked thread was load balanced to another processor and unblocked
simultaneously, there was a race condition.
2024-08-05 20:14:13 +03:00
Bananymous
e72424e01a
Kernel: Implement ANSI CSI M and fix ANSI CSI L
...
There are not maybe not correct, but work much better than the old ones
2024-08-05 15:53:01 +03:00
Bananymous
dbba9128a4
Ports: Add ncurses and vim port!
...
vim is kind of buggy because my virtual tty {insert,delete} line ansi
codes don't really work.
2024-08-05 15:20:18 +03:00
Bananymous
352c1ddc16
BuildSystem: Rewrite port compilation system
...
Now ports define some environment variables, and call a unified bash
script that handles configuration, recompilation and installation.
If a port uses non-configure buildsystem, port script can also specify
custom build and install step.
2024-08-05 15:20:18 +03:00
Bananymous
4d96ae56ac
LibC: Add stubs for ungetc(), tcflush() and symlink()
2024-08-05 01:48:24 +03:00
Bananymous
adadb10b15
LibC: Fix strsignal() and implement psignal()
2024-08-05 00:59:03 +03:00
Bananymous
a749b9806e
LibC: Add definition for h_errno
...
Nothing uses this yet, but linking will succeed
2024-08-05 00:58:06 +03:00
Bananymous
615d9d4abe
LibC: Add INADDR_LOOPBACK
...
Some port was using this. Loopback addresses are not supported, but they
will be 127.0.0.1.
2024-08-05 00:56:42 +03:00
Bananymous
aa03274093
LibC: Remove O_DIRECTORY from opendir()
...
opendir() did not work on symlinks after with this flag...
2024-08-05 00:55:03 +03:00
Bananymous
e7a06979ec
LibC: Implement usleep()
...
This is not a POSIX function, but some ports seem to be using it either
way
2024-08-05 00:54:17 +03:00
Bananymous
3651306f57
LibC: Implement strto{u,i}max()
2024-08-05 00:53:27 +03:00
Bananymous
5dce4e6aea
LibC: Implement strftime()
...
I did not test this at all, this might very well be broken
2024-08-05 00:49:44 +03:00
Bananymous
1d9041f2aa
LibC: make opendir() fail if path is not a directory
2024-08-01 22:57:46 +03:00
Bananymous
a578527012
Kernel/LibC: Implement ioctl(TIOCGWINSZ)
...
This allows ncurses to get the window size!
2024-08-01 22:56:26 +03:00
Bananymous
af78a2d080
Kernel: Implement ANSI CSI L for TTY
...
vim seems to be using this, so I decided its needed
2024-08-01 22:08:46 +03:00
Bananymous
840000d02b
Kernel: Make sure null signal is not send with kill()
2024-08-01 21:41:54 +03:00
Bananymous
9ea4c777ad
Kernel: TTY now handles ESC key presses
...
This allows exiting vim :D
2024-08-01 21:41:11 +03:00
Bananymous
a33b63d066
Kernel/LibC: Implement alarm() and setitimer()
...
This makes vim able to start!
2024-08-01 21:09:56 +03:00
Bananymous
da3b30cd94
Kernel: Add macro to dump all syscalls and their return values
2024-08-01 18:21:49 +03:00
Bananymous
4599e1dec5
Kernel: Make schedler not crash when unblocking active thread
...
This was happening when sending signals to processes that were currently
running.
2024-08-01 18:21:49 +03:00
Bananymous
6de350ce9d
Kernel/LibC: Cleanup, fix and implement a lot of signal code
...
This patch implements sigsets and some of their usages
2024-08-01 17:01:18 +03:00
Bananymous
838d31fa41
Kernel: Implement more POSIX compliant open() and openat() syscalls
2024-08-01 15:35:02 +03:00
Bananymous
401b460d75
LibC: Implement setbuf() and setvbuf()
2024-08-01 01:30:00 +03:00
Bananymous
c440204fa5
LibC: Implement dummy strcoll()
2024-07-31 23:58:10 +03:00
Bananymous
adf50dffd8
LibC: Implement uname()
2024-07-31 23:54:26 +03:00
Bananymous
20d38ed28c
LibC/Shell: Implement gethostname() and shell uses it for hostname
2024-07-31 23:53:55 +03:00
Bananymous
edc30cd71d
LibC: Compile without exceptions
...
This allows libc to not require __gxx_personality_v0. I can maybe add
C++ back to libc... :D I don't know why I did not research earlier what
this symbols was used for
2024-07-31 23:33:41 +03:00
Bananymous
10ce03a1e7
LibC: Implement ctime() and asctime()
2024-07-31 23:26:10 +03:00
Bananymous
5fca5c774a
LibC: Implement umask()
2024-07-31 23:26:10 +03:00
Bananymous
fc6c39e670
LibC: Implement gettimeofday()
2024-07-31 23:26:06 +03:00
Bananymous
7c3b6307d9
Kernel: Cleanup USB initialization code
2024-07-31 23:23:44 +03:00
Bananymous
e52dac3b25
LibC: Implement tmpnam()
...
This implementation is not really spec compliant as rand() does not
guarantee TMP_MAX different outputs + seeding
2024-07-30 12:02:30 +03:00
Bananymous
62db9a8ef3
LibC: Implement C++ static guards
2024-07-30 12:02:05 +03:00
Bananymous
f0be4f86a6
LibC/Kernel: Implement access
2024-07-30 11:51:07 +03:00
Bananymous
e5bb843059
LibC/Kernel: Implement ttyname
2024-07-30 11:41:18 +03:00
Bananymous
ca774dfeb5
LibC: Implement setlocale() for C locale
2024-07-30 11:33:02 +03:00
Bananymous
681d8327f5
LibC/Kernel: Cleanup termios code
...
This is still not correct, but much better than it used to be
2024-07-30 11:10:43 +03:00
Bananymous
9bc02c81f8
Kernel: Map DMA and PCI MMIO as uncached
2024-07-30 11:10:08 +03:00
Bananymous
bb1738db8c
Kernel: Make thread unblocking O(1)
...
This is still bit broken. VirtualBox seems to freeze sometimes, but I
could not recreate this on qemu (with and without kvm) or real hardware.
2024-07-24 00:31:01 +03:00
Bananymous
9548c592a3
Kernel: Always print basic info about xHCI controller
...
Its nice to see that the controller is getting initalized
2024-07-23 09:09:08 +03:00
Bananymous
cda0276d39
Kernel: Force PCI irq line usage when not using APIC
...
afaik PIC does not support MSI
2024-07-23 09:08:00 +03:00
Bananymous
539afb329a
Kernel: All processors use LAPIC timer when running with APIC
...
This makes scheduler preemption much cleaner as bsb does not have to
send smp messages to notify other processes about timer interrupt.
Also PIT percision is now "full" 0.8 us instead of 1 ms that I was using
before.
2024-07-23 02:28:52 +03:00
Bananymous
3e0150f847
Kernel: Pressing F1 now toggles rendering of CPU loads to the terminal
...
This can be nice for seeing the performance and problems on the load
balancing algorithm.
2024-07-22 00:43:13 +03:00
Bananymous
f8261c60c0
Kernel: Rewrite the whole scheduler and re-architecture SMP handling
...
Change Semaphore -> ThreadBlocker
This was not a semaphore, I just named it one because I didn't know
what semaphore was. I have meant to change this sooner, but it was in
no way urgent :D
Implement SMP events. Processors can now be sent SMP events through
IPIs. SMP events can be sent either to a single processor or broadcasted
to every processor.
PageTable::{map_page,map_range,unmap_page,unmap_range}() now send SMP
event to invalidate TLB caches for the changed pages.
Scheduler no longer uses a global run queue. Each processor has its own
scheduler that keeps track of the load on the processor. Once every
second schedulers do load balancing. Schedulers have no access to other
processors' schedulers, they just see approximate loads. If scheduler
decides that it has too much load, it will send a thread to another
processor through a SMP event.
Schedulers are currently run using the timer interrupt on BSB. This
should be not the case, and each processor should use its LAPIC timer
for interrupts. There is no reason to broadcast SMP event to all
processors when BSB gets timer interrupt.
Old scheduler only achieved 20% idle load on qemu. That was probably a
very inefficient implementation. This new scheduler seems to average
around 1% idle load. This is much closer to what I would expect. On my
own laptop idle load seems to be only around 0.5% on each processor.
2024-07-22 00:33:50 +03:00
Bananymous
9f90eeab05
Kernel: Fix stack pointer OOB check
...
i686 does not push the stack pointer on interrupt when no CPL change
happens.
2024-07-22 00:27:08 +03:00
Bananymous
1ee37cb671
Kernel: Make sure stack is aligned on interrupts for i686 target
...
I just realized that only x86_64 aligns stack pointer when interrupt is
triggered.
2024-07-22 00:10:42 +03:00
Bananymous
8fe798de6d
Kernel: Make PIT counter atomic with spinlock
2024-07-21 18:56:41 +03:00
Bananymous
e00efca170
Userspace: Pprogram template and loadfont mark install as optional
2024-07-21 17:41:40 +03:00
Bananymous
86b6714777
Kernel: Add command line option to boot without smp
2024-07-21 17:40:57 +03:00
Bananymous
77b5e6d44a
Kernel: Make ATABus use BAN::Atomic<> instead of gcc builtin atomics
2024-07-21 17:39:26 +03:00
Bananymous
ffe73165f9
Kernel: Fix PCI typo serail -> serial
2024-07-21 17:36:29 +03:00
Bananymous
96c7e9e29d
Kernel: Cleanup VirtualRange code
...
Virtual range does not need to look into the page table for mapped
physcial pages. It can (and should) just keep track of them itself.
2024-07-21 17:35:07 +03:00
Bananymous
02051ed60f
Kernel: Move keyboard kernel panic to the general input device
...
This will allow command to work without requiring it per keyboard driver
2024-07-21 17:33:38 +03:00
Bananymous
f49689caac
Kernel: Implement API for sending IPIs for only one processor
...
Also move the spin wait to check for pending IPI sends to the start of
ipi sending function. There is no need to wait for IPI send succeeding
right after it. It is enough to make sure there are not multiple IPIs
being sent at the same time.
2024-07-21 17:30:59 +03:00
Bananymous
819c130366
BAN: If format string is started with space, numbers are padded with it
2024-07-19 21:39:31 +03:00
Bananymous
974b9b992d
Kernel: Fix process exiting infinite loop
...
If process was exiting and had a process waiting for it and that waiting
process got interrupted, the exiting process could never exit.
2024-07-18 21:40:44 +03:00
Bananymous
3ab1214012
LibC: Fix _toupper and _tolower definitions
...
They were using C++ global namespace, which of course does not exist for
C targets.
2024-07-18 01:10:51 +03:00
Bananymous
4b917390ac
Kernel: Fix sse state saving
...
This was broken when I added SMP support. This patch makes sse kind of
dumb as it is saved and restored on every interrupt, but now it at least
works properly... I'll have to look into how sse can get optimized
nicely with SMP. Simple way would be pinning each thread to a specific
processor and doing pretty much what I had before, but sse thread saved
in processor rather than static global.
2024-07-16 23:15:11 +03:00
Bananymous
7a0fb9a57f
Kernel: Fix TTY scroll clearing first and/or last characters from line
2024-07-16 22:49:49 +03:00
Bananymous
58fcd2b2fe
Kernel: Fix multi-interface USB device initialization
2024-07-16 22:29:18 +03:00
Bananymous
bdcf058e52
README: update discord link
2024-07-16 21:10:32 +03:00
Bananymous
61f0043cd8
resolver: Fix infinite debug printing loop, if client disconnects
2024-07-16 15:05:07 +03:00
Bananymous
dd7bfba8d5
ports: Compile with multiple jobs and fix curl install query
2024-07-16 15:04:46 +03:00
Bananymous
5b8fdbc82d
LibC: Don't expose math.h in stdlib.h
2024-07-16 12:47:38 +03:00
Bananymous
6a1c677cbc
Ports: Update doom port gitignore
2024-07-16 11:54:57 +03:00
Bananymous
e30952efee
Kernel: Implement key repeating for USB keyboard
...
USB keyboards don't send repeating keys automatically, so it has to be
emulated in software.
2024-07-16 11:54:57 +03:00
Bananymous
fd8dc03ae9
BAN: Default initialize optional storage
...
This removes maybe uninitialized warning when using default initialized
optionals.
2024-07-16 11:19:16 +03:00
Bananymous
1337758660
Kernel: Make USB HID interfaces configure all endpoints
2024-07-16 00:23:26 +03:00
Bananymous
339e8a7910
Kernel: Fix USB keyboard state updating with variable reports
2024-07-16 00:03:00 +03:00
Bananymous
a60b460701
Kernel: Update USB HID code to support multiple top-level collections
...
This allows me to use my laptops own keyboard!
2024-07-16 00:01:53 +03:00
Bananymous
a5cb4057f9
Kernel: Implement unified input files for device hot-plugging support
...
/dev/keyboard and /dev/mouse can be read for events from any attached
keyboard or mouse respectively. This makes device hot-plugging support
pretty much automatic for TTY, GUI, and whatever takes input.
2024-07-15 22:11:15 +03:00
Bananymous
9d7f97ccd5
Kernel: Implement DevFileSystem::remove_device
...
This function cleanly removes the devices from the whole filesystem.
USB devices are now removed from the filesystem as soon as they are
destroyed.
2024-07-15 22:10:42 +03:00
Bananymous
0578d41500
Kernel: Implement WriteCombining memory
...
This makes framebuffer much faster on real hardware
2024-07-15 22:09:09 +03:00
Bananymous
42c3fa24f0
Kernel: Add support for HID Report ID and parsing all collections
...
Only the first top-level collection is used for the device, but that
seems to generally be what keyboard and mouse use for input.
2024-07-15 15:51:07 +03:00
Bananymous
60b396fee5
Kernel: Add mouse move and scroll event merging back
...
This makes mouse work much faster when reading can't keep up with the
amount of events.
2024-07-15 15:45:20 +03:00
Bananymous
4cd9252ff6
Kernel: Fix USB code
...
Fix USB Keyboard scan code table for bottom row of keyboard
Support multiple interfaces on a single USB device
Add usb mouse to default qemu settings
2024-07-15 11:48:48 +03:00
Bananymous
75875d3a8f
Kernel: Set interval and average trb length on configure endpoint
...
Real controllers seem to require this while spec 4.8.2.4 says that they
should be left as zero.
2024-07-15 11:46:28 +03:00
Bananymous
86e9d92ecb
Kernel: Take ownership of xHCI controller from bios
2024-07-14 03:31:35 +03:00
Bananymous
baa4e6475a
Kernel: Implement basic USB Mouse
...
This has the same problem I described in previous commit for keyboard
2024-07-14 02:11:32 +03:00
Bananymous
ac5c77ee2c
Kernel: Implement USB Keyboard
...
This is kinda hacky, as I had disable the PS/2 initialization so that
usb keyboard gets /dev/keyboard0. I should add device hot plugging
support for TTY and GUI...
2024-07-14 02:09:18 +03:00
Bananymous
1efc6a1385
Kernel: Implement simple USB HID driver
...
This should be easily expandable to add HID devices
2024-07-14 02:04:48 +03:00
Bananymous
442ea8a692
BAN: Remove Optional emplace constructor
...
This was kind breaking some initializations. Emplacing is still possible
through Optional::emplace
2024-07-14 01:53:50 +03:00
Bananymous
749be67df3
Kernel: Fix cxxabi for function static variable guards
2024-07-14 01:53:50 +03:00
Bananymous
a97a574718
Kernel: Rewrite the whole input system
...
PS/2 code is now kind of messed up, but it works. Keyboards and mice are
now an abstract class that is automatically exposed to userspace. This
will make adding USB input much nicer.
2024-07-14 01:53:50 +03:00
Bananymous
110a45bee6
BAN: Implement Variant::has_value() and Variant::operator bool()
2024-07-12 20:37:56 +03:00
Bananymous
f120da3aca
Kernel: USB device now sets the current configuration
2024-07-12 11:26:06 +03:00
Bananymous
240684bc1f
Kernel: Refactor some xHCI code and add new definitions
2024-07-12 11:25:24 +03:00
Bananymous
62003d96f3
BAN: Implement Optional::value_or
...
This will return value specified in the argument if optional is not
storing any value.
2024-07-12 11:22:10 +03:00
Bananymous
e905634343
Kernel: Fix bugs and cleanup USB and xHCI code and API
2024-07-11 14:10:55 +03:00
Bananymous
14dce1abac
Kernel: Start work on USB stack
...
Current code can enumerate all xHCI devices and detect their type based
on the class code on device or interface descriptors.
2024-07-10 12:06:00 +03:00
Bananymous
8ddab05ed3
BuildSystem: Cleanup userspace directory layout
...
userspace programs are now in userspace/programs
userspace tests are now in userspace/tests
This makes listing userspace projects much cleaner. Libraries were
already separated to their own directory, so other programs should also.
2024-07-03 09:18:02 +03:00
Bananymous
5dc441c4af
Kernel/userspace: Implement KD_LOADFONT and loadfont program
2024-07-03 09:02:49 +03:00
Bananymous
940fb0d1fd
Base: Add /var/www with dummy index.html
2024-07-02 21:34:32 +03:00
Bananymous
f18c33563d
Kernel: Fix PCI MSI-X allocation
2024-06-30 20:36:43 +03:00
Bananymous
10e8a54b2e
General: Add more missing features to README
2024-06-29 22:13:33 +03:00
Bananymous
f792976d6d
BuildSystem: Don't fill mount dir if mounting fails
2024-06-29 22:12:36 +03:00
Bananymous
08cbd009ac
Kernel: PCI don't report multi function bit with header_type()
2024-06-29 22:11:55 +03:00
Bananymous
3d4219bfee
Kernel: Don't panic if nvme initialization fails
2024-06-29 22:07:55 +03:00
Bananymous
d58a569660
WindowServer: Limit msync to 60 Hz and only sync necessary pages
...
This speeds up GUI a lot. I can now run GUI on real hardware at almost
60 Hz.
2024-06-29 19:00:58 +03:00
Bananymous
fd3cf5d2b1
BuildSystem: Allow running qemu without kvm
...
If you set QEMU_ACCEL to empty string, build system won't try to look
for kvm support.
2024-06-29 19:00:10 +03:00
Bananymous
1a844426c3
Kernel: Add fast path for framembuffer sync if bpp == 32
2024-06-28 23:34:11 +03:00
Bananymous
42237a3bc8
Kernel: Implement fast scrolling for TTY
2024-06-28 23:15:03 +03:00
Bananymous
010c2c934b
BAN: Write RefPtr and WeakPtr to be thread safe
2024-06-28 22:00:29 +03:00
Bananymous
48a76426e7
BAN: Add more APIs for Atomic and make compare_exchage take a reference
2024-06-28 21:47:47 +03:00
Bananymous
0c645ba867
LibGUI: Window now uses double buffering
...
This allows data in shared memory object be always up to date. With this
change window server can update lazily, and not necessarily on all
invalidate calls
2024-06-27 00:39:59 +03:00
Bananymous
f538dd5276
test-tcp: Fix printing of "connection reset" when tcp connection closed
2024-06-27 00:39:22 +03:00
Bananymous
31568fc5a1
Kernel: Rewrite Sockets to not be TmpInodes
...
TmpInodes just caused issues because TmpFS kept them alive. There was
really no reason for sockets to even be stored inside a TmpFS...
2024-06-27 00:35:19 +03:00
Bananymous
44c7fde2f7
BAN: Fix Function requires clause argument forwariding
2024-06-27 00:33:50 +03:00
Bananymous
cb07142832
Kernel: ACPI allow more calling or \_S5
...
Spec says that \_Sx must have 4 fields, but virtual box seems to only
have the two defined once. This patch allows shutodown on virtual box
2024-06-25 23:25:10 +03:00
Bananymous
60a05412c9
Kernel: ACPI implement SizeOf
2024-06-25 23:24:51 +03:00
Bananymous
0179f5ea09
Kernel: ACPI add \_OS string
2024-06-25 23:24:19 +03:00
Bananymous
f671ed7e3f
Kernel: ACPI implement integer stores to registers as copies
...
Before storing const integer and then modifying the register it would
error.
2024-06-25 23:23:52 +03:00
Bananymous
2fccff5a35
Kernel: Implement ACPI IndexOp into Strings
2024-06-25 23:23:00 +03:00
Bananymous
cd41d5f6dd
ports: DOOM install now downloads and installs doom1.wad
2024-06-25 19:57:15 +03:00
Bananymous
66905fcc08
http-server: Make http-server actually usable
...
http-server now implements basic static content from a specified
directory.
2024-06-25 19:36:10 +03:00
Bananymous
af4b138094
Kernel/LibC: Implement realpath
...
realpath is implemented as a syscall. This is not really required but it
was the easiest way to get it working as there is already path
canonicalization at kernel level.
2024-06-25 19:32:40 +03:00
Bananymous
3c57e05a65
BAN: Implement hash for StringView
2024-06-25 19:28:45 +03:00
Bananymous
25099b4c98
Kernel: Don't validate O_SEARCH for non-directories
2024-06-25 19:27:55 +03:00
Bananymous
1ac7629459
BAN: Implement StringView::rfind()
2024-06-25 11:04:03 +03:00
Bananymous
95681a7a05
LibImage: Cleanup bicubic calculations
2024-06-25 11:04:03 +03:00
Bananymous
d7b8458a56
Kernel: Fix TCP sending
...
TCP send was effectively always waiting for connection to close and then
return a value of 0.
2024-06-25 11:04:03 +03:00
Bananymous
67dfe0bcf3
BAN: Allow String::formatted to fail
2024-06-25 11:04:03 +03:00
Bananymous
b1869bced4
BAN: Implement StringView::starts_with()
2024-06-25 11:04:03 +03:00
Bananymous
61aa1ea11f
sudo: Fix installation permissions
...
I had accudentally removed SETUID bit from sudo. This required to
elevate the permissions.
2024-06-24 15:00:08 +03:00
Bananymous
20aa7c79d1
BuildSystem: Fix crt file installation
...
crt files should be installed always before userpace programs are
linked.
2024-06-22 17:30:00 +03:00
Bananymous
22548a3f4a
BuildSystem: Fix crt file installation
...
crt files for userspace are now a dependency of libc, which means that
everytime libc gets installed, crt files will also install.
This fixes the problem when building libc
2024-06-21 17:10:58 +03:00
Bananymous
9e1b5cbaab
BuildSystem: Cleanup CMake code to allow libc only installation
...
There was no way to just install libc which is required for stdlibc++
2024-06-21 01:45:14 +03:00
Bananymous
1488ec5a03
Userspace: Implement the most basic http server
...
This server just responds with static http "hello world" to every
incoming request
2024-06-20 13:29:01 +03:00
Bananymous
4f0457a268
Kernel: Rewrite a lot of TCP code and implement TCP server sockets
...
TCP stack is now implemented much closer to spec
2024-06-20 13:26:50 +03:00
Bananymous
30fdc2198f
BAN: Add exchage() to Atomic<T>
2024-06-20 13:24:42 +03:00
Bananymous
bce16cdd6e
Kernel: Fix how socket closing works
...
Sockets are now closed only when they are not referenced any more. This
allows child process to close socket and still keep it open for the
parent.
2024-06-19 10:39:44 +03:00
Bananymous
d5daa46ab8
General: Add default .vscode directory
...
The .vscode contains 2 C++ profiles that use my custom toolchain and
correct library include paths. One configuration is for kernel and other
for userspace
2024-06-19 10:16:20 +03:00
Bananymous
ad6d95ba52
BuildSystem: Rework the whole cmake build system
...
Now files are installed using the install() command instead of manually
copying files to their destinations. This allows automatic recompilation
of headers that did not work previously
2024-06-19 09:40:03 +03:00
Bananymous
318ce5dec8
All: Fix a lot of compiler warnings from header files
...
While reworking build system, header files started to report warnings.
2024-06-18 23:02:10 +03:00
Bananymous
526d4369ce
Ports: Don't throw error if _installed_ does not exist
...
This was annoying and I got multiple people reporting it as a possible
bug.
2024-06-18 13:16:33 +03:00
Bananymous
c69919738b
BuildSystem: Move all userpace libraries under the userspace directory
...
As the number of libraries is increasing, root directory starts to
expand. This adds better organization for libraries
2024-06-18 13:14:35 +03:00
Bananymous
1b5a01a6c9
LibImage: Add support for PNG images
...
I have not tested images with less than 8 bits per color or images with
indexed color as gimp could not export those. There is currently no
support for interlaced images.
2024-06-18 02:37:46 +03:00
Bananymous
f233715b70
BAN: Add d{print,want,error}ln_if macros for userspace
2024-06-18 02:35:45 +03:00
Bananymous
a58ac18fa0
BAN: Add move constructors to ByteSpan
2024-06-18 01:52:02 +03:00
Bananymous
f1e366d36f
Kernel: Free keyboard mutex while waiting for data to read
...
This was making select hang if one thread was trying to read from
keyboard.
2024-06-17 23:04:37 +03:00
Bananymous
301dcd78cc
LibImage: Compile with -O3
...
This makes image resizing with cubic interpolation around 10x faster
2024-06-17 23:03:52 +03:00
Bananymous
65c6d62a15
LibImage: Start work on PNG decoding
...
This patch adds PNG decoder that currently only inflates the PNG's zlib
deflate stream
2024-06-17 22:58:59 +03:00
Bananymous
aaf7a249c6
image: Add nicer error message if image could not be parsed
2024-06-17 22:58:59 +03:00
Bananymous
0bc8d49684
LibImage: Add image format probing
...
Instead of determining the image type in Image.cpp call image probing
functions for each supported image type
2024-06-17 22:14:43 +03:00
Bananymous
17ecbca204
BAN: Add network_endian_to_host
2024-06-17 22:14:43 +03:00
Bananymous
78928b7eb4
Ports: Add curl port!
2024-06-17 21:40:13 +03:00
Bananymous
5236e1ef0d
LibC: Add dummy functions for rename() and strftime()
...
I don't really want to implement them right now, but they are required
to exist for some ports.
2024-06-17 21:02:37 +03:00
Bananymous
be7ed8e74a
Kernel/LibC: Implement {get,set}sockopt()
...
These are pretty much dummy functions in the kernel side. Only case that
is handled is SOL_SOCKET with SO_ERROR. This is hard coded to return no
error. Network stack is currently synchronous, so all errors are already
reported through synchronous network functions.
2024-06-17 20:56:48 +03:00
Bananymous
78bcb85679
LibC: Implement gethostbyname()
...
This is not a POSIX function, but curl seems to depend on it. It is
even deprecated on linux...
2024-06-17 20:55:50 +03:00
Bananymous
b98bb9eb27
LibC: Add HOST_NAME_MAX definition
2024-06-17 20:55:17 +03:00
Bananymous
cad55a4da5
Kernel/LibC: Implement getsockname for ipv4 sockets
2024-06-17 20:54:45 +03:00
Bananymous
511fc870a1
BAN: Mark RefPtr and WeakPtr operator bool() as explicit
2024-06-17 20:19:36 +03:00
Bananymous
dafd2fecf7
LibC: Implement gmtime() and localtime()
...
localtime() just returns gmtime() as there is no timezone support
2024-06-17 16:51:41 +03:00
Bananymous
9c5cca784e
LibC: Implement bsearch()
2024-06-17 16:51:24 +03:00
Bananymous
1138165308
LibC: Define PF_* macros on sys/socket.h
2024-06-17 16:50:03 +03:00
Bananymous
d7eb321d58
LibC: Make assert() macro a void expression
2024-06-17 16:49:26 +03:00
Bananymous
15f8c7014f
BAN: Add line endings to d{warn,error}ln
2024-06-17 16:48:56 +03:00
Bananymous
dd64e2060e
WindowServer: Add support for background images
...
WindowServer now looks in _$HOME/.config/WindowServer.conf_ for a
configuration file that can specify a background image.
Also add default background image /usr/share/images/sample.ppm to the
base sysroot provided in the git repo.
2024-06-16 00:28:09 +03:00
Bananymous
14d4551476
LibImage: Add rgba getter for Image::Color
...
Actually the format is 0xAARRGGBB which is what my framebuffer uses.
2024-06-16 00:23:02 +03:00
Bananymous
e6549b0fe8
LibImage: Implement (bi)cubic interpolation
...
This is kind of slow but yields much nicer results compared to
(bi)linear interpolation. I should probably add gamma correction...
2024-06-15 23:05:10 +03:00
Bananymous
157e05f57c
image: Implement --scale argument to scale image to framebuffer
...
Also fix bug where red and blue channels were flipped
2024-06-15 17:24:01 +03:00
Bananymous
96efd1e8b9
LibImage: Implement image resize using nearest or bilinear filters
2024-06-15 17:23:24 +03:00
Bananymous
672ce40618
LibImage: Move userspace image parsing to its own library
...
The image utility now uses this tool instead of parsing images on its
own.
2024-06-14 11:05:54 +03:00
Bananymous
05e9d76c77
BAN: Implement will_{addition,multiplication}_overflow
2024-06-14 11:04:29 +03:00
Bananymous
ea7fc7f6c4
Kernel: Implement read-only FAT12/16/32 driver with long name support
...
You can now mount FAT filesystems! This code might not work perfectly
but my quick testing seemed to work on all (FAT12/16/32) variants.
2024-06-14 01:04:12 +03:00
Bananymous
6b1d5d28be
Kernel: VFS root now has to be block device instead of partition
2024-06-14 00:19:12 +03:00
Bananymous
a9b0bfa740
LibC: Make ino_t always 64 bit
2024-06-14 00:18:21 +03:00
Bananymous
cc6b80a55b
BAN: Optimize Vector copy assignment to reduce allocations
...
If vector contains enough elements, it will now replace old elements
instead of clearing and reallocating
2024-06-14 00:17:28 +03:00
Bananymous
6707989cd5
BAN: Implement same_as and add requires for BAN::Function with lambda
...
BAN::Function(lambda) now requires that the object is callable and
returns the correct type. This allows overloads with different
callback formats.
2024-06-14 00:15:48 +03:00
Bananymous
766439db6d
Kernel: Start work on adding support for new filesystems
...
Old code tried to create ext2 filesystem from all devices.
2024-06-11 10:50:26 +03:00
Bananymous
d4903caafa
Kernel: Combine consecutive mouse move and scroll events
...
This makes mouse work much smoother when running without kvm.
2024-06-11 00:07:31 +03:00
Bananymous
caa0111c79
BAN: Implement back() for CircularQueue
2024-06-11 00:05:11 +03:00
Bananymous
ffacff67cf
LibFont: Move PSF code to separate file
2024-06-10 16:10:05 +03:00
Bananymous
f43a7fdfb4
Ports/doom: Doom now runs inside a window
2024-06-10 16:10:05 +03:00
Bananymous
7bb1a3906d
BuildSystem: Run kvm-ok to determine kvm access
2024-06-10 16:10:05 +03:00
Bananymous
530c259e71
Kernel: Close unix domain socket when it gets destoyed
...
Inode closing is something that needs a complete rework. Currently all
sockets are closed when close() is called, which leads to connection
closing if you fork()/exec() with socket being marked as CLOEXEC.
Inodes should probably only be closed once they are not referenced
anywhere.
2024-06-03 18:06:01 +03:00
Bananymous
843a6851c4
Userspace: Start work on a terminal emulator
...
Terminal is still missing some ANSI codes, cursor and pseudo terminal
support.
Shell's builtin start-gui now launches a Terminal instead of test
windows.
2024-06-03 18:04:33 +03:00
Bananymous
234051d6bc
Shell: Optimize drawing characters at the end of a command
2024-06-03 18:03:19 +03:00
Bananymous
981c0eb8bc
Shell: Only set terminal properties if STDIN is a TTY
2024-06-03 18:02:49 +03:00
Bananymous
1066855532
LibGUI: Mark Window's server fd as CLOEXEC and expose it through API
2024-06-03 18:01:34 +03:00
Bananymous
f2d6518311
LibGUI: Add new drawing APIs to LibGUI::Window
2024-06-03 18:00:50 +03:00
Bananymous
765ccfa18c
Kernel: Deliver SIGCHLD on process exit and ignore it properly
2024-06-03 17:58:24 +03:00
Bananymous
201aee3119
LibInput: Implement key_to_utf8_ansi
...
This function outputs utf8 encoding of a key event or ansi code for
everything it is applicable (arrows, ctrl+..., ...)
2024-06-03 17:52:43 +03:00
Bananymous
65f299038d
BAN: Implement traits {true,false}_type with integral_constant
2024-06-03 17:51:44 +03:00
Bananymous
bd1290706a
Kernel: Implement SharedMemoryObject cloning
2024-06-03 03:41:00 +03:00
Bananymous
939cbf46e4
BAN: Implement BAN::UTF8::to_codepoint() for single byte types
2024-06-03 03:39:57 +03:00
Bananymous
aec5a09caf
Kernel/LibC: Implement SYS_ISATTY and isatty()
2024-06-03 03:36:25 +03:00
Bananymous
6346d1b6c7
Shell: Add builtin command for starting window server and test windows
2024-06-02 17:27:40 +03:00
Bananymous
05ee242b80
WindowServer: Add window title to title bar and send close events
2024-06-02 17:27:09 +03:00
Bananymous
64be3f05a3
LibGUI: Add 10 second timeout for connecting to WindowServer
2024-06-02 17:25:17 +03:00
Bananymous
cfdce9be61
BAN: Mark RefPtr and WeakPtr helper destructors virtual
...
Also fix a bug in WeakPtr::lock() which would assert false if the
underlying weak link was not initialized
2024-06-02 16:50:26 +03:00
Bananymous
446220494e
Kernel: Unix domain sockets close can now be detected
...
When a unix domain socket is closed and it has a connection to another
socket, it will make the other socket readable and recv will return 0.
This allows detection of socket closing
2024-06-02 16:48:55 +03:00
Bananymous
f12ffa92a0
LibFont: Font::get_glyph() now returns nullptr if glyph does not exist
...
This allows getting glyphs with a single hash lookup
2024-05-31 13:05:07 +03:00
Bananymous
b2a4797d16
BAN: Fix dwarnln and derrorln stop color
2024-05-31 13:04:36 +03:00
Bananymous
8bfacb0091
Kernel: Implement deletion of SMO objects
2024-05-31 13:04:23 +03:00
Bananymous
0501f3bd99
Kernel: Move font code to its own library LibFont
2024-05-31 10:47:05 +03:00
Bananymous
ae3ae6fd0e
WindowServer: Fix partial invalidation over cursor
2024-05-31 03:20:21 +03:00
Bananymous
011a5f57e1
WindowServer: Add title bars and clean up code
2024-05-31 03:02:58 +03:00
Bananymous
84b3289a2a
Kernel: Move Scheduler::yield() lock check after interrupts disabled
...
I have no idea why this solves a bug where current processor has
scheduler lock at the beginning of yield.
2024-05-31 02:56:39 +03:00
Bananymous
b760892de2
Kernel: Make pselect use nanosecods instead of milliseconds
2024-05-31 02:56:17 +03:00
Bananymous
6840a8983c
Kernel: Make sure MSB is not set on SMO keys
2024-05-29 20:01:12 +03:00
Bananymous
a1b3490764
Kernel: Improve random number generation for unsigned types
2024-05-29 20:00:47 +03:00
Bananymous
076f1efecb
Kernel: Fix 32 bit fast page locking
...
I forgot to change this when changing the lock type. 32 bit boots again
fine :D
2024-05-29 19:44:39 +03:00
Bananymous
b23511edb1
LibC: Don't use BAN inside pwd.cpp
...
This made pwd.cpp require libstdc++ which meant that getlogin() also
needed libstdc++. This made build process of libstdc++ require itself
which is of course not possible.
2024-05-29 19:12:15 +03:00
Bananymous
53e572f072
Kernel: Fix s_fast_page_lock type on 32 bit target
2024-05-29 18:04:23 +03:00
Bananymous
c2b6ba0d5a
Userspace: Start work on GUI and WindowServer
...
Current implementation can create custom windows and each window has
its own framebuffer. When window wants to write its framebuffer to the
screen it will send a message to the WindowServer using unix sockets.
2024-05-29 16:00:54 +03:00
Bananymous
d4d530e6c8
Kernel: Implement basic shared memory objects
...
These can allocate memory that can be shared between processes using
a global key. There is currenly no safety checks meaning anyone can
map any shared memory object just by trying to map every possible key.
2024-05-29 15:58:46 +03:00
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
Bananymous
687fa44eff
Kernel: Add support for ACPI general purpose events
2024-04-17 21:51:03 +03:00
Bananymous
aefb33efff
Kernel: Implement dummy AML NotifyOp
2024-04-17 15:40:11 +03:00
Bananymous
da0c45b7ee
Kernel: Cleanup AML debug dump output
2024-04-17 15:35:42 +03:00
Bananymous
956335e844
Kernel: Implement AML WhileOp
2024-04-17 15:00:14 +03:00
Bananymous
701fc600cd
Kernel: Implement evaluate and store for BankFieldElement
2024-04-17 14:59:51 +03:00
Bananymous
e38b2cff4f
Kernel: Implement proper synchronization for AML opregions
2024-04-17 14:59:26 +03:00
Bananymous
b268293402
Kernel: Fix Buffer evaluate and store for sizes >= byte
...
All reads and writes were to the first byte. This patch adds the
correct offset for reading and writing.
2024-04-17 14:57:13 +03:00
Bananymous
45b9dc8be9
Kernel: Make ACPI \\_OSI return true for Linux
2024-04-17 02:19:35 +03:00
Bananymous
0ad7025a17
Kernel: Actually map FACS (and global lock)
2024-04-17 02:14:56 +03:00
Bananymous
49b7467840
Kernel: Simplify AML method invocation API
2024-04-17 01:20:58 +03:00
Bananymous
a40ef610a2
Kernel: Allow demand paging only for userspace threads
2024-04-17 01:16:43 +03:00
Bananymous
f9943b60e4
Kernel: Fix mutex try_lock return value
...
WHY IS GCC NOT COMPLAINING FROM HEADERS... I used almost 2 hours
trying to locate why AML was broken
2024-04-17 01:16:43 +03:00
Bananymous
f97fb1b35d
Kernel: Evaluate _REG on devices for embedded controller if needed
2024-04-17 01:16:43 +03:00
Bananymous
b959181afd
Kernel: Remove ACPI namespace from itself
...
This removes unnecessary cyclic reference
2024-04-17 00:52:05 +03:00
Bananymous
cbc27a94ac
Kernel: AML cleanup IfElse code
2024-04-17 00:49:07 +03:00
Bananymous
6a4f999b88
Kernel: Cleanup AML code and add evaluate for string
2024-04-16 17:39:16 +03:00
Bananymous
7707e01352
Kernel: AML add flag to force absolute lookup for ACPI namespace
2024-04-16 17:38:23 +03:00
Bananymous
e667326df5
Kernel: Fix AML if parsing
...
Parse else case unconditionally, even if _if_ case evaluates to true
2024-04-16 17:36:04 +03:00
Bananymous
f1b2d7530d
Kernel: Rework AML namespace and object hierarchy
...
Remove tree-like structure from AML. This allows more spec compliant
parsing of named objects inside not yet declared devices.
This also allows AML to be run thread safely. All object adds/removes
are now guarded by a mutex.
2024-04-16 16:47:45 +03:00
Bananymous
b6587b32b9
Kernel: ACPI ignore events from non-existent ports
2024-04-16 00:00:07 +03:00
Bananymous
b89bafa165
Kernel: Add support for power button shutdown
...
This patch implements basic support for power button using ACPI
fixed events. I still need to implement general purpose events
and embedded controller for full power button support.
2024-04-15 23:55:25 +03:00
Bananymous
9fac5f94ba
Kernel: Fix entering ACPI mode
...
My condition to check wheter to enter ACPI mode was incorrect.
I only entered ACPI mode if I already was in ACPI mode :DD
2024-04-15 15:05:48 +03:00
Bananymous
5affc73ee6
Kernel: Parse ACPI namespace only after TTY is initialized
...
This allows better debugging when there is no serial port available.
2024-04-12 16:47:17 +03:00
Bananymous
027016ddae
Kernel: Load all SSDTs and PSDTs
...
Spec says to load all tables with unique OEM table IDs but that seem
wrong.
2024-04-12 16:45:00 +03:00
Bananymous
8f2f98b7b4
Kernel: AML implement SleepOp
2024-04-12 16:17:14 +03:00
Bananymous
6b43d12469
Kernel: AML package doesn't mark ZeroOp as NullName reference
2024-04-12 16:10:16 +03:00
Bananymous
74940ed33c
Kernel: Cleanup AML code and fix bugs
...
I can enter ACPI mode on my own laptop!
2024-04-12 16:03:14 +03:00
Bananymous
17871bb3ca
Kernel: Fix ACPI namespace initialization
...
ACPI spec says that only SSDTS with unique OEM table IDs are to be
loaded.
Add loading of ACPI 1.0 PSDTs
2024-04-12 12:41:30 +03:00
Bananymous
89c4abc07a
Kernel: Cleanup AML device initialization
...
_STA and _INI are now properly called on call devices
2024-04-12 02:00:30 +03:00
Bananymous
46b5a7697c
Kernel: Implement dummy \_OSI method for AML
...
This always returns Zero (not supported)
2024-04-12 01:49:54 +03:00
Bananymous
dd8060d64f
Kernel: Add FieldElement access attribute for AML interpreter
2024-04-12 01:49:15 +03:00
Bananymous
afb1d7ef0c
Kernel: Implement more features for AML parser/interpreter
...
Added
- BankField
- BufferField
- PowerResource
- ThermalZone
- Reference
- Package element forward declare
2024-04-12 01:47:40 +03:00
Bananymous
93ddee5956
Kernel: Implement locking for AML
...
Now global lock uses the actual global lock. Currenly if no lock
can be acquired, we just panic the kernel so that I remember to
implement it properly once AML is running concurrently.
2024-04-11 01:48:46 +03:00
Bananymous
0184e5beb5
Kernel: AML tries to initialize processors when entering ACPI mode
...
I had forgotten that Processors used to be a different definition
in AML.
I also implemented reads/writes for FieldElement/IndexFieldElement
that fit in 64 bits. Reads and writes to buffer are still a TODO.
2024-04-11 01:48:46 +03:00
Bananymous
3f2e110eab
Kernel: Entering ACPI mode now actually enables ACPI
...
I used to only initialize devices, but now I send ACPI_ENABLE if
machine is not hardware reduced.
2024-04-11 00:17:03 +03:00
Bananymous
0ff68b7d66
Kernel: Make ACPI load all SSDT headers after DSDT is loaded
2024-04-10 15:03:54 +03:00
Bananymous
cdbdc1a822
Kernel: Remove lai as a dependecy
...
I don't think lai is needed anymore, since my own AML interpreter
can do ACPI poweroff which was all that lai was used for.
2024-04-10 04:39:48 +03:00
Bananymous
7a2be05c69
Kernel: Implement poweroff with my AML interpreter
...
This can succesfully poweroff qemu!
2024-04-10 04:32:35 +03:00
Bananymous
5be38d0702
Kernel: My AML parser can now enable ACPI mode on QEMU!
2024-04-10 03:05:27 +03:00
Bananymous
ff203d8d34
Kernel: Implement more AML method invocation stuff
...
Method invocation is starting to come together. This implemenetation
can interpret some of the qemu's functions to enter ACPI mode.
PCI config space access is currently the one thing is between
entering ACPI mode.
2024-04-10 01:52:14 +03:00
Bananymous
23fa39121c
Kernel: Start working on AML method evaluations
...
Also fix namespace lookup and scope creations.
2024-04-09 18:37:51 +03:00
Bananymous
b16e65168f
Kernel: Rewrite whole AML parser
...
Now AML parsing is actually done while respecting namespaces and
scopes. I implemented the minimal functionality to parse qemu's AML.
Next step is to implement AML interpreting and then we can drop lai
as a dependency.
2024-04-09 01:16:07 +03:00
Bananymous
090a294017
BAN: Add {little,big}_endian_to_host
...
These just call host_to_{little,big}_endian but are more verbose
and cleaner.
2024-04-09 01:13:28 +03:00
Bananymous
22bc4b4271
Kernel: Fix AML package parsing
2024-04-07 20:32:22 +03:00
Bananymous
e01c049401
Kernel: Fix AML buffer parsing
2024-04-07 20:24:05 +03:00
Bananymous
e7ef7a9e55
Kernel: Implement barebones AML parser
...
This implements only parsing for AML in qemu. InvokeMethods are not
parsed since number of arguments to Methods is not yet known.
Parsing AML uses multiple kilobytes of stack space, so I increased
boot stack size by a lot :D
I am not sure where my own AML is going, but this is good start if
I decide to implement full ACPI on my own.
This code is very much just ugly macro expansion.
Qemu has 2 DefPackage elements that I am not able to parse. Package
data ends while there should be still multiple elements.
2024-04-07 17:03:30 +03:00
Bananymous
e0011d22f2
Kernel: Move ACPI to its own directory and namespace
2024-04-04 15:00:13 +03:00
Bananymous
7d34bd8f82
Ports: Doom don't call exit() on I_Quit()
...
This seems to close the app prematurely :D
2024-04-04 00:40:51 +03:00
Bananymous
bd69cf599b
Ports: Add doom port
...
This patch contains simple infrastructure for porting software for
banan-os. I added a doom as the first port. Doom needs a wad file
that you have to aquire yourself. I am not sure if I am allowed to
redistribute doom1.wad (shareware) version so I decided not to.
2024-04-03 19:20:15 +03:00
Bananymous
1ac7de9ee5
General: Update README feature list
...
Features listed in README were kind of old. Banan-os now supports much more. Update lists to match current progress.
2024-04-03 16:31:09 +03:00
Bananymous
397043a9c0
General: Rename LICENCE -> LICENSE
2024-04-03 15:59:30 +03:00
Bananymous
43ff03e33b
Update README badges
...
Add more badges now that I have github mirror and badges from shields.io and tokei.rs work!
2024-04-03 15:57:09 +03:00
Bananymous
fa900df5a7
Kernel: Add signals for threads after IRQs
...
This allows signals to be called even if the process does no syscalls
The old scheduler did signal handling but I feel like it should be
enough to handle them only after syscalls and IRQs. ISRs already
handle signals that caused the ISR and there is no other route to
kernel space.
2024-04-03 15:07:18 +03:00
Bananymous
414f0f6cd9
Userspace: Don't link with libc
...
This fixes bug where sometimes cmake does not find libc from sysroot
LibC is linked per program in its own CMakeLists.txt
2024-04-03 14:46:18 +03:00
Bananymous
7ef751ba95
Kernel: Fix multiprocessor for i686
...
i686 is now actually ran with multiple processors.
2024-04-03 14:42:17 +03:00
Bananymous
f8c01418b1
Kernel: Fix multiprocessing on x86_64
...
I did not even start APs after initializing them... :D
2024-04-03 14:21:55 +03:00
Bananymous
731330c6b5
Merge pull request 'Add back x86_32 support' ( #5 ) from x86_32 into main
...
Reviewed-on: Bananymous/banan-os#5
2024-04-03 02:36:28 +03:00
Bananymous
d2df55b1ac
Kernel: Allow booting with multiple processors on i686
...
Also remove unnecessary ds clearing in x86_64.
2024-04-03 02:30:38 +03:00
Bananymous
0dd74e3c9d
Kernel: Implement syscalls for i686 and cleanup x86_64
...
This actually allows i686 to boot properly!
2024-04-03 02:23:23 +03:00
Bananymous
9e073e9fa0
Kernel: Add offset for interrupt stack in Scheduler::yield()
...
This allows accessing (garbage) sp and ss in interrupt stack.
2024-04-03 00:45:22 +03:00
Bananymous
c95a271821
Kernel: Set ss in i686 tss
2024-04-03 00:43:38 +03:00
Bananymous
fe386fa819
Kernel: Implement thread start trampoline for userspace
...
This is needed on i686 to set segment registers.
2024-04-03 00:42:39 +03:00
Bananymous
4d70322eab
Kernel: Save segment registers on all interrupts on i686
2024-04-03 00:41:13 +03:00
Bananymous
d9b8391968
Kernel: Fix i686 page table global mappings
2024-04-03 00:40:16 +03:00
Bananymous
6ac3681604
Bootloader: Implement loading for 32 bit ELF files.
2024-04-02 15:30:35 +03:00
Bananymous
b35cad0c2e
Bootloader allow installation when BANAN_ARCH=i686
2024-04-02 12:48:35 +03:00
Bananymous
2106a9e373
Kernel: Rework scheduler/processor stacks.
2024-04-02 12:34:42 +03:00
Bananymous
5050047cef
Kernel: Rewrite whole scheduler
...
Current context saving was very hacky and dependant on compiler
behaviour that was not consistent. Now we always use iret for
context saving. This makes everything more clean.
2024-03-29 18:02:12 +02:00
Bananymous
1b65f850ee
Kernel: Rename thread stacks to more appropriate names
2024-03-27 15:06:24 +02:00
Bananymous
7c2933aae1
Kernel: Fix ISR error code formatting to 32 bit
2024-03-26 21:01:18 +02:00
Bananymous
96babec22a
Kernel: Implement Thread trampolines for x86_32
2024-03-26 21:01:18 +02:00
Bananymous
c12d1e9bd9
Kernel: Implement PageTable for x86_32
...
This is mostly copied from x86_64 with necessary modifications
2024-03-26 20:16:20 +02:00
Bananymous
4d1f0e77f2
Kernel: Fix physical address size for x86_32
...
Having 32 bit address space does not mean physical address space
is also only 32 bits...
2024-03-26 20:16:20 +02:00
Bananymous
d7bf34ecd0
Kernel: Write isr handler for x86_32 and cleanup x86_64
2024-03-26 20:16:20 +02:00
Bananymous
1943c3e7a1
Kernel: Unify IDT and GDT code between x86_64 and x86_32
...
The code is pretty much the same, so there are just couple macros
differiating initialization.
2024-03-26 16:42:02 +02:00
Bananymous
af050cc729
Kernel: Fix boot code for x86_32
...
Boot assembly now initializes processor and jumps to kernel
2024-03-26 13:25:22 +02:00
Bananymous
84ef2161a1
BuildSystem: Allow running qemu with i686 target
2024-03-26 03:18:54 +02:00
Bananymous
ca23360d07
Bootloader: Fix GDRT pointer size to 32 bits
2024-03-26 03:04:57 +02:00
Bananymous
5dbe51a52e
Userspace: Update printf formats to compile on 32 bit
2024-03-26 03:03:33 +02:00
Bananymous
99e30a4d7d
Kernel: Replace i386 with i686
...
I don't really want to be working with i386 since it doesn't support
compare exchange instruction
2024-03-26 02:48:26 +02:00
Bananymous
93975fdc45
Kernel: Process signal mask is now 2 32 bit values
...
This allows signal mask to be atomic on 32 bit target
2024-03-26 02:46:51 +02:00
Bananymous
fbef90f7cb
Kernel/LibC: Write cxx abi with proper locking
2024-03-26 02:28:10 +02:00
Bananymous
a9db4dd9a3
Kernel: NVMe Queue max simultaneous commands is dependent on arch
...
This allows mask to be atomic on 32 bit architectures
2024-03-26 01:45:43 +02:00
Bananymous
fc7e96fa66
Kernel: Rewrite i386 boot code + linker script
2024-03-26 00:10:42 +02:00
Bananymous
097d9a6479
Kernel: Implement dummy IDT and GDT for i386
2024-03-26 00:10:42 +02:00
Bananymous
2dd0bfdece
Kernel: Make i386 thread tramplines crash
2024-03-26 00:10:42 +02:00
Bananymous
26585bb1d9
Kernel: Implement signal trampoline for i386
2024-03-22 15:41:15 +02:00
Bananymous
0d92719433
Kernel: Remove old i386 spinlock code
2024-03-22 15:41:15 +02:00
Bananymous
1ab2722850
Kernel: Add PageTable stub to progress linking
2024-03-22 15:41:15 +02:00
Bananymous
fe17958b9f
Kernel: Rename rsp->sp and rip->ip
...
This makes more sense if we support i386
2024-03-22 15:41:15 +02:00
Bananymous
3e4d410646
Kernel: Fix AHCI device physical address writing on i386 target
2024-03-22 15:41:15 +02:00
Bananymous
b5aae34d86
Kernel: Specify template paramenters where they cannot be deduced
2024-03-22 15:41:15 +02:00
Bananymous
7f029b2713
Kernel: Allow Processor compilation for i386 targets
...
This is achieved by rewriting some inline assembly and changing
ProcessorID to be 32 bit value. For some reason if processor id
is 8 bits gcc runs out of 8 bit registers on i386.
2024-03-22 15:41:15 +02:00
Bananymous
0424082e7b
Kernel: Only compile lai for x86_64 targets
...
I will be dropping lai entirely soon. Once I get to writing AML
interpreter.
2024-03-22 15:41:15 +02:00
Bananymous
2352c86048
Kernel: i386 has 14 indirect blocks in TmpInode instead of 2
...
This allows keeping size of TmpInodeInfo as 128
2024-03-22 14:01:27 +02:00
Bananymous
c0dff5e203
Kernel: Scheduler/Thread add inline assembly for i386
2024-03-22 14:01:27 +02:00
Bananymous
d920785256
Kernel: RDRAND on i386 is called twice with 32 bit register
2024-03-22 14:01:27 +02:00
Bananymous
45cea14165
Kernel: Move sys_fork trampolines to kernel/arch/ directory
2024-03-22 12:48:54 +02:00
Bananymous
26ed689d30
Kernel: Remove old GDT, IDT and MMU code from i386
...
It will be easier to just rewrite them
2024-03-22 12:47:34 +02:00
Bananymous
7ce0370b6a
Kernel: Define KERNEL_OFFSET for i386 target
2024-03-22 12:35:49 +02:00
Bananymous
aa2e53c4f8
Kernel: E1000 fix physical address on 32 bit target
2024-03-22 12:35:38 +02:00
Bananymous
9ecd156622
Kenrel: Ext2 fix signed-unsigned comparisons
2024-03-22 12:35:29 +02:00
Bananymous
3c62be3f5d
BAN: Implement make_signed and make_unsigned
2024-03-22 12:35:20 +02:00
Bananymous
d1c8273826
Toolchain: Allow toolchain compilation for i386 targets
...
Fix GCC flags that were x86_64 specific
2024-03-21 21:59:09 +02:00
Bananymous
7d1b7436d4
LibC: Dummy ctr* files for i386
...
This allows compilation of libc for i386 targets
2024-03-21 15:20:20 +02:00
Bananymous
65750586b6
LibC: Use GCC builtins for math functions
2024-03-21 15:19:44 +02:00
Bananymous
62f6128ba1
Kernel: Cleanup NVMe Queue command submission
...
There is techically a race condition on thread sleep and checking
done mask. This patch allows read to success even if this race
condition is hit, although the full timeout has to be waited.
This can be fixed in future with some sort of wait queues that
can properly handle this race condition.
2024-03-19 13:01:27 +02:00
Bananymous
7f5c850744
Userspace: Add us keymap and make it default
2024-03-19 12:30:57 +02:00
Bananymous
9607b4205a
Kernel: Fix kernel panic on signal
...
Signals are now added/handled without Scheduler's lock
2024-03-18 16:05:47 +02:00
Bananymous
e447d5fccf
All: remove obsolete gitignore files
...
These have not been in use for almost a year
2024-03-18 15:28:46 +02:00
Bananymous
090c3c9930
Kernel: NVMe queues now supports upto 64 simultaneous operations
2024-03-15 13:46:35 +02:00
Bananymous
48ea9e1c1d
Kernel: PS2Controller uses RecursiveSpinLock so timeouts don't panic
2024-03-15 13:45:44 +02:00
Bananymous
42469b83fe
Kernel: kernel panic is now sent to all processors
2024-03-15 13:45:01 +02:00
Bananymous
e65bc040af
Kernel: Now all active processors are used in scheduling
...
When a timer reschedule happens, ipi is broadcasted too all
processors for them to perform a reschedule!
2024-03-09 23:53:50 +02:00
Bananymous
89ca4c8a8b
Kernel: Implement IPI broadcasting
2024-03-09 23:53:38 +02:00
Bananymous
2323a55517
Kernel: Debug lock is locked while dumping stack trace
2024-03-09 23:52:06 +02:00
Bananymous
45d6caa1d0
Kernel: APs now start their idle threads when scheduler is started
2024-03-09 23:51:40 +02:00
Bananymous
55d2a64f54
Kernel: Map interrupt handlers for all processors
...
This doesn't mean that processors will actually handle the irqs
2024-03-09 23:50:57 +02:00
Bananymous
2420886c2c
Kernel: Move current and idle thread to Processor
2024-03-08 23:39:29 +02:00
Bananymous
e636dce919
Kernel: Rewrite scheduler thread lists
...
Scheduler now has its own data SchedulerQueue which holds active nad
blocking thread lists. This removes need for BAN/Errors.h and making
current thread separate element instead of iterator into linked list.
This makes it possible to have current_thread on each processor
instead of a global one in Scheduler.
2024-03-08 22:13:45 +02:00
Bananymous
1a1f9b1cf2
Kernel: Fix {read,write}_gs_sized input operands to work always
2024-03-08 22:12:33 +02:00
Bananymous
54d0cb47cd
BAN: Update ASSERT_NOT_REACHED message
2024-03-08 22:11:39 +02:00
Bananymous
23a2f8b903
Kernel: Cleanup multiprocessor startup by removing magic numbers
2024-03-07 17:01:17 +02:00
Bananymous
29fd682672
Kernel: Store current processor pointer in IA32_GS_BASE
...
This allows easier access to processors fields
2024-03-07 16:05:29 +02:00
Bananymous
efed67cbd0
BAN: Remove unnecessary default constructor from Array
2024-03-06 16:01:52 +02:00
Bananymous
6234a5bc0b
Kernel: Move multiprocessor initialize after framebuffer is created
...
This allows getting output before multiprocessor is started.
2024-03-06 16:00:19 +02:00
Bananymous
54f64e7618
Kernel: Move current page table to Processor
...
APs can now map kernel page table and print current time!
2024-03-06 02:19:59 +02:00
Bananymous
f0105cb7fb
Kernel: Move Interruptable from InterruptController.h to its own file
2024-03-06 00:47:02 +02:00
Bananymous
76b0f80169
Kernel: Move IDT to Processor
2024-03-06 00:45:54 +02:00
Bananymous
f84df175ce
Kernel: Save BSB id
2024-03-06 00:36:09 +02:00
Bananymous
58aca68726
Kernel: Move GDT to Processor
2024-03-06 00:35:45 +02:00
Bananymous
8670364f44
BAN: Remove unnecessary include from Array.h
2024-03-06 00:01:06 +02:00
Bananymous
418bc54f2b
Kernel: Move SpinLock definition to header and fix Scheduler locking
...
This patch allows inlining of spinlocks :)
2024-03-04 22:36:41 +02:00
Bananymous
9c36d7c338
BAN/Kernel: Rework assertion/panic system
...
BAN/Assert.h does not need any includes meaning it can be included
anywhere without problems.
2024-03-04 11:41:54 +02:00
Bananymous
8141b9977d
Kernel: Per processor information is now stored in class Processor
...
This allows us to allocate processor stacks, and other per processor
structures dynamically in runtime. Giving processor stack to
ap_trampoline feels super hacky, but it works for now.
2024-03-03 22:30:06 +02:00
Bananymous
c035d3c82c
Kernel: Start all processors on kernel boot
...
Processors don't do anything, except print hello message and halt.
2024-03-03 02:19:43 +02:00
Bananymous
1de9daa40f
Kernel: Move interrupt status stuff to Processor.h
...
SpinLocks are now locked with processor id instead of thread id. This
allows having multiple processors running while scheduler is not yet
activated.
2024-03-03 01:47:22 +02:00
Bananymous
efd8203232
BAN: Atomic memory order can be set per function call
2024-03-03 01:41:46 +02:00
Bananymous
a667d88f93
Kernel: Remove now obsolete CriticalScope
...
All critical scopes in kernel are now replaced by SpinLocks. This
allows proper locking in actual multiprocessing with multiple cores.
2024-03-01 15:51:02 +02:00
Bananymous
8d7dd577ab
Kernel: Replace last CriticalScopes in kernel with SpinLocks
2024-03-01 15:49:39 +02:00
Bananymous
054b41383f
Kernel: Implement SpinLock unsafe that does not keep track of locker
...
This will be used in scheduler where thread ids are changing
2024-03-01 15:48:08 +02:00
Bananymous
02ad199138
Kernel: Move interrupt status functions to kernel/Interrupts.h
2024-03-01 02:13:28 +02:00
Bananymous
65c4f9db5b
Kernel: Replace CriticalScopes with SpinLocks in Process/Thread
2024-03-01 02:13:28 +02:00
Bananymous
51e38b7614
Kernel: Replace CriticalScope with SpinLock in SerialTTY
2024-02-29 19:17:28 +02:00
Bananymous
90878a7c2b
Kernel: Replace CriticalScopes with SpinLocks in networking code
2024-02-29 19:17:28 +02:00
Bananymous
7f028f70d5
Kernel: Replace CriticalScopes with SpinLock in PS/2 and input code
2024-02-29 19:17:28 +02:00
Bananymous
ec0cb5fd54
Kernel: Remove CriticalScopes from memory handing code
2024-02-29 19:16:41 +02:00
Bananymous
682de62c57
Kernel: Replace HPET CriticalScope with SpinLock
2024-02-29 19:15:33 +02:00
Bananymous
18253b6966
Kernel: Replace InterruptController CriticalScopes with SpinLock
2024-02-29 19:15:33 +02:00
Bananymous
21f05eb118
Merge branch 'main' into locking
2024-02-28 23:00:02 +02:00
Bananymous
d94f6388b7
Kernel: Fix all broken locks from new mutexes
2024-02-28 22:45:34 +02:00
Bananymous
1971813336
BAN: Add HashMap::remove(iterator)
2024-02-28 22:35:42 +02:00
Bananymous
3c88d2aad3
BAN: Implement find() for HashMap
2024-02-28 13:20:24 +02:00
Bananymous
5c39903323
Kernel: Simplify writing to threads stacks
...
This can be done more simply as all stacks are now page aligned
2024-02-28 13:20:17 +02:00
Bananymous
6d59a2b45d
Kernel: Remove VirtualRanges created in kmalloc memory
...
These were only used as stacks of kernel threads, but they can just
as well be allocated as full pages from Heap
2024-02-28 13:19:18 +02:00
Bananymous
09c24088a2
Kernel: Cleanup kmalloc VirtualRange creation
2024-02-28 13:19:18 +02:00
Bananymous
efdc4817bb
Kernel: Print to debug log ICMP unreachable messages
...
These messages should be forwarded to underlying sockets
2024-02-28 13:19:18 +02:00
Bananymous
0c97abb053
BAN: Implement find() for HashMap
2024-02-27 15:40:30 +02:00
Bananymous
1759d247d9
Kernel: Simplify writing to threads stacks
...
This can be done more simply as all stacks are now page aligned
2024-02-25 21:57:33 +02:00
Bananymous
21dc64dc21
Kernel: Remove VirtualRanges created in kmalloc memory
...
These were only used as stacks of kernel threads, but they can just
as well be allocated as full pages from Heap
2024-02-25 21:56:37 +02:00
Bananymous
264eff3ad0
Kernel: Cleanup kmalloc VirtualRange creation
2024-02-25 21:33:30 +02:00
Bananymous
05c7b21b0a
Kernel: Print to debug log ICMP unreachable messages
...
These messages should be forwarded to underlying sockets
2024-02-25 21:32:37 +02:00
Bananymous
40b626b0aa
Kernel: Rewrite all kernel mutexes
...
Now SpinLock is actually just a spin lock and I added a Mutex that
does the same as the old "SpinLock". This is in preparation for
starting to support smp and making the kernel smp safe. This commit
also removes obsolete PageTableScope and CriticalScope which should
now be used by alternative APIs.
2024-02-25 21:29:43 +02:00
Bananymous
6ebfe05fce
BAN: Add parenthesis in ASSERT macros
2024-02-25 21:22:47 +02:00
Bananymous
59abb5d344
Kernel: Make HPET read_main_counter() atomic with 32 bit main counter
2024-02-23 13:42:04 +02:00
Bananymous
9594ee8e47
Kernel: Start making device numbers unique for each device
2024-02-22 15:53:48 +02:00
Bananymous
7a4ec7f7a3
Kernel: Use static_cast instead of c-style cast in HPET
2024-02-22 14:44:39 +02:00
Bananymous
51db1706e9
Kernel: Fix checking of partition boundaries on write
2024-02-22 13:31:12 +02:00
Bananymous
ac9e71d9c7
LibC: Fix parsing mode from string
2024-02-20 13:25:24 +02:00
Bananymous
f3f5ca1bd8
Kernel: Seed RNG by real time if no RDRAND available
2024-02-20 13:00:26 +02:00
Bananymous
b979023b9d
Shell: Add test cases for stroul and strod in builtin `test-strtox`
2024-02-16 15:35:02 +02:00
Bananymous
915dea01c9
LibC: fix printf %e for inf/nan values
2024-02-16 15:34:24 +02:00
Bananymous
566bb73897
LibC: Implement ato* and strto* functions for floating point numbers
2024-02-16 15:28:52 +02:00
Bananymous
fb0d8d746f
BAN: Add {max,min}_exponent{2,10} to numeric_limits<T>
2024-02-16 15:27:40 +02:00
Bananymous
1b24c4f279
LibC: Implement strtou{l,ll}
2024-02-15 12:25:56 +02:00
Bananymous
a5a041e637
LibC: Remove cast from S_* macros so they can be used in preprocessor
2024-02-15 12:20:09 +02:00
Bananymous
c469d9b3ff
Shell: Add builtin test for strtol `test-strtol`
2024-02-14 22:38:16 +02:00
Bananymous
373d166076
LibC: Implement ato{i,l,ll} and strto{l,ll}
2024-02-14 22:35:23 +02:00
Bananymous
3c54243ac7
BAN: Implement some numerical limits
2024-02-14 22:34:42 +02:00
Bananymous
1f467580ee
Userspace: Add test for popen
2024-02-14 17:23:26 +02:00
Bananymous
1ba883719a
LibC: Implement popen and pclose
2024-02-14 17:22:45 +02:00
Bananymous
f73e954b28
Kernel: Remove SpinLock from Pipe
...
Pipe already is using lock on the inode. If you read from pipe when
there was no data, pipe blocked indefinately since writes were blocked
by Inode::m_lock.
2024-02-14 17:21:32 +02:00
Bananymous
de629291b9
LibC: Implement freopen, rewind and fix bugs in code
...
Now everything will be properly locked once threads are implemented.
All functions "lock" the stream for the wanted operation
2024-02-14 16:36:48 +02:00
Bananymous
7eb5d220fd
Userspace: Implement getopt for testing libc getopt()
2024-02-14 15:01:27 +02:00
Bananymous
4cd9abdd15
LibC: Implement getopt()
2024-02-14 15:00:58 +02:00
Bananymous
198dde8365
Kernel: Add klibc for kernel
...
Now building same source as libc is not needed and libc doesn't
have to do hacks to allow kernel compilation
2024-02-14 15:00:04 +02:00
Bananymous
b165340662
Kernel: Don't use strcat in kernel code
2024-02-14 14:59:13 +02:00
Bananymous
5ad4340679
BAN: Use strerrordesc_np instead of strerror
2024-02-14 14:58:27 +02:00
Bananymous
b56fa4a29d
LibC: Implement fscanf
...
I had missed this when I was implementing *scanf functions
2024-02-14 14:39:22 +02:00
Bananymous
e946b392c9
LibC: Add definition for S_IFMT
...
I was using S_IFMASK, but linux seems to use this
2024-02-14 14:39:22 +02:00
Bananymous
81689b5f02
LibC: Implement most of missing functions from string.h
...
only strcoll*, strxfrm* and strerror_l are left unimplemented
2024-02-14 14:39:22 +02:00
Bananymous
c18d926174
LibC: Fix timeval field name
2024-02-14 03:36:18 +02:00
Bananymous
00662bad46
Kernel: Rewrite HPET code
...
Now the set timer frequency actually works... :D
2024-02-13 17:59:48 +02:00
Bananymous
420a7b60ca
resolver: use select for client communication
2024-02-12 23:47:39 +02:00
Bananymous
2ab3eb4109
Kernel: Fix bugs in select
...
Unix domain socket is now select readable when it has pending
connection
2024-02-12 23:46:27 +02:00
Bananymous
9314528b9b
Kernel: Improve syscall handling
...
Syscalls are now called from a list of function pointers
2024-02-12 21:51:11 +02:00
Bananymous
78ef7e804f
BAN: Implement bit_cast
2024-02-12 21:46:33 +02:00
Bananymous
3fc1edede0
Kernel/LibC: Implement super basic select
...
This does not really even block but it works... :D
2024-02-12 17:26:33 +02:00
Bananymous
f50b4be162
Kernel: Cleanup TCP code
2024-02-12 15:44:40 +02:00
Bananymous
ccde8148a7
Userspace: Implement basic udp test program
2024-02-12 04:45:42 +02:00
Bananymous
b9bbf42538
Userspace: Implement basic test program for tcp connection
2024-02-12 04:45:42 +02:00
Bananymous
435636a655
Kernel: Implement super simple TCP stack
...
No SACK support and windows are fixed size
2024-02-12 04:45:42 +02:00
Bananymous
ba06269b14
Kernel: Move on_close_impl from network socket to udp socket
2024-02-12 04:45:42 +02:00
Bananymous
be01ccdb08
Kernel: Fix E1000 mtu
2024-02-12 04:25:39 +02:00
Bananymous
b45d27593f
Kernel: Implement super simple PRNG
2024-02-12 04:25:06 +02:00
Bananymous
ff49d8b84f
Kernel: Cleanup OSI layer overlapping
2024-02-09 17:05:07 +02:00
Bananymous
5d78cd3016
Kernel: Add spin lock assert back. I had accidentally deleted it
2024-02-09 16:58:55 +02:00
Bananymous
ed0b1a86aa
Kernel: Semaphores and Threads can now be blocked with timeout
2024-02-09 15:28:15 +02:00
Bananymous
534b3e6a9a
Kernel: Add LockFreeGuard to LockGuard.h
2024-02-09 15:13:54 +02:00
Bananymous
d452cf4170
Kernel: Fix checksum for packets with odd number of bytes
2024-02-09 01:20:40 +02:00
Bananymous
f117027175
resolver: dump errors to debug output
2024-02-08 18:34:15 +02:00
Bananymous
acf79570ef
Kernel: Cleanup network APIs and error messages
2024-02-08 18:33:49 +02:00
Bananymous
5a939cf252
Userspace: Add simple test for unix domain sockets
2024-02-08 13:18:54 +02:00
Bananymous
9bc7a72a25
Kernel: Implement unix domain sockets with SOCK_DGRAM
...
Also unbind sockets on close
2024-02-08 13:18:54 +02:00
Bananymous
065ee9004c
Userspace: Add DNS cache to resolver
...
Also the format of resolver reply is now just sockaddr_storage with
family set and address in the storage field.
2024-02-08 12:06:30 +02:00
Bananymous
6fb69a1dc2
LibC: Implement inet_ntop for IPv4 addresses
2024-02-08 11:59:11 +02:00
Bananymous
49889858fa
Kernel: Allow chmod on TmpSocketInode
2024-02-08 03:16:01 +02:00
Bananymous
2424f38a62
Userspace: Implement super simple DNS resolver in userspace
...
You connect to this service using unix domain sockets and send the
asked domain name. It will respond with ip address or 'unavailable'
There is no DNS cache implemented so all calls ask the nameserver.
2024-02-08 03:14:00 +02:00
Bananymous
218456d127
BAN: Fix some includes
2024-02-08 03:13:21 +02:00
Bananymous
e7dd03e551
Kernel: Implement basic connection-mode unix domain sockets
2024-02-08 02:28:19 +02:00
Bananymous
0c8e9fe095
Kernel: Add operator bool() for WeakPtr
2024-02-08 02:26:46 +02:00
Bananymous
5b4acec4ca
BAN: Add capacity() getter for Queue
2024-02-07 22:53:56 +02:00
Bananymous
e26f360d93
Kernel: allow kmalloc of size 0
2024-02-07 22:36:24 +02:00
Bananymous
2cc9534570
BAN: Add emplace for Variant
...
This allows variant to store values that are not copy/move
constructible.
2024-02-07 22:33:16 +02:00
Bananymous
572c4052f6
Kernel: Fix Process APIs
2024-02-07 15:57:45 +02:00
Bananymous
132286895f
Kernel: Implement Socket inodes for tmpfs
2024-02-07 15:57:45 +02:00
Bananymous
454bee3f02
LibC: Fix sockaddr_un implementation
2024-02-07 15:57:45 +02:00
Bananymous
41cad88d6e
Kernel/LibC: Implement dummy syscalls for accept, connect, listen
2024-02-07 15:57:45 +02:00
Bananymous
40e341b0ee
BAN: Remove unstable hash map and set
...
These can now be implemented safely with new linked list api
2024-02-06 17:35:15 +02:00
Bananymous
5da59c9151
Kernel: Make better abstractions for networking
2024-02-06 16:45:39 +02:00
Bananymous
f804e87f7d
Kernel: Implement basic gateway for network interfaces
2024-02-05 18:18:56 +02:00
Bananymous
dd3641f054
Kernel: Cleanup ARPTable code
...
Packet process is now killed if ARPTable dies.
ARP wait loop now just reschecules so timeout actually works.
2024-02-05 18:18:56 +02:00
Bananymous
b2291ce162
Kernel/BAN: Fix network strucute endianness
2024-02-05 18:18:56 +02:00
Bananymous
c35ed6570b
LibC: Implement endiannes and ip address functions
2024-02-05 18:18:56 +02:00
Bananymous
d15cbb2d6a
Kernel: Fix IPv4 header checksum calculation
2024-02-05 18:18:56 +02:00
Bananymous
b8cf6432ef
BAN: Implement host_to_network_endian
2024-02-05 17:29:24 +02:00
Bananymous
89805fb092
dhcp-client: Use dprintln for debug printing
2024-02-05 01:24:45 +02:00
Bananymous
692cec8458
Kernel/Userspace/LibC: Implement basic dprintln for userspace
2024-02-05 01:24:09 +02:00
Bananymous
79897e77dc
dhcp-client: Remove packet send test :D
2024-02-03 18:04:31 +02:00
Bananymous
649e9f4500
Kernel: ARP now replies to requests
2024-02-03 18:04:12 +02:00
Bananymous
3a6d31d3fa
BAN: Add comparison for MAC
2024-02-03 18:03:27 +02:00
Bananymous
2138eeb87f
Userspace: Implement super simple DHCP client
2024-02-03 02:41:06 +02:00
Bananymous
102aa50a41
BuildSystem: Use E1000E network controller in qemu
2024-02-03 02:40:15 +02:00
Bananymous
5cfe249945
Kernel: Cleanup network code and implement basic ARP request
2024-02-03 02:39:26 +02:00
Bananymous
a0138955cd
Kernel: Implement barebones arp table
2024-02-03 01:50:10 +02:00
Bananymous
e1ffbb710b
Kernel/LibC: Implement basic ioctl for network addresses
2024-02-03 01:50:10 +02:00
Bananymous
c18f72ceb9
BAN: Add more APIs for IPv4 address
2024-02-03 01:50:10 +02:00
Bananymous
bc1441a5eb
LibC: add stropts.h
2024-02-02 14:29:20 +02:00
Bananymous
0f154c3173
Kernel: Implement basic recvfrom
2024-02-02 13:50:00 +02:00
Bananymous
7b287a1d5b
BAN: Add types for IPv4 and MAC addresses
2024-02-02 13:48:07 +02:00
Bananymous
4b332b5d42
Kernel: Cleanup PCI code
2024-02-02 03:16:37 +02:00
Bananymous
ec2f21bb9f
Kernel/LibC: Implement SYS_SENDTO
2024-02-02 03:16:01 +02:00
Bananymous
acd6c86f98
BAN: Add NetworkEndian to Endianness
2024-02-02 03:13:14 +02:00
Bananymous
ab150b458a
Kernel/LibC: Implement basic socket binding
2024-02-02 01:31:58 +02:00
Bananymous
cf28ecd5a6
Kernel/LibC: Add SYS_SOCKET
2024-02-01 23:39:09 +02:00
Bananymous
99eed9c37a
Kernel: Start work on network stack
2024-02-01 23:38:06 +02:00
Bananymous
f4e86028d0
Kernel: Write simple working E1000 and E1000E drivers
2024-02-01 22:08:59 +02:00
Bananymous
7cb71ec6fb
test-sort: Test more algorithms and cleanup output format
2024-02-01 15:22:28 +02:00
Bananymous
d054e5b4b7
BAN: Implement basic radix sort for unsigned integers
2024-02-01 15:22:28 +02:00
Bananymous
c69efc040c
Kernel: Scheduler now uses the new LinkedList API for moving threads
...
Scheduler doesn't have to depend on the fact that allocations should
work when same amount of memory is just deallocated
2024-02-01 15:22:28 +02:00
Bananymous
c4bf1641bd
BAN: Add cool API for LinkedList
...
You can now move elements between LinkedLists without allocations or
deallocations. Same node moves from source to destination
2024-02-01 14:19:02 +02:00
Bananymous
9213dd13bc
dd: Improve output format
...
Include written bytes and speed with units
2024-02-01 00:06:46 +02:00
Bananymous
4273f43be1
BAN: Move placement new to its own file and fix includes
2024-01-31 23:55:41 +02:00
Bananymous
139bb5c2a5
Kernel: Fix linker script
...
I have no idea why rodata was executable :D
2024-01-30 17:32:50 +02:00
Bananymous
95e861bcdd
Kernel: Optimize all SpinLocks. All locking operations are atomic
2024-01-30 12:39:37 +02:00
Bananymous
ca8e7b40bc
Kernel: Implement SpinLock without CriticalScope
...
This actually is not even spinlock since it yields the current
thread. It will become one when I get to SMP though...
2024-01-30 01:21:15 +02:00
Bananymous
cc79f55817
BAN: Add compare_exchange to atomic
2024-01-30 01:21:15 +02:00
Bananymous
a1faa836c5
Kernel: Hack NVMe controller to work :)
2024-01-30 01:06:00 +02:00
Bananymous
1f8aaa6fba
Toolchain: Add `insmod all_video` to uefi grub
...
This allows getting GOP framebuffer... This was all it took
2024-01-26 00:50:04 +02:00
Bananymous
6bfe833aa5
Kernel: Parse RSDP from multiboot headers if exists
2024-01-26 00:49:42 +02:00
Bananymous
0408aa9bbc
BAN: Implement is_unsigned* traits and (un)?signed_integral concepts
2024-01-25 14:17:23 +02:00
Bananymous
210b24b6e3
AOC2023: Delete file that should not be committed...
2024-01-24 15:53:38 +02:00
Bananymous
dfe5a2d665
All: Cleanup all files
...
Add newline to end of files and remove whitespace from end of lines
2024-01-24 15:53:38 +02:00
Bananymous
3441f63298
Kernel: Don't panic kernel if no interrupt could be reserved
2024-01-24 14:34:59 +02:00
Bananymous
2cee2a85e6
Kernel: DevFS now stores all devices
...
This allows removing hack in PCI that was required to keep NVMe
controller alive.
2024-01-24 14:33:50 +02:00
Bananymous
5001fa58e0
Kernel: Fix wait syscall with atomics
2024-01-24 14:32:52 +02:00
Bananymous
d2cf7c7a5c
BAN: Implement basic Atomic class that wraps gcc builtins
2024-01-24 14:30:04 +02:00
Bananymous
e544e6a62d
LibC: Implement floating point parsing to *scanf functions
2024-01-24 11:54:12 +02:00
Bananymous
606a7cb313
LibC: Implement almost POSIX compliant *scanf functions
...
Only wchar strings and floating point values are not parsed
2024-01-24 10:33:12 +02:00
Bananymous
de4fdcd898
BAN: Implement is_base_of and integral_constant to Traits
2024-01-22 16:59:14 +02:00
Bananymous
2c471a89d0
LibC: Add compile option to libc to stop optimizing string.h
2024-01-17 19:44:29 +01:00
Bananymous
a5660b95b2
BAN: String don't memcpy with nullptr
2024-01-17 19:04:40 +01:00
Bananymous
54a92293da
Kernel: Implement NVMe driver
...
I'm actually able to boot this os fine on own laptop now!
2024-01-17 08:26:58 +01:00
Bananymous
812e9efd41
Kernel: StorageDevices now specify prefix for partition names
2024-01-14 01:16:48 +02:00
Bananymous
c6130f33d7
Kernel: Implement MSI, MSI-X and interrupt reservation
2024-01-13 18:21:21 +02:00
Bananymous
56a29dc176
Kernel: Fix PS/2 Controller if port 0 is empty
2024-01-13 17:05:29 +02:00
Bananymous
7e36a0be75
Bootloader: Add .data section
2024-01-12 19:27:36 +02:00
Bananymous
7adc7e55a5
Kernel: Fix timeouts in AHCI code and add more volatile keywords
2024-01-12 19:26:20 +02:00
Bananymous
4be726b130
Kernel: Implement more error handling in IDE controller
2024-01-12 02:55:06 +02:00
Bananymous
ff2486f58c
Bootloader: Try to enable A20 line if it is disabled
...
VirtualBox seems to have A20 disabled by default
2024-01-12 02:55:06 +02:00
Bananymous
db933d5466
Kernel: Improve keymap file loading
...
Now you can include other files in keymaps and set which keys are
modifier keys
Only keys that are set in keymap file are actually updated
2024-01-12 02:55:06 +02:00
Bananymous
8e31ab2de8
BuildSystem: clean target now deletes disk image
2024-01-11 13:27:02 +02:00
Bananymous
83ca469ed7
Kernel: Modifier keys are taken from current keyboard layout
...
I used to assume where all modifiers were, but they are now taken
from keyboard layout.
2024-01-11 11:53:11 +02:00
Bananymous
d2c0718f7d
Kernel: Fix toggleable modifier keys and add two more keys
2024-01-11 11:43:05 +02:00
Bananymous
c1f0704fa8
fi keymap: Fix arrow key keycodes
2024-01-10 14:59:50 +02:00
Bananymous
64a63fa4be
Userspace: Add loadkeys program to change keymap
2024-01-10 14:57:50 +02:00
Bananymous
ab39c6541a
Kernel: Require keymap loading superuser privileges
2024-01-10 14:50:30 +02:00
Bananymous
51214ea1bf
Kernel: Add load_keymap syscall and load Finnish keymap in init
2024-01-10 14:46:29 +02:00
Bananymous
8f89519bcf
Kernel: Keymaps can now be loaded from files
2024-01-10 14:43:19 +02:00
Bananymous
e6d42e5c45
Kernel: Add timeout for device commands on PS/2 devices
2024-01-10 12:51:24 +02:00
Bananymous
961ab9768a
Kernel: KeyEvent is now well known keycode
...
Keycodes are easier to handle as you need only one keyboard layout
for keycodes. Otherwise you would need to implement keyboard layout
for every keyboard driver in every language.
2024-01-10 12:51:24 +02:00
Bananymous
e4f48cbc73
Kernel: Move PS/2 command queue to controller instead of device
2024-01-09 20:00:19 +02:00
Bananymous
e8f853a197
Kernel: After device updates, reschedule instead of sleeping
2024-01-09 11:21:00 +02:00
Bananymous
d760239748
Kernel: Do a big rewrite of PS/2 code
...
Command sending+response reading is now synchronized. This allows
bochs to properly initialize both mouse and keyboard simultaneously.
Also status register is checked EVERY time read/write to other IO
ports is performed.
2024-01-08 10:50:55 +02:00
Bananymous
2fec718590
Bootloader: cleanup code
2024-01-08 10:50:55 +02:00
Bananymous
f0cf54e194
Kernel: Reads from PS/2 keyboard and mouse can be terminated
2024-01-05 12:13:44 +02:00
Bananymous
41ae05dd6e
Kernel: Update block_or_eintr API to return ErrorOr<>
2024-01-05 12:13:11 +02:00
Bananymous
40f55be587
Userspace: Write simple mouse test program
...
This program draws circle on framebuffer, that you can move with
mouse, resize with scroll, and recolor with mouse buttons.
2024-01-04 19:50:26 +02:00
Bananymous
54c811ac2e
Kernel: Fix some mouse scrolling bugs and cleanup event generation
2024-01-04 19:50:26 +02:00
Bananymous
12a78c822e
Kernel: Explicitly construct ByteSpan from Span<uint8_t>
...
VSC complains about not finding proper constructor, this fixes that.
2024-01-04 12:17:55 +02:00
Bananymous
e45b544a39
Kernel: Implement PS/2 mouse driver
...
This is realtively simple driver that queries extensions (scroll +
extra buttons) from mouse and reads mouse packages.
2024-01-04 12:17:55 +02:00
Bananymous
d1e187570e
Kernel: Fix old keyboard command
2024-01-04 12:08:23 +02:00
Bananymous
d4191c0d94
Kernel: Reorganize PS/2 files to their own directory
2024-01-04 12:04:45 +02:00
Bananymous
c2957d8761
Kernel: PS/2 device automatically sends commands when appended
2024-01-04 12:04:45 +02:00
Bananymous
891ced4da2
Kernel: Move PS2Device to its own file
2024-01-04 12:04:45 +02:00
Bananymous
8f8d6bddc0
Kernel: Unify PS2Device to handle commands instead of inherited
2024-01-04 12:04:45 +02:00
Bananymous
d2d12d5281
Kernel: validate_{string,pointer}_access now return ErrorOr<void>
...
Now that signals are only processed when returning to userspace,
address validation has to do an early return.
2024-01-03 23:53:04 +02:00
Bananymous
0ba278041b
Kernel: Start exec by loading the ELF file. It might not exist...
2024-01-03 23:50:02 +02:00
Bananymous
ccaa159a73
Bootloader: Add support for ext2 blocks up to 4 KiB
...
This should work with blocks bigger than that, but my linux system
only supports up to 4 KiB, so I cannot test this.
This allows getting rid of forced block size in mkfs and let the
program select appropriately sized blocks.
2024-01-03 18:26:03 +02:00
Bananymous
7356a83a44
Bootloader: Optimize some unnecessary branches on carry add/sub
2024-01-03 17:05:33 +02:00
Bananymous
2a68df81e2
Bootloader: Fix bootloader on bochs
...
Bochs int 0x10 seems to scrap full ebp and top bits in some
registers. I now save all 32-bit registers on call frame. Also
ebp is across all int 0x10 calls.
2024-01-03 13:09:55 +02:00
Bananymous
50ca2ac09e
Bootloader: Interpret 0x7F (DEL) as backspace
...
This allows backspace to work over qemu's serial connection
2024-01-03 11:58:50 +02:00
Bananymous
b0ff2392a1
Kernel: Add some helpful debug prints
...
Log RIP when stack pointer is out of bounds.
Log all syscalls that return ENOTSUP
2024-01-03 02:08:01 +02:00
Bananymous
001e95f973
Kernel: Optimize sse saving/loading
...
Only save and load sse when new thread is trying to execute sse
instruction. There is no need to do that every time we enter kernel.
2024-01-03 02:06:49 +02:00
Bananymous
db0650cf10
LibC: Implement basic atexit. This allows clean exit from doom (soon)
2024-01-03 00:30:37 +02:00
Bananymous
753de3d9f0
ls: Write group name instead of gid in list mode
2024-01-03 00:15:13 +02:00
Bananymous
668c4c8976
LibC: Implement getgrnam and getgrgid
2024-01-03 00:14:49 +02:00
Bananymous
d2bc399770
BAN: Make StringView::split const and fix bug with empties
2024-01-03 00:14:29 +02:00
Bananymous
1bd33e76e5
cat/cat-mmap: print newline if file doesn't end in one
2024-01-02 23:27:13 +02:00
Bananymous
9fa13079f2
Kernel: Implement supplementary groups
...
This code has very ugly file parsing code. I have to create API
for reading files line by line in kernel space...
This allows users to open framebuffer/input files without root.
Mounting has to be moved to userspace soon. It makes no sense to
hard code permissions for every (device) file.
2024-01-02 23:24:32 +02:00
Bananymous
96d831c31a
Kernel/LibC/Userspace: Implement chown and set tty owner on login
2024-01-02 22:19:38 +02:00
Bananymous
07d5d3f936
BAN: Simple iterator now contains valid flag
...
This allows iteration over empty containers
2023-12-29 14:49:57 +02:00
Bananymous
51820b15cb
README: Add packages required by compilation in pacman
2023-12-29 03:11:30 +02:00
Bananymous
9fafafb17e
BuildSystem: Add instructions + fixes to build system
...
You can now easily build with clean ubuntu install
2023-12-28 21:37:18 +02:00
Bananymous
7c6565880d
BuildSystem: Use git apply instead of am
...
This allows you to not have configured git user
2023-12-28 20:16:36 +02:00
Bananymous
93a72ebd06
BuildSystem: Download cmake only if needed
2023-12-28 19:50:22 +02:00
Bananymous
4307968182
All: Start work again on sse support
2023-12-28 19:14:42 +02:00
Bananymous
5d83ab2289
BuildSystem: Download correct cmake if it is not available
2023-12-28 19:13:27 +02:00
Bananymous
af80bad87a
BuildSystem: Allow running custom version of cmake
...
You can now set the environment variable CMAKE_COMMAND to use custom
cmake version.
2023-12-27 13:01:11 +02:00
Bananymous
87272f0cd7
BuildSystem: Create build directory if it doesn't exists
2023-12-27 12:36:40 +02:00
Bananymous
8b5e437936
AOC2023: Implement day25 part1
...
7 starts missing + partly broken day22. I might finish these soon...
2023-12-26 20:04:42 +02:00
Bananymous
3939da4fb0
BuildSystem: Increase image size 50MiB -> 500 MiB
2023-12-26 15:01:12 +02:00
Bananymous
d87fa1a7ea
AOC2023: Implement day24 part1
2023-12-26 14:10:49 +02:00
Bananymous
910a57089b
AOC2023: Implement day23 part1
...
My day22 implementation is off by couple of bricks...
2023-12-26 00:56:35 +02:00
Bananymous
861bf27e96
BAN: Implement abs()
2023-12-26 00:54:06 +02:00
Bananymous
36590fb5c7
AOC2023: Implement day21 part1
2023-12-24 14:58:21 +02:00
Bananymous
ce990c3026
AOC2023: Implement day20 part1
2023-12-24 13:39:26 +02:00
Bananymous
b833239a82
BAN: Make hashmap work with non-copy constructable values
2023-12-24 13:38:47 +02:00
Bananymous
6fec142760
BAN: Add requires clauses for vector
2023-12-24 13:38:20 +02:00
Bananymous
84b2438b3d
BAN: Add requires for copy constructor for linked list
2023-12-24 13:37:49 +02:00
Bananymous
0e714d5eb4
BAN: Implement String::operator==(const String&)
2023-12-24 13:36:46 +02:00
Bananymous
9b8e6e6629
BAN: Implement is_*constructable
2023-12-24 13:36:12 +02:00
Bananymous
4146f2777b
AOC2023: Implement 10 hour solution to day19 part2
2023-12-23 20:53:50 +02:00
Bananymous
64323c51e6
AOC2023: Implement day19 part 1
2023-12-23 18:47:44 +02:00
Bananymous
a0200a7b10
AOC2023: Implement day18 part 1
2023-12-23 18:47:21 +02:00
Bananymous
8add759b5d
AOC2023: Implement day17 part1
2023-12-23 18:46:43 +02:00
Bananymous
2faf90bc2b
AOC2023: Add script to create day template and download input
2023-12-23 18:46:14 +02:00
Bananymous
762d575d70
AOC2023: Add program to run all days
2023-12-23 18:45:40 +02:00
Bananymous
2e77718f07
BAN: Implement find() for StringView
2023-12-23 18:43:52 +02:00
Bananymous
f371fabe35
BAN: HashSet is now internally Vector<LinkedList<T>>
...
It used to be Vector<Vector<T>> but this feels more proper
2023-12-23 16:37:21 +02:00
Bananymous
79a15132da
BAN: Cleanup HashSet
...
I now use BAN::Iterator as the base iterator. Also unstable version
was added.
2023-12-23 16:32:06 +02:00
Bananymous
bacc0db778
BAN: Fix unstable hash map rebucket
2023-12-23 16:31:42 +02:00
Bananymous
3963afe343
BAN: Add unstable version of hash map
...
This version differs only when doing rebucket. If rebucket fails,
the whole hash map is invalidated. This allows rebucketing to use
moving instead of copying.
2023-12-19 22:23:28 +02:00
Bananymous
3b21cc90ae
AOC2023: Add helper for downloading puzzle input
2023-12-19 22:22:31 +02:00
Bananymous
4e900804b8
AOC2023: Implement day16
2023-12-19 22:22:16 +02:00
Bananymous
9ec733904f
AOC2023: Implement day15
2023-12-19 21:42:59 +02:00
Bananymous
3352640d09
LibC: strlen had to be marked not optimized...
2023-12-19 21:42:59 +02:00
Bananymous
637397dd2f
LibC: Make memcpy and memset not optimized
...
GCC does some weird optimizations and breaks these functions
2023-12-19 21:42:59 +02:00
Bananymous
5edbb1d5c4
LibC: make execvp fail if no executable found
2023-12-19 21:42:59 +02:00
Bananymous
f46240e879
AOC2023: Implement day14
2023-12-19 02:49:48 +02:00
Bananymous
68627995f8
AOC2023: Implement day13
2023-12-19 01:25:23 +02:00
Bananymous
951eac6bfa
Kernel: Implement hacky non-block read for ps2 keyboard
2023-12-19 00:20:46 +02:00
Bananymous
0833d7b43f
Kernel: Allow opening files with O_NONBLOCK
2023-12-19 00:20:15 +02:00
Bananymous
1cd5b3c20c
LibC: Fix stpncpy
...
I had misunderstood and tought that the string is always
null terminated
2023-12-15 00:33:37 +02:00
Bananymous
c773e2ed07
LibC: Optimize malloc even further
...
aoc2023/day12 now runs in 3.5 seconds on my machine. This is way
better than the old almost hour.
2023-12-14 23:49:25 +02:00
Bananymous
c4186bd5f0
LibC: Compile with -O2 optimizations
...
I have no idea why libc had no optimizations enabled.
Weird thing is that memcpy optimized to infinite loop if I kept the
__restrict__ attributes in pointers. I don't think there was any ub.
2023-12-14 23:40:08 +02:00
Bananymous
5f640da166
LibC: Optimize malloc by a lot
...
I now cache first free node in malloc_pool and whether the node is
last or not. There allow doing less full iterations over the whole
malloc pool.
Malloc is still unbearably slow and I will have to write a proper
fast malloc at some point. With this patch running aoc2023/day12 is
atleast possible. Probabaly will take closer to an hour...
2023-12-14 15:31:00 +02:00
Bananymous
7320104fd0
LibC: Mark __assert_fail as noreturn
2023-12-14 15:13:54 +02:00
Bananymous
d273c5e77c
rm: Use remove instead of unlink for removing files
2023-12-14 11:03:58 +02:00
Bananymous
8344f2f9ab
AOC2023: Fix day3 implementation
...
I accidently broke my day3 when messing with signed/unsigned integers
2023-12-14 11:03:19 +02:00
Bananymous
600bd7ee0f
LibC: Implement rmdir in unistd.h
2023-12-14 11:02:56 +02:00
Bananymous
adf1e54605
LibC: Implement more functions to string.h
2023-12-14 11:02:30 +02:00
Bananymous
a3de64f5fa
LibC: Implement basic version of system() this assumes Shell exists
2023-12-14 11:00:40 +02:00
Bananymous
8216d09e06
LibC: Implement non-locale specific functions from strings.h
2023-12-14 10:59:39 +02:00
Bananymous
694cda6e40
LibC: Implement remove for stdio
2023-12-14 10:58:50 +02:00
Bananymous
e227a87140
Kernel: Allow creating directories if path ends with '/'
...
Also create and create_dir will now fail with EEXISTS if file exists
2023-12-14 10:56:53 +02:00
Bananymous
6cd5763361
Kernel: Allow cloning of mmapped framebuffer regions
2023-12-14 10:54:06 +02:00
Bananymous
0f1c740fe8
Kernel: Implement two missing ubsan handlers needed by lai
2023-12-14 10:53:36 +02:00
Bananymous
3f3e81fcf2
Bootloader: Align boot information passed to kernel
...
UBSAN found this bug
2023-12-14 10:52:51 +02:00
Bananymous
862993398d
AOC2023: Implement day12
...
There seems to be a problem with my malloc so the hash map is not
working. This code worked fine on my linux with actually working
malloc :D
2023-12-14 10:51:48 +02:00
Bananymous
225c7c6ab4
AOC2023: Implement day11
2023-12-11 14:36:33 +02:00
Bananymous
58633ca373
AOC2023: Remove unnecessary loop
2023-12-10 20:18:59 +02:00
Bananymous
00d57d783e
LibC+userspace: Make everything compile with -Wall -Wextra -Werror
...
I added -Wall -Wextra -Werror as public compile flags to libc. Now
everything in userspace in compiled using these flags. I made all
necessary changes to allow compilation to work.
Only exception is execvp which has a large stack usage. Maybe it
should use malloc for the buffer but posix allows ENOMEM only when
kernel is out of memory... This can be fixed when fexecve is
implemented and there is no need for absolute path.
2023-12-10 19:20:14 +02:00
Bananymous
f077e17b2a
AOC2023: Implement day10
2023-12-10 18:28:04 +02:00
Bananymous
2f8759d2d3
Kernel: Make ext2 fs work with block sizes != 1024
2023-12-10 01:32:30 +02:00
Bananymous
a6bfbbf655
ls: Rewrite whole program for cleaner output
...
ls -l now sorts elements and aligns them by columns.
2023-12-10 01:05:12 +02:00
Bananymous
9d8c9baa3f
LibC: Remove unnecessary RWX mask definition
2023-12-09 19:43:49 +02:00
Bananymous
c273bf98c9
ls+stat: show setuid, setgid and sticky bits
2023-12-09 19:43:25 +02:00
Bananymous
99a5b6e2ef
AOC2023: Cleanup day9 code
...
Move tree building to its own function. Both parts can use the same
tree. This also decreaseas memory usage by one element by row :D
2023-12-09 19:08:13 +02:00
Bananymous
284a012509
Kernel: Add framebuffer information to kernel image
2023-12-09 17:33:58 +02:00
Bananymous
abc69fa3d5
Bootloader: Search framebuffer information from kernel memory
...
Framebuffer information is no longer hard coded into bootloader.
Kernel can define framebuffer info structure in its memory which is
used for finding proper video mode.
2023-12-09 17:32:10 +02:00
Bananymous
8b01e2d4a2
Bootloader: Generalize framebuffer video mode search
...
Framebuffer size is now taken as arguments to vesa_find_video_mode
2023-12-09 16:48:04 +02:00
Bananymous
0c3e5980d6
AOC2023: Implement day9
2023-12-09 16:22:43 +02:00
Bananymous
951873098e
BAN: Rewrite heap sort
...
Heap sort is now more close to gnulibc++ version. This is just more
simplified version.
2023-12-08 22:45:55 +02:00
Bananymous
2b927b9729
BAN: Restructure sort functions and namespaces
2023-12-08 18:58:47 +02:00
Bananymous
b523ccb893
AOC2023: Implement day8
...
Second part was kinda weird. You are supposted to assume something
of the input, which necessarily is not true.
2023-12-08 17:13:20 +02:00
Bananymous
7bb3172591
AOC2023: Use the default sort algorithm
2023-12-08 00:10:59 +02:00
Bananymous
be657b9b18
BAN: Add default sort. This is wrapper around sort_intro
2023-12-08 00:10:09 +02:00
Bananymous
94e6b9fa65
BAN: Implement intro sort
2023-12-07 23:56:11 +02:00
Bananymous
d8ea0eeba3
BAN: Add less than operator for iterator
2023-12-07 23:55:41 +02:00
Bananymous
6873244169
BAN: Move placement new to New.h
...
I have no idea why they were defined in Move.h
2023-12-07 23:52:57 +02:00
Bananymous
805b4096e9
BAN: Remove empty else. Builds with -Wall -Wextra
2023-12-07 23:50:35 +02:00
Bananymous
0f74e123b8
BAN: Implement ilog2 for unsigned integers
2023-12-07 23:50:04 +02:00
Bananymous
7f212106db
BAN: Implement heap sort
2023-12-07 23:18:49 +02:00
Bananymous
46c3da71b6
BAN: Cleanup sorting code
2023-12-07 23:18:49 +02:00
Bananymous
e5cab047d6
BAN: Implement more methods for iterators
2023-12-07 23:18:49 +02:00
Bananymous
bf3e9eabd5
BAN: Implement distance() for iterators
2023-12-07 23:18:49 +02:00
Bananymous
19604015de
BAN: Implement quick sort
2023-12-07 19:28:31 +02:00
Bananymous
08bc0a2815
BAN: Implement next() and prev() for iterators and use them in sorts
2023-12-07 19:28:05 +02:00
Bananymous
3bc7113cc5
sudo: fix some typos
2023-12-07 14:05:17 +02:00
Bananymous
24243268a6
Shell: do path resolution only if command doesn't contain '/'
2023-12-07 13:34:46 +02:00
Bananymous
2e858fddb5
Kernel: Remove obsolete Scheduler::is_valid_tid()
...
This function was used when processes could die at any point in time.
Now that processes can only die in known spots, we can be sure they
are not holding any locks. This allows much more performant locking.
2023-12-07 13:26:42 +02:00
Bananymous
12474addda
Kernel: Make Inodes use the new lock
...
Also remove old lock from TTY since it can just use the one Inode
already has.
2023-12-07 13:19:12 +02:00
Bananymous
7c25e4ce5a
Kernel: Implement RecursivePrioritySpinLock
...
This locks won't allow locking from userspace thread if there is
kernel thread waiting to lock this.
2023-12-07 13:18:21 +02:00
Bananymous
669d55707e
AOC2023: Use quick sort in solution
2023-12-07 11:55:28 +02:00
Bananymous
6caa9b6f95
BAN: implement quick sort and test for it
2023-12-07 11:55:28 +02:00
Bananymous
59ad639fa8
BAN: Fix simple iterator operator--()
2023-12-07 11:55:28 +02:00
Bananymous
43458cc74f
BAN: implement exchange sort and test for it
2023-12-07 11:55:28 +02:00
Bananymous
e935a33a4d
BAN: add value_type to iterators
2023-12-07 10:15:18 +02:00
Bananymous
536bb74d53
AOC2023: optimize hand score calculation
2023-12-07 09:26:17 +02:00
Bananymous
a872efdef2
BAN: implement basic swap
...
This will be improved, currently just works on general type T and
moves values between arguments.
2023-12-07 09:26:17 +02:00
Bananymous
efd8be8207
AOC2023: implement day7
2023-12-07 07:56:56 +02:00
Bananymous
06a84da844
Userspace: Implement barebones sudo
...
This doesn't do any password checking or anything. Just sets uid and
gid before execvp()
2023-12-06 18:15:42 +02:00
Bananymous
24b71d1170
Kernel: Appreciate setuid and setgid bits executables
2023-12-06 18:14:27 +02:00
Bananymous
0dc168a8c0
LibC: Implement basic execvp
2023-12-06 18:14:00 +02:00
Bananymous
76049b2e13
LibC: Implement and fix some string.h functions
2023-12-06 18:13:34 +02:00
Bananymous
393ac33e3c
Kernel: Make sys_nanosleep interruptable by signals
2023-12-06 16:22:24 +02:00
Bananymous
deeb6d2756
Kernel: Cleanup sys_sleep() and TTY::read_impl
2023-12-06 16:21:22 +02:00
Bananymous
1ac831d4b1
Kernel: Add API to block on semaphore until unblock or EINTR
2023-12-06 16:13:07 +02:00
Bananymous
534969df32
Kernel: Scheduler::unblock_thread() wakes sleeping threads
2023-12-06 16:12:37 +02:00
Bananymous
976ae64f88
LibC: make sleep() set errno if sleep woke up early
2023-12-06 13:13:43 +02:00
Bananymous
a12ffaa8a2
Kernel: Make sleep syscall interruptable
2023-12-06 13:13:37 +02:00
Bananymous
ff8b3be8dc
Userspace: implement basic sleep command
2023-12-06 13:05:53 +02:00
Bananymous
56008869d6
Shell: Handle keyboard input that was interrupted by signal
2023-12-06 13:04:33 +02:00
Bananymous
1c78671078
Kernel: Rework all signal code
...
Signal handling code was way too complex. Now everything is
simplified and there is no need for ThreadBlockers.
Only complication that this patch includes is that blocking syscalls
have to manually be made interruptable by signal. There might be some
clever solution to combat this is make this happen automatically.
2023-12-06 13:02:17 +02:00
Bananymous
cdcc36efde
Kernel: Remove unnecessary raise syscall
2023-12-06 13:00:45 +02:00
Bananymous
336daa2cc5
Kernel: Add helper for checking whether segment is from userspace
2023-12-06 12:57:13 +02:00
Bananymous
531211e09d
AOC2023: implement day6
2023-12-06 07:27:25 +02:00
Bananymous
894065a67e
LibC: cleanup and fix fgets
...
My quick fix for fgets wrote non-nullterminated newline if size was
one.
POSIX doesn't specify what happens if size == 0, so I do the same as
glibc and return NULL without setting errno.
2023-12-05 10:00:43 +02:00
Bananymous
82cb2ea20b
AOC2023: implement day5
2023-12-05 09:13:13 +02:00
Bananymous
95fc894303
LibC: fix fgets when reading empty line
2023-12-05 07:46:14 +02:00
Bananymous
622007f2ee
Shell: Verify that command exists before executing it
...
This prevents page fault somewhere when executing non-existing
commands.
2023-12-04 22:57:27 +02:00
Bananymous
cf76d2e7d9
AOC2023: remove unnecessary loop
2023-12-04 17:54:10 +02:00
Bananymous
41f8974080
AOC2023: implement day4
2023-12-04 17:51:27 +02:00
Bananymous
3ed25425a3
AOC2023: implement day3
...
Solution to second puzzle is not optimal, it definately should be
O(1) space, but I didn't want to think about it.
2023-12-03 17:07:09 +02:00
Bananymous
49f8c4268f
AOC2023: implement day2
2023-12-02 16:10:37 +02:00
Bananymous
70c224d8ea
AOC2023: Cleanup day1 code
2023-12-01 13:31:55 +02:00
Bananymous
6a7335e5c9
AOC2023: implement day1
2023-12-01 12:38:01 +02:00
Bananymous
3aaa755c51
AOC2023: update buildsystem
2023-12-01 12:38:01 +02:00
Bananymous
c140dd2a65
Kernel: Fix keyboard layout for underscore
2023-12-01 12:31:16 +02:00
Bananymous
dabd79afa7
Userspace: Prepare aoc2023 environment :)
2023-12-01 01:22:53 +02:00
Bananymous
6ccb1bbbf9
init: set default termios on every username prompt
...
Before if e.g. Shell crashed init would have broken termios
2023-12-01 01:22:53 +02:00
Bananymous
9b841cb823
BuildSystem/Kernel: Enable -Wextra and -Werror in kernel
...
Only needed to fix some unused variable bugs
2023-12-01 01:22:53 +02:00
Bananymous
c1cac43f28
BuildSystem: Don't build lai with -Wstack-usage
...
Lai has two functions that trigger warnings on gcc. There isn't
really anything I can do about it, so just disable the warning
2023-12-01 01:22:53 +02:00
Bananymous
8564b59e14
image: Remove inheritance from Netbpm
...
This inheritance made no sense
2023-11-29 20:56:05 +02:00
Bananymous
fdb6dc94ba
Kernel: cast between inheritance with static_cast
...
using reinterpret_cast is not a good idea. preferably we would use
dynamic_cast, but that is not possible since kernel is compiled with
-fno-rtti.
2023-11-29 20:50:57 +02:00
Bananymous
327b330338
Kernel: Make internal framebuffer bpp constexpr defined in libc
2023-11-29 20:07:33 +02:00
Bananymous
7090388c70
cp: allow copying all files except directories
...
The old condition seemed odd. This allows taking screen shots by
copying the /dev/fb0.
2023-11-29 16:13:40 +02:00
Bananymous
ff550785a7
Userspace: Implement basic image rendering for Netbpm
...
You can now render Netbpm (P6) format image to framebuffer using
`image` command. I added basic test image to
/usr/share/images/sample.ppm
2023-11-29 16:11:35 +02:00
Bananymous
d7a3aca5d4
Kernel: Use the correct bpp when writing to framebuffer
2023-11-29 00:31:24 +02:00
Bananymous
056586486d
Shell: make clear use \e[2J instead of \e[J
...
This makes kernel to actually clear the full screen. If framebuffer
did not fit font exactly last row would be left partially uncleared
2023-11-28 23:55:37 +02:00
Bananymous
42a1d26d5b
Userspace: Implement basic test for framebuffer mmap
2023-11-28 23:52:22 +02:00
Bananymous
cc572af390
Kernel: Implement mmaping for framebuffer device
2023-11-28 23:51:56 +02:00
Bananymous
4275d2ce48
Kernel: Add framebuffer device to devfs
2023-11-28 23:51:28 +02:00
Bananymous
4a87d6052b
Kernel: Add API for implementing mmappable devices
2023-11-28 23:50:49 +02:00
Bananymous
d86ecf4f61
Kernel: Reading from negative offset in fb dev gives out info
2023-11-28 23:50:11 +02:00
Bananymous
09b7cb2f33
Kernel/LibC: Implement pread()
2023-11-28 23:47:30 +02:00
Bananymous
4c3da66c92
mmap-shared-test: Add test case for msync
2023-11-22 22:45:16 +02:00
Bananymous
60e755210c
Kernel/LibC: Implement very basic msync
2023-11-22 22:44:06 +02:00
Bananymous
ab9954fe73
Kernel: Delete the now obsolete VesaTerminalDriver
2023-11-22 21:59:11 +02:00
Bananymous
fd18071975
Kernel: Implement TerminalDriver for Framebuffer device
...
Use this new FramebufferTerminalDriver for terminal instead of the
old VesaTerminalDriver. Only drawback with this is that framebuffer
device can only be intialized after DevFS is initialized.
2023-11-22 21:57:17 +02:00
Bananymous
b88a7e0c6b
Kernel: Add more APIs to FramebufferDevice
2023-11-22 21:56:27 +02:00
Bananymous
cdf53f33f6
Kernel: Implement basic framebuffer device
...
This allows exposing framebuffer to userspace
2023-11-22 20:34:41 +02:00
Bananymous
25485069e6
Bootloader: Add cache to ext2 inode data block indices
...
This reduces the number of read calls with current kernel size from
~1700 to ~700 (60% performance boots). Loading the kernel is now alot
faster.
2023-11-22 13:54:53 +02:00
Bananymous
f80bd040c8
Bootloader: add missing size directive
2023-11-21 19:11:48 +02:00
Bananymous
bc5e8add19
Kernel: Make Ext2 filesystem use BlockDevice instead of Partition
2023-11-21 15:20:24 +02:00
Bananymous
7a8fd6d04a
Kernel: TmpFS doesn't mark any functions as final
...
I didn't think these would be overloaded, but they are
2023-11-21 15:19:34 +02:00
Bananymous
b749963b62
Kernel: Add common {read,write}_blocks() api to BlockDevice
2023-11-21 15:19:07 +02:00
Bananymous
6a068fb9f9
Kernel: Move Partition to its own file
2023-11-21 15:16:04 +02:00
Bananymous
19ed0cb9bf
BAN: Add basic GUID data structure
2023-11-21 15:11:50 +02:00
Bananymous
d08e876319
BuildSystem: Check value of BANAN_UEFI_BOOT with `if ((...)); then`
2023-11-21 11:53:50 +02:00
Bananymous
f2a6f213dd
BuildSystem: Add missing bootloader install script
2023-11-20 14:19:07 +02:00
Oskari Alaranta
f7a5bfbccd
Merge pull request 'BuildSystem: custom mount directory for bananos image to avoid conflicts' ( #4 ) from Sinipelto/banan-os:main into main
...
Reviewed-on: Bananymous/banan-os#4
2023-11-20 14:16:58 +02:00
Sinipelto
6624821f55
BuildSystem: image sh
...
mount in build dir
Signed-off-by: Sinipelto <sinipelto@noreply.bananymous.com>
2023-11-20 14:12:35 +02:00
Sinipelto
328acd894f
BuildSystem: image create sh
...
use banan build dir
Signed-off-by: Sinipelto <sinipelto@noreply.bananymous.com>
2023-11-20 14:11:29 +02:00
Sinipelto
01b17eaadc
Update script/image.sh
...
mount dir default value
Signed-off-by: Sinipelto <sinipelto@noreply.bananymous.com>
2023-11-20 13:28:53 +02:00
Sinipelto
fd16d6802c
Update script/image-create.sh
...
custom mount dir
Signed-off-by: Sinipelto <sinipelto@noreply.bananymous.com>
2023-11-20 13:28:10 +02:00
Sinipelto
fed2738805
Update script/image.sh
...
handle custom mount dir
Signed-off-by: Sinipelto <sinipelto@noreply.bananymous.com>
2023-11-20 13:24:15 +02:00
Sinipelto
9ad2ea8205
Merge pull request 'update main' ( #1 ) from Bananymous/banan-os:main into main
...
Reviewed-on: #1
2023-11-20 13:20:51 +02:00
Bananymous
f8f7e2208f
BuildSystem: Remove old bootloader target
...
And creating image now builds the bootloader
2023-11-20 00:56:06 +02:00
Bananymous
8630f71f0c
Toolchain: Build full toolchain with one call to toolchain/build.sh
2023-11-20 00:56:06 +02:00
Bananymous
9e44e8be75
Buildsystem: default bootloader is not my custom one
...
You can set BANAN_BOOTLOADER=GRUB to use grub instead. Image creation
does not convert disk image now automatically between bootloaders and
calling ./bos image-full is now required.
2023-11-18 17:18:03 +02:00
Bananymous
cadb56d8ba
Kernel: ProcFS inodes reflect processes ruid/rgid
...
setgid/setuid did not change the permissions of procfs inodes. This
made Shell launched by init not appear in meminfo.
2023-11-18 14:26:44 +02:00
Bananymous
cd646a1ab7
Bootloader do some directory restructuring
2023-11-18 13:59:45 +02:00
Bananymous
c9e9cfd361
Bootloader: Implement VESA video mode query and pass it to kernel
...
Kernel now gets framebuffer from bootloader. Framebuffer dimensions
and bpp are hardcoded in bootloader, but will probably be read from
config file at some point.
2023-11-17 22:45:35 +02:00
Bananymous
ac96ea3370
Bootloader: Fix kernel memset to zero
2023-11-17 21:05:02 +02:00
Bananymous
ef53aab24a
Bootloader add temporary initial command line
...
This will probably be read from some config file at some point
2023-11-17 20:38:38 +02:00
Bananymous
cb5a5d3ed1
Kernel/Bootloader: banan-os can now be booted with my bootloader :D
2023-11-17 20:33:02 +02:00
Bananymous
d1444761a3
Bootloader: Clear screen, better memcpy
...
Clear screen before jumping to kernel. Memcpy now uses ebx as offset
register, so only one register has to updated every loop
2023-11-17 20:31:42 +02:00
Bananymous
95af728e39
Kernel: Don't calculate divisor in a for loop in ext2 inodes
2023-11-17 19:02:01 +02:00
Bananymous
24d87acec4
Kernel: Serial now uses random size for some serial ports
...
If the serial port doesn't repond with a size, just use a random
one. There is no reason to ditch the whole output if you cannot
determine its size.
2023-11-17 18:56:02 +02:00
Bananymous
84040e64b8
Kernel: Don't use multiboot2 explicitly. Parse it to common structure
...
This allows support of multiple different bootloaders
2023-11-17 18:54:59 +02:00
Bananymous
641a2dec00
Bootloader: Load kernel to memory and jump to it!
2023-11-17 16:36:29 +02:00
Bananymous
9e69053e64
Bootloader enter unreal mode at the start of stage2
2023-11-17 14:22:21 +02:00
Bananymous
1a415a380a
Bootloader: Fix getting command line
2023-11-17 13:17:44 +02:00
Bananymous
a19c5c672b
Bootloader: implement reading from inode
2023-11-17 13:17:44 +02:00
Bananymous
3bcbc7c018
Bootloader: add support for indirect inode blocks
2023-11-16 13:34:21 +02:00
Bananymous
b371abade5
Bootloader: Add helpers for printing n bit hexadecimal numbers
2023-11-16 13:30:01 +02:00
Bananymous
9d4101e0c5
Bootloader: Implement basic ext2 filesystem
...
This can search for files in an ext2 filesystem. Only 12 blocks
are currently supported.
Now only ELF loading is missing for loading the actual kernel!
2023-11-15 16:58:26 +02:00
Bananymous
c791a1c200
Bootloader: Build with cmake instead of custom script
2023-11-14 03:44:47 +02:00
Bananymous
bd3f2bb61c
Bootloader: Split bootloader into multiple files
...
This cleans up the code since bootloader is starting to near 1k lines
2023-11-14 03:27:52 +02:00
Bananymous
7ca9a961b3
Bootloader move bootloader code from arch directory
...
The os itself only supports x86 so this won't matter. x86_64 and i386
use the same bootloader assembly.
2023-11-13 21:42:58 +02:00
Bananymous
cbb9422ee0
Bootloader: installer now uses banan os elf headers intead of Linux's
2023-11-13 21:40:15 +02:00
Bananymous
2c2ee6636f
fixup
2023-11-13 21:39:48 +02:00
Bananymous
3beebd721f
LibELF: Remove 2 32 bit types that don't exist
2023-11-13 21:39:39 +02:00
Bananymous
048bbf874a
Bootloader: Find root partition from GPT header
2023-11-13 18:55:48 +02:00
Bananymous
d2970b5b8d
Bootloader: installer now patches GPT GUID's
2023-11-13 18:53:55 +02:00
Bananymous
0004d3b435
Bootloader: Add API to create GUID from string
2023-11-13 18:52:41 +02:00
Bananymous
d5aa08baa5
BuildSystem: add bootloader target
...
Use this target to run banan-os with custom bootloader
2023-11-12 01:50:30 +02:00
Bananymous
5362962d9a
BuildSystem: add proper clean target
2023-11-12 01:14:42 +02:00
Bananymous
bfe6d60e9e
ls: print link targets when listing files
2023-11-11 23:17:18 +02:00
Bananymous
c084ce8b01
Kernel/LibC: Implement readlink and readlinkat
2023-11-11 23:16:52 +02:00
Bananymous
381cfdad77
Bootloader: Continue work on bootloader
...
Bootloader can now get the memory map and read cmdline from user.
Now 'just' video mode query, ext2 and ELF parsing are needed :D
2023-11-11 22:49:00 +02:00
Bananymous
cfc7313451
Bootloader: Start work on bootloader
...
I wrote a fast first stage bootloader and a installer to put it into
a disk image.
2023-11-09 22:42:47 +02:00
Bananymous
bc8fd1285f
Toolchain: Fix typo when setting make flags
...
I defaultet MAKEFLAGS to -j which will launch processes in parallel
without any limit.
2023-11-09 21:57:45 +02:00
Bananymous
8e5224ef53
Toolchain: add em=gnu to gas. This allows using / in expressions
2023-11-09 21:43:13 +02:00
Bananymous
fda0dfec30
Kernel: Make TmpFS enforce max page count.
2023-11-07 16:13:21 +02:00
Bananymous
d6ae1bcf36
Kernel: Remove now obsolete RamFS
...
Everything is using now the better TmpFS which uses physical pages
for page allocation instead of the static kmalloc memory.
2023-11-07 16:07:11 +02:00
Bananymous
5044810451
Kernel: Make DevFS use the new and better TmpFS instead of RamFS
2023-11-07 16:05:05 +02:00
Bananymous
147cd93ed3
Kernel: Add method to TmpFS for looping over all (cached) inodes
2023-11-07 16:04:34 +02:00
Bananymous
07b5920f3f
Kernel: Lock TmpFS in all its methods
2023-11-07 16:03:52 +02:00
Bananymous
2bcf934389
Kernel: Implement symlinks to TmpFS
2023-11-07 15:59:50 +02:00
Bananymous
1405712f26
Kernel: Make PS/2 keyboard wait until interrupts are enabled
2023-11-07 15:58:50 +02:00
Bananymous
a8ffe6b3a6
BuildSystem: Fix temporary sysroot creation in toolchain compilation
2023-11-07 14:16:49 +02:00
Bananymous
613d6640fe
meminfo: better format for files without permissions
2023-11-07 02:41:01 +02:00
Bananymous
885ed218fa
Kernel: Make unlinking from /proc always fail with EPERM
2023-11-07 02:40:27 +02:00
Bananymous
b1f431d962
Kernel: /tmp is now TmpFS instead of RamFS
2023-11-07 02:36:22 +02:00
Bananymous
06e176e6b9
Kernel: Make ProcFS use the new TmpFS internally
2023-11-07 02:35:44 +02:00
Bananymous
b7771e95ac
Kernel: Implement TmpFS Inode unlinking and deletion
2023-11-06 21:49:12 +02:00
Bananymous
3e33fc156b
Kernel: TmpFS directory inodes now iterate over only valid entries
2023-11-06 21:41:51 +02:00
Bananymous
438f01a856
Kernel: Fix TmpFS directory entry enumeration early return
2023-11-06 21:06:10 +02:00
Bananymous
5dd8189048
Kernel: Fix ext2 directory listing for big directories
2023-11-06 21:05:58 +02:00
Bananymous
ff6b127c3a
Kernel: Implement TmpFS directory listing
2023-11-06 21:05:58 +02:00
Bananymous
c3ed700324
Kernel: Implement TmpFS inode chmod
2023-11-06 20:11:34 +02:00
Bananymous
ba2f09a4e6
Kernel: Cleanup TmpFS code and block access doesn't require allocs
...
TmpFS blocks are now accessed with a simple wrapper
2023-11-06 20:07:09 +02:00
Bananymous
c92c1b8e2b
Kernel: TmpInode blocks are on demand allocated
2023-11-06 10:44:37 +02:00
Bananymous
c27d20abd8
Kernel: Implement read/write/truncate for TmpFileInode
2023-11-05 02:28:43 +02:00
Bananymous
99d7b0917d
Kernel: Start work on proper TmpFS in Heap instead of kmalloc memory
2023-11-04 18:18:45 +02:00
Bananymous
8b4e129fc1
Kernel: Add better APIs for fast page
2023-11-04 18:13:16 +02:00
Bananymous
240d57f4b4
BAN: Update bytespan -> span API
2023-11-04 18:12:46 +02:00
Bananymous
f6c312a6b3
BuildSystem: using sysroot doesn't need root privileges anymore!
...
Sysroot is now created with fakeroot. This allows root access to be
only needed for disk image creation, since it uses loopback devices.
2023-11-04 17:50:43 +02:00
Bananymous
ca34ece8ef
BAN: Update ASSERT api
...
its now much harder to mix < with <= and > with >=
2023-11-02 00:01:12 +02:00
Bananymous
71ecdd7245
Kernel: Canonicalize vaddr before using it
2023-10-30 19:20:17 +02:00
Bananymous
b80b59ce24
Kernel: Remove unused externs in kernel.cpp
2023-10-30 19:09:31 +02:00
Bananymous
640d27748f
Kernel: Temporarily force FileBackedRegion mappings writable
...
Now that write-protect bit is enabled this is neccessary.
2023-10-30 19:08:33 +02:00
Bananymous
42772611ce
Kernel: Add fast page to page table
...
Add "fast page" to KERNEL_OFFSET. This is always present in page
tables and only requires changing the page table entry to map. This
requires no interrupts since it should only be for very operations
like memcpy.
I used to map all temporary mappings to vaddr 0, but this is much
better. C++ standard always says that nullptr access is undefined
and this gets rid of it.
Fixed some bugs I found along the way
2023-10-30 19:02:09 +02:00
Bananymous
6e676ee8c5
Kernel: Remove GeneralAllocator since it was not used
2023-10-30 18:13:17 +02:00
Bananymous
066fb44105
Kernel: Allow offsetof with packed fields
...
This is not standard C++ but should be fine with my toolchain.
2023-10-30 17:51:18 +02:00
Bananymous
3f638f125e
Kernel: panic takes arguments as rvalue references
2023-10-30 16:22:02 +02:00
Bananymous
35f8f44510
Kernel: Fix ext2 small link deallocation
...
Also fix deallocation bug
2023-10-30 16:22:02 +02:00
Bananymous
0c590821ed
Kernel: only map kernel from g_kernel_start onwards
2023-10-30 16:22:02 +02:00
Bananymous
3c311efb81
BAN: Implement better ASSERT macros
...
Implement macros for all basic binary ops. These macros print failed
values when the fail.
2023-10-30 16:22:02 +02:00
Bananymous
6ef153b6ca
Kernel: Enable Write Protect. This seems to be good for security
2023-10-30 12:23:22 +02:00
Bananymous
130a69bac6
Kernel: Fix stack OOB detection
...
I now check both interrupt and normal stack to detect OOB. Processes
are killed if they encouner stack over/under flow.
2023-10-30 12:17:08 +02:00
Bananymous
b5d873dfae
Kernel/LibELF: Map pages always as RW so kernel can write to them
...
Kernel doesn't seem to require W permissions to a page without UEFI
so this had not been found earlier.
2023-10-30 12:14:12 +02:00
Bananymous
d5e0900cbb
BAN: String now uses union for its sso storage
...
This allows String to shrink by 8 bytes since Variant's 8 index is
no longer stored in here.
This required me to make Strings max size one bit less, but that
should still be fine. There should never be strings with size of
over half of the computer's address space.
2023-10-30 11:13:16 +02:00
Bananymous
a63006afaf
Userspace: Add quick test for global ctors and dtors
2023-10-30 11:11:10 +02:00
Bananymous
7c6832cee4
LibC: implement and call __cxa_finalize() on exit()
...
This allows global destructors to be actually called
2023-10-30 11:10:08 +02:00
Bananymous
0b5fcb3f88
Kernel/LibC: Add crt* files to LibC and remove crt0 from kernel
...
There was no reason for libc get crt0 from kernel.
2023-10-30 11:06:13 +02:00
Bananymous
f33c0bad99
Toolchain: Clone GCC and Binutils from git
...
This feels much cleaner than just downloading tar balls from
pregiven urls. Also patching works much better like this!
I added --disable-initfini-array since global constructors were
not called.
2023-10-30 11:02:57 +02:00
Bananymous
18f61c5427
Kernel: Fix ACPI DSDT address
...
Read x_dsdt address only if fadt's length contains it. Bochs seems
to have version 1 fadt without the x_* fields.
2023-10-29 21:35:11 +02:00
Bananymous
229082a1b2
BAN: Rewrite String with small string optimizations
...
String now holds a 15 byte sso buffer. I'm not sure what the size
should actually be but 15 will work for now. Maybe the sso buffer
should be contained in an union with one bit flag in size instead of
variant that uses extra 8 bytes for type index.
This patch buffs sizeof(String) from 24 bytes to 32 bytes on 64 bit.
I assume this is much better version than the old which had to make
allocation even for empty strings :D.
2023-10-29 03:11:13 +03:00
Bananymous
0db17e9d39
BAN: Add variant to ForwardList
...
I should be using the forward list more
2023-10-29 02:28:55 +03:00
Bananymous
2d34b2b8a3
BuildSystem: Add bos short hand for building with zsh completions :)
2023-10-28 22:23:29 +03:00
Bananymous
76f48f095c
Kernel: Rewrite a lot of ext2 code
...
This commit consists of multiple big changes
1. blocks for inodes are now allocated on demand
- reading from non allocated block will just return zeroes
- writing to non allocated block allocates it
2. code doesn't really use raw pointers anymore
- all casts to uint32_t or structures are now replaced with
spans. either as<T> or as_span<T> which both are bounds
checked
3. code doesn't depend on random macros for accessing indirect blocks
- i added some recursive functions which take care of this :)
2023-10-28 22:13:28 +03:00
Bananymous
d98f84f9d3
BAN: Update ByteSpan API
...
Add ByteSpan::as_span<T> and const versions of as() and as_span()
require T to be const.
2023-10-28 22:10:47 +03:00
Bananymous
240a687d8f
Kernel: Fix ext2 inode block allocation with triply indirect blocks
2023-10-28 16:53:00 +03:00
Bananymous
35b46e37bb
Kernel: Fix ext2 inode deletion cleanup
...
I now cleanup all blocks (including direct) in i_block array
2023-10-28 16:52:56 +03:00
Bananymous
14d24bce98
All: Remove read only from ext2 filesystem :)
2023-10-26 13:26:10 +03:00
Bananymous
ea0d7156a4
rm: add option to remove recursively
2023-10-26 02:32:49 +03:00
Bananymous
38c267b4c8
Kernel: Fix ext2 inode deletion
...
fsck now reports clean filesystem even after deleting files
2023-10-26 02:05:05 +03:00
Bananymous
81228d3401
Userspace: implement basic rm command
2023-10-25 21:45:27 +03:00
Bananymous
87ff38664a
Kernel/LibC: Add syscall and wrapper for unlink
2023-10-25 21:45:04 +03:00
Bananymous
b7007016c0
BAN: Implement Ext2 file unlinking
...
Ext2 inodes can now be unlinked from directories and after last
inode closes (destructor gets called) we check if link count is 0
and cleanup the inode from filesystem
2023-10-25 21:43:36 +03:00
Bananymous
3566ddab00
BAN: ByteSpan can be sliced without specified size
...
This will give span with all remaining size after offset
2023-10-25 21:41:11 +03:00
Bananymous
6ee4d10651
Kernel/LibC/Userspace: Implement mkdir and creat
...
Touch now uses creat insteadd of open with O_CREAT flag
2023-10-25 21:07:26 +03:00
Bananymous
e9b7cf332d
Kernel: Implement directory creation for RamFS
2023-10-25 19:41:34 +03:00
Bananymous
4ee2f0f789
Kernel: Implement Ext2 directory creation
2023-10-25 19:37:04 +03:00
Bananymous
18e90d305d
Kernel: Add Inode API for creating directories
2023-10-25 19:36:04 +03:00
Bananymous
fd1b331b86
Kernel: Ext2FS now uses Ext2Inodes as cached values
2023-10-25 19:34:00 +03:00
Bananymous
5c51d09309
Kernel: Fix read offset of RamFileInode
2023-10-25 02:53:20 +03:00
Bananymous
c445ea6266
cp: abort copy if write fails
2023-10-25 02:43:02 +03:00
Bananymous
e685f38fd1
Userspace: Add basic chmod command
2023-10-25 02:37:19 +03:00
Bananymous
627b8cc140
Kernel/LibC: implement chmod syscall + libc wrapper
2023-10-25 02:35:37 +03:00
Bananymous
657f95d3f0
Userspace: Implement basic cp
...
This does not support any meaningful command line arguments but
is a good start.
2023-10-25 00:07:25 +03:00
Bananymous
07f8c972b3
Shell: Set get old termios earlier
...
I sourced the config file before getting old termios. Sourcing
updated the termios so old_termios was always in non canonical, non
echoing mode.
2023-10-24 19:10:53 +03:00
Bananymous
fc8a000e46
BAN: Fix bug of size of splice after slice()
...
I have no idea what was I doing before :D
2023-10-24 17:23:45 +03:00
Bananymous
6f6ccbfa04
meminfo: fix g++ warning for oob write
...
g++ doesn't realize that read can only return -1
2023-10-24 16:50:21 +03:00
Bananymous
c71ac588b2
BuildSystem: Fix bugs in new build system
...
I had not tested the new build system with clean toolchain build
but it seems to work now.
2023-10-24 16:48:46 +03:00
Bananymous
2d0da93ac4
Kernel: Add timeout to ACHI commands
...
ACHI commands can now fail from timeouts.
2023-10-24 11:56:25 +03:00
Bananymous
fb801044ec
BuildSystem: Match README.md with the new buildsystem
2023-10-24 11:56:00 +03:00
Bananymous
ce87e0a605
BuildSystem: Rewrite whole build system structure
...
Now you have to use script/build.sh for building and running banan-os
2023-10-24 11:56:00 +03:00
Bananymous
f3d9da9549
Kernel: Rewrite all read/write functions to use BAN::ByteSpan
...
This allows us to not work with raw pointers and use sized containers
for reading and writing.
2023-10-24 11:56:00 +03:00
Bananymous
71cad2fc38
BAN: Implement ByteSpan
...
This is a span over exisiting containers/data types. I'm not too
happy with the constructors and assignment operators, but they will
work for now
2023-10-20 04:59:29 +03:00
Bananymous
61c7a68f4a
BAN: add helper to cast Span<T> to Span<const T>
2023-10-20 04:59:08 +03:00
Bananymous
c17cdb39d5
Kernel: Map multiboot2 memory in PageTable initialization
...
It cannot be assumed that multiboot data lies between kernel_end
and 2 GiB mark, so I properly allocate virtual address space for it.
2023-10-17 01:15:08 +03:00
Bananymous
69a39b7077
Kernel: Start using multiboot2 instead of multiboot
...
This allows better compatibility with (U)EFI and gives RSDP location
instead of me having to scan ram to find it.
2023-10-17 01:06:24 +03:00
Bananymous
19696bdad3
Kernel: TTY doesn't panic if it doesn't find input device
2023-10-16 16:58:39 +03:00
Bananymous
00dd7d85ce
Kernel: Fix device identification with all bits as ones
...
If device identification sends all ones, don't initialize the device.
2023-10-16 16:57:07 +03:00
Bananymous
0c88c74b76
Kernel: ATABuses are but to compatibility mode if possible
...
I don't support native mode ata bus (irq sharing) so ata buses are
but to compatibility mode if possible.
2023-10-16 16:56:12 +03:00
Bananymous
c4a640bcb6
Kernel: Fix ATADevice naming
...
ATADevice now stores its name instead of using static buffer. Old
static buffer was changing on every name query. I just hadn't noticed
since virtual machine disks were always sda.
2023-10-16 16:52:15 +03:00
Bananymous
0fdf8b6f68
Kernel: Fix PCI bugs
...
IO BarRegion used vaddr instead of the correct paddr. Add API for
memory region iobase query.
2023-10-16 16:50:49 +03:00
Bananymous
37bc52988c
Kernel: Don't require framebuffer
...
Initializes virtual tty only if framebuffer is initialized
2023-10-16 01:44:54 +03:00
Bananymous
1312a9dad2
Kernel: PCI checks if ethernet device is E1000 before initialization
...
I used to treat all ethernet deivices as E1000 but now it is actually
verified before initialization
2023-10-16 01:44:54 +03:00
Bananymous
73b9c28457
Kernel: PCIDevice stores its vendor id and device id
2023-10-16 01:44:54 +03:00
Bananymous
29db8d0d40
BuildSystem: add cmake variable UEFI_BOOT
...
If this variable is defined in cmake, image will be build with esp
and booted with uefi.
2023-10-16 01:44:54 +03:00
Bananymous
5bf0f9742a
Toolchain: Build grub with efi capabilities
2023-10-16 01:37:12 +03:00
Bananymous
fc5bfa2cb3
Kernel: Clear TTY when setting as current
...
Actually this should replace from old buffer, but this works
for now.
2023-10-13 17:20:26 +03:00
Bananymous
f7e38ccfe4
Kernel: Don't crash if header type != 0 in bar region creation
...
Also remove spammy debug printing
2023-10-13 16:32:32 +03:00
Bananymous
128202a55a
Kernel: Cleanup GDT code
2023-10-13 16:18:22 +03:00
Bananymous
89d74a9088
Kernel: Separate scheduler execution and stack loading
...
Not sure if this is actually needed, but this allows actual
executing function to be in clean environment
2023-10-13 16:17:27 +03:00
Bananymous
63f64619bc
Kernel: add NEVER_INLINE and make Interruptable not constructable
2023-10-13 16:17:27 +03:00
Bananymous
518fd3fad0
Kernel: Add 16 more irq handlers
...
IDT will now panic if trying to assing handler for non supported
irq.
2023-10-13 16:17:27 +03:00
Bananymous
74b77ba2ac
Kernel: Debug temporary debug print just to beginning when full
2023-10-13 12:43:52 +03:00
Bananymous
888e44ce0b
Kernel: Allow getting ACPI headers with same signature
2023-10-13 11:24:21 +03:00
Bananymous
b3b8376cca
Kernel: Fix PhysicalRange mapping size
2023-10-13 03:45:01 +03:00
Bananymous
9c143d18b9
Kernel: Add temporary terminal output before controlling terminal
...
Starting work on getting this boot on real hardware.
2023-10-13 03:31:36 +03:00
Bananymous
9a6cc0dc2d
Kernel: Check whether ELF address space can be loaded
...
Before reserving address space in SYS_EXEC verify that ELF address
space is actually loadable. For example when trying to execute the
kernel binary in userspace, binarys address space would overlap with
current kernel address space. Now kernel won't crash anymore and
will just send SIGKILL to the process calling exec*().
2023-10-12 22:59:36 +03:00
Bananymous
8c792f9c6d
Shell: Fix parsing $ with unknown character
2023-10-12 22:24:27 +03:00
Bananymous
adc5ff9e99
Kernel: Implement AHCI driver
...
SATA drives can now be used with banan-os. This allows much faster
disk access (writing 10 MiB from 30s to 1.5s). This can definitely
be optimized but the main slow down is probably the whole disk
structure in the os.
AHCI drive is now the default when running qemu.
2023-10-12 21:53:48 +03:00
Bananymous
bde9ff9319
Kernel: Generalize ATA device and cleanup code
2023-10-12 21:35:25 +03:00
Bananymous
75fdf4c3c6
Kernel: Add Timer::ns_since_boot()
2023-10-12 21:16:39 +03:00
Bananymous
b723ed5fd2
Kernel: Add vaddr/paddr conversion functions to DMARegion
2023-10-12 15:20:05 +03:00
Bananymous
89c975350d
Kernel: PCI can now get interrupts for devices
2023-10-11 22:18:58 +03:00
Bananymous
f27974dd3c
Kernel: PCI cleanup PCI::Device API
2023-10-11 21:52:08 +03:00
Bananymous
744ff40ba0
BAN: Optional can now be constructed from another Optional
...
Also fix bug in release_value() where we did not call the
destructor.
2023-10-11 20:10:06 +03:00
Bananymous
d4c9f371a6
Kernel: make DMARegion::create static and fix mapping
2023-10-08 18:18:36 +03:00
Bananymous
2aabf43ace
Kernel: fix some math in physical ranges
...
I allocated 1 bitmap page per 8 data pages. Bitmap page can actually
store 8*PAGE_SIZE data pages.
Also properly set last bits in bitmap. I did not care about endianness
but now we set the bits on unsigned long longs instead of bytes.
2023-10-08 13:25:34 +03:00
Bananymous
a6ca9fd453
Kernel: Implement bare boness DMA Region
...
This does nothing but allocate contiguous physical and virtual memory
and map it as CacheDisable. Also memory is automatically freed RAII style.
2023-10-08 02:57:22 +03:00
Bananymous
799aab02f5
Kernel: Add API for getting contiguous physcial pages
...
This will be used to create DMA regions.
2023-10-08 02:57:22 +03:00
Bananymous
0fae2c7309
Kernel: Rework physical memory allocation
...
PhysicalRange is now much simpler bitmap. This makes expanding
PhysicalRange API much easier.
2023-10-08 02:50:23 +03:00
Bananymous
7ba72b1507
Kernel: Fix PCI BarRegion offsets
...
Calculations accidentally assumed bar registers are 8 byte instead
of 4.
2023-10-08 02:50:23 +03:00
Bananymous
f21d4e794c
Kernel: Rework whole ATA driver structure
...
Make ATA driver more compatible when we are adding SATA support
2023-10-08 02:50:23 +03:00
Bananymous
27eb5af6f0
Kernel: Rework interrupt mechanism
...
All interruptrable classes now inherit from Interruptable which
has methdo handle_irq which is called on a interrupt.
2023-10-05 18:53:45 +03:00
Bananymous
68a913c838
BuildSystem: Don't strip kernel
2023-10-05 18:52:44 +03:00
Bananymous
a084db6817
BuildSystem: Try to set compiler only if it exists
2023-10-05 18:52:05 +03:00
Bananymous
bc4d272c4f
cat: Use write() instead of puts to print file contents
...
This allows printing files that contain null bytes behave more like
you would expect
2023-10-04 22:16:19 +03:00
Bananymous
57605c2b3e
meminfo: Print allocated physical memory percentage
2023-10-03 10:39:27 +03:00
Bananymous
1cd99631e1
Shell: source $HOME/.shellrc if found on Shell startup
2023-10-03 10:39:27 +03:00
Bananymous
f67ed9a66e
Shell: Implement sourcing scripts
2023-10-03 10:24:10 +03:00
Bananymous
6c11dac113
meminfo: Add process command line to the output
2023-09-30 23:17:31 +03:00
Bananymous
39bc6c43dc
Kernel: Expose command line and environment to /proc
2023-09-30 23:01:33 +03:00
Bananymous
5ee3506474
Kernel: Add physical memory info to /proc/{pid}/meminfo
2023-09-30 22:11:45 +03:00
Bananymous
c5119cda97
Userspace: Add meminfo command that parses /proc/{pid}/meminfo
2023-09-30 21:20:53 +03:00
Bananymous
785de5f9b9
Kernel: /proc/{pid}/meminfo now reports per process memory usage
2023-09-30 21:20:18 +03:00
Bananymous
8f630a97df
Kernel: Add procfs that contains only pids
2023-09-30 21:19:36 +03:00
Bananymous
56bb419884
Kernel: All process' memory areas can report their virtual mem usage
2023-09-30 21:15:46 +03:00
Bananymous
d7a00e8cc2
LibC: Implement stpcpy since gcc seems to need it
...
gcc seems to optimize some calls to strcpy to stpcpy
2023-09-30 20:58:19 +03:00
Bananymous
9f0797047f
Kernel/LibC: dirent now contains file type
2023-09-30 20:46:57 +03:00
Bananymous
e8a0eeb0b4
Kernel: RamInode verifies that you have not specified mode type
...
This is kinda weird behaviour, but it ensures the user cannot
create e.g. CharacterDevice with mode having IFLNK.
The Inode overrider is the only one setting the mode.
2023-09-30 20:46:57 +03:00
Bananymous
3e5645d453
Kernel: Add API for RamDirectoryInodes to delete containing inodes
2023-09-30 19:22:30 +03:00
Bananymous
2301654c4e
Kernel: Rework RamInode API
...
RamInode is now a general RamInode with no data. RamFileInode is now
a inode for regular files. This is much cleaner and more intuitive
since there is no reason for most non-regular inodes to hold data
Vector.
2023-09-30 19:22:30 +03:00
Bananymous
0b93fce923
BAN: Remove endianness functions from Math
...
There is now a Endianness.h for these. The functions were super slow.
2023-09-29 19:38:07 +03:00
Bananymous
6304388100
Shell: Quick fix to not freeze for multiple seconds
...
When sync is writing to disk, it reserves whole disk to itself.
This commit makes Shell to read username only once from getpwuid().
We used to get username every time prompt was printed.
2023-09-29 19:20:48 +03:00
Bananymous
96b1186c19
Userspace: Implement basic test for MAP_SHARED
2023-09-29 18:59:37 +03:00
Bananymous
43c23db4a6
Kernel: Implement MAP_SHARED for regular files
...
Every inode holds a weak pointer to shared file data. This contains
physical addresses of pages for inode file data. Physical addresses
are allocated and read on demand.
When last shared mapping is unmapped. The inodes shared data is freed
and written to the inode.
2023-09-29 18:59:20 +03:00
Bananymous
8ff4e1f8c8
Kernel: Don't write to stat_loc on SYS_WAIT if it is null
2023-09-29 18:31:44 +03:00
Bananymous
b57811b371
Userspace: Implement cat-mmap
...
This behaves exactly as cat, but uses mmap to read the file.
2023-09-29 17:24:55 +03:00
Bananymous
23f429e23b
LibC: Fix mmap()
...
mmap() did not pass fildes to the syscall structure.
2023-09-29 17:24:21 +03:00
Bananymous
7b1c573ad0
Kernel: Implement MAP_PRIVATE file mappings
...
mmap() now supports mapping files with MAP_PRIVATE.
2023-09-29 17:23:42 +03:00
Bananymous
4ee759aa3b
Kernel: Implement new abstract MemoryRegion
...
MemoryBackedRegion now inherits from this and is used for private
anonymous mappigs. This will make shared mappings and file backed
mappings much easier to implement.
2023-09-29 16:18:23 +03:00
Bananymous
48096b18c2
LibC: mmap returns MAP_FAILED instead of NULL
2023-09-29 10:38:08 +03:00
Bananymous
06af9f3187
LibELF: Optimize LoadableELF::clone() memory usage
...
We only clone mapped pages that have been marked as writeble.
Read/execute only pages will be exactly as in the file itself and
can be demand paged also :D
2023-09-29 02:05:12 +03:00
Bananymous
16eb055737
Kernel: Add some sanity assertions/functions
2023-09-29 02:03:19 +03:00
Bananymous
a34f2e6e0d
Kernel: Use the new on demand ELF structure
...
All executable files are now read from disk and paged on demand.
This was a big rewrite of the old ELF library but in the end
everything seems much cleaner, since all the old functionality was
not actually needed for execution.
I have to do some measurements, but I feel like memory usage dropped
quite a bit after this change.
2023-09-29 02:00:10 +03:00
Bananymous
8357dd7b3d
LibELF: Implement new ELF structure
...
This structure is used for demand pagable execution. It handles all
memory allocation and file reading.
2023-09-29 01:58:03 +03:00
Bananymous
5bdf7d313f
LibELF: Add types for native executable
2023-09-29 01:56:57 +03:00
Bananymous
5b6569f2c9
Kernel: Fix off by one error when calculating pages in range
2023-09-29 01:56:15 +03:00
Bananymous
58f4ed22c4
Kernel: Don't map interrupt stack as userspace accessable
2023-09-28 21:58:24 +03:00
Bananymous
245f58cc3a
Kernel: mmap regions are now demand paged
...
mmap will not actually take any memory unless you use the given
memory.
2023-09-28 21:07:14 +03:00
Bananymous
15cd59b8ce
LibC: Fix a bug in malloc
...
You could not allocate with size equal to one of the pool sizes.
2023-09-28 21:05:27 +03:00
Bananymous
d9a5e471f5
Kernel: Remove duplicate code in VirtualRange::create_to_vaddr_range
2023-09-28 13:59:49 +03:00
Bananymous
d7ecf94347
Kernel: Reboot will now always succeed
...
If acpi reset fails, we forcefully trigger a triple fault to restart
the system.
2023-09-28 13:53:03 +03:00
Bananymous
6eda65eea6
Kernel/LibC/Userspace: Add SYS_POWEROFF + cli tool
...
You can now shutdown/reboot banan-os with the poweroff cli tool.
Reboot doesn't seem to work on qemu.
2023-09-28 12:36:47 +03:00
Bananymous
d45bf363f1
Kernel: Enter ACPI mode with lai
2023-09-28 12:30:27 +03:00
Bananymous
1abf787596
LibC: Add errno for unknown error
2023-09-28 12:06:17 +03:00
Bananymous
3b283cb860
Kernel: Make tty overload correct has_data() function
...
This allows snake game to work again :)
2023-09-28 11:54:12 +03:00
Bananymous
4a01e4c3b4
Userspace: Use printf length modifiers when printing
2023-09-28 11:49:31 +03:00
Bananymous
61694268e2
LibC: Implement length modifiers to printf
2023-09-28 11:42:57 +03:00
Bananymous
399d5338c6
Shell: String leading and trailing whitespace from commands
...
This fixes a bug of inserting empty argument if command had trailing
whitespace
2023-09-28 10:28:49 +03:00
Bananymous
a8d74f604e
BAN: Update Endiannes API
...
Add functions to swap endiannes or convert host to big/little endian
This code should be very compiler friendly and should be optimized to
single bswap instruction on x86.
2023-09-28 01:22:14 +03:00
Bananymous
cb76f1ea75
Kernel: Add some functionality to disable TTY input/output
...
Userspace programs can call tty_ctrl() to disable/enable tty from
handling input and displaying output.
This API is probably going to change in the future to ioctl calls
but I'm not sure how ioctl is used and what functionality should it
have. I decided to create whole new function and syscall for now.
Next I will expose framebuffer in /dev/fb0 and then I can start work
on graphical environment! :D
2023-09-27 15:44:05 +03:00
Bananymous
459afef89e
Kernel: Disable DiskCache sync messages
2023-09-27 14:12:21 +03:00
Bananymous
8621d8a155
BuildSystem: Rework calling qemu
...
I change always manually the serial/graphical. When running cmake
you can define variable QEMU_ACCEL that will be used as accelerator.
Also ninja has the following targets for running qemu
1. qemu: Run graphical qemu environment
2. qemu-nographic: Run qemu without graphical screen. You should
select 'serial only' from grub menu.
3. qemu-debug: Run qemu without accelerator and interrupt
debugger.
2023-09-27 13:49:01 +03:00
Bananymous
1c26a402b0
Kernel: Add missing TRY() to font loading
2023-09-27 00:49:53 +03:00
Bananymous
b573701625
Sync: Add some argument parsing to sync(1)
...
You can specify --block to make the program wait until sync is
complete.
2023-09-27 00:37:23 +03:00
Bananymous
a69e5fb288
LibC: add syncsync() to unistd.h
...
This is my own WELL NAMED (:D) function that takes a paramemeter
to make the sync operation synchronous.
2023-09-27 00:35:36 +03:00
Bananymous
1e6930a3bc
Kernel: SYS_SYNC now schedules sync to happen soon
...
You can pass non-zero argument to the syscall to block until the
sync has finished.
2023-09-27 00:34:00 +03:00
Bananymous
11db49e2d3
Kernel: DiskCache now requires sync to be called from kernel thread
...
This disables the scenario where user interrupts sync operation
possibly leaving the syncing in invalid state.
2023-09-27 00:32:13 +03:00
Bananymous
c33e658f98
Kernel: Allow creationg of empty processes and manual registration
...
You can now create kernel processes without any threads, add the
needed threads and only then register the process and its threads
to the scheduler.
2023-09-27 00:29:45 +03:00
Bananymous
22252cfcf0
Kernel: All syscalls now validate users pointers
...
We now validate pointers passed by the user, to forbid arbitary
memory read/write. Now the user is only allowed to pass in pointers
in their own mapped memory space (or null).
2023-09-25 22:07:12 +03:00
Bananymous
976114fde1
Kernel: Print more detailed output on ISR
2023-09-25 20:33:07 +03:00
Bananymous
9d55cf1d80
Kernel: Ext2 inodes are now stored in cache
...
This allows faster inode access and ensures working inodes when
opened in multiple places.
2023-09-25 20:31:40 +03:00
Bananymous
ef68e12125
BAN: Implement basic WeakPtr
...
This can be constructed from classes that inherit from Weakable
2023-09-25 19:43:10 +03:00
Bananymous
669b2ace4e
Kernel: Ext2 filesystem now holds 10 preallocated block buffers
...
Inodes can query blocks from this buffer. This allows allocation of
blocks to not fail during normal operations. Also less stress on
kmalloc.
2023-09-25 14:32:25 +03:00
Bananymous
0e67c6318b
Kernel: Fix ext2 block allocation
...
Redo ext2 block allocation. This is now much "cleaner" although
I'm not too fond of the macros.
2023-09-25 13:17:44 +03:00
Bananymous
959fb64752
BuildSystem: Optimize image creation
...
We now use truncate to create disk image, since it doesn't require
writing zeroes to full disk. I also removed creation of third
partition as this was not currently used.
2023-09-25 13:15:55 +03:00
Bananymous
ffa80d0466
Kernel: Hacky kmalloc quick fix
...
Remove GeneralAllocator from kmalloc as it is not CriticalScope safe.
This requires increasing kmalloc memory.
2023-09-25 13:13:57 +03:00
Bananymous
e7ca83ecb2
Kernel: VirtualRange doesn't store physical addresses of pages
...
This was unnecessarry allocation, since the page table allready
contains virtual address -> physical address mappings.
2023-09-24 01:29:34 +03:00
Bananymous
f6261e5dc9
Kernel: all mapped ranges are now stored in one container
...
We just now have a flag if a mapping is unmappable
2023-09-23 23:45:26 +03:00
Bananymous
d1bbbf48f6
Kernel: Fully remove sys_alloc and sys_free
...
I could delete the whole FixedWidthAllocator as it was now obsolete.
GeneralAllocator is still used by kmalloc. Kmalloc cannot actually
use it since, GeneralAllocator depends on SpinLock and kmalloc runs
without interrupts.
2023-09-23 03:53:30 +03:00
Bananymous
3ba15b41a3
Kernel/LibC: remove PATH resoltion from kernel
...
I have no idea why I had made PATH environment variable parsing
to be part of the kernel. Now the shell does the parsing and
environment syscall is no longer needed.
2023-09-23 03:08:14 +03:00
Bananymous
7a7c5e433e
Kernel/LibC: add flag to enable/disable sse support
...
SSE support is very experimental and causes GP. I decided to make
SSE not default until I get to fixing it :)
2023-09-23 02:28:25 +03:00
Bananymous
6bb2c80bdd
Kernel/LibC: userspace malloc now uses mmap to get memory
...
We could remove syscalls to allocate more memory. This was not
something the kernel should have done.
2023-09-23 02:26:23 +03:00
Bananymous
af4af1cae9
Kernel/LibC: add mmap for private anonymous mappings
...
This will be used by the userspace to get more memory. Currently
kernel handles all allocations, which is not preferable.
2023-09-22 23:01:14 +03:00
Bananymous
b9c779ff7e
BuildSystem: Add cmake target for debugging qemu
2023-09-22 17:20:35 +03:00
Bananymous
2a469241b2
BAN: Fix LinkedList::pop_back()
2023-09-22 17:20:35 +03:00
Bananymous
83b165ebb0
Kernel: Add constexpr conditional debug prints
2023-09-22 17:20:35 +03:00
Bananymous
c5f9f0c307
Kernel: Add LAI as a dependency
...
I did not feel like implementing AML interpreter now, and wanted
everything AML has to offer. I will be writing my own AML interperter
at some point.
2023-09-22 17:20:35 +03:00
Bananymous
9d827037ca
Kernel: Fix timer includes
2023-09-22 17:20:35 +03:00
Bananymous
58506c5bd1
Kernel: Add config read/write api to PCI
2023-09-22 17:20:35 +03:00
Bananymous
dd0b8c4140
Kernel: Add pointer validation API to page table
2023-09-22 17:20:35 +03:00
Bananymous
d1183f0bf6
General: remove linecount.sh
2023-09-22 17:20:35 +03:00
Bananymous
11717f90c1
Kernel: PCI devices can now create region for BAR
...
This creates either MEM or IO region for read/write access to PCI
device.
2023-09-22 17:20:35 +03:00
Bananymous
a740bf8df4
1000th COMMIT: Kernel: Add basic E1000 driver
...
This driver is only capable to read mac address and enable and read
link status
2023-09-22 17:20:28 +03:00
Bananymous
63dc2b6aa6
Kernel: Implement SYS_SYNC and add sync executable to userspace
...
You can (and have to) manually sync disk after writes to it.
2023-09-11 01:26:27 +03:00
Bananymous
eee0537053
Kernel: Writes to disk are not synchronous anymore
...
Implement "proper" DiskCache syncing
2023-09-11 01:25:16 +03:00
Bananymous
7ec860a3d4
Kernel: Print stack trace on isr
2023-09-11 01:20:55 +03:00
Bananymous
9b9a6b2cfc
Kernel: Fix ext2 file write
2023-09-11 01:20:39 +03:00
Bananymous
f178fa6d5b
BuildSystem: remove install-usb.sh since it is not used
...
This was dangerous script since it rewrote /dev/sda
2023-09-10 01:20:44 +03:00
Bananymous
9ebf29991d
Kernel: Add basic dd command
...
This only supports if, of, bs, count and status=progress
2023-09-10 01:19:47 +03:00
Bananymous
8fb5f97a18
Kernel: Improve open() POSIX compatability
...
Also rename Process::sys_creat -> create_file since it is not
actually a syscall and only used by open as a healper.
2023-09-10 00:31:42 +03:00
Bananymous
921d95d18f
All: Clear lines with only whitspace in them
2023-09-10 00:31:42 +03:00
Bananymous
1fcf122c50
Kernel: Add basic ZeroDevice to /dev/zero
2023-09-10 00:31:42 +03:00
Bananymous
dd9af56e21
Kernel: Start work on making inodes more thread safe
...
All inode operations are now locked and thread blocked
2023-09-10 00:31:42 +03:00
Bananymous
39a5c52088
Kernel: Fix directory permissions
...
We did not care about X bit in directories and instead used only the
R bit for search/read.
2023-09-08 11:46:53 +03:00
Bananymous
660f7cbfeb
Kernel: Ext2 directories can allocate new blocks if needed
2023-09-08 10:29:26 +03:00
Bananymous
1abf54d652
Kernel: Fix bug in disk writing
...
I have used two weeks in locating a bug in my ext2 implementation
while the bug was actually in disk write. If you called write_sectors
on disk it would write the first sector_size bytes repeatedly to all
asked sectors and this corrupted the disk...
2023-09-08 02:43:08 +03:00
Bananymous
3750d29b2b
Kernel: Fix possible out-of-bounds disk access in ext2
2023-09-08 02:42:53 +03:00
Bananymous
e75522a005
BuildSystem: Cleanup disk image creation
2023-09-08 02:41:39 +03:00
Bananymous
5972c73950
LibC: fix fread implementation
...
fread() should read until either size*nitems bytes are read or eof
is reached.
2023-09-07 16:00:47 +03:00
Bananymous
41757b5f6c
Shell: Clean exit on ^D and use getchar()
...
Use getchar() instead of fread(&ch, 1, sizeof(char), stdin). This
is much cleaner.
2023-09-07 15:51:05 +03:00
Bananymous
c33c7f8b3b
Init: use read instead of fread()
...
This allows actually correct behaviour. My fread implementation is
flawed. It should not return on '\n'
2023-09-07 15:47:59 +03:00
Bananymous
4648f6718e
Kernel: Cleanup TTY::read()
2023-09-07 15:27:21 +03:00
Bananymous
b30af0edca
Kernel: TTY now reads input byte by byte
...
This allows correct behaviour for character streams / keyboard
handling. Serial input can now send working ^C :D
2023-09-07 15:06:27 +03:00
Bananymous
5e1725abb2
Kernel: Remove bitmap debug printing from ext2 inode allocation
2023-09-06 01:25:09 +03:00
Bananymous
6ad2f23259
Kernel: Correct inode links count
2023-09-05 14:46:56 +03:00
Bananymous
0d725f68e3
Snake render grid lines without extra space after last '#'
2023-09-05 14:35:53 +03:00
Bananymous
0770ba0936
BuildSystem: Don't set permissions on image creation
...
This is already handled by *new* tar ball sysroot
2023-09-05 14:35:53 +03:00
Bananymous
c13b5aecfe
Snake: Reorder apple generation/snake body update
...
If new apple was generated to heads previous position after update,
it would not render.
2023-09-05 14:30:30 +03:00
Bananymous
3892579049
Base: Add grub entries for serial-only boot
...
We can now fully boot with serial input and output :)
Qemu can be run with -nographic flag
2023-09-05 01:07:52 +03:00
Bananymous
ba7e1b9ca5
Kernel: Add /dev/tty symlink that targets the current tty
2023-09-05 01:07:52 +03:00
Bananymous
f0772e385c
Kernel: Implement basic RamSymlinkInode
2023-09-05 01:07:52 +03:00
Bananymous
3fd94b1acb
Kernel: You can now read serial output from the /dev/ttyS*
2023-09-05 01:07:52 +03:00
Bananymous
93c5755012
Kernel: Receive interrupts for COM1 and COM2 input
...
The input has to still be attached to terminal
2023-09-04 22:07:40 +03:00
Bananymous
323de3c866
Kernel: Rework whole Terminal structure
...
Serial monitors can now be used as a output. This requires editing
init code for the stdio opening. Serial input is not supported, so qemu
still needs graphical window for ps/2 keyboard.
2023-09-04 19:34:18 +03:00
Bananymous
52b9fddfd7
Kernel: Make serial devices to their own class
2023-09-04 14:57:05 +03:00
Bananymous
e4041ce5ec
Userspace: Implement basic snake game :)
2023-09-04 14:30:45 +03:00
Bananymous
04cfbca336
Kernel: Add ANSI support for hiding/showing cursor to TTY
2023-09-04 14:30:09 +03:00
Bananymous
7184514b5d
LibC: add time() implementation
2023-09-04 13:52:58 +03:00
Bananymous
dfb18d38f7
LibC: Add rand() and srand() implementation
...
This code is from the wikipedia page for Permuted congruential generator
2023-09-04 13:52:13 +03:00
Bananymous
9901f95d78
Kernel: Add basic nanosleep, only millisecond percision
2023-09-04 12:59:50 +03:00
Bananymous
b2139c0b1e
Kernel: Add basic support for O_NONBLOCK (only for tty)
2023-09-04 12:57:52 +03:00
Bananymous
6f002c926a
Kernel: add basic fcntl() with couple of commands and no validation
2023-09-04 12:57:09 +03:00
Bananymous
a711462ef4
Kernel: Split ext2 implementation to multiple files
2023-09-01 15:10:23 +03:00
Bananymous
f31c6b847f
Kernel: Start work on writable ext2 filesystem
2023-08-31 23:40:31 +03:00
Bananymous
195ccf4f53
Kernel: Add missing ififo() to Inode::Mode
2023-08-31 21:38:31 +03:00
Bananymous
5786ffe7d2
BuildSystem: Add cmake target to validate main partition
2023-08-31 21:37:30 +03:00
Bananymous
073edd0b8e
Kernel: Stack trace dumping validates pointers before using them
2023-08-31 21:36:23 +03:00
Bananymous
2c136dae2d
Update README.md
2023-08-31 17:54:12 +03:00
Bananymous
250789aa20
Kernel: better handle kernel errors
2023-08-29 00:13:21 +03:00
Bananymous
8032824054
BuildSystem: use -a with rsync
...
This allows cmake to not rebuild whole project every time
2023-08-28 11:38:17 +03:00
Bananymous
7aaea786c2
LibC: Don't undef needed values in inttypes.h
2023-08-24 15:48:14 +03:00
Bananymous
ce8e8e68f4
BuildSystem: Add USES_TERMINAL when preparing sysroot
...
You were not able to enter sudo password on sysroot unpacking,
which caused ninja to hang
2023-08-23 20:48:40 +03:00
Bananymous
80e7a89f67
BuildSystem: Base sysroot is now distributed as a tar ball
...
This allows file and directory permissions work as intended.
cmake is now filled with 'sudo' but with sudo timeout this should be
fine.
2023-08-23 10:38:21 +03:00
Bananymous
b780df8be0
Shell: hostname is not parsed from /etc/hostname
2023-08-23 10:38:21 +03:00
Bananymous
c4210b5810
Shell: use process groups more properly
2023-08-22 14:54:50 +03:00
Bananymous
38e72019c7
Kernel: kill() with negative pid actually matches pgid
2023-08-22 14:54:15 +03:00
Bananymous
d745fca86a
Kernel: Process keeps track if forked process has called exec*()
2023-08-22 14:53:46 +03:00
Bananymous
60a2185ee6
Kernel/LibC: implement proper getpgid and setpgid
2023-08-22 14:53:12 +03:00
Bananymous
d634fec8dc
Kernel: Add function to enumerate processes in session
2023-08-22 14:52:28 +03:00
Bananymous
e33bf62bba
BAN: increase function size to 5 * sizeof(void*)
2023-08-22 14:52:03 +03:00
Bananymous
2dcd4ed131
Shell/init: We now use pgrp instead of pid and init open terminal
2023-08-22 11:37:04 +03:00
Bananymous
c9243f0d1e
Kernel/LibC: Add {get,set}pgrp()
2023-08-22 11:36:33 +03:00
Bananymous
0f6c19a1b7
Kernel: Barebones implementation sessions and process groups
2023-08-22 11:35:40 +03:00
Bananymous
642929f071
BAN: Add enum class Iteration for for_each loops
2023-08-22 11:30:53 +03:00
Bananymous
2746419c8c
BAN: Function call is now const
2023-08-22 11:30:40 +03:00
Bananymous
b5a7246ba7
LibC: make printf buffer only 128 bytes
...
Only reason for it to be big is if you want super large zero padding
for your number. This will eventually be handled without the buffer.
2023-08-18 16:49:27 +03:00
Bananymous
c1d82282d9
Id: Print username corresponding to uid/euid
...
Also print euid and egid if they differ from uid or gid.
2023-08-18 15:36:51 +03:00
Bananymous
0abe30af38
BuildSystem: only apply stack usage warning to libc
2023-08-17 20:49:52 +03:00
Bananymous
089da2608c
Shell: command execution and parsing support piped commands
...
There is still problems with "blocking" builtin commands (time),
return value, ...
2023-08-17 12:05:38 +03:00
Bananymous
85c6149138
LibC: add fileno() and fdopen()
...
fdopen() doesn't currently care about mode and will have same mode
as the underlying file descriptor.
2023-08-17 12:03:59 +03:00
Bananymous
79f3aa5419
Kernel/LibC: add dup() syscall and function
2023-08-17 12:03:29 +03:00
Bananymous
ed5f4d64a8
Shell: add basic printf test
2023-08-16 10:49:34 +03:00
Bananymous
569e76a848
LibC: printf handles nan and inf
2023-08-16 10:49:34 +03:00
Bananymous
3a36c30e80
LibC: math.h defines is*() macros and uses builtins for values
2023-08-16 10:41:55 +03:00
Bananymous
a09232a555
cat: use 1025 buffer. this allows reads to be 1024 byte
...
reading from disk currently returns ENOTSUP if buffer size is not
multiple of sector size.
2023-08-16 09:33:14 +03:00
Bananymous
5a94818210
Shell: $? returns last return value
2023-08-15 09:17:46 +03:00
Bananymous
2441f208c6
Userspace: Add basic whoami command
2023-08-15 09:03:51 +03:00
Bananymous
db2eca697e
Shell: '\u' in PS1 is replaced with username corresponding to euid
2023-08-14 14:55:23 +03:00
Bananymous
81d79cca61
Shell: ^A moves cursor to the beginning of line
2023-08-14 12:26:22 +03:00
Bananymous
871c792976
Kernel: O_SEARCH doesn't require any permissions
...
Except read permissions for all directories in the path
This allows us to stat e.g. device files for which we don't have
the permissions.
2023-08-11 12:26:07 +03:00
Bananymous
9ab7e76a3b
LibC: cleanup fstatat
2023-08-11 12:25:15 +03:00
Bananymous
8480ffe108
Kernel: open() now validates file access mode
2023-08-11 11:53:38 +03:00
Bananymous
e1400f9680
Kernel: Remove unused syscall
2023-08-11 11:43:48 +03:00
Bananymous
77ff585248
Userspace: implement basic stat
...
I tried to format the output pretty much how linux does, except for
uid and git -> name resolution which is not implemented
2023-08-11 10:30:50 +03:00
Bananymous
9cb50cba33
LibC: Fix S_IF* macros and add macros for access/type masks
2023-08-11 10:30:50 +03:00
Bananymous
6e5bce3c57
Kernel: Zero initialize threads sse_storage
2023-08-11 00:26:43 +03:00
Bananymous
f75adab9d8
Kernel: Move structures in boot.S to .data section
2023-08-11 00:26:12 +03:00
Bananymous
5d0a6e7b08
Kernel: HPET is now used in legacy mode when PIC is forced
2023-08-10 22:01:30 +03:00
Bananymous
b0c8a9cdc4
Kernel: Fix slave PIC
...
we dont mask interrupt 2 in PIC since it corresponds to the
slave PIC. Also cleanup PIC code :)
2023-08-10 21:52:31 +03:00
Bananymous
ebe0adb3b5
Kernel: HPET doesn't use the legacy mapping anymore
2023-08-10 21:08:32 +03:00
Bananymous
4842d5e2b9
Kernel: APIC now uses MMIO namespace functions for mmio
2023-08-10 21:07:23 +03:00
Bananymous
0b8396b1a6
Kernel: IDT now sends EOI for every interrupt
...
EOI is sent before calling the interrupt handler. This should be fine
since all interrupts are processed with interrupts disabled
2023-08-09 09:57:02 +03:00
Bananymous
55ef793a74
Kernel: Validate HPET tick period
2023-08-09 09:50:38 +03:00
Bananymous
96c0ad0d3d
Kernel: Remove get_unix_timestamp from SystemTimer
...
Kernel now uses the percise real_time() and time_since_boot()
2023-08-09 08:57:50 +03:00
Bananymous
6fcb191ca0
Kernel: Add PageTable::Flags::CacheDisable
...
Also fix multiple places where we were using uint8_t as page table
flags instead of PageTable::flags_t which we promoted to uint16_t
while back.
2023-08-06 23:59:30 +03:00
Bananymous
3df97c36e6
Kerne: SystemTimer can now output the current real time
2023-08-04 16:06:47 +03:00
Bananymous
c732297623
Kernel: Rename TimerHandler to SystemTimer
...
I changed SystemTimer to only handle the "best" supported timer
it can initialize.
2023-08-04 16:06:47 +03:00
Bananymous
ca5a097ef5
Kernel: Add function to retrieve boot time as timespec
2023-08-04 16:06:47 +03:00
Bananymous
1f8a5f0ce5
Kernel: F11 now prints current time to debug output
...
This allows better timer percision and system freeze checks
2023-08-04 15:22:51 +03:00
Bananymous
1fa7a1cac4
Kernel: Add basic HPET support to replace PIT if exists
...
This works same way as the PIT implementation; calls Scheduler every
milli second.
2023-08-04 15:22:51 +03:00
Bananymous
ea4a70c3b3
Kernel: Move sleep() implementation to TimerHandler
2023-08-04 15:15:00 +03:00
Bananymous
aa0929614a
Kernel: Add more structures to ACPI
2023-08-04 15:13:47 +03:00
Bananymous
3c31fc9c4b
Kernel: Implement basic MMIO functions
...
This is equivalent to IO.h except for memory mapped io instead of
IO ports
2023-08-04 15:12:29 +03:00
Bananymous
7eb2c140fe
Kernel: Move RTC to Timer directory
...
PIT ms counter seems to be off by multiple seconds/minute. I will
be probably changing to HPET for system time
2023-08-04 11:12:16 +03:00
Bananymous
659adb89a6
Kernel: Start work on abstracting Timers
2023-08-04 10:29:42 +03:00
Bananymous
dd17124c77
Kernel: Remove unnecessary timer check from Scheduler
2023-08-04 10:29:42 +03:00
Bananymous
453a5387cb
BAN: UniqPtr can now be constructed from other convertible UniqPtr
2023-08-04 10:29:42 +03:00
Bananymous
643e87a076
Kernel: Threads are deleted sooner and cleaner
...
We now delete threads when
1. it is marked as Terminated and is the current thread
2. it tries to start execution in Terminated state
This allows us to never have thread executing in Terminated state
2023-08-04 10:29:42 +03:00
Bananymous
20eafb4cc4
Kernel: align userspace stacks
...
I was getting #GP on sse instructions
2023-08-03 18:09:48 +03:00
Bananymous
e715d52f80
LibC: fix typo
2023-08-02 22:10:12 +03:00
Bananymous
3139391e06
Kernel: Change PageTable API
...
Getting free pages not reserves them, so you don't have to hold
the page table lock :)
2023-08-02 22:09:14 +03:00
Bananymous
64ad752e73
Kernel: PageTable now supports reserved pages
...
You can now map pages as reserved, so that they will not be given
from get_free_page() or get_free_contiguous_pages().
2023-08-01 16:35:54 +03:00
Bananymous
dddfa308d7
Shell: Print if the process exited because of a signal
2023-08-01 14:24:36 +03:00
Bananymous
a78a7ed156
Kernel: Cleanup returns from any kind on interrupts
2023-08-01 14:23:50 +03:00
Bananymous
b4eddf04c4
LibC: sys/wait.h now has proper exit status macros
...
We use the same format as basically every implementation
2023-08-01 10:32:04 +03:00
Bananymous
2a851b52f1
BuildSystem: Edit build flags regarding sse and warnings
2023-07-31 22:31:17 +03:00
Bananymous
b245a55ea0
Kernel: store/load sse/mmx/fpu state on isr/irq/syscall
...
I haven't tested this yet but should be fine. This will be optimized
to only save state from threads that are using it
2023-07-31 22:28:57 +03:00
Bananymous
c4f6c859c1
Kernel: Generally improve signals
2023-07-31 22:28:18 +03:00
Bananymous
834bf33e57
LibC: we don't parse syscall arguments in unistd
...
We just call Kernel::syscall() with 5 arguments from the variadic function.
This was a necessary addition since the syscall() function
used over 2 KiB of stack space.
2023-07-31 22:24:11 +03:00
Bananymous
1a6100f083
Kernel: Cleanup signal trampoline
2023-07-30 15:58:35 +03:00
Bananymous
de927b6b05
Kernel: Remove is_in_syscall from Thread
2023-07-30 14:49:51 +03:00
Bananymous
1d7795e22c
Kernel: Hardware exceptions now sends signals to userspace
2023-07-30 14:34:15 +03:00
Bananymous
abe8810d47
Kernel: raise() now force sends signal
2023-07-30 14:17:07 +03:00
Bananymous
acf125c853
Kernel: Signals are not queued anymore
...
Posix doesn't require signal queing if you don't use sigqueue() which
we don't support. Process also has its own pending signal mask.
2023-07-29 16:54:31 +03:00
Bananymous
925df39107
Kernel: Userspace sets the foreground process and Shell handles ^C
2023-07-28 18:10:36 +03:00
Bananymous
9279bbbd19
Kernel: TTY now sends SIGINT on ^C to foreground process
2023-07-28 18:10:09 +03:00
Bananymous
9fd9a8b5b1
Kernel: Mark reading section from StorageDevice as terminate critical
2023-07-28 18:09:35 +03:00
Bananymous
3c6be319b1
Kernel: Restructure process and thread termination
...
When we want to kill a process, we mark its threads as Terminating
or Terminated. If the thread is in critical section that has to be
finished, it will be in Terminating state until done. Once Scheduler
is trying to execute Terminated thread it will instead delete it.
Once processes last thread is marked Terminated, the processes will
turn it into a cleanup thread, that will allow blocks and memory
cleanup to be done.
2023-07-28 18:06:20 +03:00
Bananymous
104894c0c7
Kernel: Rewrite DiskCache
...
We now cache only clean pages since I don't want to think about
syncing the disk later.
2023-07-27 22:22:39 +03:00
Bananymous
2f52001c6d
Kernel: Locks allow locking after locker is invalid
...
SpinLock and RecursiveSpinLock will now allow locking after the initial
locker is invalid. This allows us to kill threads even if they are holding
internal locks
2023-07-27 18:52:51 +03:00
Bananymous
f609170a6a
Kernel: DiskCache uses are now done without interrupts
...
This allows disk cache to not be invalid state after partial read/write
2023-07-27 18:52:51 +03:00
Bananymous
9f75b04714
Kernel: Scheduler can now check if tid is valid
...
Tid can become invalid if the thread is already terminated
2023-07-27 18:34:06 +03:00
Bananymous
7b4a2fe3d1
Kernel: Process::exit() unblocks the whole lock before blocking
2023-07-24 22:29:59 +03:00
Bananymous
f6ee4b3496
Kernel: Implement SYS_GET_PID and SYS_TCSETPGID
...
we don't have consept of process groups yet
2023-07-24 22:29:59 +03:00
Bananymous
1ef0534b69
Kernel: TTY now stores foreground process pid
...
this will be process pgid when we have process groups
2023-07-24 22:29:59 +03:00
Bananymous
b9dd1895bb
Kernel: add Thread::queue_signal()
2023-07-24 22:26:10 +03:00
Bananymous
be47743dfa
Kernel: Scheduler can now block threads based on tid
2023-07-24 22:24:21 +03:00
Bananymous
57798e5d76
Kernel: remove Semaphore::is_blocked
...
this will not mean anything after semaphores can spuriously wake up
2023-07-24 22:23:13 +03:00
Bananymous
cd64c1cfec
Kernel: add is_tty() to inode
2023-07-24 22:19:59 +03:00
Bananymous
f76d921e25
Kernel: you can now ask process if it is userspace process
2023-07-23 18:54:10 +03:00
Bananymous
a2bf474013
Kernel: OpenFileDesctiptor can now return inode of fd
2023-07-23 18:52:33 +03:00
Bananymous
9729e5a05b
Kernel: Change signal kernel API
...
return rsp and rip are now stored per thread
2023-07-23 18:33:10 +03:00
Bananymous
2dce0a0415
Kernel: Userspace signal handlers are now called one at a time
...
I added a syscall for telling the kernel when signal execution has
finished. We should send a random hash or id to the signal trampoline
that we would include in the syscall, so validity of signal exit can
be confirmed.
2023-07-23 13:34:53 +03:00
Bananymous
d560137ae6
Kernel/LibC: add SYS_SIGNAL/signal()
2023-07-21 20:08:13 +03:00
Bananymous
c12f4fb40f
Kernel: Make signals more POSIX
2023-07-21 20:01:12 +03:00
Bananymous
10169d773d
Kernel/LibC: Add SYS_KILL/kill()
2023-07-21 19:27:38 +03:00
Bananymous
b78596dcf4
Kernel: Scheduler now sends queued signals
2023-07-21 19:27:10 +03:00
Bananymous
40f7c6b8fa
Kernel: Make signals thread specific
2023-07-21 19:00:59 +03:00
Bananymous
8063700d7b
Kernel: add default signal actions
2023-07-21 18:02:35 +03:00
Bananymous
70f89ed1fc
BuildSystem: Strip kernel. We will add the map once we use it
2023-07-21 15:47:31 +03:00
Bananymous
c2cf98e32f
Kernel/LibC: Add bareboness signals
...
You can now call raise() to raise a signal. Signal handlers are
not yet supported, but the handling works :)
2023-07-21 15:45:02 +03:00
Bananymous
a1db032ba9
Kernel: kernel memory takes now full pml4e
...
This allows flags to work properly
2023-07-21 13:47:05 +03:00
Bananymous
5babd7b4f2
Kernel: remove PAGE_FLAGS_MASK as that was not correct anymore
...
After I added NXE bit, the flags mask is no longer valid
2023-07-21 12:01:50 +03:00
Bananymous
c0029a2fa2
Kernel: Don't map kernel executable memory as writable
2023-07-21 11:17:39 +03:00
Bananymous
4e35b8b49d
Kernel: Syscalls now get the interrupt stack
2023-07-21 11:04:16 +03:00
Bananymous
21c6135ae2
BAN: Fix function call in Optional
2023-07-21 10:57:46 +03:00
Bananymous
b02c486ad0
Kernel: add NullDevice to /dev/null
2023-07-20 00:06:22 +03:00
Bananymous
08cd285ca6
Kernel: move Device.h to its own directory
2023-07-19 23:55:38 +03:00
Bananymous
94af856db0
Kernel: cleanup sys_exec()
...
We now scope everyting so desctructors get called
2023-07-19 23:20:39 +03:00
Bananymous
bf5d74b8bc
Kernel: fix memory leak in PageTable
...
PageTable used to leak 2 pages on creation and other two on deletion
2023-07-19 23:17:39 +03:00
Bananymous
fd9210ba9e
Kernel: FixedWidthAllocator creation can now fail
2023-07-19 18:07:24 +03:00
Bananymous
66d9260257
Kernel: VirtualRange creation can fail
2023-07-19 17:56:26 +03:00
Bananymous
5d2bfc858e
Kernel: SYS_FORK can now fail instead of panicing on error
2023-07-19 17:47:12 +03:00
Bananymous
8b34880064
Kernel: Fix bug which made bochs unbootable
...
We could not boot if ATABus did not have valid primary device.
2023-07-13 15:53:09 +03:00
Bananymous
98c698d9ec
Kernel: Enable global bit on kernel pages
2023-07-13 15:23:25 +03:00
Bananymous
9ea2c1d932
Kernel: Support execute disable bit
...
We will now map executable memory explicitly as executable.
2023-07-13 14:28:53 +03:00
Bananymous
297e65f19a
Kernel: CPUID can detect wether cpu supports nxe bit
2023-07-13 14:24:58 +03:00
Bananymous
65559a3e44
Kernel: Fix multiple bugs with terminal
2023-07-13 13:09:52 +03:00
Bananymous
c3a71e94a9
Kernel: Fix ATA disk and partition numbering
2023-07-13 12:12:47 +03:00
Bananymous
fb4b363a16
Init: Use the new pwd.h api for user parsing
2023-07-13 12:01:41 +03:00
Bananymous
4154f43b49
LibC: add getpwname() and getpwuid()
2023-07-13 12:01:16 +03:00
Bananymous
b1fcb0b58f
LibC: implement endpwent(), getpwent() and setpwent()
2023-07-13 11:22:09 +03:00
Bananymous
00409ffa60
Kernel: Ext2Inode::create_file actually sets the inode data
...
We used to just create inode without touching its memory.
2023-07-13 10:20:56 +03:00
Bananymous
16acd50559
BAN: Iterators are now single general type with CONST template
...
This allows us to use the same base class for iterator and
const_iterator which were practically the same code.
2023-07-12 13:35:21 +03:00
Bananymous
5df48804e1
BAN: add either_or and either_or_t
...
This allows you to select type depending on constexpr evaluatable
boolean
2023-07-12 13:34:31 +03:00
Bananymous
9eab6710ce
BAN: Implement ConstIteratorDouble and add it to HashMap
...
This is same as IteratorDouble except it uses const_iterator and does
not return non-const references.
2023-07-12 11:41:05 +03:00
Bananymous
65424a6769
BAN: Generalize HashMapIterator to IteratorDouble
...
This iterator should be able to iterate any container within container
with type iterator defined.
This also fixed bug if first entry in outer container is empty container.
2023-07-12 09:29:05 +03:00
Bananymous
12d53ac233
Base: add empty directories with .gitkeep to base/
2023-07-11 08:02:28 +03:00
Bananymous
9bcfb34524
Kernel: Rewrite whole device structure
...
We now have DevFileSystem which is derived from RamFileSystem. All
devices are RamInodes. We don't have separate DeviceManager anymore.
To iterate over devices, you can loop througn every inode in devfs.
2023-07-10 23:17:14 +03:00
Bananymous
f88b9ae4f2
BAN: Add iterators to HashMap
2023-07-10 23:16:41 +03:00
Bananymous
8cd91f5a6a
Userspace: add basic 'touch' command
2023-07-10 16:38:15 +03:00
Bananymous
f65e5f4190
tee: indent with tabs
2023-07-10 16:18:08 +03:00
Bananymous
f521a98157
Userspace: Add basic tee command
2023-07-10 16:07:53 +03:00
Bananymous
ee4ef6638c
Kenrel: RamInode now implements truncate()
2023-07-10 16:07:09 +03:00
Bananymous
0910958c04
Kernel: OpenFileDescriptors can now store more than 8 bits of flags
2023-07-10 16:06:36 +03:00
Bananymous
d6408bcf17
Kernel: add O_TRUNC
...
this is not supported by anything yet
2023-07-10 15:48:18 +03:00
Bananymous
178fc00905
Kernel: creat() mode now has to be access mode
...
We provide the S_IFREG in creat
2023-07-10 15:34:41 +03:00
Bananymous
89d4fa4d9b
Kernel: Ext2 fill now return ENOTSUP on write
...
We used to crash the kernel
2023-07-10 15:34:25 +03:00
Bananymous
46e1419e70
Kernel: O_APPEND is now supported
2023-07-10 15:11:27 +03:00
Bananymous
f7c4bc908e
Kernel: open() and openat() now take mode as parameter
...
O_CREAT now tries to create file if O_CREAT is specified
2023-07-10 15:08:54 +03:00
Bananymous
a0ecbed726
Kernel: You can now read/write to RamInodes
...
RamFS should be stored on physical pages and not in kmalloc, but
that will be implemented later :)
2023-07-10 14:09:35 +03:00
Bananymous
74fc0aa308
Kernel: Inode::create_file() now takes uid and gid as parameters
2023-07-10 13:32:10 +03:00
Bananymous
d5f0448e48
Kernel: start work on ram file system
2023-07-10 13:26:14 +03:00
Bananymous
51e4b11890
LibC: add NAME_MAX to limits.h
...
This is defined to 255 which is _XOPEN_NAME_MAX, smallest value
for XOPEN compliance
2023-07-10 11:48:11 +03:00
Bananymous
d713f252aa
Kenrel: Fix inode comparison
...
We should not compare rdevs
2023-07-10 11:48:11 +03:00
Bananymous
5ec2d85081
Kernel: Inode rename directory functions
2023-07-10 11:48:11 +03:00
Bananymous
0d132ee518
Kernel: Mark Ext2 classes final
2023-07-10 11:48:11 +03:00
Bananymous
fabbb9f531
BAN: RefPtr can be constructed from other types
2023-07-10 11:48:11 +03:00
Bananymous
80c8d52dc5
Kernel: add more functionality to PCI
2023-07-09 23:04:11 +03:00
Bananymous
b6c4a2dbf1
Kernel: Edit lock scopes and make string copy able to fail
2023-07-07 23:12:19 +03:00
Bananymous
a2f5ad7bed
Kernel: Move open file descriptors to their own class
...
This simplifies code a lot :)
2023-07-07 23:11:37 +03:00
Bananymous
a337f414fc
LibC: limits.h now defined OPEN_MAX
2023-07-07 23:08:49 +03:00
Bananymous
404b3dd44c
Shell: $(...) expansion works now :)
2023-07-06 23:22:57 +03:00
Bananymous
d04b031e30
Shell: you can call Shell -c ... to invoke the shell as interpreter
2023-07-06 23:22:49 +03:00
Bananymous
07fec6e211
Kernel/LibC: add basic dup2
2023-07-06 23:17:54 +03:00
Bananymous
4cd72992c8
Kernel/LibC: Add basic pipe() syscall and command
...
You can now create pipes :)
2023-07-06 22:16:26 +03:00
Bananymous
cdcb395640
LibC: add read() and write() to unistd
2023-07-06 22:15:55 +03:00
Bananymous
5a8eb51968
Kernel: TTY now unblocks semaphore after read
...
This allows concurrent reads not fully reading the buffer not block
indefinately.
2023-07-06 21:32:34 +03:00
Bananymous
a74422281f
Kernel: Add O_CLOEXEC
2023-07-06 20:00:33 +03:00
Bananymous
a45f9ee76b
Kernel: Remove spammy process/thread exit printing
2023-07-06 10:34:46 +03:00
Bananymous
f19dc114d6
Userspace: Shell now has 'env' for printing environment
2023-07-06 10:32:43 +03:00
Bananymous
d2aabb669b
Userspace: Shell imporove 'time' command
2023-07-06 09:45:04 +03:00
Bananymous
9c3f4039a5
Userspace: Shell now has time builtin
2023-07-06 00:39:04 +03:00
Bananymous
1fb305fa45
Kernel/LibC: add clock_gettime() for CLOCK_MONOTONIC
...
This gets the number of milliseconds since boot
2023-07-06 00:38:29 +03:00
Bananymous
4086d7c3be
Kernel: rework the whole PageTable structure
...
We now have page table structure for kernel memory which is shared
between all processes.
2023-07-05 23:41:35 +03:00
Bananymous
60fe5a656c
LibC: Fix syscall SYS_READ and SYS_WRITE arguments
2023-06-19 10:38:29 +03:00
Bananymous
7d254c26bc
Kernel: Rewrite and optimize DiskCache
...
DiskCache now consists of PageCaches which are caches of contiguous
sectors. This allows the disk cache to be ordered and faster traversal.
We seem to have a problem somewhere during reading. The stack gets
corrupted.
2023-06-19 10:31:47 +03:00
Bananymous
328d67f551
Userspace: u8sum fix error message
2023-06-19 10:31:23 +03:00
Bananymous
84ecf861cd
Userspace: Shell now processes $ arguments
2023-06-19 01:39:24 +03:00
Bananymous
46a6daccfe
Userspace: Shell argument parsing now appriciates quotes
2023-06-19 01:07:00 +03:00
Bananymous
3df3c37bad
Userspace: Shell argument parse now results in BAN::String
2023-06-19 00:34:44 +03:00
Bananymous
191a24110a
Userspace: Shell now sets SHELL environment variable
2023-06-18 23:35:51 +03:00
Bananymous
275a730485
LibELF: We use BAN::Vector<uint8_t> as elf storage
...
This is made possible by the dynamic kmalloc
2023-06-18 23:29:23 +03:00
Bananymous
9a7b2587af
Kernel: kmalloc has now somewhat dynamic storage
...
Allocations bigger than PAGE_SIZE and those not forced to be identity
mapped are now done on a GeneralAllocator. This allows us to use kmalloc
for big allocations; bigger than the fixed 1 MiB storage.
This is still a hack and the whole kmalloc will have to be rewritten at
some point, but for now this does the job :D
2023-06-18 23:27:00 +03:00
Bananymous
09c824b90e
Kernel: Add GeneralAllocator::paddr_of
...
Yoy can now query physical address of a virtual address for general
allocator allocation
2023-06-18 23:25:51 +03:00
Bananymous
57e59d998f
Kernel: Add enum for ISR name to number
2023-06-18 23:24:27 +03:00
Bananymous
44fb3945df
Kernel: General allocator takes first valid vaddr as parameter
2023-06-17 22:23:34 +03:00
Bananymous
95c4e608de
Kernel: Move print during boot
2023-06-12 23:45:36 +03:00
Bananymous
b9603d9d23
BAN: Optional can be constructed inplace
2023-06-12 23:45:36 +03:00
Bananymous
16e5f96b1d
BAN: Add operator-> and operator* to Optional
2023-06-12 22:25:14 +03:00
Bananymous
d0a0e3bdef
Userspace: Add u8sum
...
This program caluculates the sum of bytes in file mod 256
2023-06-12 20:36:16 +03:00
Bananymous
5dcc53bcf2
Kernel: Make disk IO blocking thread safe
...
This was causing a lot of deadlocks on vms without kvm accel
2023-06-12 18:57:47 +03:00
Bananymous
23543b15ca
Kernel: Rework syscall calling
...
I removed the intermediate function when calling syscalls. Now syscall
handler calls the current process automatically. Only exception is
sys_fork, since it needs a assembly trampoline for the new thread.
2023-06-12 14:16:48 +03:00
Bananymous
2253c45feb
Kernel: Remove Shell from kernel
...
This is now obsolete since we have a userspace Shell.
2023-06-12 02:04:52 +03:00
Bananymous
9f9a70713e
Base: add home directories for root and user
2023-06-12 02:03:13 +03:00
Bananymous
cd57adc856
BuildSystem: every file except /home/* is now owned by root
2023-06-12 02:03:13 +03:00
Bananymous
b4b892148c
Userspace: Shell processes PS1 '\~' as cwd and implement cd
2023-06-12 02:03:13 +03:00
Bananymous
048183ddb5
Userspace: init now sets HOME environment variable and cd's into HOME
2023-06-12 02:02:52 +03:00
Bananymous
f09b82c4b5
Kernel/LibC: add SYS_{SET,GET}_PWD and chdir, getpwd
2023-06-12 02:02:52 +03:00
Bananymous
7aeb8e4d36
Kernel: allocate thread stacks from 0x300000 onwards
...
I had a problem where thread stack was overlapping with elf loading
2023-06-12 01:02:19 +03:00
Bananymous
58ec4d6a31
Kernel: Fix bug in elf loading
...
We were allocating one extra page
2023-06-12 00:59:19 +03:00
Bananymous
25f8343269
Userspace: init now default logins as user
2023-06-12 00:46:07 +03:00
Bananymous
e9cb844c28
Userspace: Shell now uses PS1 as prompt if set
2023-06-12 00:45:47 +03:00
Bananymous
30ac046232
Userspace: Add color to ls
2023-06-11 23:00:19 +03:00
Bananymous
f67f8ccbe0
Userspace: init now sets user and group ids before running their shell
2023-06-11 22:37:00 +03:00
Bananymous
e9217b3484
Userspace: Add basic id that prints {,e}{uid,gid} of the current proc
2023-06-11 22:37:00 +03:00
Bananymous
11b68f6a53
Kernel: Add SYS_GET_{,E}{UID,GID}
2023-06-11 22:37:00 +03:00
Bananymous
3fe67e4882
Kernel: Add syscalls for set{,e,re}{uid,gid}
2023-06-11 22:37:00 +03:00
Bananymous
9288537949
LibC: gid_t and id_t are now signed types
...
I have no idea why I had made them unisigned
2023-06-11 22:37:00 +03:00
Bananymous
78536f9678
Kernel/Userspace: Add basic init process
...
This process parses /etc/passwd and promps login screen.
When an username is entered, it will launch that users shell
2023-06-11 22:37:00 +03:00
Bananymous
cce2f3e19a
BAN: Add basic Optional
2023-06-11 21:00:25 +03:00
Bananymous
297141f321
LibC: add strchrnul()
...
this is a gnu libc extension
2023-06-11 20:18:03 +03:00
Bananymous
c7ec19c25c
Kernel: Add basic Credentials for the system
...
Now filesystem access/open, etc confirm that you have access for rwxs
2023-06-11 20:06:06 +03:00
Bananymous
3181ea7b4d
Kernel: GeneralAllocator and FixedWidth allocator invalidate TLB caches
...
We were getting random exceptions when reallocating same addressess and
this fixes that problem :)
2023-06-11 15:57:48 +03:00
Bananymous
1cf464d5c7
Userspace: add basic ls command
2023-06-11 03:38:44 +03:00
Bananymous
83a6e6f637
LibC: Reorder some syscalls
2023-06-11 03:29:22 +03:00
Bananymous
64890bb640
Kernel: Add SYS_OPENAT
2023-06-11 03:29:22 +03:00
Bananymous
caca6dc701
Kernel: Exceptions will now enable interrupts before calling exit()
...
this allows scheduler verification on reschedule() not panic
2023-06-11 03:29:22 +03:00
Bananymous
68ec443e07
LibC: implement close
2023-06-11 03:29:22 +03:00
Bananymous
aa86125f2b
Kernel: Implement SYS_FSTAT
2023-06-11 03:29:22 +03:00
Bananymous
c423164066
LibC: Implement basic dirent functionality
...
We don't currently support seeking
2023-06-11 03:29:22 +03:00
Bananymous
14aeb8de10
Kernel: we don't panic anymore on unrecognized syscall
2023-06-11 00:18:48 +03:00
Bananymous
691b17e0cc
Kernel: allow open() call with O_SEARCH
2023-06-11 00:18:34 +03:00
Bananymous
eae6119039
Kernel: Add syscall for reading directory entries
2023-06-11 00:18:08 +03:00
Bananymous
30f81e1696
LibC: add missing O_EXEC and O_SEARCH
2023-06-11 00:17:18 +03:00
Bananymous
01311b470f
Kernel: Rewrite directory listing so it can be integrated to libc
2023-06-11 00:17:18 +03:00
Bananymous
223d2ac3a6
Userspace: fix return values of cat and echo
2023-06-10 17:34:10 +03:00
Bananymous
4cdeb98897
Kernel: We now store the processes exit code
2023-06-10 17:31:56 +03:00
Bananymous
47c69e9def
Userspace: add exit to shell
2023-06-09 01:51:23 +03:00
Bananymous
9728947d5d
Userspace: add echo
2023-06-09 01:50:18 +03:00
Bananymous
66fe48e94b
Userspace: add ^L support for shell
2023-06-09 01:24:33 +03:00
Bananymous
c0fe4756cb
Kernel: SpinLocks now reschedule if they cannot aquire the lock
...
This allows us to not actually spin doing nothing while waiting for
another (not executing) to release the lock. This api won't probably
work when we get to SMP
2023-06-09 00:53:32 +03:00
Bananymous
5032e79be3
Kernel: Process::exit() now uses the new Scheduler::reschedule()
...
We use this new function while waiting for all blocking threads to
resume execution
2023-06-09 00:49:19 +03:00
Bananymous
1aec3fcedd
Kernel: Scheduler now has reschedule()
...
This can be called from anywhere and just causes the scheduler to
schedule the next thread. This is more efficient and verbose version
of Scheduler::set_current_thread_sleeping(0), since we don't have
to wake other threads or do other verifications.
2023-06-09 00:47:17 +03:00
Bananymous
aec63081e2
Kenrel: Rename Scheduler::reschedule -> Scheduler::timer_reschedule
2023-06-09 00:41:43 +03:00
Bananymous
801025ad7b
Kernel: Big commit. Rewrite ELF loading code
...
We now load ELF files to VirtualRanges instead of using kmalloc.
We have only a fixed 1 MiB kmalloc for big allocations and this
allows loading files even when they don't fit in there.
This caused me to rewrite the whole ELF loading process since the
loaded ELF is not in memory mapped by every process.
Virtual ranges allow you to zero out the memory and to copy into
them from arbitary byte buffers.
2023-06-09 00:37:43 +03:00
Bananymous
59b10c4d25
Kernel: PageTableScope locks the PageTable before disabling interrupts
...
This allows replacing some PageTableScopes with PageTable::lock()
2023-06-09 00:34:41 +03:00
Bananymous
841584ccbd
Kernel: get_free_contiguous_pages works with non-page aligned addresses
...
also fix bug in ordering
2023-06-06 02:03:23 +03:00
Bananymous
24993f6020
LibC: implement setenv, unsetenv, putenv
2023-06-05 22:51:02 +03:00
Bananymous
55ea5c5488
Kernel: add basic support for environment variables
...
exec functions will search files from PATH
2023-06-05 22:51:02 +03:00
Bananymous
290b81dedc
BAN: add StringView::contains(char)
2023-06-05 22:51:02 +03:00
Bananymous
c6b5cc1e07
Kernel: exec now has better posix errors
2023-06-05 21:12:08 +03:00
Bananymous
357081346e
Shell: load old termios for process execution
2023-06-05 21:12:08 +03:00
Bananymous
896b919c9d
Kernel/LibC: pass environ pointer to process
2023-06-05 21:12:08 +03:00
Bananymous
6b73f4d187
Kernel: TTY now actually flushes on ^D
2023-06-05 20:21:46 +03:00
Bananymous
08a806e75d
Kernel: verify that loaded elfs are executable
2023-06-05 19:29:32 +03:00
Bananymous
73c11c3d29
Shell: add bareboness utf8 support
...
This should work as long as TTY provides only valid utf8.
If the utf is invalid, assertion fails and the shell dies.
2023-06-05 18:55:22 +03:00
Bananymous
5af77dcfb9
Shell: we now support left/right arrows
2023-06-05 18:24:41 +03:00
Bananymous
a7dc7ecb90
LibC: abort now prints 'abort()' and exits
...
we used to call assert in abort which then recursively called
abort again.
2023-06-05 18:23:19 +03:00
Bananymous
cf88142856
Kernel: TTY now supports CSI s and u
...
These are commonly supported values to save and load cursor
position
2023-06-05 18:19:13 +03:00
Bananymous
efb355c7be
BuildSystem: disable nls from gcc
2023-06-05 17:55:47 +03:00
Bananymous
d1ad38c8d4
Kernel/LibC: add SYS_STAT and stat(), lstat()
2023-06-05 14:37:14 +03:00
Bananymous
69b94dad00
Base: revert bin and lib symlinks to relative paths
...
Absolute paths fucked up toolchain building and usespace linking,
since g++ was finding host libraries from /usr/lib.
2023-06-05 10:08:01 +03:00
Bananymous
4c40aa6b38
Userspace: Start work on proper shell
2023-06-05 01:42:57 +03:00
Bananymous
5cf3221364
Base: /lib and /bin are now absolute symlinks
2023-06-04 18:12:05 +03:00
Bananymous
40055f023c
LibC: add wait and waitpid
...
Note that wait() doesn't work since only waiting for specified
pid is supported. wait() will just return -1 and set errno to
ECHILD.
2023-06-04 18:00:52 +03:00
Bananymous
9fbb2b9369
Kernel: Add SYS_WAIT
...
This syscall waits for a given pid.
2023-06-04 18:00:52 +03:00
Bananymous
a3aca67eef
Kernel: fork() now clones current thread
...
This is how posix specifies thread cloning during fork
2023-06-04 17:40:37 +03:00
Bananymous
977652ad57
Kernel: Process FixedWidthAllocators come now in 4 sizes
2023-06-04 01:26:43 +03:00
Bananymous
5bf7ca1c80
Kernel: Allocators are now stored in UniqPtr
...
This allows proper memory management, we had some memory leak
2023-06-04 01:25:57 +03:00
Bananymous
1b1f22c35e
Kernel: make load_elf() its own function
2023-06-04 01:24:11 +03:00
Bananymous
479817231a
Kernel: PhysicalRange maps its nodes to kernel vaddr space
...
This keeps the lower half of address space cleaner
2023-06-04 01:20:47 +03:00
Bananymous
e3c5477df4
Kernel: reorder process exit steps
2023-06-04 01:19:04 +03:00
Bananymous
b403155ca9
Kernel: You can specify first vaddr for getting free pages
2023-06-04 01:15:48 +03:00
Bananymous
9fd3111011
BAN: Add UniqPtr
2023-06-04 00:39:20 +03:00
Bananymous
5f339d585c
Kernel: PAGE_FLAG_MASK is now only 0xF
...
We don't care currenly about anything but the last few bits
2023-06-03 20:08:13 +03:00
Bananymous
b168462b43
Kernel: PageTable now has debug_dump
...
This dumps all the mapped pages and their flags
2023-06-03 20:08:13 +03:00
Bananymous
68691faca1
Kernel: boot.S is back to 2 MiB pages
...
bochs doesn't seem to support 1 GiB pages
2023-06-03 18:53:36 +03:00
Bananymous
1e075c248f
BAN: Errors now includes assert.h
2023-06-03 18:53:05 +03:00
Bananymous
d201e65810
BuildSystem: remove sse and sse2 from userspace
2023-06-03 16:05:32 +03:00
Bananymous
3a79880e69
LibC: printf string persision works now
2023-06-03 15:07:02 +03:00
Bananymous
9228df0f23
Kernel: Inode/Device detection is done with overridden bool functions
2023-06-03 13:28:15 +03:00
Bananymous
402ad85583
Kernel: Heap will return 0 if no free page is available
2023-06-03 02:55:31 +03:00
Bananymous
53e91ba98a
Kernel: DiskCache will try to shrink_to_fit after cache cleanup
2023-06-03 02:55:22 +03:00
Bananymous
fd153f3762
Kernel: DiskCache won't crash when running out of kmalloc memory
2023-06-03 02:36:20 +03:00
Bananymous
813d0f1b5f
Kernel: add basic disk cache
...
ATADevices now add disk cache to themselves
2023-06-03 02:23:14 +03:00
Bananymous
2b901abfb1
Kernel: Shell 'memory' now prints heap memory usage
2023-06-03 02:22:18 +03:00
Bananymous
d4289f9e74
Update README.md
2023-06-02 18:43:30 +03:00
Bananymous
3a5d6914ba
Userspace: create_program creates proper cmake files again
2023-06-02 18:42:25 +03:00
Bananymous
e96efea2fb
BuildSystem: all scripts have now bash shebang
...
I could not use the scripts on debian
2023-06-02 18:41:45 +03:00
Bananymous
2df7f8a1e5
BuildSystem: add rule to build libstdc++
...
We can now build libstdc++ and actually link with g++
2023-06-02 18:39:42 +03:00
Bananymous
8645c4c653
Kernel: Shell ls and stat now properly show symlinks
2023-06-02 18:22:56 +03:00
Bananymous
88e92eec9e
LibC: Add simple definition for realloc
...
The syscall just crashes the kernel currently. I will implement
this when needed
2023-06-02 17:56:13 +03:00
Bananymous
a41b8e416f
LibC: add __cxa_at_exit() for libc
2023-06-02 17:50:55 +03:00
Bananymous
8716c8baf4
LibC: remove select() declaration
...
This already comes from sys/select.h
2023-06-02 17:29:09 +03:00
Bananymous
2d67a7153b
LibC: rename [[noreturn]] to __attribute__((__noreturn__))
...
This compiles with C compiler
2023-06-02 17:28:36 +03:00
Bananymous
3fcc7c6768
LibC: stdlib.h doesn't seem to typedef wchar_t without __need_wchar_t
2023-06-02 17:27:31 +03:00
Bananymous
5d2a062b36
LibC: fix INFINITY definition typo
2023-06-02 17:27:14 +03:00
Bananymous
e517ff6b6d
LibC: fix DIR typedef for C code
2023-06-02 17:26:38 +03:00
Bananymous
7296846a81
LibC: complex.h undefs I before defining it
2023-06-02 17:13:09 +03:00
Bananymous
6abcb0de9b
LibC: mbstate_t is empty struct
2023-06-02 17:10:29 +03:00
Bananymous
40f9d9d9bc
LibC: fix sig_atomic_t definition
2023-06-02 17:08:43 +03:00
Bananymous
7aea8c45f7
Kernel: VFS now has max link depth of 100
2023-06-02 12:50:40 +03:00
Bananymous
7bbdee6cc4
Kernel: Symlinks are now working
...
We still have to implement loop or depth detection
2023-06-02 11:43:46 +03:00
Bananymous
efb3271588
BAN: Fix function call in Vector
2023-06-01 00:50:04 +03:00
Bananymous
ff548bd898
Kernel: Shell can now list symlinks
2023-06-01 00:25:53 +03:00
Bananymous
835d32814d
Kernel: add basic support for symlinks
2023-06-01 00:24:45 +03:00
Bananymous
79d1f665f2
Kernel: Shell opens standard files
2023-05-31 23:14:15 +03:00
Bananymous
9c818d3da0
BuildSystem: cmake creates /usr/bin
2023-05-31 23:13:53 +03:00
Bananymous
a378e59432
BuildSystem: link libraries when they change
...
This also fixed the need for manual linkin on firt build
2023-05-31 23:01:40 +03:00
Bananymous
a75a3f7a5f
Userspace: make test program link against libc on change
2023-05-31 22:36:47 +03:00
Bananymous
0f412e570c
LibC: add execl
2023-05-31 22:36:26 +03:00
Bananymous
1daa1f5611
Kernel: Cleanup exec code
2023-05-31 22:36:05 +03:00
Bananymous
24a190d1f7
Kernel: Add SYS_EXEC syscall
2023-05-31 20:57:33 +03:00
Bananymous
b48b239882
Kernel: Implement Process::exec()
2023-05-31 20:56:29 +03:00
Bananymous
5fb69300ca
Kernel: Move userspace entry functions to Process instead of Thread
2023-05-31 19:31:10 +03:00
Bananymous
dcb23f686f
Kernel: boot.S maps GiB as single pdpte
2023-05-31 00:51:15 +03:00
Bananymous
650570e57d
Kernel: Fix comment
2023-05-31 00:51:15 +03:00
Bananymous
1f5a36f074
Kernel: PageTable destructor works now
...
we are successfully booting higher half kernel now :)
2023-05-31 00:44:14 +03:00
Bananymous
aeaf2cd3f1
Kernel: PageTable::create_userspace() now works
2023-05-31 00:44:14 +03:00
Bananymous
959c0fc572
Kernel: kmalloc free error prints the pointer
2023-05-31 00:34:56 +03:00
Bananymous
e3d3788f28
Kernel: RSDP location is now done with virtual addresses
2023-05-31 00:34:21 +03:00
Bananymous
850b7f27a2
Kernel: Physical range now calculates RAM with physical addresses
2023-05-31 00:33:44 +03:00
Bananymous
0939f23b04
Kernel: Heap gets multiboot pointer with P2V
2023-05-30 23:57:44 +03:00
Bananymous
67886b0c5a
Kernel: Move V2P and P2V to Memory/Types.h
2023-05-30 23:57:03 +03:00
Bananymous
56eb6fb4ce
Kernel: PageTable::map_range_at maps correctly the last page
2023-05-30 23:56:07 +03:00
Bananymous
81cf389754
Kernel: Booting with higher half kernel gets to Heap initialization
2023-05-30 22:21:12 +03:00
Bananymous
0907965dc5
Kernel: start work on higher half kernel
2023-05-30 08:00:17 +03:00
Bananymous
79315d318c
Toolchain: lib gcc is wuild with mcmodel=large
2023-05-30 07:59:41 +03:00
Bananymous
e8f820ef8d
LibC: Fix some headers to make gcc build again
2023-05-30 01:17:45 +03:00
Bananymous
210d90ec79
Kernel: We now identity map full GiB in boot.S
...
The paging structure is pre-built so no unnecessary calculations are done
2023-05-30 00:08:52 +03:00
Bananymous
8bea18a6f2
Kernel: Remove unused includes of CriticalScope
2023-05-29 21:15:55 +03:00
Bananymous
861966eed6
Kernel: Remove unnecessary usages of PageTableScope
...
This should be used as few times as possible since it calls 'cli'
2023-05-29 21:11:29 +03:00
Bananymous
5bb1f2a48c
Kernel: Rename MMU to PageTable
...
This is more descriptive name for what it actually represents
2023-05-29 21:06:09 +03:00
Bananymous
fb17af4844
Kernel/LibC: opening standard files is done in libc
2023-05-29 20:21:19 +03:00
Bananymous
9a8512887f
LibC: open() now just returns syscall(SYS_OPEN, ...)
...
errno is handled in syscall()
2023-05-29 20:19:17 +03:00
Bananymous
b8ec8918b7
Kernel: We can't lock the MMU lock in load()
...
It needs to be callable always by scheduler
2023-05-29 19:39:35 +03:00
Bananymous
ff83f967d8
Kernel: Make RecursiveSpinLock thread safe
...
also SpinLock is now implemented with gcc builtins
2023-05-29 19:38:09 +03:00
Bananymous
998999a755
Kernel: Add SYS_SLEEP
2023-05-28 22:34:48 +03:00
Bananymous
09666adc53
Kernel: fork() now copies allocations through FixedWidthAllocator
2023-05-28 21:34:35 +03:00
Bananymous
ec73db0057
Kernel: Move page macros to Types.h
2023-05-28 21:03:08 +03:00
Bananymous
833642d405
Kernel: ISR will now crash userspace process instead of panicing kernel
2023-05-28 20:53:10 +03:00
Bananymous
f04399c3a0
Kernel: fork() now copies allocation done through GeneralAllocator
2023-05-28 20:37:39 +03:00
Bananymous
f2d767b799
Kernel: Add bareboness fork() function
2023-05-28 18:08:49 +03:00
Bananymous
3e93dae53c
Kernel: Add invalidate() to MMU
2023-05-28 18:05:49 +03:00
Bananymous
187bb046aa
Kernel: fix MMU::map_page_at()
...
We used to only reassign if flags changed
2023-05-28 17:57:05 +03:00
Bananymous
dd4973ac35
LibC: fputs uses fputc instead of putc
2023-05-28 17:48:34 +03:00
Bananymous
b021d3eebd
Kernel: Processes and Threads use VirtualRange memory allocations
2023-05-28 17:48:34 +03:00
Bananymous
15842db83e
Kernel: Move PhysicalRange to its own file and add VirtualRange
2023-05-28 17:48:34 +03:00
Bananymous
869de7283f
Kernel: MMU::get() is now MMU::kernel
...
MMU is can now be locked with RecursiveSpinLock.
Scheduler now has get_current_tid() that works before the Scheduler
is initialized. This allows RecursiveSpinLock usage early on.
2023-05-28 16:18:18 +03:00
Bananymous
a2ee543fa1
Shell: we now link BAN (we can't use it though)
2023-05-26 22:31:21 +03:00
Bananymous
eb24d32383
Kernel: Directory listing is working again
2023-05-26 22:31:21 +03:00
Bananymous
565e3db22d
Kernel: kmalloc debug_dump is marked [[maybe_unused]]
2023-05-26 22:31:21 +03:00
Bananymous
faf14b880e
LibC: Rewrite all the headers.
...
We now have more or less posix issue 2018 conforming libc headers.
This was a really time consuming and boring operation but it had to
be done.
Now we get to actually start implementing libc :)
2023-05-26 22:31:21 +03:00
Bananymous
faa7bc6043
BAN: libban is now build into library dir
2023-05-26 22:31:21 +03:00
Bananymous
03c64b950b
BAN: Errors.h can be included from userspace
2023-05-26 22:31:21 +03:00
Bananymous
27147790fd
Userspace: Start work on shell
2023-05-26 22:31:21 +03:00
Bananymous
1658e925f2
Kernel: Add bareboness possibility to set termios
2023-05-26 22:31:21 +03:00
Bananymous
82dcec9576
Buildsystem: Fix userspace link order
2023-05-26 22:31:21 +03:00
Bananymous
80d9f6131b
Kernel/LibC: move file offset back to kernel
...
This makes keeping track of offsets easier and more proper
2023-05-26 22:31:21 +03:00
Bananymous
e0a72defa2
Kernel: Add argc and argv to process entry
2023-05-16 00:27:49 +03:00
Bananymous
e0a7e242f8
Kernel: Add MMUScope
...
This disables interrupts and loads specified mmu for the
scope it lives in
2023-05-16 00:26:39 +03:00
Bananymous
6acb86c14b
Kernel: MMU keeps track of the current
2023-05-16 00:26:39 +03:00
Bananymous
8ec675cca6
LibC: fix bugs with printf
2023-05-15 22:47:08 +03:00
Bananymous
591d03de95
BAN: add is_arithmetic and is_signed to Traits.h
2023-05-15 20:26:29 +03:00
Bananymous
ec316391c5
Kernel: argc is passed as zero to userspace
2023-05-11 18:28:32 +03:00
Bananymous
7543fadfa8
LibC: printf now prints 0 as integer
2023-05-11 18:20:37 +03:00
Bananymous
bbaf1223f3
BuildSystem: add helper to create userspace programs
2023-05-11 18:10:06 +03:00
Bananymous
177b205c48
BuildSystem: userspace has cmake target
2023-05-11 16:19:53 +03:00
Bananymous
729ff267d7
LibC: add function declarations to sys/stat.h
2023-05-11 15:11:33 +03:00
Bananymous
d9be14e1fb
LibC: add function declarations to dirent.h
2023-05-11 01:42:52 +03:00
Bananymous
8a9f9b07e7
LibC: add definitions to math.h
2023-05-11 01:40:42 +03:00
Bananymous
c989a01913
LibC: add defines in stdio.h
2023-05-11 01:39:16 +03:00
Bananymous
5188efcc57
LibC: add function declarations to unistd.h
2023-05-11 00:34:03 +03:00
Bananymous
c05a5b796b
LibC: add function declarations to string.h
2023-05-11 00:34:03 +03:00
Bananymous
f0058e67c2
LibC: add function declarations to math.h
2023-05-11 00:34:03 +03:00
Bananymous
508d6311de
LibC: define all errnos and strerror{name,desk}_np
2023-05-11 00:34:03 +03:00
Bananymous
7c6bf40d0d
LibC: add function declarations to time.h
2023-05-11 00:34:03 +03:00
Bananymous
a74343c589
LibC: add more types to sys/types.h
2023-05-11 00:33:53 +03:00
Bananymous
d188576ef3
LibC: Add dummy signal.h
2023-05-10 23:20:27 +03:00
Bananymous
d922c5e1d0
LibC: add toupper, tolower in ctype.h
2023-05-10 23:13:56 +03:00
Bananymous
0adf24fcad
LibC: Add dummy setjmp.h
2023-05-10 23:00:53 +03:00
Bananymous
80e13965d9
LibC: Add dummy locale.h
2023-05-10 22:58:07 +03:00
Bananymous
36707ec87a
LibC: implement printf conversions e, E, f, F
2023-05-10 22:36:03 +03:00
Bananymous
5f89f083a2
LibC: add math.h with floorl
2023-05-10 22:35:42 +03:00
Bananymous
0d9422ead8
BAN: add pow, log2, log10, log in math
...
These are implemented using x86 floating point assembly
2023-05-10 19:03:33 +03:00
Bananymous
cae0a1cc60
LibC: add working f modifier to printf
...
This is implementation will write out of bounds if the conversion
takes more than 1024 characters (either super large number or very
big percision).
Also we dont handle NaN and infinity cases
2023-05-10 15:43:42 +03:00
Bananymous
480d92fce5
LibC: add better error string support
2023-05-10 02:22:31 +03:00
Bananymous
49fe3d0d4f
LibC: add probably functional *printf
...
I wrote a general printf function that takes an putc function
pointer. We can use this to implement all the printf family
functions. I haven't done thorough testing with this, but it seems
to be functional for the most part
2023-05-10 02:00:28 +03:00
Bananymous
ff2e2937a5
Kernel: Remove offset from OpenFileDescriptor
...
This is now handled on the libc side. There might be reasons to
have it in kernel side, but for simplicity's sake I'm moving it
to libc for now :)
2023-05-09 20:31:22 +03:00
Bananymous
0cc1fb53d5
LibC: Fix bug in *printf
2023-05-09 20:30:12 +03:00
Bananymous
512be884ed
Kernel: Add barebones GeneralAllocator for >4096B
2023-05-08 22:10:49 +03:00
Bananymous
f1667b398a
Kernel: FixedWidthAllocator operates on MMU
...
Instead of Process* we use MMU& in FixedWidthAllocator since it is
everything it actually needs :)
2023-05-08 00:06:56 +03:00
Bananymous
b0ec0f1a1a
Kernel: We add FixedWidthAllocators on demand
...
On SYS_ALLOC we will add a new FixedWidthAllocator if the old ones
are already full or we don't have one with proper size. This allows
arbitary number of allocations as long as you have enough memory
available :)
Next I will be writing a general allocator for allocations larger
than 4096 bytes which should make SYS_ALLOC syscall complete :)
2023-05-07 23:57:01 +03:00
Bananymous
05046d6e93
BAN: Error uses 64 bit error codes
2023-05-07 02:09:52 +03:00
Bananymous
054c5450df
LibC: syscall() now returns -1 on error and updates errno
2023-05-07 01:51:39 +03:00
Bananymous
12e42f40c5
Kernel/LibC: add free function for FixedWidthAllocator
...
I have to rework the syscall API and allocators in process. For
now this works well enough :)
2023-05-07 01:21:50 +03:00
Bananymous
890aa9aa15
BuildSystem: linker -O2 doesn't do anything? hopefully
2023-05-06 19:58:08 +03:00
Bananymous
bcfd838131
Kernel: Add basic fixed width allocator for userspace
...
We have to move process stacks to the general heap and maybe map
kernel to higher half.
2023-05-06 19:58:08 +03:00
Bananymous
9c07add00f
Kernel: Invalid physical addresses from heap are specified now by 0
2023-05-06 17:34:22 +03:00
Bananymous
ab8aac7dcf
Kernel: GDT tss selector is now 16 bit value
2023-05-06 17:34:22 +03:00
Bananymous
f36b94d039
Kernel: MMU can now provide info about virtual address space
2023-05-06 17:34:22 +03:00
Bananymous
92daa831d1
Kernel: ISRs now print pid and tid
2023-05-06 00:10:15 +03:00
Bananymous
e7a170c89f
Kernel: 64 bit MMU now properly identity maps kernel
2023-05-05 14:19:28 +03:00
Bananymous
3c5d3eb8ad
Kernel: TTY input process is now single instance
...
Process sends key events to the active (currently only) tty
2023-04-30 16:11:14 +03:00
Bananymous
55bb0084aa
Kernel: namespace and function renames
...
MMU moved to namespace kernel
Kernel::Memory::Heap moved to just Kernel
MMU::map_{page,range} renamed to identity_map_{page,range}
Add MMU::get_page_flags
2023-04-28 14:48:38 +03:00
Bananymous
acf5660090
Kernel: Add set_tss_stack() to 32 bit
2023-04-28 14:44:23 +03:00
Bananymous
9d7530662f
Kernel: dprintln file name is now relative
...
This makes file names much shorter
2023-04-28 14:43:19 +03:00
Bananymous
9cf09165b5
BAN: Add is_power_of_two to Math functions
2023-04-28 14:42:49 +03:00
Bananymous
e1a6e7c3ac
LibC: add proper stdlib.h header
...
Function declarations taken from the posix specifications
2023-04-27 15:14:03 +03:00
Bananymous
3537d53d5c
LibC: add link to posix stdio.h
2023-04-27 14:16:25 +03:00
Bananymous
c20ba3064d
Userspace: Simple stdio test
2023-04-25 14:50:26 +03:00
Bananymous
a22caa38d2
Kernel: Scheduler updates tss stack on thread execution
2023-04-25 14:49:50 +03:00
Bananymous
dc0f8b383f
Kernel: Usespace threads now have an interrupt stack
2023-04-25 14:49:18 +03:00
Bananymous
f1a0625b61
Kernel: TSS stack can be set after initialization
2023-04-25 14:48:12 +03:00
Bananymous
02b961fd7e
Kernel: Stack pointer out of bounds now panics with a message
2023-04-25 13:40:55 +03:00
Bananymous
1d42b26fce
LibC: Fix some bugs
2023-04-25 13:27:01 +03:00
Bananymous
6e01e04922
Kernel: Fix bug in Process::create_userspace()
...
We used to write more than we needed to. This could lead to unwanted
page faults
2023-04-25 13:21:28 +03:00
Bananymous
79812b34b0
LibC: fread() now does a single syscall
2023-04-25 12:38:08 +03:00
Bananymous
b7c2ea8d46
Kernel: Fix possible dead lock in Process::read()
2023-04-23 14:46:18 +03:00
Bananymous
cd74b2167d
LibC: Write mostly functioning stdio
2023-04-23 14:32:37 +03:00
Bananymous
9b2a577fc3
Kernel: Add ASSERTion to Process::exit()
...
This is just so I don't forget that exit can currently only
be called on the executing thread itself
2023-04-22 19:05:27 +03:00
Bananymous
2dd09163e6
Kernel: Process can now load 32 bit elf files on i386
...
We are page faulting on process exit but I'm investigating
the reason.
2023-04-22 19:03:30 +03:00
Bananymous
850ff93940
LibELF: Add 32 bit support
2023-04-22 19:00:18 +03:00
Bananymous
fb6add2b4a
Kernel: Fix 32 bit MMU
2023-04-22 18:22:39 +03:00
Bananymous
48445f12ac
Kernel: More proper paging in Elf loading
2023-04-22 18:17:44 +03:00
Bananymous
792fad2a03
Kernel: d{print,warn,error}ln(...) now has a spinlock
2023-04-22 17:58:51 +03:00
Bananymous
cc04990ce3
Kernel: Process now frees up its pages on destruction
2023-04-22 16:54:46 +03:00
Bananymous
7530482cc2
Kernel: Cleanup process creation for userspace
2023-04-22 16:51:50 +03:00
Bananymous
33d8c518e9
Kernel: Fix some deadlocks in the Process
2023-04-22 16:19:57 +03:00
Bananymous
e0ce2394fe
Kernel: Remove obsolete userspace stuff from kernel
2023-04-22 15:38:45 +03:00
Bananymous
fadce063a7
Kernel: Usespace programs are now ran through ELF files
...
only 64 bit elf files are supported for now.
2023-04-22 15:35:32 +03:00
Bananymous
ef0263e32d
LibELF: Header printing can now be turned off
2023-04-22 15:34:09 +03:00
Bananymous
4588e25d27
LibELF: ELF now has methods for accessing more attributes
...
You can now access the program headers and the memory itself
2023-04-22 15:31:05 +03:00
Bananymous
ff8c0086e2
LibC: puts() now just calls syscall(SYS_WRITE, ...)
2023-04-22 15:29:38 +03:00
Bananymous
dc1b7cf08f
LibC: syscalls have now proper argument order
2023-04-22 15:29:15 +03:00
Bananymous
26fe6ad898
Kernel: kmalloc does not dump stack trace
...
dump_stack_trace() page faults and i dont feel like debugging this
now :)
2023-04-21 13:45:13 +03:00
Bananymous
fc71d2f7c4
Kernel: Don't call 'cli' on interrupt
...
This is automatically done because we are using interrupt gates
in the IDT
2023-04-21 11:18:08 +03:00
Bananymous
35e949ef5e
Kernel: Fix syscall return value in 32 bit
2023-04-21 11:08:02 +03:00
Bananymous
9c506ef85b
Kernel: Stack pointer is validated when updated
...
This allows us not to fail stack pointer when in syscall since
interrupts use their own stack
2023-04-21 10:40:24 +03:00
Bananymous
b1c7af38d0
Kernel: Add barebones per process virtual addresses
...
We now assign every (userspace) process its own MMU which we load
in scheduler. This allows every process to have separate virtual
address space.
This is very hackish implementations but it works for now
2023-04-20 00:45:41 +03:00
Bananymous
ea0c9b639f
Kernel: Add some bareboness functionality to map virtual addresses
2023-04-19 23:51:36 +03:00
Bananymous
0030f035be
Kernel: Rename MMU::{un,}allocate... to MMU::{un,}map
...
This is more appropriate name for the behaviour :D
2023-04-19 21:50:30 +03:00
Bananymous
c26529ae86
Kernel: kmalloc will always print debug on failed alloc
2023-04-19 18:05:01 +03:00
Bananymous
7d57d2fcfb
LibELF: remove unused file
2023-04-19 17:32:12 +03:00
Bananymous
e8a0df54b1
Kernel: ATAController will fail to initialize in native mode
2023-04-19 17:29:36 +03:00
Bananymous
33393335c8
Kernel: PCI devices now report their prog_if
2023-04-19 16:43:05 +03:00
Bananymous
c5b02bb9f5
Kernel: Shell fix file reading
...
We were reading 8 bytes at a time instead of the 1024 we were
supposed to :DD
2023-04-19 14:09:23 +03:00
Bananymous
a1047918d2
Kernel: Shell now has exit() command
2023-04-19 12:53:09 +03:00
Bananymous
fd81e31050
Kernel: Fix Process::exit() and where it is called from
...
cksum doesn't seem to work anymore on big files. I have to look
into this. It locks up after couple of seconds...
2023-04-19 12:52:21 +03:00
Bananymous
160315c4d0
Update README.md
...
Add cool badges :D
2023-04-19 00:46:42 +03:00
Bananymous
d9b7747fc5
LibC: exit() calls _fini()
2023-04-19 00:42:00 +03:00
Bananymous
dcce18799f
Kernel: We now launch Shell again on boot
...
Adding this just before push :D
2023-04-19 00:41:24 +03:00
Bananymous
a9a15ea2c0
Kernel: init2 is now launched as a process instead of thread
...
Also only process can now add threads to scheduler. Nobody should
have raw access to scheduler and everything should be through
Process::current() or irqs (reschedules)
2023-04-19 00:39:06 +03:00
Bananymous
d63716db96
Kernel: Process is not reference counted any more
...
This was not necessary and it made things needlessly complicated
2023-04-19 00:34:18 +03:00
Bananymous
3ca623349a
BAN: Add {TRY,MUST}_REF for references
...
It is annoying that we have to have separate macros for these but
I can't find a way to cleanly return lvalue reference from statement
expression. Currently we cast the reference to pointer and return
unreference the pointer outside of the expression.
This feature will probably not be used any time soon, but atleas
it is implemented if I need it one day
2023-04-19 00:31:15 +03:00
Bananymous
121f4bc1dd
BAN: TRY and MUST macros use rvalue references
2023-04-19 00:11:15 +03:00
Bananymous
8e31ef9905
BAN: Add specialization for ErrorOr<LValueReference>
...
ErrorOr can now return a reference :)
2023-04-18 22:02:47 +03:00
Bananymous
2c52e0aad8
BAN: Variant with reference now supports copy/assign
2023-04-18 20:21:23 +03:00
Bananymous
06916f56be
BAN: Variant now works with references
...
References can be assigned with the set() method. Construction nor
assigment operators cannot be used with references to avoid ambiguity
with what assignment to reference does.
You can set the underlying reference with the set() method and access
it with the get() method.
The references are stored as pointers to the object under the hood
which means that size of a reference is sizeof pointer.
2023-04-18 19:53:34 +03:00
Bananymous
c3df0bd15e
BAN: Variant::set now copy/move assigns when possible
2023-04-18 19:10:22 +03:00
Bananymous
b41a8e2829
BAN: Variant now has variadic template types
2023-04-18 18:29:48 +03:00
Bananymous
96ac072166
Kernel: Heap allows us to take free pages.
...
The API is kinda weird and will probably be reworked in near future
but this will work for now :)
2023-04-18 10:18:15 +03:00
Bananymous
295a27f16a
Kernel: Panic wont print stacktrace if it has already paniced
...
This prevents stack trace dump to panic and loop
2023-04-18 10:18:15 +03:00
Bananymous
88f60b5e41
Kernel: Map all ACPI tables on initialization
...
This makes their usage much easier and less error prone
They won't mapped be processes when we get to there, so this won't be
a problem
2023-04-18 10:18:15 +03:00
Bananymous
1c22e90fa0
Scripts: remove disk build from install-usb.sh
...
You can still use the install-usb.sh script from the build directory.
2023-04-18 10:18:15 +03:00
Bananymous
d23604b0d5
Kernel: Handle some Heap edge cases
2023-04-18 10:18:15 +03:00
Bananymous
c5347e6707
Kernel: Reorder boot initialization
...
We now create the TTY as soon as possible so we can show console
output without serial port.
2023-04-18 10:18:15 +03:00
Bananymous
bf0c7b9ae8
Kernel: Heap implementation can now give free pages from all of RAM
2023-04-18 10:18:15 +03:00
Bananymous
0374b68fa1
Kernel: Remove unused file
2023-04-18 10:18:15 +03:00
Bananymous
633929629c
Kernel: Start working on heap
2023-04-18 10:18:15 +03:00
Bananymous
6a3b3213cf
Kernel: Kmalloc now has its memory statically allocated
...
We don't use the memory map given by bootloader since this automatically
maps the memory to a available space.
2023-04-18 10:18:15 +03:00
Bananymous
fdb4eb6042
Kernel: Move kmalloc and MMU to Memory directory
2023-04-18 10:18:15 +03:00
Bananymous
998ae511a3
LibELF: Start implementing elf library
2023-04-18 10:18:15 +03:00
Bananymous
c897b90c28
Create LICENCE
2023-04-13 00:38:24 +03:00
Bananymous
3f9d6f0311
LibC: add needed stubs to build executables with our compiler
2023-04-12 17:53:02 +03:00
Bananymous
8ee63f8264
Kernel: We can create basic userspace processes
...
These are still allocated on the kernel memory
2023-04-12 17:52:36 +03:00
Bananymous
34358b8471
Kernel: Scheduler can now terminate processes threads
2023-04-12 17:49:04 +03:00
Bananymous
5b1af4ec47
Kernel: Debug::dump_stack_trace now 'detects' repeating function
2023-04-12 01:32:41 +03:00
Bananymous
071d7af58a
Kernel: kmalloc does not check for corruptiong unless it cannot allocate
...
We 'don't care' if kmalloc is corrupted unless it prevents us from
allocating memory. Scheduler should be catching stack overflows either
way and is much more efficient
2023-04-12 00:24:02 +03:00
Bananymous
3201c3654e
Kernel: Threads now use only 4 KiB stack :)
2023-04-12 00:22:08 +03:00
Bananymous
6ed3023725
Kernel: Fix TTY spinlock usage
2023-04-12 00:20:04 +03:00
Bananymous
892a63aec5
Kernel: Shell TTY_PRINT is now function instead of macro
...
This makes functions uses way less stack
2023-04-12 00:18:58 +03:00
Bananymous
3fe889d4a4
BuildSystem: GCC will now complain on functions with 1 KiB stack
2023-04-12 00:18:06 +03:00
Bananymous
c35e7368f2
BAN: Variant now aligns its data properly
2023-04-12 00:17:45 +03:00
Bananymous
cafd546ce8
Kernel: kmalloc now detects corruption
...
Kmalloc checks if its nodes have corrupted. This was happening
because of stack overflow.
2023-04-11 23:36:46 +03:00
Bananymous
5810a77cbf
Kernel: Mark Scheduler::start() as noreturn as appropriate
2023-04-11 23:33:20 +03:00
Bananymous
6f7045ead2
Kernel: kernel doesn't allocate large blocks of data on stack
...
We used to allocate 1 KiB blocks on multiple places on stack. This
is a problem, since kernel stack shouldn't have to be too big
2023-04-11 23:31:58 +03:00
Bananymous
40f9a42c00
Kernel: Scheduler will panic if it encounters stack overflow
2023-04-11 23:29:21 +03:00
Bananymous
9abe1f27bb
Kernel: Process now locks the mutex while modifying open files
...
This allows processes to be actually removed from the list instead
of dead locking
2023-04-11 23:28:16 +03:00
Bananymous
aa2aee684b
Kernel: remove message from BAN::Error
...
We don't store the error message anymore in BAN::Error.
Instead we store a error code that can be mapped into a string.
This allows BAN::Error to only take 4 bytes instead of 128.
We should also make some kernel initialization just panic instead
of returning errors since they are required for succesfull boot
anyway.
2023-04-11 23:25:21 +03:00
Bananymous
cfa025acae
BAN: Move RefPtr to its own file and create New.h
...
New.h contains definitions for placement new operators and
BAN::allocator and BAN::dealloctor
2023-04-10 21:07:25 +03:00
Bananymous
781cc78a1f
BuildSystem: Fix header copying to sysroot
...
We used to copy all headers everytime to sysroot which caused
rebuild of the whole os. Now we use the cmake command
'copy_directory_if_different' which seemed to fix this issue :)
2023-04-10 21:07:25 +03:00
Bananymous
f924ac9265
Kernel: Threads can now be terminated mid execution
2023-04-10 21:07:25 +03:00
Bananymous
df6e8a6562
Kernel: Add small wait in ATA driver before reading/writing
...
This allows bochs to boot again
2023-04-10 21:07:25 +03:00
Bananymous
3f01f936a1
Kernel: Fix framepointers on started threads
2023-04-10 21:07:25 +03:00
Bananymous
25ddc24754
BuildSystem: cmake can now build out libc
...
I can't seem to get libc++ build to work...
2023-04-10 21:07:25 +03:00
Bananymous
989f9ec5fe
LibC: remove old unused files
2023-04-07 02:26:44 +03:00
Bananymous
3fbee2c835
BuildSystem: remove now obsolete include directories from kernel build
2023-04-07 02:25:47 +03:00
Bananymous
b10b3cbe3b
Add a screenshot to README
2023-04-06 21:01:27 +03:00
Bananymous
77e94e1d3b
General: Write basic README
2023-04-06 20:59:45 +03:00
Bananymous
4a3bfaff90
Scripts: linecount does not count lines from toolchain/
2023-04-06 20:31:10 +03:00
Bananymous
2a8dc58b6a
BuildSystem: Cleanup cmake code
...
The buildsystem is kind of a mess. I will be writingn build
instructions soon.
2023-04-06 20:31:10 +03:00
Bananymous
8a8793fd2d
BuildSystem: you can now build the toolchain with cmake
2023-04-06 00:23:02 +03:00
Bananymous
7ab9e420ac
Update .gitignore
2023-04-06 00:02:47 +03:00
Bananymous
43ca62de47
BuildSystem: Create script for os specific toolchain
2023-04-06 00:02:13 +03:00
Bananymous
a5830c5424
LibC: add stubs for a lot of functions
2023-04-05 23:58:40 +03:00
Bananymous
b6896a6d85
LibC: sys/types uses 'typedef' instead of 'using'
2023-04-05 15:03:24 +03:00
Bananymous
9e0b4132ee
Kernel: Shell now somewhat functions again
...
I will not be fixing the shell implementation until I get to
userspace
2023-04-05 11:37:41 +03:00
Bananymous
68158324f4
Kernel: Fix TTY echo and canonical flag behaviour
2023-04-05 11:35:19 +03:00
Bananymous
a420be6b20
Kernel: Fix ansi control sequence cursor movement
2023-04-05 03:07:52 +03:00
Bananymous
f281543255
Kernel: Add tty to process and make termios modifiable
2023-04-05 02:53:28 +03:00
Bananymous
67ff01e915
LibC: Add errno ENOTTY
2023-04-05 02:47:37 +03:00
Bananymous
dcf0969e2d
Kernel: TTY now supports clearing
2023-04-05 02:04:18 +03:00
Bananymous
4f522d337a
Kernel: Add partial support for shell
...
We don't handle arrow keys, and the tty does not know how to clear
the screeen :D
2023-04-05 01:30:58 +03:00
Bananymous
af0979ec32
Kernel: Process can now initialize stdio
...
This allows the use of the fds STD{IN,OUT,ERR}_FILENO
2023-04-05 01:10:25 +03:00
Bananymous
63e863ad35
LibC: Add unistd.h with STD{IN,OUT,ERR}_FILENO definitions
2023-04-05 00:59:48 +03:00
Bananymous
7f95444bb5
Kernel: Start work on making tty a file
...
TTY is now a file that you can read from/write to. I still have
to port shell to use this new interface
2023-04-05 00:56:09 +03:00
Bananymous
783842bac2
Kernel: add virtual write function to inode
2023-04-03 20:29:07 +03:00
Bananymous
e1534ad25b
Kernel: Fix keys in PS2Keymap
2023-04-03 20:25:23 +03:00
Bananymous
ee1f3623ce
Kernel: Fix typo
2023-04-03 19:56:55 +03:00
Bananymous
dffdb51713
BuildSystem: remove non-existent file from kernel CMakeLists.txt
2023-04-03 19:02:25 +03:00
Bananymous
daa35aaf7d
BAN: Add data() member function to Array
2023-04-03 17:00:52 +03:00
Bananymous
b87dae7e7c
Kernel: Device dev and rdev number is done more properly
...
Also hd* partitions are now 1 indexed instead of 0
2023-04-03 11:43:16 +03:00
Bananymous
86d777e2eb
LibC: add device macros in sys/sysmacros.h
2023-04-03 10:59:15 +03:00
Bananymous
2ffee63889
Kernel: Cleaner partition parsing errors
2023-04-03 09:55:49 +03:00
Bananymous
c936aac777
Kernel: Optimize scheduler idling
...
Now after each interrupt we will ask the scheduler to reschedule
if the current thread is the idle thread. This allows semaphore
unblocking to be practically instant when there is only one thread
executing.
Now disk reading is back to ~3 MB/s for single threaded process
2023-04-03 01:51:05 +03:00
Bananymous
46d65471d9
Kernel: ATA now uses irqs instead of polling
...
Reading is now much slower at ~500 kB/s it was around 3 MB/s.
This is probably mostly due semaphore blocking taking atleast
until next reschedule (1 ms itervals). This will be a problem
as long as we are using only single processor.
I could try to use {READ/WRITE}_MULTIPLE commands, but since
most of the disk reads are 2 sectors (inode block size) this
will at most double the speed.
Most efficient speed up would of course be caching disk access
data and inodes overall.
2023-04-03 00:03:38 +03:00
Bananymous
dcc174b62e
Kernel: Move ATADevice to its own file from ATAController
...
The API is kinda weird since device reads/writes go from
ATADevice -> ATAController -> ATADevice
but this is for now atleast necessary since ATAController has(?)
to keep all devices from using the disks at the same time
2023-04-02 18:26:19 +03:00
Bananymous
bdc7a99c59
Kernel: ATA controller waits now before read/write until disk is ready
...
Qemu used to freeze on disk writes but now it seems fine
2023-04-02 05:37:17 +03:00
Bananymous
2aad357c18
BuildSystem: building for 32-bit works now
2023-04-02 05:03:17 +03:00
Bananymous
ccf51cec5c
Scipts: linecount doesn't count lines in build/
2023-04-02 04:09:54 +03:00
Bananymous
4c5176f751
BuildSystem: We are now using cmake instead of plain make
...
I have been annoyed for a while since I had to build everything
when running the os since the buildsystem was really bad.
I wanted to rewrite the whole build system and changed to using cmake
:)
2023-04-02 04:07:27 +03:00
Bananymous
d71f1f24e4
LibC: Combine string.h functions definitions to single file
2023-04-02 00:00:29 +03:00
Bananymous
cbb0f6be9a
Kernel: cleanup includes
...
I went quickly went through all files since I found some weird
includes :D
2023-04-01 02:14:49 +03:00
Bananymous
a60f8098ee
Kernel: Fix traversing back from mount points
2023-04-01 01:54:35 +03:00
Bananymous
8bffbf64b9
Kernel: Add inodes '.' and '..' to device manager
2023-04-01 01:33:04 +03:00
Bananymous
d91a5bccf4
Kernel: Reads return 0 bytes read at the end of device
...
We used to not have any idea if we where already at the end of device.
Also fixed couple of copy-paste errors from read->write
2023-04-01 00:55:07 +03:00
Bananymous
1ca0d3a3c1
Kernel: Shell cleanup cat command
2023-04-01 00:54:39 +03:00
Bananymous
653f688567
Kernel: Shell 'time' prints the time even if command fails
2023-04-01 00:30:33 +03:00
Bananymous
8b5d8d9f8a
Kernel: Process gets absolute paths for mount
2023-04-01 00:30:11 +03:00
Bananymous
c45ada6ccb
Kernel: fix ext2 failed creation memory leak
2023-04-01 00:22:03 +03:00
Bananymous
db65cfeb8a
Kernel: Cleanup ATA device initialization
2023-03-31 00:58:57 +03:00
Bananymous
a3ba6da6f3
Kernel: Move DeviceManager to its own file
2023-03-30 22:39:45 +03:00
Bananymous
b048630e5b
Kernel: Improve locking in Process, VFS and ATAController
...
We used to block on all process access. This meant that shell
reading the keyboard input would block all VFS access making disk
accesses practically impossible. We now block only when it is
necessary :)
2023-03-30 22:02:16 +03:00
Bananymous
dcee92a6bc
Kernel: Thread is no longer RefCounted
...
This makes developement with Scheduler much easier against compiler
optimizations. I could now remove the pragma GCC optimize stuff.
2023-03-30 19:16:51 +03:00
Bananymous
c2e3b422cc
Kernel: Add Semaphore to block threads
2023-03-30 18:46:33 +03:00
Bananymous
7b7f4eb141
BAN: LinkedList::remove now returns iterator to the element after
2023-03-30 18:46:19 +03:00
Bananymous
d4c03d3939
Kernel: root partition is now passed from the commandline
2023-03-30 18:46:19 +03:00
Bananymous
5d459130a7
BAN: StringView::split(char, bool) is now thread safe
...
I had to duplicate some code, but this is better since I would like
to not use BAN::Function for something like this
2023-03-30 16:35:38 +03:00
Bananymous
8e68d2e3ea
Kernel: Shell can now mount partitions
2023-03-30 15:06:41 +03:00
Bananymous
30c33b55e3
Kernel: Inode::Mode is now a struct so we can have functions in it
2023-03-30 14:41:15 +03:00
Bananymous
e2791e5260
Kernel: StorageDevices and Controllers are now devices
2023-03-30 14:22:15 +03:00
Bananymous
88a8bd659d
Kernel: Add IFBLK, IFLNK, IFSOCK to Inode::Mode
2023-03-30 13:15:46 +03:00
Bananymous
f9cc114907
Kernel: All devices have atime, mtime, ctime at their creation
2023-03-30 13:15:46 +03:00
Bananymous
9a4d603a62
Kernel: Remove the mount test from VFS
2023-03-30 11:43:24 +03:00
Bananymous
78ea4b2207
Kernel: fix stat command and device numbers
2023-03-30 10:43:08 +03:00
Bananymous
ab3cdea548
Kernel: Rewrite mounting code
2023-03-29 21:34:48 +03:00
Bananymous
10e0c90fde
BAN: String add front() and back() helpers
2023-03-29 14:10:29 +03:00
Bananymous
dd84a2175f
Kernel: Move Partition out of StorageDevice and rename functions
2023-03-29 13:23:01 +03:00
Bananymous
ae05ad3f38
Kernel: Shell commands 'ls' and 'stat' recognize character devices
2023-03-29 11:56:33 +03:00
Bananymous
62fb233eb1
Kernel: DeviceManager is now a 'FileSystem' so it can expose devices
...
Shell reads keyboard through /dev/input :)
2023-03-29 11:50:46 +03:00
Bananymous
cd0d10b64e
LibC: add ENOBUFS errno
2023-03-29 10:58:25 +03:00
Bananymous
426b1482dd
Kernel: Fix keymap numlock behaviour
2023-03-29 03:18:22 +03:00
Bananymous
16d9d29971
Kernel: Remove obsolete KeyboardLayout/
...
This was used by the old input system. Currently keyboard layout is
hardcoded to finnish. But it will be reworked as something read from
the filesystem
2023-03-29 03:09:14 +03:00
Bananymous
a4fb805315
Kernel: Add linecount.sh script
...
This calculates the number of lines of code in the whole project :D
2023-03-29 03:06:57 +03:00
Bananymous
fa8e921ee8
Kernel: Rework the whole input system
...
We now use Device abstraction that will allow us to provide devices
to userspace through /dev. Currently Shell reads from first and only
device (it being PS/2 Keyboard).
2023-03-29 03:05:16 +03:00
Bananymous
e5c3486826
BAN: Vector now takes optional argument for default value on resize
2023-03-28 23:10:36 +03:00
Bananymous
8e626b8d1f
BAN: Implement basic Circular Queue
2023-03-28 21:44:02 +03:00
Bananymous
ea900ad744
Kernel: ACPI unmap_header does not do anything
...
We have to work with MMU mapping/unmapping to be user friendly
2023-03-28 02:56:44 +03:00
Bananymous
6a6717cdd3
BAN: ScopeGuard can now be disabled (it wont call the function)
2023-03-28 01:15:13 +03:00
Bananymous
c7286396d8
Kernel: Move ACPI to its own file
2023-03-27 17:30:45 +03:00
Bananymous
0cebf248a3
BAN: move placement new declaration to Move.h
2023-03-27 03:38:06 +03:00
Bananymous
686b425eb9
Build System: Create base directory for the FS
2023-03-27 01:11:17 +03:00
Bananymous
666051fd34
Kernel/BAN: move unix time conversion to BAN and add stat to Shell
2023-03-27 00:49:58 +03:00
Bananymous
e55860eb6b
Kernel: Rework processes and VFS so we don't expose inodes
...
Everything is now done through a file descriptor.
2023-03-26 04:30:57 +03:00
Bananymous
32c3aca52f
LibC: add dirent.h
2023-03-25 02:08:33 +02:00
Bananymous
9fd17ef73c
LibC: Add stat structure
2023-03-24 18:08:22 +02:00
Bananymous
1fade1aa9e
Kernel: Process::working_directory() is now thread safe
...
I realized you cannot return a stirng view and it to be thread safe
2023-03-24 01:46:25 +02:00
Bananymous
814f0b215d
Kernel: Create RecursiveSpinLock and add it to Process
...
We now lock every function within Proccess, just to be sure.
Recursive lock allows us to use lock from the same thread even if
we already have the spinlock locked
2023-03-24 01:32:35 +02:00
Bananymous
5fd26b4ea8
Kernel: Lock process functions instead of the ata controller
...
Process has to use locks at least on some functions so multithreaded
disk io is safe. This seemed to fix corrupted reads from disk
2023-03-24 01:17:39 +02:00
Bananymous
e5eab8bae4
Kernel: Ext2FS now does allocations better
...
We only have to allocate at the beginning of the all functions and
can properly exit before any disk reads if we run out of memory.
This makes development little bit 'harder' since the {read,write}_block
user must allocate a buffer of atleast block_size bytes.
I also made disk access to cause kernel panic on error since the error
handling during file write is something I don't want to think now.
The filesystem can easily corrupt so, I feel like when disk io starts
to fail I'll come back to this.
2023-03-23 23:22:31 +02:00
Bananymous
75c4f35e85
Kernel: Add possibiliity to create empty files on Ext2
...
Big rewrite for Ext2 for more easy and optimized code
2023-03-23 22:26:06 +02:00
Bananymous
1be8b2f514
LibC: add more typedefs to sys/types
2023-03-23 19:24:12 +02:00
Bananymous
633414bd20
Kernel: Remove block group descriptor cache from ext2fs
...
This will make improving the fs easier since we need to only update
the values on the disk
2023-03-23 18:52:58 +02:00
Bananymous
7ca6cd61be
Kernel: Move get_unix_time to RTC namespace
2023-03-23 18:14:51 +02:00
Bananymous
d6e4430692
LibC: add errno NAMETOOLONG
2023-03-23 14:48:42 +02:00
Bananymous
efe73caf1b
BAN: char* is now formatted as string and not pointer
2023-03-23 14:29:35 +02:00
Bananymous
3ef72e8a7b
BAN: Modify Span constructors to keep constness correctly
2023-03-23 14:26:03 +02:00
Bananymous
e9da63ad79
BAN: Add is_const to traits
2023-03-23 13:28:57 +02:00
Bananymous
9b56801c3d
Kernel: StorageDevice and Ext2 "support" writing
2023-03-23 13:04:13 +02:00
Bananymous
5f6c58ffd2
Kernel: Shell now prints unix time with 'date' command
2023-03-23 11:13:51 +02:00
Bananymous
74949401bd
Kernel: Cleanup GPT parsing code
2023-03-23 11:13:14 +02:00
Bananymous
4ffc69a6e4
Kernel: TTY buffer is resized on font size change
...
Shell also has better line wrapping. You still can't visually go
back to previous line, but atleas we now write from the beginning
of the line
2023-03-22 02:09:22 +02:00
Bananymous
61ac9833be
Kernel: Reading from fd verifies that file is opened for reading
2023-03-22 01:55:58 +02:00
Bananymous
dbf7d9f19e
Kernel: Ext2 directory functions now fail on invalid blocks
...
Invalid blocks should only happen while writing to a file and
I think in that case we should just bail out instead of giving
you incomlete inode list or search result.
2023-03-22 01:55:57 +02:00
Bananymous
a6e5a0b704
Kernel: cksum uses now a different crc32_table to match linux 'cksum'
2023-03-22 01:55:21 +02:00
Bananymous
337463ec16
Kernel: Ext2 can now read from non-block-size aligned offsets
2023-03-21 19:19:17 +02:00
Bananymous
072954480d
Kernel: Remove obsolete Ext2FS::ext2_root_inode()
...
This was not used by anyone and the cast was wrong anyway
2023-03-21 18:19:48 +02:00
Bananymous
3652d11059
Kernel: Remove for_each_block from Ext2
2023-03-21 18:14:02 +02:00
Bananymous
54824aec74
Kernel: Cleanup font parsing
...
We use now the LittleEndian<> wrapper for PSF2 header and no more
magic constants in code
2023-03-20 19:48:08 +02:00
Bananymous
a61cf61fd1
BAN: Add wrappers for little/big endian numbers
2023-03-20 19:48:08 +02:00
Bananymous
75e85def83
Kernel: prefs font does not allocate extra buffer
2023-03-20 19:48:01 +02:00
Bananymous
f9ae1f0023
Kernel: Fix PC Screen font parsing
...
I had misread the format and the parsing code was incorrect. I also
changed fonts to store unicode codepoints as 32 bit integers, so
every character can be represented
2023-03-20 14:52:42 +02:00
Bananymous
896b4c280c
Kernel: Font parsing uses Spans now
2023-03-20 13:35:54 +02:00
Bananymous
ce3f268075
BAN: Implement basic Span
...
This is wrapper over contiguous block of memory e.g. Vector
2023-03-20 13:34:26 +02:00
Bananymous
8edabaea55
BAN: Add iterators to all containers with contiguous memory
2023-03-20 13:26:42 +02:00
Bananymous
ec22b86e00
BAN: Add implementation for basic iterator for contiguous memory
2023-03-20 13:15:38 +02:00
Bananymous
e4bcd98904
Kernel: Add basic mounting to VFS.
2023-03-19 05:51:25 +02:00
Bananymous
cf2be54e8f
LibC: add errno ENOTEMPTY
2023-03-19 05:43:40 +02:00
Bananymous
3ab62e83d3
LibC: add errno EEXISTS
2023-03-19 04:17:39 +02:00
Bananymous
3570764448
Kernel: Add comparison operator for inodes
2023-03-19 03:34:23 +02:00
Bananymous
6188023fb5
Create README.md
2023-03-18 04:05:59 +02:00