summary refs log tree commit diff stats
path: root/hw/misc/mips_itu.c
diff options
context:
space:
mode:
authorYongbok Kim <yongbok.kim@mips.com>2019-01-03 16:50:54 +0100
committerAleksandar Markovic <amarkovic@wavecomp.com>2019-01-18 16:53:28 +0100
commit40cd718052b6c665c41852b95e723f03469f65be (patch)
treeb097f25ea4851c43a5999bea3fca7c275dce5dbe /hw/misc/mips_itu.c
parent043715d1e0fbb3e3411be3f898c5b77b7f90327a (diff)
downloadfocaccia-qemu-40cd718052b6c665c41852b95e723f03469f65be.tar.gz
focaccia-qemu-40cd718052b6c665c41852b95e723f03469f65be.zip
target/mips: Update ITU to handle bus errors
Update ITU to handle bus errors.

Reviewed-by: Stefan Markovic <smarkovic@wavecomp.com>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Diffstat (limited to 'hw/misc/mips_itu.c')
-rw-r--r--hw/misc/mips_itu.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c
index ee1addc744..1257d8fce6 100644
--- a/hw/misc/mips_itu.c
+++ b/hw/misc/mips_itu.c
@@ -375,6 +375,12 @@ static void view_pv_try_write(ITCStorageCell *c)
     view_pv_common_write(c);
 }
 
+static void raise_exception(int excp)
+{
+    current_cpu->exception_index = excp;
+    cpu_loop_exit(current_cpu);
+}
+
 static uint64_t itc_storage_read(void *opaque, hwaddr addr, unsigned size)
 {
     MIPSITUState *s = (MIPSITUState *)opaque;
@@ -382,6 +388,14 @@ static uint64_t itc_storage_read(void *opaque, hwaddr addr, unsigned size)
     ITCView view = get_itc_view(addr);
     uint64_t ret = -1;
 
+    switch (size) {
+    case 1:
+    case 2:
+        s->icr0 |= 1 << ITC_ICR0_ERR_AXI;
+        raise_exception(EXCP_DBE);
+        return 0;
+    }
+
     switch (view) {
     case ITCVIEW_BYPASS:
         ret = view_bypass_read(cell);
@@ -420,6 +434,14 @@ static void itc_storage_write(void *opaque, hwaddr addr, uint64_t data,
     ITCStorageCell *cell = get_cell(s, addr);
     ITCView view = get_itc_view(addr);
 
+    switch (size) {
+    case 1:
+    case 2:
+        s->icr0 |= 1 << ITC_ICR0_ERR_AXI;
+        raise_exception(EXCP_DBE);
+        return;
+    }
+
     switch (view) {
     case ITCVIEW_BYPASS:
         view_bypass_write(cell, data);