Skip to content

make_fcontext is non-portable. #17

@penimi

Description

@penimi

The example given in the Boost documentation gives make_fcontext as taking a block of heap memory for the new stack. In the example, pointer from malloc is given directly to make_fcontext. However, the behaviour of make_fcontext is architecture dependent. It either expects a pointer to the bottom of the stack (consistent with the result of malloc) or the top of the stack (which requires pointer arithmetic to derive the end of the malloc block)

Code that uses this interface is therefore non-portable. Since the size of the stack is always passed to make_fcontext it would be trivial to update the assembler implementation to ALWAYS expect a pointer to the bottom of the stack, making interfacing code portable again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions