sim: handle the case when there're not enough HW thread contexts

In SE mode, since there's no OS scheduler, the number of active SW
threads is limited by the number of HW thread contexts. Previously, if
there is no spare HW thread context, the simulator just fails and stops.
Instead, this patch returns EAGAIN error code from a clone syscall if
there's no available HW thread context. Then it's up to the simulated
program to handle the error.

Linux man page reference:

Change-Id: Ib4e092433e49de4dde376c8cb81f7d3f7851cbc0
Reviewed-by: Brandon Potter <>
Maintainer: Brandon Potter <>
1 file changed