This patch adds support for thread creation and context switching. Signed-off-by: Ley Foon Tan <lftan@altera.com>