diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2019-07-04 17:32:24 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2019-07-04 17:32:24 +0100 |
| commit | 57dfc2c4d51e770ed3f617e5d1456d1e2bacf3f0 (patch) | |
| tree | eb9d22fab4d2b8948668cc95c9e836633760e5b0 /hw/timer | |
| parent | c3e1d838cfa5aac1a6210c8ddf182d0ef7d95dd8 (diff) | |
| parent | 89a11ff756410aecb87d2c774df6e45dbf4105c1 (diff) | |
| download | focaccia-qemu-57dfc2c4d51e770ed3f617e5d1456d1e2bacf3f0.tar.gz focaccia-qemu-57dfc2c4d51e770ed3f617e5d1456d1e2bacf3f0.zip | |
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190704-1' into staging
target-arm queue: * more code-movement to separate TCG-only functions into their own files * Correct VMOV_imm_dp handling of short vectors * Execute Thumb instructions when their condbits are 0xf * armv7m_systick: Forbid non-privileged accesses * Use _ra versions of cpu_stl_data() in v7M helpers * v8M: Check state of exception being returned from * v8M: Forcibly clear negative-priority exceptions on deactivate # gpg: Signature made Thu 04 Jul 2019 17:31:22 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20190704-1: target/arm: Correct VMOV_imm_dp handling of short vectors target/arm: Execute Thumb instructions when their condbits are 0xf hw/timer/armv7m_systick: Forbid non-privileged accesses target/arm: Use _ra versions of cpu_stl_data() in v7M helpers target/arm: v8M: Check state of exception being returned from arm v8M: Forcibly clear negative-priority exceptions on deactivate target/arm/helper: Move M profile routines to m_helper.c target/arm: Restrict semi-hosting to TCG target/arm: Move debug routines to debug_helper.c Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/timer')
| -rw-r--r-- | hw/timer/armv7m_systick.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/hw/timer/armv7m_systick.c b/hw/timer/armv7m_systick.c index a17317ce2f..94640743b5 100644 --- a/hw/timer/armv7m_systick.c +++ b/hw/timer/armv7m_systick.c @@ -75,11 +75,17 @@ static void systick_timer_tick(void *opaque) } } -static uint64_t systick_read(void *opaque, hwaddr addr, unsigned size) +static MemTxResult systick_read(void *opaque, hwaddr addr, uint64_t *data, + unsigned size, MemTxAttrs attrs) { SysTickState *s = opaque; uint32_t val; + if (attrs.user) { + /* Generate BusFault for unprivileged accesses */ + return MEMTX_ERROR; + } + switch (addr) { case 0x0: /* SysTick Control and Status. */ val = s->control; @@ -121,14 +127,21 @@ static uint64_t systick_read(void *opaque, hwaddr addr, unsigned size) } trace_systick_read(addr, val, size); - return val; + *data = val; + return MEMTX_OK; } -static void systick_write(void *opaque, hwaddr addr, - uint64_t value, unsigned size) +static MemTxResult systick_write(void *opaque, hwaddr addr, + uint64_t value, unsigned size, + MemTxAttrs attrs) { SysTickState *s = opaque; + if (attrs.user) { + /* Generate BusFault for unprivileged accesses */ + return MEMTX_ERROR; + } + trace_systick_write(addr, value, size); switch (addr) { @@ -172,11 +185,12 @@ static void systick_write(void *opaque, hwaddr addr, qemu_log_mask(LOG_GUEST_ERROR, "SysTick: Bad write offset 0x%" HWADDR_PRIx "\n", addr); } + return MEMTX_OK; } static const MemoryRegionOps systick_ops = { - .read = systick_read, - .write = systick_write, + .read_with_attrs = systick_read, + .write_with_attrs = systick_write, .endianness = DEVICE_NATIVE_ENDIAN, .valid.min_access_size = 4, .valid.max_access_size = 4, |