Commit Graph

26 Commits

Author SHA1 Message Date
Andrius Štikonas a0cb7cd9a6
Make a copy of program area when forking.
Otherwise things go wrong if global variables are modified
between fork and execve.
2024-01-14 11:50:46 +00:00
Andrius Štikonas 5f7ebfd46c
Disable UEFI interrupts while we are running POSIX programs.
syscall instruction messed up with SS and CS registers which we
fix in sycall handler but there is a race condition between fixing
register and UEFI timer interrupt triggering.
2024-01-13 16:49:10 +00:00
Andrius Štikonas b61add87cb
Close open file descriptors on exit. 2024-01-13 00:08:24 +00:00
Andrius Štikonas dc1e5eaf0e
Make a deep copy of envp before starting a new process. 2024-01-12 22:06:03 +00:00
Andrius Štikonas c10e10b1fb
Make a deep copy of argv before starting a new process. 2024-01-12 20:46:18 +00:00
Andrius Štikonas 6ba649aa3f
Fix populating envp of posix binaries. 2024-01-07 16:08:25 +00:00
Andrius Štikonas 2d32522f45
Increase MAX_MEMORY_PER_PROC to 768 MiB. 2024-01-03 23:57:44 +00:00
Andrius Štikonas cc3db46d2c
Set FILEDES_MAX to 4096. 2024-01-03 23:51:46 +00:00
Andrius Štikonas 0660f25086
Add file descriptor map. 2024-01-03 22:52:48 +00:00
Andrius Štikonas 6bf7bafb50
Fix a typo. 2024-01-02 00:49:35 +00:00
Andrius Štikonas c0baf959ab
Make sure brk area is zeroed on start.
Some stage0 applications, e.g. M0 assume that newly allocated memory
is empty.

We also need to do that for forked processes but it's not part of this commit.
2024-01-02 00:47:32 +00:00
Andrius Štikonas c7c827a1e9
Fix _brk issues and workaround some M2-Planet assign on initialization bugs. 2024-01-01 22:22:37 +00:00
Andrius Štikonas 008899d565
Add memory allocation failure checks. 2024-01-01 12:28:29 +00:00
Andrius Štikonas a870103aad
Fix argc of the first process. 2024-01-01 00:55:28 +00:00
Andrius Štikonas a34bce78ba
Add sys_chroot. 2023-12-31 21:34:04 +00:00
Andrius Štikonas 0e5f18fa2f
Add sys_uname. 2023-12-31 21:29:04 +00:00
Andrius Štikonas 7ad5f2afac
Free memory of process that exited. 2023-12-31 21:18:01 +00:00
Andrius Štikonas 1cbca175a0
Fix pushing argv onto stack from execve calls. 2023-12-31 20:36:39 +00:00
Andrius Štikonas db2d001395
Simplify argc counting. 2023-12-31 20:05:09 +00:00
Andrius Štikonas ac13be4291
Initial version of sys_fork, sys_execve and sys_wait4.
It is not fully working yet, in particular child programs have broken
initial stack and argv returns garbage.
2023-12-30 23:45:10 +00:00
Andrius Štikonas 4f2a62fa34
Push envp onto a stack of new process. 2023-12-29 21:59:23 +00:00
Andrius Štikonas 29f38d943a
Just in case make sure to save and restore more registers. 2023-12-28 23:59:12 +00:00
Andrius Štikonas e894942e52 Add sys_lseek. 2023-12-28 23:59:00 +00:00
Andrius Štikonas 572513c916
posix-runner: Add read,write and open syscalls. 2023-12-27 23:10:21 +00:00
Andrius Štikonas ebf61b2e9a Add syscall_table. 2023-12-26 23:57:20 +00:00
Andrius Štikonas ffe3f524a5 Initial version of posix-runner. 2023-12-26 21:30:19 +00:00