void* vmboxaddr(char* s, USeg **sp)
char* vmbox(void* p, ulong sz, char* c)
char* bufbox(buf, char* c)
char* varbox(var, char* c)
If sp is non-nil, the pointer at *sp is initialized to point to a USeg structure containing information about the box.
Vmbox is used to obtain the name for a virtual memory box given an address range starting at address p and
containing l addresses. The name obtained can be used to operate on the box. The parameter c is contatenated as a constraint to the name built. The macros varbox and bufbox call vmbox to return the box name for an array buf or a variable var in scope. The box name is created in static storage and is rewritten on
each call. It is also important to note that the named box is mem unless otherwise specified by user (see the example below).
This code creates a segment named x and then obtains its address and length to initialize it to "0xff"s.
p = vmboxaddr("buff", nil);
cprint("got %s", p);
This code copies data from /some/box into local memory at address p.
struct S v;
copy("/some/box", varbox(v, nil));
copy(bufbox(buf, "text"), "/other/box");
The first call copies the contents of /some/box to the variable v. The second call copies the contents of buf into /other/box, using text as the type for the virtual memory range box. The third call would copy the memory starting at address 0x4cd000 up to (but not including) 0x4ce000 to /some/box.