From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerone Young Subject: [PATCH 08 of 20] Move kvm_destroy_phys_mem to libkvm-x86.c Date: Fri, 02 Nov 2007 05:36:44 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org # HG changeset patch # User Jerone Young # Date 1193998499 18000 # Node ID baaa6c2233371bba2d1d67a839747576c013bbe4 # Parent 9ac9f734ec73ca1b5f156250c69741ee2a642718 Move kvm_destroy_phys_mem to libkvm-x86.c Signed-off-by: Jerone Young diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c --- a/libkvm/libkvm-x86.c +++ b/libkvm/libkvm-x86.c @@ -323,3 +323,29 @@ void *kvm_create_phys_mem(kvm_context_t log, writable); } +/* destroy/free a whole slot. + * phys_start, len and slot are the params passed to kvm_create_phys_mem() + */ +void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start, + unsigned long len) +{ + int slot; + struct kvm_memory_region *mem; + + slot = get_slot(phys_start); + + if (slot >= KVM_MAX_NUM_MEM_REGIONS) { + fprintf(stderr, "BUG: %s: invalid parameters (slot=%d)\n", + __FUNCTION__, slot); + return; + } + mem = &kvm->mem_regions[slot]; + if (phys_start != mem->guest_phys_addr) { + fprintf(stderr, + "WARNING: %s: phys_start is 0x%lx expecting 0x%llx\n", + __FUNCTION__, phys_start, mem->guest_phys_addr); + phys_start = mem->guest_phys_addr; + } + kvm_create_phys_mem(kvm, phys_start, 0, 0, 0); +} + diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h new file mode 100644 --- /dev/null +++ b/libkvm/libkvm-x86.h @@ -0,0 +1,14 @@ +/* This header is for x86 functions & variables that will be exposed to users. + * DO NOT PLACE FUNCTIONS OR VARIABLES HERE THAT ARE NOT GOING TO EXPOSED TO + * USERS. + */ +#ifndef LIBKVM_X86_H +#define LIBKVM_X86_H + +void *kvm_create_phys_mem(kvm_context_t, unsigned long phys_start, + unsigned long len, int log, int writable); + +void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start, + unsigned long len); + +#endif diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -447,33 +447,6 @@ int kvm_register_userspace_phys_mem(kvm_ #else return -ENOSYS; #endif -} - - -/* destroy/free a whole slot. - * phys_start, len and slot are the params passed to kvm_create_phys_mem() - */ -void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start, - unsigned long len) -{ - int slot; - struct kvm_memory_region *mem; - - slot = get_slot(phys_start); - - if (slot >= KVM_MAX_NUM_MEM_REGIONS) { - fprintf(stderr, "BUG: %s: invalid parameters (slot=%d)\n", - __FUNCTION__, slot); - return; - } - mem = &kvm->mem_regions[slot]; - if (phys_start != mem->guest_phys_addr) { - fprintf(stderr, - "WARNING: %s: phys_start is 0x%lx expecting 0x%llx\n", - __FUNCTION__, phys_start, mem->guest_phys_addr); - phys_start = mem->guest_phys_addr; - } - kvm_create_phys_mem(kvm, phys_start, 0, 0, 0); } int kvm_create_memory_alias(kvm_context_t kvm, ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/