user-exec.c (9c125d17e9402c232c46610802e5931b3639d77b) user-exec.c (9323e79f10e5f5d8fffc3b307776173ca11faeae)
1/*
2 * User emulator execution
3 *
4 * Copyright (c) 2003-2005 Fabrice Bellard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

--- 87 unchanged lines hidden (view full) ---

96 * @cpu: the cpu context
97 * @old_set: the sigset_t from the signal ucontext_t
98 * @host_pc: the host pc, adjusted for the signal
99 * @guest_addr: the guest address of the fault
100 *
101 * Return true if the write fault has been handled, and should be re-tried.
102 *
103 * Note that it is important that we don't call page_unprotect() unless
1/*
2 * User emulator execution
3 *
4 * Copyright (c) 2003-2005 Fabrice Bellard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either

--- 87 unchanged lines hidden (view full) ---

96 * @cpu: the cpu context
97 * @old_set: the sigset_t from the signal ucontext_t
98 * @host_pc: the host pc, adjusted for the signal
99 * @guest_addr: the guest address of the fault
100 *
101 * Return true if the write fault has been handled, and should be re-tried.
102 *
103 * Note that it is important that we don't call page_unprotect() unless
104 * this is really a "write to nonwriteable page" fault, because
104 * this is really a "write to nonwritable page" fault, because
105 * page_unprotect() assumes that if it is called for an access to
105 * page_unprotect() assumes that if it is called for an access to
106 * a page that's writeable this means we had two threads racing and
107 * another thread got there first and already made the page writeable;
106 * a page that's writable this means we had two threads racing and
107 * another thread got there first and already made the page writable;
108 * so we will retry the access. If we were to call page_unprotect()
109 * for some other kind of fault that should really be passed to the
110 * guest, we'd end up in an infinite loop of retrying the faulting access.
111 */
112bool handle_sigsegv_accerr_write(CPUState *cpu, sigset_t *old_set,
113 uintptr_t host_pc, abi_ptr guest_addr)
114{
115 switch (page_unprotect(guest_addr, host_pc)) {

--- 412 unchanged lines hidden ---
108 * so we will retry the access. If we were to call page_unprotect()
109 * for some other kind of fault that should really be passed to the
110 * guest, we'd end up in an infinite loop of retrying the faulting access.
111 */
112bool handle_sigsegv_accerr_write(CPUState *cpu, sigset_t *old_set,
113 uintptr_t host_pc, abi_ptr guest_addr)
114{
115 switch (page_unprotect(guest_addr, host_pc)) {

--- 412 unchanged lines hidden ---