Bananymous
f071240b33
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
27364f64a6
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
bcf62c5f2e
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
4d6322ff9c
BuildSystem: Don't strip kernel
2023-10-05 18:52:44 +03:00
Bananymous
2eef581737
BuildSystem: Try to set compiler only if it exists
2023-10-05 18:52:05 +03:00
Bananymous
7ce8e2d57b
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
e780eaa45f
meminfo: Print allocated physical memory percentage
2023-10-03 10:39:27 +03:00
Bananymous
44cb0af64f
Shell: source $HOME/.shellrc if found on Shell startup
2023-10-03 10:39:27 +03:00
Bananymous
bb0989fdef
Shell: Implement sourcing scripts
2023-10-03 10:24:10 +03:00
Bananymous
f0b6844feb
meminfo: Add process command line to the output
2023-09-30 23:17:31 +03:00
Bananymous
b712c70c75
Kernel: Expose command line and environment to /proc
2023-09-30 23:01:33 +03:00
Bananymous
797ca65c66
Kernel: Add physical memory info to /proc/{pid}/meminfo
2023-09-30 22:11:45 +03:00
Bananymous
762b7a4276
Userspace: Add meminfo command that parses /proc/{pid}/meminfo
2023-09-30 21:20:53 +03:00
Bananymous
a511441f7e
Kernel: /proc/{pid}/meminfo now reports per process memory usage
2023-09-30 21:20:18 +03:00
Bananymous
cd61d710df
Kernel: Add procfs that contains only pids
2023-09-30 21:19:36 +03:00
Bananymous
f88ad7efcd
Kernel: All process' memory areas can report their virtual mem usage
2023-09-30 21:15:46 +03:00
Bananymous
38320018dc
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
d883d212b1
Kernel/LibC: dirent now contains file type
2023-09-30 20:46:57 +03:00
Bananymous
dedb2a2399
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
8604c55de8
Kernel: Add API for RamDirectoryInodes to delete containing inodes
2023-09-30 19:22:30 +03:00
Bananymous
e949e8550c
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
eb5c6cf736
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
94ce2c97be
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
3f164c6b82
Userspace: Implement basic test for MAP_SHARED
2023-09-29 18:59:37 +03:00
Bananymous
f953f3d3ff
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
9fc75fe445
Kernel: Don't write to stat_loc on SYS_WAIT if it is null
2023-09-29 18:31:44 +03:00
Bananymous
7a5bb6a56b
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
d54c6b7f6b
LibC: Fix mmap()
...
mmap() did not pass fildes to the syscall structure.
2023-09-29 17:24:21 +03:00
Bananymous
db5d6a7f80
Kernel: Implement MAP_PRIVATE file mappings
...
mmap() now supports mapping files with MAP_PRIVATE.
2023-09-29 17:23:42 +03:00
Bananymous
4a92f44cf6
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
376b9f7272
LibC: mmap returns MAP_FAILED instead of NULL
2023-09-29 10:38:08 +03:00
Bananymous
7e9e4c47ae
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
603fc200e6
Kernel: Add some sanity assertions/functions
2023-09-29 02:03:19 +03:00
Bananymous
c11e84b248
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
be13120554
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
9943edad5a
LibELF: Add types for native executable
2023-09-29 01:56:57 +03:00
Bananymous
f4049be975
Kernel: Fix off by one error when calculating pages in range
2023-09-29 01:56:15 +03:00
Bananymous
6cf7e01fe9
Kernel: Don't map interrupt stack as userspace accessable
2023-09-28 21:58:24 +03:00
Bananymous
b51d2f5295
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
49d941ad65
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
a66c3bdae5
Kernel: Remove duplicate code in VirtualRange::create_to_vaddr_range
2023-09-28 13:59:49 +03:00
Bananymous
547eabb403
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
79851394b3
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
fcdc922343
Kernel: Enter ACPI mode with lai
2023-09-28 12:30:27 +03:00
Bananymous
0b11d76576
LibC: Add errno for unknown error
2023-09-28 12:06:17 +03:00
Bananymous
f7097398ca
Kernel: Make tty overload correct has_data() function
...
This allows snake game to work again :)
2023-09-28 11:54:12 +03:00
Bananymous
85b1252b9e
Userspace: Use printf length modifiers when printing
2023-09-28 11:49:31 +03:00
Bananymous
1cd12b5f16
LibC: Implement length modifiers to printf
2023-09-28 11:42:57 +03:00
Bananymous
c84b66d078
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
27adb9486b
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