1/****************************************************************************** 2 * mem_event.h 3 * 4 * Memory event common structures. 5 * 6 * Copyright (c) 2009 by Citrix Systems, Inc. (Patrick Colp) 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a copy 9 * of this software and associated documentation files (the "Software"), to 10 * deal in the Software without restriction, including without limitation the 11 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 12 * sell copies of the Software, and to permit persons to whom the Software is 13 * furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice shall be included in 16 * all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 * DEALINGS IN THE SOFTWARE. 25 */ 26 27#ifndef _XEN_PUBLIC_MEM_EVENT_H 28#define _XEN_PUBLIC_MEM_EVENT_H 29 30#include "xen.h" 31#include "io/ring.h" 32 33/* Memory event flags */ 34#define MEM_EVENT_FLAG_VCPU_PAUSED (1 << 0) 35#define MEM_EVENT_FLAG_DROP_PAGE (1 << 1) 36#define MEM_EVENT_FLAG_EVICT_FAIL (1 << 2) 37#define MEM_EVENT_FLAG_FOREIGN (1 << 3) 38#define MEM_EVENT_FLAG_DUMMY (1 << 4) 39 40/* Reasons for the memory event request */ 41#define MEM_EVENT_REASON_UNKNOWN 0 /* typical reason */ 42#define MEM_EVENT_REASON_VIOLATION 1 /* access violation, GFN is address */ 43#define MEM_EVENT_REASON_CR0 2 /* CR0 was hit: gfn is CR0 value */ 44#define MEM_EVENT_REASON_CR3 3 /* CR3 was hit: gfn is CR3 value */ 45#define MEM_EVENT_REASON_CR4 4 /* CR4 was hit: gfn is CR4 value */ 46#define MEM_EVENT_REASON_INT3 5 /* int3 was hit: gla/gfn are RIP */ 47#define MEM_EVENT_REASON_SINGLESTEP 6 /* single step was invoked: gla/gfn are RIP */ 48 49typedef struct mem_event_st { 50 uint32_t flags; 51 uint32_t vcpu_id; 52 53 uint64_t gfn; 54 uint64_t offset; 55 uint64_t gla; /* if gla_valid */ 56 57 uint32_t p2mt; 58 59 uint16_t access_r:1; 60 uint16_t access_w:1; 61 uint16_t access_x:1; 62 uint16_t gla_valid:1; 63 uint16_t available:12; 64 65 uint16_t reason; 66} mem_event_request_t, mem_event_response_t; 67 68DEFINE_RING_TYPES(mem_event, mem_event_request_t, mem_event_response_t); 69 70#endif 71 72/* 73 * Local variables: 74 * mode: C 75 * c-set-style: "BSD" 76 * c-basic-offset: 4 77 * tab-width: 4 78 * indent-tabs-mode: nil 79 * End: 80 */ 81