qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] translate-all.c: Remove writable protection fea


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] translate-all.c: Remove writable protection feature for tb_alloc_page()
Date: Thu, 14 Jan 2016 10:30:12 +0000

On 14 January 2016 at 10:26, Chen Gang <address@hidden> wrote:
> On 2016年01月14日 18:05, Peter Maydell wrote:
>> If we don't mark the page as non-writeable when we generate a TB
>> from it, how do we detect when guest code later writes to that
>> page (which means we need to invalidate the TB) ?
>>
>
> For me, what you said above sounds reasonable, at present, that's really
> valuable to me :-)
>
> I guess, you also mean: our qemu will catch the host page fault signal
> and invalidate the TB.

Yes, this is how it works for user-mode. (For softmmu we can catch
writes and send them via the slow path which does the check for
whether TBs need to be invalidated; for linux-user we have no
emulated MMU so we must rely on the host kernel sending us the
SIGSEGV.) The bit of code that does this is at the top of
handle_cpu_signal():

    if (is_write && h2g_valid(address)
        && page_unprotect(h2g(address), pc, puc)) {
        return 1;
    }

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]