tmake
| Number | 0x09 |
|---|---|
| Signature | (entry, sp, arg) -> tid or -err |
| Group | task |
| Since | 1.0 |
Create a thread in the calling process, sharing its address space and handle table. The
thread starts at entry(arg) on the stack you provide.
The caller owns the stack. tmake does not allocate one so pass the top of a region you
mapped yourself, and size it for the thread’s needs.
The new thread gets its own TCB slot in the process’s TCB page, so its lmsg buffer and
tid are reachable via the frozen TPIDRURO -> tdata_t path. A process is capped at
TCB_MAX_SLOTS (7) threads by that page.
Arguments
| Register | Name | Description |
|---|---|---|
r0 | entry | Thread entry point (user VA) |
r1 | sp | Top of the thread's user stack (caller-allocated) |
r2 | arg | Single argument passed to the entry function |
Returns
The new thread's tid.
Errors
| Code | Condition |
|---|---|
ERR_BADPTR | entry or sp is not a valid user address |
ERR_NOMEM | No free thread, or no free TCB slot in the process |