--- tme/machine/sun2/sun2-control.c 2018/04/24 16:37:52 1.1 +++ tme/machine/sun2/sun2-control.c 2018/04/24 16:43:20 1.1.1.3 @@ -1,4 +1,4 @@ -/* $Id: sun2-control.c,v 1.1 2018/04/24 16:37:52 root Exp $ */ +/* $Id: sun2-control.c,v 1.1.1.3 2018/04/24 16:43:20 root Exp $ */ /* machine/sun2/sun2-control.c - implementation of Sun 2 emulation control space: */ @@ -34,7 +34,7 @@ */ #include -_TME_RCSID("$Id: sun2-control.c,v 1.1 2018/04/24 16:37:52 root Exp $"); +_TME_RCSID("$Id: sun2-control.c,v 1.1.1.3 2018/04/24 16:43:20 root Exp $"); /* includes: */ #include "sun2-impl.h" @@ -47,7 +47,7 @@ _tme_sun2_control_cycle_handler(void *_s { struct tme_sun2 *sun2; struct tme_bus_cycle cycle_resp; - tme_bus_addr_t reg, address, index; + tme_bus_addr32_t reg, address, index; tme_uint32_t pte; int rc; @@ -63,12 +63,15 @@ _tme_sun2_control_cycle_handler(void *_s /* this macro evaluates to TRUE whenever a register is maybe being accessed: */ #define _TME_SUN2_REG_ACCESSED(icreg) \ - TME_RANGES_OVERLAP(reg, \ - reg \ - + cycle_init->tme_bus_cycle_size - 1, \ - TME_SUN2_CONTROL_ADDRESS(icreg), \ - TME_SUN2_CONTROL_ADDRESS(icreg) \ - + sizeof(sun2->icreg) - 1) + ((TME_SUN2_CONTROL_ADDRESS(icreg) == 0) \ + ? (reg < sizeof(sun2->icreg)) \ + : TME_RANGES_OVERLAP(reg, \ + reg \ + + cycle_init->tme_bus_cycle_size - 1, \ + !TME_SUN2_CONTROL_ADDRESS(icreg) + \ + TME_SUN2_CONTROL_ADDRESS(icreg), \ + TME_SUN2_CONTROL_ADDRESS(icreg) \ + + sizeof(sun2->icreg) - 1)) /* whenever the page map register is accessed, we need to fill it before running the cycle: */ @@ -146,6 +149,9 @@ _tme_sun2_control_cycle_handler(void *_s if (_TME_SUN2_REG_ACCESSED(tme_sun2_enable)) { rc = _tme_sun2_ipl_check(sun2); assert(rc == TME_OK); + /* in case TME_SUN2_ENA_NOTBOOT changed, make a pseudo-context + change: */ + _tme_sun2_mmu_context_user_set(sun2); } }