Commit Graph

184 Commits

Author SHA1 Message Date
Andrius Štikonas 294fae932f
Add support for O_TRUNC. 2024-02-16 23:33:28 +00:00
Andrius Štikonas d2e76d6bc3
Update submodules.
M2libc update brings in improvement to chdir that fixes cp.
mescc-tools-extra brings in unxz.
2024-02-11 20:38:14 +00:00
Andrius Štikonas 90585802bc
Update submodules. 2024-02-06 21:24:32 +00:00
Andrius Štikonas 877801c8f7
Manually manage saved program memory. 2024-02-06 00:56:13 +00:00
Andrius Štikonas ccf7808a13
Fix out of memory check. 2024-02-05 00:23:39 +00:00
Andrius Štikonas 48e0ebf2a2
Fix sys_open when file does not exist. 2024-01-14 12:40:45 +00:00
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 acbf7cc31a
Build posix-runner at the end of stage0-uefi. 2024-01-06 16:22:07 +00:00
Andrius Štikonas f5be5f91b5
Update M2libc with access() fix. 2024-01-06 00:30:21 +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 1c12f7d869
Add sys_access, sys_chdir and sys_getcwd. 2023-12-29 01:09:00 +00:00
Andrius Štikonas 5385ab3c26
Add sys_unlink. 2023-12-29 00:37:34 +00:00
Andrius Štikonas 9d4a1e2159
Add sys_close. 2023-12-29 00:15:23 +00:00
Andrius Štikonas d9def6dd05
Add sys_mkdir. 2023-12-29 00:06:45 +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 e61e1b16b4 Add sys_brk. 2023-12-28 23:59:04 +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
Andrius Štikonas 75398b0518
Update M2libc to fix stack alignment issues. 2023-12-24 12:44:08 +00:00
Andrius Štikonas 1407f92220
cc_amd64: fix stack alignment and save non-volatile registers. 2023-12-23 23:09:33 +00:00
Andrius Štikonas 8247a28f78
M0: fix stack alignment and save non-volatile registers. 2023-12-23 17:06:20 +00:00
Andrius Štikonas e871378bcf
catm: fix stack alignment and save non-volatile registers. 2023-12-23 01:12:17 +00:00
Andrius Štikonas c01f86c7c5
hex2: fix stack alignment and save non-volatile registers. 2023-12-22 23:16:51 +00:00
Andrius Štikonas 90d9bc7fb4
hex1: fix stack alignment and save non-volatile registers. 2023-12-22 19:13:27 +00:00
Andrius Štikonas 043f90d61b
Update bootstrap-seeds to those that fix stack alignment. 2023-12-21 22:43:52 +00:00
Andrius Štikonas ddcc53ab44 hex0: optimize stack alignment code. 2023-12-17 17:34:49 +00:00
Andrius Štikonas 78a70d0af8 Fix remaining alignment issues in kaem-optional. 2023-12-17 16:51:13 +00:00
Andrius Štikonas 20c3bfbb99 Further hex0 size reduction and calling convention fixes. 2023-12-16 17:09:51 +00:00
Andrius Štikonas 2e2f608c31 Minor whitespace cleanup. 2023-12-10 23:10:28 +00:00