1
0
Fork 0

GSP: Fix appending of interrupts to the shared memory buffer

The code was previously appending the interrupt to after the end of the
buffer, instead of at the end.
This commit is contained in:
Yuri Kunde Schlesner 2015-01-14 03:26:27 -02:00
parent 9e084826b8
commit 7630b31672
2 changed files with 11 additions and 16 deletions

View File

@ -210,12 +210,12 @@ void SignalInterrupt(InterruptId interrupt_id) {
} }
for (int thread_id = 0; thread_id < 0x4; ++thread_id) { for (int thread_id = 0; thread_id < 0x4; ++thread_id) {
InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(thread_id); InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(thread_id);
interrupt_relay_queue->number_interrupts = interrupt_relay_queue->number_interrupts + 1;
u8 next = interrupt_relay_queue->index; u8 next = interrupt_relay_queue->index;
next += interrupt_relay_queue->number_interrupts; next += interrupt_relay_queue->number_interrupts;
next = next % 0x34; // 0x34 is the number of interrupt slots next = next % 0x34; // 0x34 is the number of interrupt slots
interrupt_relay_queue->number_interrupts += 1;
interrupt_relay_queue->slot[next] = interrupt_id; interrupt_relay_queue->slot[next] = interrupt_id;
interrupt_relay_queue->error_code = 0x0; // No error interrupt_relay_queue->error_code = 0x0; // No error

View File

@ -45,21 +45,16 @@ enum class CommandId : u32 {
/// GSP thread interrupt relay queue /// GSP thread interrupt relay queue
struct InterruptRelayQueue { struct InterruptRelayQueue {
union { // Index of last interrupt in the queue
u32 hex; u8 index;
// Number of interrupts remaining to be processed by the userland code
u8 number_interrupts;
// Error code - zero on success, otherwise an error has occurred
u8 error_code;
u8 padding1;
// Index of last interrupt in the queue u32 missed_PDC0;
BitField<0,8,u32> index; u32 missed_PDC1;
// Number of interrupts remaining to be processed by the userland code
BitField<8,8,u32> number_interrupts;
// Error code - zero on success, otherwise an error has occurred
BitField<16,8,u32> error_code;
};
u32 unk0;
u32 unk1;
InterruptId slot[0x34]; ///< Interrupt ID slots InterruptId slot[0x34]; ///< Interrupt ID slots
}; };