Coverage Report

Created: 2026-11-20 08:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qemu/target/i386/tcg/mem_helper.c
Line
Count
Source
1
/*
2
 *  x86 memory access helpers
3
 *
4
 *  Copyright (c) 2003 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
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
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.
15
 *
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/>.
18
 */
19
20
#include "qemu/osdep.h"
21
#include "cpu.h"
22
#include "exec/helper-proto.h"
23
#include "accel/tcg/cpu-ldst.h"
24
#include "qemu/int128.h"
25
#include "qemu/atomic128.h"
26
#include "tcg/tcg.h"
27
#include "helper-tcg.h"
28
29
void HELPER(boundw)(CPUX86State *env, target_ulong a0, int v)
30
0
{
31
0
    int low, high;
32
33
0
    low = cpu_ldsw_le_data_ra(env, a0, GETPC());
34
0
    high = cpu_ldsw_le_data_ra(env, a0 + 2, GETPC());
35
0
    v = (int16_t)v;
36
0
    if (v < low || v > high) {
37
0
        if (env->hflags & HF_MPX_EN_MASK) {
38
0
            env->bndcs_regs.sts = 0;
39
0
        }
40
0
        raise_exception_ra(env, EXCP05_BOUND, GETPC());
41
0
    }
42
0
}
43
44
void HELPER(boundl)(CPUX86State *env, target_ulong a0, int v)
45
0
{
46
0
    int low, high;
47
48
0
    low = cpu_ldl_le_data_ra(env, a0, GETPC());
49
0
    high = cpu_ldl_le_data_ra(env, a0 + 4, GETPC());
50
0
    if (v < low || v > high) {
51
0
        if (env->hflags & HF_MPX_EN_MASK) {
52
0
            env->bndcs_regs.sts = 0;
53
0
        }
54
0
        raise_exception_ra(env, EXCP05_BOUND, GETPC());
55
0
    }
56
0
}