2 * x86 memory access helpers
4 * Copyright (c) 2003 Fabrice Bellard
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
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
22 #include "exec/helper-proto.h"
23 #include "exec/exec-all.h"
24 #include "exec/cpu_ldst.h"
25 #include "qemu/int128.h"
26 #include "qemu/atomic128.h"
28 #include "helper-tcg.h"
30 void helper_boundw(CPUX86State
*env
, target_ulong a0
, int v
)
34 low
= cpu_ldsw_data_ra(env
, a0
, GETPC());
35 high
= cpu_ldsw_data_ra(env
, a0
+ 2, GETPC());
37 if (v
< low
|| v
> high
) {
38 if (env
->hflags
& HF_MPX_EN_MASK
) {
39 env
->bndcs_regs
.sts
= 0;
41 raise_exception_ra(env
, EXCP05_BOUND
, GETPC());
45 void helper_boundl(CPUX86State
*env
, target_ulong a0
, int v
)
49 low
= cpu_ldl_data_ra(env
, a0
, GETPC());
50 high
= cpu_ldl_data_ra(env
, a0
+ 4, GETPC());
51 if (v
< low
|| v
> high
) {
52 if (env
->hflags
& HF_MPX_EN_MASK
) {
53 env
->bndcs_regs
.sts
= 0;
55 raise_exception_ra(env
, EXCP05_BOUND
, GETPC());