qemu/linux-user/include/host/sparc64/host-signal.h
<<
>>
Prefs
   1/*
   2 * host-signal.h: signal info dependent on the host architecture
   3 *
   4 * Copyright (c) 2003-2005 Fabrice Bellard
   5 * Copyright (c) 2021 Linaro Limited
   6 *
   7 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
   8 * See the COPYING file in the top-level directory.
   9 */
  10
  11#ifndef SPARC64_HOST_SIGNAL_H
  12#define SPARC64_HOST_SIGNAL_H
  13
  14/* The third argument to a SA_SIGINFO handler is struct sigcontext.  */
  15typedef struct sigcontext host_sigcontext;
  16
  17static inline uintptr_t host_signal_pc(host_sigcontext *sc)
  18{
  19    return sc->sigc_regs.tpc;
  20}
  21
  22static inline void host_signal_set_pc(host_sigcontext *sc, uintptr_t pc)
  23{
  24    sc->sigc_regs.tpc = pc;
  25    sc->sigc_regs.tnpc = pc + 4;
  26}
  27
  28static inline void *host_signal_mask(host_sigcontext *sc)
  29{
  30    return &sc->sigc_mask;
  31}
  32
  33static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
  34{
  35    uint32_t insn = *(uint32_t *)host_signal_pc(uc);
  36
  37    if ((insn >> 30) == 3) {
  38        switch ((insn >> 19) & 0x3f) {
  39        case 0x05: /* stb */
  40        case 0x15: /* stba */
  41        case 0x06: /* sth */
  42        case 0x16: /* stha */
  43        case 0x04: /* st */
  44        case 0x14: /* sta */
  45        case 0x07: /* std */
  46        case 0x17: /* stda */
  47        case 0x0e: /* stx */
  48        case 0x1e: /* stxa */
  49        case 0x24: /* stf */
  50        case 0x34: /* stfa */
  51        case 0x27: /* stdf */
  52        case 0x37: /* stdfa */
  53        case 0x26: /* stqf */
  54        case 0x36: /* stqfa */
  55        case 0x25: /* stfsr */
  56        case 0x3c: /* casa */
  57        case 0x3e: /* casxa */
  58            return true;
  59        }
  60    }
  61    return false;
  62}
  63
  64#endif
  65