MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / OSLoadContext

Function OSLoadContext

src/dolphin/src/os/OSContext.c:275–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273extern void __RAS_OSDisableInterrupts_end();
274
275asm void OSLoadContext(register OSContext* context)
276{
277 // clang-format off
278 nofralloc
279
280 lis r4,__RAS_OSDisableInterrupts_begin@ha
281 lwz r6,context->srr0
282 addi r5,r4,__RAS_OSDisableInterrupts_begin@l
283 cmplw r6,r5
284 ble _notInRAS
285 lis r4,__RAS_OSDisableInterrupts_end@ha
286 addi r0,r4,__RAS_OSDisableInterrupts_end@l
287 cmplw r6,r0
288 bge _notInRAS
289 stw r5,context->srr0
290
291_notInRAS:
292
293 lwz r0, context->gpr[0]
294 lwz r1, context->gpr[1]
295 lwz r2, context->gpr[2]
296
297 lhz r4, context->state
298 rlwinm. r5, r4, 0, 30, 30
299 beq notexc
300 rlwinm r4, r4, 0, 31, 29
301 sth r4, context->state
302 lmw r5, context->gpr[5]
303 b misc
304notexc:
305 lmw r13, context->gpr[13]
306misc:
307
308 lwz r4, context->gqr[1]
309 mtspr GQR1, r4
310 lwz r4, context->gqr[2]
311 mtspr GQR2, r4
312 lwz r4, context->gqr[3]
313 mtspr GQR3, r4
314 lwz r4, context->gqr[4]
315 mtspr GQR4, r4
316 lwz r4, context->gqr[5]
317 mtspr GQR5, r4
318 lwz r4, context->gqr[6]
319 mtspr GQR6, r4
320 lwz r4, context->gqr[7]
321 mtspr GQR7, r4
322
323 lwz r4, context->cr
324 mtcr r4
325 lwz r4, context->lr
326 mtlr r4
327 lwz r4, context->ctr
328 mtctr r4
329 lwz r4, context->xer
330 mtxer r4
331
332 mfmsr r4

Callers 4

__OSSwitchThreadFunction · 0.85
__OSDispatchInterruptFunction · 0.85
__OSUnhandledExceptionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected