Page MenuHomeFreeBSD

Add a sysentvec for CloudABI on x86-64.
ClosedPublic

Authored by ed on Jul 15 2015, 12:55 PM.

Details

Summary

For CloudABI we need to put two things on the stack of new processes:
the argument data (a binary blob; not strings) and a startup data
structure. The startup data structure contains interesting things such
as a pointer to the ELF program header, the thread ID of the initial
thread, a stack smashing protection canary, and a pointer to the
argument data.

Fetching system call arguments and setting the return value is similar
to FreeBSD. The only differences are that system call 0 does not exist
and that we call into cloudabi_convert_errno() to convert the error
code. We also need this function in a couple of other places, so we'd
better reuse it here.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ed retitled this revision from to Add a sysentvec for CloudABI on x86-64..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added reviewers: kib, dchagin.

I believe that by not using aux vector, you paint yourself into the corner. How do you plan to extend the startup ABI ? The size of the structure is too weak invariant.

sys/amd64/cloudabi64/cloudabi64_sysvec.c
65 ↗(On Diff #6969)

This is spelled rounddown(USRSTACK - len, sizeof(register_t)) or may be even rounddown2().

sys/compat/cloudabi/cloudabi_errno.c
38 ↗(On Diff #6969)

static

ed marked 2 inline comments as done.Jul 16 2015, 9:02 AM
In D3098#61314, @kib wrote:

I believe that by not using aux vector, you paint yourself into the corner. How do you plan to extend the startup ABI ? The size of the structure is too weak invariant.

That's a good point. I think when I first implemented this, I didn't use the auxiliary vector for the sole reason that you have to iterate past the argv vector to find it, which CloudABI doesn't have. But that on its own doesn't make a lot of sense, as we can just invoke the entry point with a pointer to the auxiliary vector.

I just changed the code over to use the auxiliary vector, containing all of the fields that were once part of startup_data_t. We can now use exec_setregs() directly; it does the right thing.

ed edited edge metadata.

Add auxiliary vector.

Use args->pagesz instead of PAGE_SIZE.

kib edited edge metadata.
This revision is now accepted and ready to land.Jul 16 2015, 5:48 PM
This revision was automatically updated to reflect the committed changes.