29 #define LS_SIZE 0x40000
32 typedef unsigned int u32;
33 typedef unsigned long long u64;
35 #include <spu_intrinsics.h>
39 static inline void save_event_mask(
void)
50 static inline void save_tag_mask(
void)
61 static inline void save_upper_240kb(
addr64 lscsa_ea)
63 unsigned int ls = 16384;
64 unsigned int list = (
unsigned int)&dma_list[0];
65 unsigned int size =
sizeof(dma_list);
66 unsigned int tag_id = 0;
67 unsigned int cmd = 0x24;
73 spu_writech(MFC_LSA, ls);
74 spu_writech(MFC_EAH, lscsa_ea.
ui[0]);
75 spu_writech(MFC_EAL, list);
76 spu_writech(MFC_Size, size);
77 spu_writech(MFC_TagID, tag_id);
78 spu_writech(MFC_Cmd, cmd);
81 static inline void save_fpcr(
void)
94 static inline void save_decr(
void)
106 static inline void save_srr0(
void)
118 static inline void spill_regs_to_mem(
addr64 lscsa_ea)
120 unsigned int ls = (
unsigned int)®s_spill[0];
122 unsigned int tag_id = 0;
123 unsigned int cmd = 0x20;
129 spu_writech(MFC_LSA, ls);
130 spu_writech(MFC_EAH, lscsa_ea.
ui[0]);
131 spu_writech(MFC_EAL, lscsa_ea.
ui[1]);
132 spu_writech(MFC_Size, size);
133 spu_writech(MFC_TagID, tag_id);
134 spu_writech(MFC_Cmd, cmd);
137 static inline void enqueue_sync(
addr64 lscsa_ea)
139 unsigned int tag_id = 0;
140 unsigned int cmd = 0xCC;
145 spu_writech(MFC_TagID, tag_id);
146 spu_writech(MFC_Cmd, cmd);
149 static inline void save_complete(
void)
156 spu_stop(SPU_SAVE_COMPLETE);
172 lscsa_ea.
ui[0] = spu_readch(SPU_RdSigNotify1);
173 lscsa_ea.
ui[1] = spu_readch(SPU_RdSigNotify2);
180 build_dma_list(lscsa_ea);
181 save_upper_240kb(lscsa_ea);
186 enqueue_putllc(lscsa_ea);
187 spill_regs_to_mem(lscsa_ea);
188 enqueue_sync(lscsa_ea);