blob: 4de9ec783f66a3730d0b0c681676df5733fd7b84 [file] [log] [blame]
bellarde88de092005-02-07 12:35:39 +00001#ifndef QEMU_H
2#define QEMU_H
bellard31e31b82003-02-18 22:55:36 +00003
bellard6180a182003-09-30 21:04:53 +00004#include "cpu.h"
Paolo Bonzinif08b6172014-03-28 19:42:10 +01005#include "exec/cpu_ldst.h"
blueswir1992f48a2007-10-14 16:27:31 +00006
balrog06177d32007-12-24 13:47:52 +00007#undef DEBUG_REMAP
balrog06177d32007-12-24 13:47:52 +00008
Paolo Bonzini022c62c2012-12-17 18:19:49 +01009#include "exec/user/abitypes.h"
blueswir1992f48a2007-10-14 16:27:31 +000010
blueswir1992f48a2007-10-14 16:27:31 +000011#include "syscall_defs.h"
LluĂ­s Vilanova460c5792016-02-01 19:38:42 +010012#include "target_syscall.h"
bellard66fb9762003-03-23 01:06:05 +000013
Peter Maydell400b7f62021-09-08 16:43:57 +010014/*
15 * This is the size of the host kernel's sigset_t, needed where we make
Peter Maydell1d48fdd2016-06-14 12:49:18 +010016 * direct system calls that take a sigset_t pointer and a size.
17 */
18#define SIGSET_T_SIZE (_NSIG / 8)
19
Peter Maydell400b7f62021-09-08 16:43:57 +010020/*
21 * This struct is used to hold certain information about the image.
bellard31e31b82003-02-18 22:55:36 +000022 * Basically, it replicates in user space what would be certain
23 * task_struct fields in the kernel
24 */
25struct image_info {
Richard Henderson9955ffa2010-07-27 10:25:30 -070026 abi_ulong load_bias;
blueswir1992f48a2007-10-14 16:27:31 +000027 abi_ulong load_addr;
28 abi_ulong start_code;
29 abi_ulong end_code;
30 abi_ulong start_data;
31 abi_ulong end_data;
blueswir1992f48a2007-10-14 16:27:31 +000032 abi_ulong brk;
blueswir1992f48a2007-10-14 16:27:31 +000033 abi_ulong start_stack;
Paul Brook97374d32010-06-16 13:03:51 +010034 abi_ulong stack_limit;
Richard Henderson5d94c2f2023-08-16 10:54:57 -070035 abi_ulong vdso;
blueswir1992f48a2007-10-14 16:27:31 +000036 abi_ulong entry;
37 abi_ulong code_offset;
38 abi_ulong data_offset;
Mika Westerbergedf8e2a2009-04-07 09:57:11 +030039 abi_ulong saved_auxv;
Alexander Graf125b0f52012-01-28 21:12:14 +020040 abi_ulong auxv_len;
Richard Henderson60f1c802022-04-26 19:51:29 -070041 abi_ulong argc;
42 abi_ulong argv;
43 abi_ulong envc;
44 abi_ulong envp;
Richard Henderson7c4ee5b2016-12-15 09:38:11 -080045 abi_ulong file_string;
Paul Brookd8fd2952012-03-30 18:02:50 +010046 uint32_t elf_flags;
Peter Maydell400b7f62021-09-08 16:43:57 +010047 int personality;
Laurent Vivier33143c42018-07-16 21:53:49 +020048 abi_ulong alignment;
Richard Henderson872f3d02022-08-10 23:00:52 -070049 bool exec_stack;
Christophe Lyona99856c2018-04-30 10:03:41 +020050
Richard Henderson60f1c802022-04-26 19:51:29 -070051 /* Generic semihosting knows about these pointers. */
52 abi_ulong arg_strings; /* strings for argv */
53 abi_ulong env_strings; /* strings for envp; ends arg_strings */
54
Christophe Lyona99856c2018-04-30 10:03:41 +020055 /* The fields below are used in FDPIC mode. */
Mike Frysinger1af02e82011-02-07 01:05:50 -050056 abi_ulong loadmap_addr;
57 uint16_t nsegs;
Peter Maydell400b7f62021-09-08 16:43:57 +010058 void *loadsegs;
Mike Frysinger1af02e82011-02-07 01:05:50 -050059 abi_ulong pt_dynamic_addr;
Christophe Lyon3cb10cf2018-04-30 10:03:43 +020060 abi_ulong interpreter_loadmap_addr;
61 abi_ulong interpreter_pt_dynamic_addr;
Mike Frysinger1af02e82011-02-07 01:05:50 -050062 struct image_info *other_info;
Richard Henderson83f990e2020-10-21 10:37:47 -070063
64 /* For target-specific processing of NT_GNU_PROPERTY_TYPE_0. */
65 uint32_t note_flags;
66
Stefan Markovic74cfc702018-10-22 16:43:40 +020067#ifdef TARGET_MIPS
68 int fp_abi;
69 int interp_fp_abi;
70#endif
bellard31e31b82003-02-18 22:55:36 +000071};
72
bellardb346ff42003-06-15 20:05:50 +000073#ifdef TARGET_I386
bellard851e67a2003-03-29 16:53:14 +000074/* Information about the current linux thread */
75struct vm86_saved_state {
76 uint32_t eax; /* return code */
77 uint32_t ebx;
78 uint32_t ecx;
79 uint32_t edx;
80 uint32_t esi;
81 uint32_t edi;
82 uint32_t ebp;
83 uint32_t esp;
84 uint32_t eflags;
85 uint32_t eip;
86 uint16_t cs, ss, ds, es, fs, gs;
87};
bellardb346ff42003-06-15 20:05:50 +000088#endif
bellard851e67a2003-03-29 16:53:14 +000089
Peter Maydell848d72c2013-09-03 20:12:17 +010090#if defined(TARGET_ARM) && defined(TARGET_ABI32)
bellard28c4f362004-02-16 21:47:43 +000091/* FPU emulator */
92#include "nwfpe/fpa11.h"
bellard28c4f362004-02-16 21:47:43 +000093#endif
94
pbrook624f7972008-05-31 16:11:38 +000095struct emulated_sigtable {
96 int pending; /* true if signal is pending */
Timothy E Baldwin907f5fd2016-05-27 15:51:52 +010097 target_siginfo_t info;
pbrook624f7972008-05-31 16:11:38 +000098};
99
bellard851e67a2003-03-29 16:53:14 +0000100typedef struct TaskState {
Mika Westerbergedf8e2a2009-04-07 09:57:11 +0300101 pid_t ts_tid; /* tid (or pid) of this task */
bellard28c4f362004-02-16 21:47:43 +0000102#ifdef TARGET_ARM
Peter Maydell848d72c2013-09-03 20:12:17 +0100103# ifdef TARGET_ABI32
bellard28c4f362004-02-16 21:47:43 +0000104 /* FPA state */
105 FPA11 fpa;
Peter Maydell848d72c2013-09-03 20:12:17 +0100106# endif
Keith Packarda10b9d92021-01-08 22:42:52 +0000107#endif
108#if defined(TARGET_ARM) || defined(TARGET_RISCV)
bellarda4f81972005-04-23 18:25:41 +0000109 int swi_errno;
bellard28c4f362004-02-16 21:47:43 +0000110#endif
j_mayer84409dd2007-04-06 08:56:50 +0000111#if defined(TARGET_I386) && !defined(TARGET_X86_64)
blueswir1992f48a2007-10-14 16:27:31 +0000112 abi_ulong target_v86;
bellard851e67a2003-03-29 16:53:14 +0000113 struct vm86_saved_state vm86_saved_regs;
bellardb333af02003-05-14 21:48:51 +0000114 struct target_vm86plus_struct vm86plus;
bellard631271d2003-05-10 13:14:52 +0000115 uint32_t v86flags;
116 uint32_t v86mask;
bellardb346ff42003-06-15 20:05:50 +0000117#endif
pbrookc2764712009-03-07 15:24:59 +0000118 abi_ulong child_tidptr;
pbrooke6e59062006-10-22 00:18:54 +0000119#ifdef TARGET_M68K
Peter Maydell1ccd9372013-07-16 18:44:55 +0100120 abi_ulong tp_value;
pbrooke6e59062006-10-22 00:18:54 +0000121#endif
Keith Packarda10b9d92021-01-08 22:42:52 +0000122#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_RISCV)
pbrooka87295e2007-05-26 15:09:38 +0000123 /* Extra fields for semihosted binaries. */
Peter Maydelld3170912016-07-04 13:06:35 +0100124 abi_ulong heap_base;
125 abi_ulong heap_limit;
pbrooka87295e2007-05-26 15:09:38 +0000126#endif
Peter Maydelld3170912016-07-04 13:06:35 +0100127 abi_ulong stack_base;
bellard851e67a2003-03-29 16:53:14 +0000128 int used; /* non zero if used */
pbrook978efd62006-06-17 18:30:42 +0000129 struct image_info *info;
Mika Westerbergedf8e2a2009-04-07 09:57:11 +0300130 struct linux_binprm *bprm;
pbrook624f7972008-05-31 16:11:38 +0000131
Timothy E Baldwin655ed672016-05-27 15:51:53 +0100132 struct emulated_sigtable sync_signal;
pbrook624f7972008-05-31 16:11:38 +0000133 struct emulated_sigtable sigtab[TARGET_NSIG];
Peter Maydell400b7f62021-09-08 16:43:57 +0100134 /*
135 * This thread's signal mask, as requested by the guest program.
Peter Maydell3d3efba2016-05-27 15:51:49 +0100136 * The actual signal mask of this thread may differ:
137 * + we don't let SIGSEGV and SIGBUS be blocked while running guest code
138 * + sometimes we block all signals to avoid races
139 */
140 sigset_t signal_mask;
Peter Maydell400b7f62021-09-08 16:43:57 +0100141 /*
142 * The signal mask imposed by a guest sigsuspend syscall, if we are
Peter Maydell3d3efba2016-05-27 15:51:49 +0100143 * currently in the middle of such a syscall
144 */
145 sigset_t sigsuspend_mask;
146 /* Nonzero if we're leaving a sigsuspend and sigsuspend_mask is valid. */
147 int in_sigsuspend;
148
Peter Maydell400b7f62021-09-08 16:43:57 +0100149 /*
150 * Nonzero if process_pending_signals() needs to do something (either
Peter Maydell3d3efba2016-05-27 15:51:49 +0100151 * handle a pending signal or unblock signals).
152 * This flag is written from a signal handler so should be accessed via
Stefan Hajnoczid73415a2020-09-23 11:56:46 +0100153 * the qatomic_read() and qatomic_set() functions. (It is not accessed
Peter Maydell3d3efba2016-05-27 15:51:49 +0100154 * from multiple threads.)
155 */
156 int signal_pending;
157
Peter Maydell5bfce0b2019-07-25 14:16:45 +0100158 /* This thread's sigaltstack, if it has one */
159 struct target_sigaltstack sigaltstack_used;
Cameron Esfahanieb33cda2022-01-27 16:12:51 -0800160
161 /* Start time of task after system boot in clock ticks */
162 uint64_t start_boottime;
Peter Maydellb1b21382022-01-14 15:37:30 +0000163} TaskState;
bellard851e67a2003-03-29 16:53:14 +0000164
Peter Maydell3b249d22021-09-08 16:44:03 +0100165abi_long do_brk(abi_ulong new_brk);
Ilya Leoshkevicha4dab0a2023-06-30 19:04:16 +0100166int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *pathname,
Ilya Leoshkevich35be8982023-06-30 19:04:17 +0100167 int flags, mode_t mode, bool safe);
Ilya Leoshkevicha4dab0a2023-06-30 19:04:16 +0100168ssize_t do_guest_readlink(const char *pathname, char *buf, size_t bufsiz);
bellard631271d2003-05-10 13:14:52 +0000169
bellardedf779f2004-02-22 13:40:13 +0000170/* user access */
171
Thomas WeiĂźschuh64d06012023-04-22 12:03:13 +0200172#define VERIFY_NONE 0
Richard Henderson68f77662021-02-12 10:48:38 -0800173#define VERIFY_READ PAGE_READ
174#define VERIFY_WRITE (PAGE_READ | PAGE_WRITE)
bellardedf779f2004-02-22 13:40:13 +0000175
Richard Hendersonc7169b02021-02-12 10:48:47 -0800176static inline bool access_ok_untagged(int type, abi_ulong addr, abi_ulong size)
bellarddae32702007-11-14 10:51:00 +0000177{
Richard Henderson114556c2021-02-12 10:48:45 -0800178 if (size == 0
Richard Henderson46b12f42021-02-12 10:48:46 -0800179 ? !guest_addr_valid_untagged(addr)
180 : !guest_range_valid_untagged(addr, size)) {
Richard Henderson4feac832021-02-12 10:48:37 -0800181 return false;
182 }
Richard Hendersonbef6f002023-07-07 21:40:52 +0100183 return page_check_range((target_ulong)addr, size, type);
bellarddae32702007-11-14 10:51:00 +0000184}
bellardedf779f2004-02-22 13:40:13 +0000185
Richard Hendersonc7169b02021-02-12 10:48:47 -0800186static inline bool access_ok(CPUState *cpu, int type,
187 abi_ulong addr, abi_ulong size)
188{
189 return access_ok_untagged(type, cpu_untagged_addr(cpu, addr), size);
190}
191
Richard Henderson658f2dc2013-01-04 16:39:31 -0800192/* NOTE __get_user and __put_user use host pointers and don't check access.
193 These are usually used to access struct data members once the struct has
194 been locked - usually with lock_user_struct. */
bellardedf779f2004-02-22 13:40:13 +0000195
Peter Maydell850d5e32018-10-09 17:18:14 +0100196/*
197 * Tricky points:
198 * - Use __builtin_choose_expr to avoid type promotion from ?:,
199 * - Invalid sizes result in a compile time error stemming from
200 * the fact that abort has no parameters.
201 * - It's easier to use the endian-specific unaligned load/store
202 * functions than host-endian unaligned load/store plus tswapN.
203 * - The pragmas are necessary only to silence a clang false-positive
204 * warning: see https://bugs.llvm.org/show_bug.cgi?id=39113 .
Peter Maydell850d5e32018-10-09 17:18:14 +0100205 * - gcc has bugs in its _Pragma() support in some versions, eg
206 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83256 -- so we only
207 * include the warning-suppression pragmas for clang
208 */
Thomas Huth798b8582018-11-30 09:23:16 +0100209#if defined(__clang__) && __has_warning("-Waddress-of-packed-member")
Peter Maydell850d5e32018-10-09 17:18:14 +0100210#define PRAGMA_DISABLE_PACKED_WARNING \
211 _Pragma("GCC diagnostic push"); \
Peter Maydell850d5e32018-10-09 17:18:14 +0100212 _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"")
Richard Henderson658f2dc2013-01-04 16:39:31 -0800213
Peter Maydell850d5e32018-10-09 17:18:14 +0100214#define PRAGMA_REENABLE_PACKED_WARNING \
215 _Pragma("GCC diagnostic pop")
Richard Henderson658f2dc2013-01-04 16:39:31 -0800216
Peter Maydell850d5e32018-10-09 17:18:14 +0100217#else
218#define PRAGMA_DISABLE_PACKED_WARNING
219#define PRAGMA_REENABLE_PACKED_WARNING
220#endif
221
222#define __put_user_e(x, hptr, e) \
223 do { \
224 PRAGMA_DISABLE_PACKED_WARNING; \
225 (__builtin_choose_expr(sizeof(*(hptr)) == 1, stb_p, \
226 __builtin_choose_expr(sizeof(*(hptr)) == 2, stw_##e##_p, \
227 __builtin_choose_expr(sizeof(*(hptr)) == 4, stl_##e##_p, \
228 __builtin_choose_expr(sizeof(*(hptr)) == 8, stq_##e##_p, abort)))) \
229 ((hptr), (x)), (void)0); \
230 PRAGMA_REENABLE_PACKED_WARNING; \
231 } while (0)
232
233#define __get_user_e(x, hptr, e) \
234 do { \
235 PRAGMA_DISABLE_PACKED_WARNING; \
236 ((x) = (typeof(*hptr))( \
237 __builtin_choose_expr(sizeof(*(hptr)) == 1, ldub_p, \
238 __builtin_choose_expr(sizeof(*(hptr)) == 2, lduw_##e##_p, \
239 __builtin_choose_expr(sizeof(*(hptr)) == 4, ldl_##e##_p, \
240 __builtin_choose_expr(sizeof(*(hptr)) == 8, ldq_##e##_p, abort)))) \
241 (hptr)), (void)0); \
242 PRAGMA_REENABLE_PACKED_WARNING; \
243 } while (0)
244
Richard Henderson658f2dc2013-01-04 16:39:31 -0800245
Marc-André Lureauee3eb3a2022-03-23 19:57:18 +0400246#if TARGET_BIG_ENDIAN
Richard Henderson658f2dc2013-01-04 16:39:31 -0800247# define __put_user(x, hptr) __put_user_e(x, hptr, be)
248# define __get_user(x, hptr) __get_user_e(x, hptr, be)
249#else
250# define __put_user(x, hptr) __put_user_e(x, hptr, le)
251# define __get_user(x, hptr) __get_user_e(x, hptr, le)
252#endif
bellardedf779f2004-02-22 13:40:13 +0000253
bellard579a97f2007-11-11 14:26:47 +0000254/* put_user()/get_user() take a guest address and check access */
255/* These are usually used to access an atomic data type, such as an int,
256 * that has been passed by address. These internally perform locking
257 * and unlocking on the data type.
258 */
259#define put_user(x, gaddr, target_type) \
260({ \
261 abi_ulong __gaddr = (gaddr); \
262 target_type *__hptr; \
Riku Voipioa42267e2014-04-22 15:40:50 +0300263 abi_long __ret = 0; \
bellard579a97f2007-11-11 14:26:47 +0000264 if ((__hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0))) { \
Riku Voipioa42267e2014-04-22 15:40:50 +0300265 __put_user((x), __hptr); \
bellard579a97f2007-11-11 14:26:47 +0000266 unlock_user(__hptr, __gaddr, sizeof(target_type)); \
267 } else \
268 __ret = -TARGET_EFAULT; \
269 __ret; \
bellardedf779f2004-02-22 13:40:13 +0000270})
271
bellard579a97f2007-11-11 14:26:47 +0000272#define get_user(x, gaddr, target_type) \
273({ \
274 abi_ulong __gaddr = (gaddr); \
275 target_type *__hptr; \
Riku Voipioa42267e2014-04-22 15:40:50 +0300276 abi_long __ret = 0; \
bellard579a97f2007-11-11 14:26:47 +0000277 if ((__hptr = lock_user(VERIFY_READ, __gaddr, sizeof(target_type), 1))) { \
Riku Voipioa42267e2014-04-22 15:40:50 +0300278 __get_user((x), __hptr); \
bellard579a97f2007-11-11 14:26:47 +0000279 unlock_user(__hptr, __gaddr, 0); \
bellard2f619692007-11-16 10:46:05 +0000280 } else { \
281 /* avoid warning */ \
282 (x) = 0; \
bellard579a97f2007-11-11 14:26:47 +0000283 __ret = -TARGET_EFAULT; \
bellard2f619692007-11-16 10:46:05 +0000284 } \
bellard579a97f2007-11-11 14:26:47 +0000285 __ret; \
bellardedf779f2004-02-22 13:40:13 +0000286})
287
bellard2f619692007-11-16 10:46:05 +0000288#define put_user_ual(x, gaddr) put_user((x), (gaddr), abi_ulong)
289#define put_user_sal(x, gaddr) put_user((x), (gaddr), abi_long)
290#define put_user_u64(x, gaddr) put_user((x), (gaddr), uint64_t)
291#define put_user_s64(x, gaddr) put_user((x), (gaddr), int64_t)
292#define put_user_u32(x, gaddr) put_user((x), (gaddr), uint32_t)
293#define put_user_s32(x, gaddr) put_user((x), (gaddr), int32_t)
294#define put_user_u16(x, gaddr) put_user((x), (gaddr), uint16_t)
295#define put_user_s16(x, gaddr) put_user((x), (gaddr), int16_t)
296#define put_user_u8(x, gaddr) put_user((x), (gaddr), uint8_t)
297#define put_user_s8(x, gaddr) put_user((x), (gaddr), int8_t)
298
299#define get_user_ual(x, gaddr) get_user((x), (gaddr), abi_ulong)
300#define get_user_sal(x, gaddr) get_user((x), (gaddr), abi_long)
301#define get_user_u64(x, gaddr) get_user((x), (gaddr), uint64_t)
302#define get_user_s64(x, gaddr) get_user((x), (gaddr), int64_t)
303#define get_user_u32(x, gaddr) get_user((x), (gaddr), uint32_t)
304#define get_user_s32(x, gaddr) get_user((x), (gaddr), int32_t)
305#define get_user_u16(x, gaddr) get_user((x), (gaddr), uint16_t)
306#define get_user_s16(x, gaddr) get_user((x), (gaddr), int16_t)
307#define get_user_u8(x, gaddr) get_user((x), (gaddr), uint8_t)
308#define get_user_s8(x, gaddr) get_user((x), (gaddr), int8_t)
309
bellard579a97f2007-11-11 14:26:47 +0000310/* copy_from_user() and copy_to_user() are usually used to copy data
311 * buffers between the target and host. These internally perform
312 * locking/unlocking of the memory.
313 */
Richard Henderson360f0ab2021-03-15 14:40:04 -0600314int copy_from_user(void *hptr, abi_ulong gaddr, ssize_t len);
315int copy_to_user(abi_ulong gaddr, void *hptr, ssize_t len);
bellard579a97f2007-11-11 14:26:47 +0000316
pbrook53a59602006-03-25 19:31:22 +0000317/* Functions for accessing guest memory. The tget and tput functions
Stefan Weil6f20f552013-09-12 19:57:15 +0200318 read/write single values, byteswapping as necessary. The lock_user function
pbrook53a59602006-03-25 19:31:22 +0000319 gets a pointer to a contiguous area of guest memory, but does not perform
Stefan Weil6f20f552013-09-12 19:57:15 +0200320 any byteswapping. lock_user may return either a pointer to the guest
pbrook53a59602006-03-25 19:31:22 +0000321 memory, or a temporary buffer. */
322
323/* Lock an area of guest memory into the host. If copy is true then the
324 host area will have the same contents as the guest. */
Richard Henderson360f0ab2021-03-15 14:40:04 -0600325void *lock_user(int type, abi_ulong guest_addr, ssize_t len, bool copy);
bellardedf779f2004-02-22 13:40:13 +0000326
bellard579a97f2007-11-11 14:26:47 +0000327/* Unlock an area of guest memory. The first LEN bytes must be
ths1235fc02008-06-03 19:51:57 +0000328 flushed back to guest memory. host_ptr = NULL is explicitly
bellard579a97f2007-11-11 14:26:47 +0000329 allowed and does nothing. */
Richard Henderson687ca792021-02-12 10:48:48 -0800330#ifndef DEBUG_REMAP
Richard Henderson360f0ab2021-03-15 14:40:04 -0600331static inline void unlock_user(void *host_ptr, abi_ulong guest_addr,
332 ssize_t len)
333{
334 /* no-op */
335}
Richard Henderson687ca792021-02-12 10:48:48 -0800336#else
Richard Henderson360f0ab2021-03-15 14:40:04 -0600337void unlock_user(void *host_ptr, abi_ulong guest_addr, ssize_t len);
pbrook53a59602006-03-25 19:31:22 +0000338#endif
bellardedf779f2004-02-22 13:40:13 +0000339
bellard579a97f2007-11-11 14:26:47 +0000340/* Return the length of a string in target memory or -TARGET_EFAULT if
341 access error. */
Richard Henderson09f679b2021-02-12 10:48:49 -0800342ssize_t target_strlen(abi_ulong gaddr);
bellardedf779f2004-02-22 13:40:13 +0000343
pbrook53a59602006-03-25 19:31:22 +0000344/* Like lock_user but for null terminated strings. */
Richard Henderson687ca792021-02-12 10:48:48 -0800345void *lock_user_string(abi_ulong guest_addr);
pbrook53a59602006-03-25 19:31:22 +0000346
Stefan Weil41d1af42013-09-12 19:57:41 +0200347/* Helper macros for locking/unlocking a target struct. */
bellard579a97f2007-11-11 14:26:47 +0000348#define lock_user_struct(type, host_ptr, guest_addr, copy) \
349 (host_ptr = lock_user(type, guest_addr, sizeof(*host_ptr), copy))
350#define unlock_user_struct(host_ptr, guest_addr, copy) \
pbrook53a59602006-03-25 19:31:22 +0000351 unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
352
bellarde88de092005-02-07 12:35:39 +0000353#endif /* QEMU_H */