Skip to content

Add file descriptor syscalls and initarfs-backed file access#23

Merged
codingskynet merged 3 commits into
mainfrom
feat/file-and-syscall
Jul 18, 2026
Merged

Add file descriptor syscalls and initarfs-backed file access#23
codingskynet merged 3 commits into
mainfrom
feat/file-and-syscall

Conversation

@codingskynet

@codingskynet codingskynet commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add per-thread file descriptor tables with standard input, output, and error descriptors.
  • Add open, read, write, and close syscalls.
  • Introduce a two-register syscall result ABI using status and value fields.
  • Add normalized absolute path handling and filesystem contexts.
  • Expose console and initarfs files through a shared file-node interface.
  • Add MicroPython file-reader support so modules can be imported from the initarfs.
  • Update the simple userland program to exercise file open, read, and close operations.
  • Fix smoke-test exit-code types and a broken Rustdoc link.

Syscall ABI

Returning syscalls now use:

  • a0: status code, where 0 indicates success
  • a1: return value, valid when the status is 0

The following syscalls are supported:

Number Syscall Arguments
0 exit exit code
1 write file descriptor, buffer, length
2 read file descriptor, buffer, length
3 open path, path length
4 close file descriptor

Validation

  • make check
  • make ports-verify PORTS=micropython
  • make run DEBUG=1 FEATURES=smoke
  • Verified the simple userland file read flow in QEMU.
  • Verified import eratosthenes from the initarfs in MicroPython.

Assisted-by: openai/gpt-5.6-sol
@codingskynet codingskynet changed the title Add file descriptor syscalls and initramfs-backed file access Add file descriptor syscalls and initarfs-backed file access Jul 18, 2026
@codingskynet
codingskynet merged commit c04cdb2 into main Jul 18, 2026
2 checks passed
@codingskynet
codingskynet deleted the feat/file-and-syscall branch July 18, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant