Skip to content

Commit

Permalink
Merge pull request #148 from Wenzel/xen_breakpoint
Browse files Browse the repository at this point in the history
Xen: breakpoint
  • Loading branch information
Wenzel committed Dec 18, 2020
2 parents 67f68a2 + 920d1c9 commit b61e80f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ hyper-v = ["winapi", "widestring", "ntapi", "vid-sys"]
log = "0.4.8"
env_logger = "0.7.1"
libc = { version = "0.2.58", optional = true }
xenctrl = { version = "0.4.1", optional = true }
xenctrl = { version = "0.4.2", optional = true }
xenstore-rs = { version = "0.3.0", optional = true }
xenforeignmemory = { version = "0.1.0", optional = true }
xenevtchn = { version = "0.1.2", optional = true }
Expand Down
17 changes: 11 additions & 6 deletions src/driver/xen.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
use libc::{PROT_READ, PROT_WRITE};
use std::error::Error;
use std::io::ErrorKind;
use std::mem;
use xenstore_rs::{XBTransaction, Xs, XsOpenFlags};

use crate::api::{
CrType, DriverInitParam, Event, EventType, InterceptType, Introspectable, Registers,
SegmentReg, SystemTableReg, X86Registers,
};
use libc::{PROT_READ, PROT_WRITE};
use nix::poll::PollFlags;
use nix::poll::{poll, PollFd};
use std::convert::TryInto;
use std::error::Error;
use std::io::ErrorKind;
use std::mem;
use xenctrl::consts::{PAGE_SHIFT, PAGE_SIZE};
use xenctrl::RING_HAS_UNCONSUMED_REQUESTS;
use xenctrl::{XenControl, XenCr, XenEventType};
use xenevtchn::XenEventChannel;
use xenforeignmemory::XenForeignMem;
use xenstore_rs::{XBTransaction, Xs, XsOpenFlags};
use xenvmevent_sys::{
vm_event_back_ring, vm_event_response_t, VM_EVENT_FLAG_VCPU_PAUSED, VM_EVENT_INTERFACE_VERSION,
};
Expand Down Expand Up @@ -338,6 +337,9 @@ impl Introspectable for Xen {
old,
},
XenEventType::Msr { msr_type, value } => EventType::Msr { msr_type, value },
XenEventType::Breakpoint { insn_len, .. } => {
EventType::Breakpoint { gpa: 0, insn_len }
}
_ => unimplemented!(),
};
vcpu = req.vcpu_id.try_into().unwrap();
Expand Down Expand Up @@ -382,6 +384,9 @@ impl Introspectable for Xen {
.xc
.monitor_mov_to_msr(self.domid, micro_msr_type, enabled)?)
}
InterceptType::Breakpoint => {
Ok(self.xc.monitor_software_breakpoint(self.domid, enabled)?)
}
_ => unimplemented!(),
}
}
Expand Down

0 comments on commit b61e80f

Please sign in to comment.