Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read command line args from userspace programs #351

Merged
merged 11 commits into from
Jun 14, 2022

Conversation

vinc
Copy link
Owner

@vinc vinc commented Jun 12, 2022

  • Add args to SPAWN syscall
  • Store args in the memory of the programs and pass them to their entry points
  • Rewrite print and sleep as userspace programs

@vinc
Copy link
Owner Author

vinc commented Jun 12, 2022

WIP:

> hello world test
DEBUG: args_len:   2
DEBUG: args_ptr:   0x444444442330 (src)
DEBUG: args_ptr:   0x444444440468 (tmp)
DEBUG: args_ptr:   0x4444454c0009 (dst)
DEBUG: code addr:  0x444445440000
DEBUG: heap addr:  0x4444454c0000
DEBUG: stack addr: 0x444445540000
DEBUG: args:       0x80009 (len=2)
DEBUG: args[0]:    0x80000 (len=5)
DEBUG: args[1]:    0x80005 (len=4)
Hello, World!
arg: DEBUG: SYSCALL WRITE (handle=1, ptr=0x0 (0x444445440000), len=0)

arg: DEBUG: SYSCALL WRITE (handle=1, ptr=0x0 (0x444445440000), len=0)

We can pass a slice of str to a userspace program and iterate it but cannot read the individual str. From the kernel side we translated their pointers to userspace addresses, but from the user side the pointers are null.

@vinc vinc marked this pull request as ready for review June 14, 2022 20:43
@vinc vinc merged commit dd5899a into trunk Jun 14, 2022
@vinc vinc deleted the feature/read-args-from-programs branch June 14, 2022 20:43
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