MCPcopy Create free account
hub / github.com/decaf-emu/decaf-emu / initialiseRootThread

Function initialiseRootThread

src/libdecaf/src/ios/kernel/ios_kernel.cpp:129–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129static Error
130initialiseRootThread()
131{
132 StackObject<Message> message;
133 auto error = IOS_CreateMessageQueue(phys_addrof(sData->messageBuffer),
134 static_cast<uint32_t>(sData->messageBuffer.size()));
135 if (error < Error::OK) {
136 gLog->error("Failed to create root thread message queue, error = {}", error);
137 return error;
138 }
139
140 sData->messageQueueId = static_cast<MessageQueueId>(error);
141
142 error = IOS_CreateTimer(5000us,
143 1000000us,
144 sData->messageQueueId,
145 makeMessage(phys_addrof(sData->rootTimerMessage)));
146 if (error < Error::OK) {
147 gLog->error("Failed to create root thread timer, error = {}", error);
148 return error;
149 }
150
151 sData->timerId = static_cast<TimerId>(error);
152
153 error = IOS_ReceiveMessage(sData->messageQueueId,
154 message,
155 MessageFlags::None);
156 if (error < Error::OK) {
157 gLog->error("Failed to receive root thread timer message, error = {}", error);
158 }
159
160 error = IOS_HandleEvent(DeviceId::SysProt,
161 sData->messageQueueId,
162 makeMessage(phys_addrof(sData->sysprotEventMessage)));
163 if (error < Error::OK) {
164 gLog->error("Failed to register sysprot event handler, error = {}", error);
165 return error;
166 }
167 return IOS_ClearAndEnable(DeviceId::SysProt);
168}
169
170static Error
171handleTimerEvent()

Callers 1

kernelEntryPointFunction · 0.85

Calls 9

IOS_CreateMessageQueueFunction · 0.85
phys_addrofFunction · 0.85
IOS_CreateTimerFunction · 0.85
makeMessageFunction · 0.85
IOS_ReceiveMessageFunction · 0.85
IOS_HandleEventFunction · 0.85
IOS_ClearAndEnableFunction · 0.85
sizeMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected