+ env->lr = tswapl(registers[99]);
+ env->ctr = tswapl(registers[100]);
+ _store_xer(env, tswapl(registers[101]));
+}
+#elif defined (TARGET_SPARC)
+static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf)
+{
+ target_ulong *registers = (target_ulong *)mem_buf;
+ int i;
+
+ /* fill in g0..g7 */
+ for(i = 0; i < 7; i++) {
+ registers[i] = tswapl(env->gregs[i]);
+ }
+ /* fill in register window */
+ for(i = 0; i < 24; i++) {
+ registers[i + 8] = tswapl(env->regwptr[i]);
+ }
+ /* fill in fprs */
+ for (i = 0; i < 32; i++) {
+ registers[i + 32] = tswapl(*((uint32_t *)&env->fpr[i]));
+ }
+#ifndef TARGET_SPARC64
+ /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
+ registers[64] = tswapl(env->y);
+ {
+ target_ulong tmp;
+
+ tmp = GET_PSR(env);
+ registers[65] = tswapl(tmp);
+ }
+ registers[66] = tswapl(env->wim);
+ registers[67] = tswapl(env->tbr);
+ registers[68] = tswapl(env->pc);
+ registers[69] = tswapl(env->npc);
+ registers[70] = tswapl(env->fsr);
+ registers[71] = 0; /* csr */
+ registers[72] = 0;
+ return 73 * sizeof(target_ulong);
+#else
+ for (i = 0; i < 32; i += 2) {
+ registers[i/2 + 64] = tswapl(*((uint64_t *)&env->fpr[i]));
+ }
+ registers[81] = tswapl(env->pc);
+ registers[82] = tswapl(env->npc);
+ registers[83] = tswapl(env->tstate[env->tl]);
+ registers[84] = tswapl(env->fsr);
+ registers[85] = tswapl(env->fprs);
+ registers[86] = tswapl(env->y);
+ return 87 * sizeof(target_ulong);
+#endif