From: Aravindh Puthiyaparambil Subject: [PATCH 3/3] tools/xen-access: Use the new mem_access APIs Date: Thu, 10 Apr 2014 20:49:39 -0700 Message-ID: <1397188179-14606-4-git-send-email-aravindp@cisco.com> References: <1397188179-14606-1-git-send-email-aravindp@cisco.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WYSU1-0004p0-Rd for xen-devel@lists.xenproject.org; Fri, 11 Apr 2014 03:50:30 +0000 In-Reply-To: <1397188179-14606-1-git-send-email-aravindp@cisco.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Modify the xen-access test program to use the new mem_access APIs. Signed-off-by: Aravindh Puthiyaparambil Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c index f6522a1..d889a9c 100644 --- a/tools/tests/xen-access/xen-access.c +++ b/tools/tests/xen-access/xen-access.c @@ -440,8 +440,8 @@ int main(int argc, char *argv[]) int rc = -1; int rc1; xc_interface *xch; - hvmmem_access_t default_access = HVMMEM_access_rwx; - hvmmem_access_t after_first_access = HVMMEM_access_rwx; + xenmem_access_t default_access = XENMEM_access_rwx; + xenmem_access_t after_first_access = XENMEM_access_rwx; int required = 0; int int3 = 0; int shutting_down = 0; @@ -475,13 +475,13 @@ int main(int argc, char *argv[]) if ( !strcmp(argv[0], "write") ) { - default_access = HVMMEM_access_rx; - after_first_access = HVMMEM_access_rwx; + default_access = XENMEM_access_rx; + after_first_access = XENMEM_access_rwx; } else if ( !strcmp(argv[0], "exec") ) { - default_access = HVMMEM_access_rw; - after_first_access = HVMMEM_access_rwx; + default_access = XENMEM_access_rw; + after_first_access = XENMEM_access_rwx; } else if ( !strcmp(argv[0], "int3") ) { @@ -520,15 +520,15 @@ int main(int argc, char *argv[]) } /* Set the default access type and convert all pages to it */ - rc = xc_hvm_set_mem_access(xch, domain_id, default_access, ~0ull, 0); + rc = xc_set_mem_access(xch, domain_id, default_access, ~0ull, 0); if ( rc < 0 ) { ERROR("Error %d setting default mem access type\n", rc); goto exit; } - rc = xc_hvm_set_mem_access(xch, domain_id, default_access, 0, - xenaccess->domain_info->max_pages); + rc = xc_set_mem_access(xch, domain_id, default_access, 0, + xenaccess->domain_info->max_pages); if ( rc < 0 ) { ERROR("Error %d setting all memory to access type %d\n", rc, @@ -554,8 +554,9 @@ int main(int argc, char *argv[]) DPRINTF("xenaccess shutting down on signal %d\n", interrupted); /* Unregister for every event */ - rc = xc_hvm_set_mem_access(xch, domain_id, HVMMEM_access_rwx, ~0ull, 0); - rc = xc_hvm_set_mem_access(xch, domain_id, HVMMEM_access_rwx, 0, xenaccess->domain_info->max_pages); + rc = xc_set_mem_access(xch, domain_id, XENMEM_access_rwx, ~0ull, 0); + rc = xc_set_mem_access(xch, domain_id, XENMEM_access_rwx, 0, + xenaccess->domain_info->max_pages); rc = xc_set_hvm_param(xch, domain_id, HVM_PARAM_MEMORY_EVENT_INT3, HVMPME_mode_disabled); shutting_down = 1; @@ -575,7 +576,7 @@ int main(int argc, char *argv[]) while ( RING_HAS_UNCONSUMED_REQUESTS(&xenaccess->mem_event.back_ring) ) { - hvmmem_access_t access; + xenmem_access_t access; rc = get_request(&xenaccess->mem_event, &req); if ( rc != 0 ) @@ -591,7 +592,7 @@ int main(int argc, char *argv[]) switch (req.reason) { case MEM_EVENT_REASON_VIOLATION: - rc = xc_hvm_get_mem_access(xch, domain_id, req.gfn, &access); + rc = xc_get_mem_access(xch, domain_id, req.gfn, &access); if (rc < 0) { ERROR("Error %d getting mem_access event\n", rc); @@ -611,8 +612,8 @@ int main(int argc, char *argv[]) if ( default_access != after_first_access ) { - rc = xc_hvm_set_mem_access(xch, domain_id, - after_first_access, req.gfn, 1); + rc = xc_set_mem_access(xch, domain_id, after_first_access, + req.gfn, 1); if (rc < 0) { ERROR("Error %d setting gfn to access_type %d\n", rc, -- 1.8.3.2