X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=testpico%2Fsh2_main.c;h=303fe3f098b5f758f816ef52f664900f0c83b29b;hb=refs%2Fremotes%2Fgithub%2Fmaster;hp=6fe8ad7f018f5544920b3ce9c56d1254d889fcc1;hpb=5073ab5adb8157c35014505385575473284788df;p=megadrive.git diff --git a/testpico/sh2_main.c b/testpico/sh2_main.c index 6fe8ad7..303fe3f 100644 --- a/testpico/sh2_main.c +++ b/testpico/sh2_main.c @@ -3,6 +3,15 @@ void spin(int loops); u16 read_frt(void); +// comm area map: +// 00-01: cmd +// 02-03: error +// 04-07: arg0/response +// 08-0b: arg1 +// 0c: last_irq_vec_master +// 0d: last_irq_vec_slave +// 0e: exception_index_master +// 0f: exception_index_slave static void do_cmd(u16 cmd, u16 r[6], u32 is_slave) { u32 *rl = (u32 *)r; @@ -50,13 +59,21 @@ static void do_cmd(u16 cmd, u16 r[6], u32 is_slave) write32(a, d); break; case CMD_GETGBR: - asm("stc gbr, %0" : "=r"(d)); + asm volatile("stc gbr, %0" : "=r"(d)); write32(&rl[4/4], d); break; case CMD_GETVBR: - asm("stc vbr, %0" : "=r"(d)); + asm volatile("stc vbr, %0" : "=r"(d)); write32(&rl[4/4], d); break; + case CMD_GETSR: + asm volatile("stc sr, %0" : "=r"(d)); + write32(&rl[4/4], d); + break; + case CMD_SETSR: + d = read32(&rl[4/4]); + asm volatile("ldc %0, sr" :: "r"(d)); + break; default: r[2/2]++; // error mem_barrier();