Skip to content

Commit

Permalink
set_mem_event & slat_control functions added
Browse files Browse the repository at this point in the history
  • Loading branch information
kaganisildak committed Jan 6, 2025
1 parent c21af83 commit ca9ac02
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libvmi/events_cdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ struct vmi_event {
status_t vmi_register_event(
vmi_instance_t vmi,
vmi_event_t *event);

status_t vmi_set_mem_event(
vmi_instance_t vmi,
addr_t gfn,
vmi_mem_access_t access,
uint16_t slat_id);

status_t vmi_events_listen(
vmi_instance_t vmi,
Expand Down
11 changes: 11 additions & 0 deletions libvmi/libvmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,13 @@ def register_event(self, event):
cffi_event = event.to_cffi()
status = lib.vmi_register_event(self.vmi, cffi_event)
check(status)

def set_mem_event(self, gfn,access,slatid):
cffgfn = ffi.new("addr_t *",gfn)
cffaccess = ffi.new("uint8_t *",access)
cffslatid = ffi.new("uint16_t *",slatid)
status = lib.vmi_set_mem_event(self.vmi, gfn,access,slatid)
check(status)

def clear_event(self, event):
cffi_event = event.to_cffi()
Expand Down Expand Up @@ -1017,6 +1024,10 @@ def get_va_pages(self, dtb):
return va_pages

# slat
def slat_control(self,state):
state = ffi.new("bool *")
status = lib.vmi_slat_control(self.vmi, state)
check(status)
def slat_get_domain_state(self):
state = ffi.new("bool *")
status = lib.vmi_slat_get_domain_state(self.vmi, state)
Expand Down
4 changes: 4 additions & 0 deletions libvmi/slat_cdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ status_t vmi_slat_change_gfn (
uint16_t slat_idx,
addr_t old_gfn,
addr_t new_gfn);

status_t vmi_slat_control (
vmi_instance_t vmi,
bool *state);

0 comments on commit ca9ac02

Please sign in to comment.