Threading part 2

This adds more advanced threading support - specifically better handling of events and mutexes. This enables mutexes/events to now actually block and a correct context switch to occur. Also adds some stubs for missing SVC functions (DuplicateHandle, SleepThread). Fixes some bugs with how we do context switching. Adds a hack to set the GSP event to always signal "ready for more data".
This code is equivalent to

    if (false == (t != nullptr && type == t->wait_type && handle == t->wait_handle)) {
        ERROR_LOG(blah);
        return false;
    }
    return true;

or alternatively

    if (t != nullptr && type == t->wait_type && handle == t->wait_handle) {
        return true;
    } else {
        ERROR_LOG(blah);
        return false;
    }