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

support plan 9 #2

Open
smasher164 opened this issue Aug 31, 2019 · 0 comments
Open

support plan 9 #2

smasher164 opened this issue Aug 31, 2019 · 0 comments
Assignees

Comments

@smasher164
Copy link
Owner

The mmap abstraction needs to be filled in for Plan 9. We should be able to use segattach to get a segment of memory from the OS.

long segattach(int attr, char *class, void *va, ulong len);

The returned long corresponds to the starting address of the segment. If it is -1, that means segattach failed. I'm slightly unclear on the supported attributes. Looking through the Plan 9 source, I see that the only attributes declared in lib9.h are SG_RONLY (read only) and SG_CEXEC (detach on exec). Call sites in the linuxemu tree suggest that we should pass in SG_CEXEC into attr?

Additionally, the class name that is used is "memory". The man page states that the system will pick an address if va is 0, and I assume that len is the number of bytes desired.

So essentially,

addr := segattach(SG_CEXEC, "memory", 0, size)
if addr == -1 {
    return nil, some error
}
return unsafe.Pointer(addr), nil

We should use segdetach to represent munmap, since it only takes the starting address returned by segattach.

x/sys/plan9 will let us make these syscalls. However testing this on travis will be slightly complicated. We'd probably have to run a VM inside Ubuntu.

@smasher164 smasher164 self-assigned this Dec 18, 2019
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

No branches or pull requests

1 participant