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.
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.
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.
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).
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.
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
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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*().
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.
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
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 :)
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.
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.
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.
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
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!
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.
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.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 :)