Bananymous
642a6aa4ad
Kernel: Process::exit() unblocks the whole lock before blocking
2023-07-24 22:29:59 +03:00
Bananymous
432c296b7b
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
b576d373c4
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
522aa8e762
Kernel: add Thread::queue_signal()
2023-07-24 22:26:10 +03:00
Bananymous
3784da0d18
Kernel: you can now ask process if it is userspace process
2023-07-23 18:54:10 +03:00
Bananymous
f7bf6d5e62
Kernel: Change signal kernel API
...
return rsp and rip are now stored per thread
2023-07-23 18:33:10 +03:00
Bananymous
2149cec29f
Kernel: Make signals more POSIX
2023-07-21 20:01:12 +03:00
Bananymous
ad756c36fc
Kernel/LibC: Add SYS_KILL/kill()
2023-07-21 19:27:38 +03:00
Bananymous
b56316e9da
Kernel: Scheduler now sends queued signals
2023-07-21 19:27:10 +03:00
Bananymous
a989c44211
Kernel: Make signals thread specific
2023-07-21 19:00:59 +03:00
Bananymous
217e5f81cc
Kernel: add default signal actions
2023-07-21 18:02:35 +03:00
Bananymous
dcd4d0daeb
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
4d5b14753d
Kernel: cleanup sys_exec()
...
We now scope everyting so desctructors get called
2023-07-19 23:20:39 +03:00
Bananymous
c0c0bbc1bf
Kernel: SYS_FORK can now fail instead of panicing on error
2023-07-19 17:47:12 +03:00
Bananymous
7d00c2670f
Kernel: Support execute disable bit
...
We will now map executable memory explicitly as executable.
2023-07-13 14:28:53 +03:00
Bananymous
3748f0304f
Kernel: Fix multiple bugs with terminal
2023-07-13 13:09:52 +03:00
Bananymous
74c79c7eff
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
2276fc95b8
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
4972284dde
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
3b5bc63d1b
Kernel: Inode::create_file() now takes uid and gid as parameters
2023-07-10 13:32:10 +03:00
Bananymous
3840fbf957
Kernel: Edit lock scopes and make string copy able to fail
2023-07-07 23:12:19 +03:00
Bananymous
78c091f7f8
Kernel: Move open file descriptors to their own class
...
This simplifies code a lot :)
2023-07-07 23:11:37 +03:00
Bananymous
a549336530
Kernel/LibC: add basic dup2
2023-07-06 23:17:54 +03:00
Bananymous
4eb95c963d
Kernel/LibC: Add basic pipe() syscall and command
...
You can now create pipes :)
2023-07-06 22:16:26 +03:00
Bananymous
f1bd26fb92
Kernel: Add O_CLOEXEC
2023-07-06 20:00:33 +03:00
Bananymous
5c6bbcb62f
Kernel: Remove spammy process/thread exit printing
2023-07-06 10:34:46 +03:00
Bananymous
3c068aa0ae
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
714305ef56
Kernel: General allocator takes first valid vaddr as parameter
2023-06-17 22:23:34 +03:00
Bananymous
bf617036c7
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
0f63cfa43f
Kernel/LibC: add SYS_{SET,GET}_PWD and chdir, getpwd
2023-06-12 02:02:52 +03:00
Bananymous
4ca99fcb4e
Kernel: Fix bug in elf loading
...
We were allocating one extra page
2023-06-12 00:59:19 +03:00
Bananymous
ef4ebaa969
Kernel: Add syscalls for set{,e,re}{uid,gid}
2023-06-11 22:37:00 +03:00
Bananymous
51eb44bf40
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
c62e820bcf
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
5aed186827
Kernel: Add SYS_OPENAT
2023-06-11 03:29:22 +03:00
Bananymous
e31080bce3
Kernel: allow open() call with O_SEARCH
2023-06-11 00:18:34 +03:00
Bananymous
e209ca7c82
Kernel: Rewrite directory listing so it can be integrated to libc
2023-06-11 00:17:18 +03:00
Bananymous
db49cbd6e2
Kernel: We now store the processes exit code
2023-06-10 17:31:56 +03:00
Bananymous
7da0627f8e
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
8af390e0f6
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
86f58f60cb
LibC: implement setenv, unsetenv, putenv
2023-06-05 22:51:02 +03:00
Bananymous
064ce568c2
Kernel: add basic support for environment variables
...
exec functions will search files from PATH
2023-06-05 22:51:02 +03:00
Bananymous
0b1b4d8f7e
Kernel: exec now has better posix errors
2023-06-05 21:12:08 +03:00
Bananymous
b0e9ab0519
Kernel/LibC: pass environ pointer to process
2023-06-05 21:12:08 +03:00
Bananymous
649f08ec78
Kernel: verify that loaded elfs are executable
2023-06-05 19:29:32 +03:00
Bananymous
9d64dbd5c2
Kernel/LibC: add SYS_STAT and stat(), lstat()
2023-06-05 14:37:14 +03:00
Bananymous
b68d5a5833
Kernel: Add SYS_WAIT
...
This syscall waits for a given pid.
2023-06-04 18:00:52 +03:00
Bananymous
94d2090777
Kernel: fork() now clones current thread
...
This is how posix specifies thread cloning during fork
2023-06-04 17:40:37 +03:00
Bananymous
e97585daf9
Kernel: Process FixedWidthAllocators come now in 4 sizes
2023-06-04 01:26:43 +03:00
Bananymous
924fc2118c
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
51f4c0c750
Kernel: make load_elf() its own function
2023-06-04 01:24:11 +03:00
Bananymous
4d4d0e26a9
Kernel: Symlinks are now working
...
We still have to implement loop or depth detection
2023-06-02 11:43:46 +03:00
Bananymous
232fdcb82c
Kernel: add basic support for symlinks
2023-06-01 00:24:45 +03:00
Bananymous
02f0239016
Kernel: Cleanup exec code
2023-05-31 22:36:05 +03:00
Bananymous
4da1d6fd27
Kernel: Implement Process::exec()
2023-05-31 20:56:29 +03:00
Bananymous
909e847369
Kernel: Move userspace entry functions to Process instead of Thread
2023-05-31 19:31:10 +03:00
Bananymous
3b9d60d7cb
Kernel: Remove unused includes of CriticalScope
2023-05-29 21:15:55 +03:00
Bananymous
e640344d7a
Kernel: Rename MMU to PageTable
...
This is more descriptive name for what it actually represents
2023-05-29 21:06:09 +03:00
Bananymous
7151bb86a8
Kernel/LibC: opening standard files is done in libc
2023-05-29 20:21:19 +03:00
Bananymous
282bf24f65
Kernel: fork() now copies allocations through FixedWidthAllocator
2023-05-28 21:34:35 +03:00
Bananymous
636c308993
Kernel: fork() now copies allocation done through GeneralAllocator
2023-05-28 20:37:39 +03:00
Bananymous
6fdbe6f9c2
Kernel: Add bareboness fork() function
2023-05-28 18:08:49 +03:00
Bananymous
0129619d9a
Kernel: Processes and Threads use VirtualRange memory allocations
2023-05-28 17:48:34 +03:00
Bananymous
b847d7dfd5
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
fed690a7f2
Kernel: Directory listing is working again
2023-05-26 22:31:21 +03:00
Bananymous
4a4a3bf184
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
f33e78882e
Kernel: Add argc and argv to process entry
2023-05-16 00:27:49 +03:00
Bananymous
1cf7ef3de6
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
812e61ca70
Kernel: Add barebones GeneralAllocator for >4096B
2023-05-08 22:10:49 +03:00
Bananymous
2d0a5a9e15
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
f32d594879
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
2fe9af7165
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
ff5bcd4416
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
b65cd1d09b
Kernel: Invalid physical addresses from heap are specified now by 0
2023-05-06 17:34:22 +03:00
Bananymous
06bc807e34
Kernel: MMU can now provide info about virtual address space
2023-05-06 17:34:22 +03:00
Bananymous
f139fc2229
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
175f07cd2f
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
77c83e5552
Kernel: Fix possible dead lock in Process::read()
2023-04-23 14:46:18 +03:00
Bananymous
b15deb420f
LibC: Write mostly functioning stdio
2023-04-23 14:32:37 +03:00
Bananymous
b38989d594
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
79e6de325f
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
82a1a29260
Kernel: More proper paging in Elf loading
2023-04-22 18:17:44 +03:00
Bananymous
3f1c0ec91b
Kernel: Process now frees up its pages on destruction
2023-04-22 16:54:46 +03:00
Bananymous
1406a75a92
Kernel: Cleanup process creation for userspace
2023-04-22 16:51:50 +03:00
Bananymous
8001493df3
Kernel: Fix some deadlocks in the Process
2023-04-22 16:19:57 +03:00
Bananymous
ec8b9640e2
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
be14a6c239
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
3aa0eeb4a3
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
d38470c8e2
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
6f65453fd4
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
7bd4593748
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
9c0f3dd996
Kernel: Move kmalloc and MMU to Memory directory
2023-04-18 10:18:15 +03:00
Bananymous
8637959289
Kernel: We can create basic userspace processes
...
These are still allocated on the kernel memory
2023-04-12 17:52:36 +03:00
Bananymous
6be53668b9
Kernel: Scheduler can now terminate processes threads
2023-04-12 17:49:04 +03:00
Bananymous
12779cdef8
Kernel: Threads now use only 4 KiB stack :)
2023-04-12 00:22:08 +03:00
Bananymous
bdaf7cddcb
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
8d6db168d6
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
e704968f96
Kernel: Threads can now be terminated mid execution
2023-04-10 21:07:25 +03:00
Bananymous
abbbf7ec15
Kernel: Add tty to process and make termios modifiable
2023-04-05 02:53:28 +03:00
Bananymous
db076058b9
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