Skip to content

threading/forking #142

@lunixbochs

Description

@lunixbochs

I want to be able to emulate threading and forking inside a single process under Unicorn. I think this will require at minimum a shared memory API.

Perhaps the easiest way would be a function allowing you to source a Unicorn's MMU from another Unicorn instance? New mappings against either instance should affect both instances. It's up to me (the "kernel") to keep things thread-safe. (I'm okay with Unicorn marking the memory mapping functions thread-unsafe and making me lock myself, as I'll already be dealing with that internally)

For fork(), I think I can implement copy-on-write by mapping everything read-only, trapping invalid memory access, and copying/remapping pages when you try to write to a CoW region. For this to be implemented via the Unicorn API, I'd need a way to do a zero-copy MMU clone pointing at the same memory but with everything marked read-only.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions