cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

runstate-action.c (1253B)


      1/*
      2 * Copyright (c) 2020 Oracle and/or its affiliates.
      3 *
      4 * This work is licensed under the terms of the GNU GPL, version 2.
      5 * See the COPYING file in the top-level directory.
      6 *
      7 */
      8
      9#include "qemu/osdep.h"
     10#include "sysemu/runstate-action.h"
     11#include "sysemu/watchdog.h"
     12#include "qemu/config-file.h"
     13#include "qapi/error.h"
     14#include "qemu/option_int.h"
     15
     16RebootAction reboot_action = REBOOT_ACTION_RESET;
     17ShutdownAction shutdown_action = SHUTDOWN_ACTION_POWEROFF;
     18PanicAction panic_action = PANIC_ACTION_SHUTDOWN;
     19
     20/*
     21 * Receives actions to be applied for specific guest events
     22 * and sets the internal state as requested.
     23 */
     24void qmp_set_action(bool has_reboot, RebootAction reboot,
     25                    bool has_shutdown, ShutdownAction shutdown,
     26                    bool has_panic, PanicAction panic,
     27                    bool has_watchdog, WatchdogAction watchdog,
     28                    Error **errp)
     29{
     30    if (has_reboot) {
     31        reboot_action = reboot;
     32    }
     33
     34    if (has_panic) {
     35        panic_action = panic;
     36    }
     37
     38    if (has_watchdog) {
     39        qmp_watchdog_set_action(watchdog, errp);
     40    }
     41
     42    /* Process shutdown last, in case the panic action needs to be altered */
     43    if (has_shutdown) {
     44        shutdown_action = shutdown;
     45    }
     46}