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

xen-legacy-backend.h (4047B)


      1#ifndef HW_XEN_LEGACY_BACKEND_H
      2#define HW_XEN_LEGACY_BACKEND_H
      3
      4#include "hw/xen/xen_common.h"
      5#include "hw/xen/xen_pvdev.h"
      6#include "net/net.h"
      7#include "qom/object.h"
      8
      9#define TYPE_XENSYSDEV "xen-sysdev"
     10#define TYPE_XENSYSBUS "xen-sysbus"
     11#define TYPE_XENBACKEND "xen-backend"
     12
     13typedef struct XenLegacyDevice XenLegacyDevice;
     14DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND,
     15                         TYPE_XENBACKEND)
     16
     17/* variables */
     18extern struct xs_handle *xenstore;
     19extern const char *xen_protocol;
     20extern DeviceState *xen_sysdev;
     21extern BusState *xen_sysbus;
     22
     23int xenstore_mkdir(char *path, int p);
     24int xenstore_write_be_str(struct XenLegacyDevice *xendev, const char *node,
     25                          const char *val);
     26int xenstore_write_be_int(struct XenLegacyDevice *xendev, const char *node,
     27                          int ival);
     28int xenstore_write_be_int64(struct XenLegacyDevice *xendev, const char *node,
     29                            int64_t ival);
     30char *xenstore_read_be_str(struct XenLegacyDevice *xendev, const char *node);
     31int xenstore_read_be_int(struct XenLegacyDevice *xendev, const char *node,
     32                         int *ival);
     33void xenstore_update_fe(char *watch, struct XenLegacyDevice *xendev);
     34void xenstore_update_be(char *watch, char *type, int dom,
     35                        struct XenDevOps *ops);
     36char *xenstore_read_fe_str(struct XenLegacyDevice *xendev, const char *node);
     37int xenstore_read_fe_int(struct XenLegacyDevice *xendev, const char *node,
     38                         int *ival);
     39int xenstore_read_fe_uint64(struct XenLegacyDevice *xendev, const char *node,
     40                            uint64_t *uval);
     41
     42void xen_be_check_state(struct XenLegacyDevice *xendev);
     43
     44/* xen backend driver bits */
     45int xen_be_init(void);
     46void xen_be_register_common(void);
     47int xen_be_register(const char *type, struct XenDevOps *ops);
     48int xen_be_set_state(struct XenLegacyDevice *xendev, enum xenbus_state state);
     49int xen_be_bind_evtchn(struct XenLegacyDevice *xendev);
     50void xen_be_set_max_grant_refs(struct XenLegacyDevice *xendev,
     51                               unsigned int nr_refs);
     52void *xen_be_map_grant_refs(struct XenLegacyDevice *xendev, uint32_t *refs,
     53                            unsigned int nr_refs, int prot);
     54void xen_be_unmap_grant_refs(struct XenLegacyDevice *xendev, void *ptr,
     55                             unsigned int nr_refs);
     56
     57typedef struct XenGrantCopySegment {
     58    union {
     59        void *virt;
     60        struct {
     61            uint32_t ref;
     62            off_t offset;
     63        } foreign;
     64    } source, dest;
     65    size_t len;
     66} XenGrantCopySegment;
     67
     68int xen_be_copy_grant_refs(struct XenLegacyDevice *xendev,
     69                           bool to_domain, XenGrantCopySegment segs[],
     70                           unsigned int nr_segs);
     71
     72static inline void *xen_be_map_grant_ref(struct XenLegacyDevice *xendev,
     73                                         uint32_t ref, int prot)
     74{
     75    return xen_be_map_grant_refs(xendev, &ref, 1, prot);
     76}
     77
     78static inline void xen_be_unmap_grant_ref(struct XenLegacyDevice *xendev,
     79                                          void *ptr)
     80{
     81    return xen_be_unmap_grant_refs(xendev, ptr, 1);
     82}
     83
     84/* actual backend drivers */
     85extern struct XenDevOps xen_console_ops;      /* xen_console.c     */
     86extern struct XenDevOps xen_kbdmouse_ops;     /* xen_framebuffer.c */
     87extern struct XenDevOps xen_framebuffer_ops;  /* xen_framebuffer.c */
     88extern struct XenDevOps xen_blkdev_ops;       /* xen_disk.c        */
     89#ifdef CONFIG_VIRTFS
     90extern struct XenDevOps xen_9pfs_ops;       /* xen-9p-backend.c        */
     91#endif
     92extern struct XenDevOps xen_netdev_ops;       /* xen_nic.c         */
     93#ifdef CONFIG_USB_LIBUSB
     94extern struct XenDevOps xen_usb_ops;          /* xen-usb.c         */
     95#endif
     96
     97/* configuration (aka xenbus setup) */
     98void xen_config_cleanup(void);
     99int xen_config_dev_blk(DriveInfo *disk);
    100int xen_config_dev_nic(NICInfo *nic);
    101int xen_config_dev_vfb(int vdev, const char *type);
    102int xen_config_dev_vkbd(int vdev);
    103int xen_config_dev_console(int vdev);
    104
    105#endif /* HW_XEN_LEGACY_BACKEND_H */