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

Add basic userspace shell #548

Merged
merged 16 commits into from
Nov 21, 2023
Merged

Add basic userspace shell #548

merged 16 commits into from
Nov 21, 2023

Conversation

vinc
Copy link
Owner

@vinc vinc commented Nov 20, 2023

Now that we have a basic userspace allocator (#544) we can add a basic userspace shell.

@vinc
Copy link
Owner Author

vinc commented Nov 20, 2023

We have two issues with the userspace allocator:

~
> exec

> hello
DEBUG: heap bottom: 0x0000444445939808
DEBUG: ptr:         0x0000444445939808
DEBUG: heap top:    0x0000444445bb9404
DEBUG: heap bottom: 0x0000444445939808
DEBUG: ptr:         0x0000444445939808
DEBUG: heap top:    0x0000444445bb9404
DEBUG: heap bottom: 0x0000444445939808
DEBUG: ptr:         0x0000444444440c88
DEBUG: heap top:    0x0000444445bb9404
DEBUG: Could not free 0x0000444444440c88
Hello, World!
DEBUG: heap bottom: 0x0000444445939808
DEBUG: ptr:         0x0000444445939818
DEBUG: heap top:    0x0000444445bb9404
DEBUG: panicked at 'Freed node aliases existing hole! Bad free?', /home/v/.cargo/registry/src/index.crates.io-6f17d22bba15001f/linked_list_allocator-0.10.5/src/hole.rs:535:17

One when ptr points to an address outside of the process heap, and another one that I don't understand yet.

For now we can just disable freeing memory from the userspace allocator.

@vinc
Copy link
Owner Author

vinc commented Nov 20, 2023

We can now execute binaries from userspace:

~
> exec

> hello
Hello, World!

> exec

> hello
Hello, World!

> quit

> quit

~
>

@vinc
Copy link
Owner Author

vinc commented Nov 20, 2023

The last commit encountered another bug though:

~
> exec

> hello
Hello, World!

> hello Alice
DEBUG: Could not map Page[4KiB](0x444444445000) to PhysFrame[4KiB](0x14ad000)
Error: Could not allocate address 0x444444445630

@vinc
Copy link
Owner Author

vinc commented Nov 20, 2023

Actually we get the same error if we call hello twice, and nothing is printed but no error if we call hello Alice directly.

@vinc
Copy link
Owner Author

vinc commented Nov 20, 2023

Screenshot of running hello from the shell, then from exec running from the shell, then from a second exec running from the first exec:

exec

@vinc vinc marked this pull request as ready for review November 21, 2023 08:24
@vinc
Copy link
Owner Author

vinc commented Nov 21, 2023

More work is needed to remove the userspace allocator bugs but we can merge this PR now without including hello and exec in the default installation until the bugs are fixed.

@vinc vinc merged commit 419001c into trunk Nov 21, 2023
1 check passed
@vinc vinc deleted the feature/userspace-shell branch November 21, 2023 08:26
@vinc vinc mentioned this pull request Dec 22, 2023
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