> On Wed, Jan 23, 2013 at 06:32:16AM +0800, Salil Wadnerkar wrote:
...
>> I tried polyml, which is the next popular SML implementation - built using
>> autotools.
>> http://www.polyml.org/. (Download: http://sourceforge.net/projects/polyml/)
>>
>> $ gmake
>> .......
>> libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -Wall -O3
>> -I../libffi/include -MT x86_dep.lo -MD -MP -MF .deps/x86_dep.Tpo -c
>> x86_dep.cpp -fPIC -DPIC -o .libs/x86_dep.o
>> x86_dep.cpp: In member function 'virtual bool
>> X86Dependent::GetPCandSPFromContext(TaskData*, sigcontext*, PolyWord*&,
>> byte*&)':
>> x86_dep.cpp:906: error: 'struct sigcontext' has no member named 'sc_pc'
>> x86_dep.cpp:907: error: 'struct sigcontext' has no member named 'sc_sp'
Right idea, wrong details. The contents of the sigcontext structure
are implementation defined; we use the native register names in
general, so on amd64 the program counter is in sc_rip and the stack
pointer is in sc_rsp.
The more important question, however, is whether the code expects to
use the {get,set,make,swap}context() family of functions. OpenBSD
doesn't provide those...but the fact that it wants to access the
program counter and stack pointer itself may indicate that it's going
to handle this all itself instead of using those functions.
On Tue, Jan 22, 2013 at 2:53 PM, Marc Espie <[email protected]> wrote:
> sigcontext is some new fangled posix thingy, if I remember right.
Even better: SVID! It was incorporated into POSIX when XPG was merged
in to form the Single Unix Specification, but sigcontext became almost
unused/useless standards-wise when the *context() family of functions
were removed from the spec.
(For those wondering why they removed: because there's no way to
declare makecontext() in C99 and basically all implementations had low
limits based on the ABI (no more than 6 arguments, etc) and all uses
relied on assumptions about the compiler (varargs are passed
compatibly with fixed args, etc). Fragile, scary stuff...)
> You can probably try to port some implementation over from say, FreeBSD.
> it's not really surprising to find this kind of code in a sml implementation.
Hopefully they just need the right names (and types?) for the
sigcontext members and it'll All Just Work. (snerk)
Philip Guenther