All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: kvm-devel
	<kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	"Yu,
	 Wilfred" <wilfred.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [Patch] (big) real mode emulation - emulator_write_std
Date: Mon, 13 Aug 2007 11:46:12 +0300	[thread overview]
Message-ID: <46C01A54.4010606@qumranet.com> (raw)
In-Reply-To: <1186783440.6097.16.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>

Nitin A Kamble wrote:
> Hi Avi,
>   I have been collected quiet a few patches in my tree now. They are 
> all in dirty(style, debug) state. Now I started cleaning some of the 
> code in my tree, and cutting patches again. I plan to send you steady 
> stream of patches now. so you can expect lots of patches coming from 
> me in coming days now.
>
> About the status of the big real mode; In my private tree I have 
> evolved the segment registers support for the emulator to next level 
> now. I think I can also cut that patch also and send it to you. now it 
> is much more complete than earlier. As of today the SuSe Linux 10.1 is 
> proceeding in the big-real mode into the int 10 call. that is with the 
> help emulation of about 20 new instructions, and also the 
> infrastructure support for those instructions.  Probably I should keep 
> a count of instructions emulated in the big real mode to gauge my 
> progress.
>
> I am cutting my tree into simple patches, so it will be easy for you 
> to understand and apply/comment.
>     

> diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
> index f7ff231..4a213e2 100644
> --- a/drivers/kvm/kvm_main.c
> +++ b/drivers/kvm/kvm_main.c
> @@ -962,8 +962,35 @@ static int emulator_write_std(unsigned long addr,
>  			      unsigned int bytes,
>  			      struct kvm_vcpu *vcpu)
>  {
> -	pr_unimpl(vcpu, "emulator_write_std: addr %lx n %d\n", addr, bytes);
> -	return X86EMUL_UNHANDLEABLE;
> +	void *data = (void *) val;
> +
> +	while (bytes) {
> +		gpa_t gpa;
> +		unsigned offset = addr & (PAGE_SIZE-1);
> +		unsigned tocopy = min(bytes, (unsigned)PAGE_SIZE - offset);
> +		unsigned long pfn;
> +		struct page *page;
> +		void *page_virt;
> +
> +		gpa = vcpu->mmu.gva_to_gpa(vcpu, addr);
> +		if (gpa == UNMAPPED_GVA)
> +			return X86EMUL_PROPAGATE_FAULT;
> +		pfn = gpa >> PAGE_SHIFT;
> +		page = gfn_to_page(vcpu->kvm, pfn);
> +		if (!page)
> +			return X86EMUL_UNHANDLEABLE;
> +		page_virt = kmap_atomic(page, KM_USER0);
> +
> +		memcpy(page_virt + offset, data, tocopy);
> +
> +		kunmap_atomic(page_virt, KM_USER0);
> +
> +		bytes -= tocopy;
> +		data += tocopy;
> +		addr += tocopy;
> +	}
> +
> +	return X86EMUL_CONTINUE;
>  }
>  


This doesn't do the right thing if the write is targeted at a page 
table.  Just use emulator_write_emulated.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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/

  parent reply	other threads:[~2007-08-13  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10 22:04 [Patch] (big) real mode emulation - emulator_write_std Nitin A Kamble
     [not found] ` <1186783440.6097.16.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-08-13  8:46   ` Avi Kivity [this message]
     [not found]     ` <46C01A54.4010606-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-13 23:00       ` Kamble, Nitin A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46C01A54.4010606@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=wilfred.yu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.