MCPcopy Create free account
hub / github.com/devkitPro/libctru / popInterrupt

Function popInterrupt

libctru/source/services/gspgpu.c:322–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322static int popInterrupt(void)
323{
324 int curEvt;
325 bool strexFailed;
326 u8* gspEventData = (u8*)gspSharedMem + gspThreadId*0x40;
327 do {
328 union {
329 struct {
330 u8 cur;
331 u8 count;
332 u8 err;
333 u8 unused;
334 };
335 u32 as_u32;
336 } header;
337
338 // Do a load on all header fields as an atomic unit
339 header.as_u32 = __ldrex((s32*)gspEventData);
340
341 if (__builtin_expect(header.count == 0, 0)) {
342 __clrex();
343 return -1;
344 }
345
346 curEvt = gspEventData[0xC + header.cur];
347
348 header.cur += 1;
349 if (header.cur >= 0x34) header.cur -= 0x34;
350 header.count -= 1;
351 header.err = 0; // Should this really be set?
352
353 strexFailed = __strex((s32*)gspEventData, header.as_u32);
354 } while (__builtin_expect(strexFailed, 0));
355
356 return curEvt;
357}
358
359// Dummy version to avoid linking in gxqueue.c if not actually used
360__attribute__((weak)) void gxCmdQueueInterrupt(GSPGPU_Event irq)

Callers 1

gspEventThreadMainFunction · 0.85

Calls 3

__ldrexFunction · 0.85
__clrexFunction · 0.85
__strexFunction · 0.85

Tested by

no test coverage detected