Miloslav Trmac wrote:
What about the number of arguments? Why isn't "1" correct?
Assume the traditional way of passing arguments on stack, with "int" naturally aligned. Then makecontext does something like this:
- set stack pointer to "top" - argc * sizeof(int)
- copy argc * sizeof (int) bytes from makecontext() arguments to stack
- set up the rest of the frame
If sizeof (void *) > sizeof (int), which happens on 64-bit platforms, the above doesn't copy the whole value of the pointer when argc == 1.
As you saw IRIX used just opposite default (pointer/long).
It seemed reasonable to me to align parameters to 8 byte baundary on 64-bit machines...
I decided to change the default threading model. Ucontext creates quite a lot of portability issues.
Best regards, Mike