annotate libmpx/mpxrt/mpxrt.h @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* mpxrt.h -*-C++-*-
kono
parents:
diff changeset
2 *
kono
parents:
diff changeset
3 *************************************************************************
kono
parents:
diff changeset
4 *
kono
parents:
diff changeset
5 * @copyright
kono
parents:
diff changeset
6 * Copyright (C) 2015, Intel Corporation
kono
parents:
diff changeset
7 * All rights reserved.
kono
parents:
diff changeset
8 *
kono
parents:
diff changeset
9 * @copyright
kono
parents:
diff changeset
10 * Redistribution and use in source and binary forms, with or without
kono
parents:
diff changeset
11 * modification, are permitted provided that the following conditions
kono
parents:
diff changeset
12 * are met:
kono
parents:
diff changeset
13 *
kono
parents:
diff changeset
14 * * Redistributions of source code must retain the above copyright
kono
parents:
diff changeset
15 * notice, this list of conditions and the following disclaimer.
kono
parents:
diff changeset
16 * * Redistributions in binary form must reproduce the above copyright
kono
parents:
diff changeset
17 * notice, this list of conditions and the following disclaimer in
kono
parents:
diff changeset
18 * the documentation and/or other materials provided with the
kono
parents:
diff changeset
19 * distribution.
kono
parents:
diff changeset
20 * * Neither the name of Intel Corporation nor the names of its
kono
parents:
diff changeset
21 * contributors may be used to endorse or promote products derived
kono
parents:
diff changeset
22 * from this software without specific prior written permission.
kono
parents:
diff changeset
23 *
kono
parents:
diff changeset
24 * @copyright
kono
parents:
diff changeset
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
kono
parents:
diff changeset
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
kono
parents:
diff changeset
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
kono
parents:
diff changeset
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
kono
parents:
diff changeset
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
kono
parents:
diff changeset
30 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
kono
parents:
diff changeset
31 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
kono
parents:
diff changeset
32 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
kono
parents:
diff changeset
33 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
kono
parents:
diff changeset
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
kono
parents:
diff changeset
35 * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
kono
parents:
diff changeset
36 * POSSIBILITY OF SUCH DAMAGE.
kono
parents:
diff changeset
37 *
kono
parents:
diff changeset
38 **************************************************************************/
kono
parents:
diff changeset
39 #ifdef __i386__
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 /* i386 directory size is 4MB. */
kono
parents:
diff changeset
42 #define NUM_L1_BITS 20
kono
parents:
diff changeset
43 #define NUM_L2_BITS 10
kono
parents:
diff changeset
44 #define NUM_IGN_BITS 2
kono
parents:
diff changeset
45 #define MPX_L1_ADDR_MASK 0xfffff000UL
kono
parents:
diff changeset
46 #define MPX_L2_ADDR_MASK 0xfffffffcUL
kono
parents:
diff changeset
47 #define MPX_L2_VALID_MASK 0x00000001UL
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 #define REG_IP_IDX REG_EIP
kono
parents:
diff changeset
50 #define REX_PREFIX
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 #define XSAVE_OFFSET_IN_FPMEM sizeof (struct _libc_fpstate)
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 #else /* __i386__ */
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 /* x86_64 directory size is 2GB. */
kono
parents:
diff changeset
57 #define NUM_L1_BITS 28
kono
parents:
diff changeset
58 #define NUM_L2_BITS 17
kono
parents:
diff changeset
59 #define NUM_IGN_BITS 3
kono
parents:
diff changeset
60 #define MPX_L1_ADDR_MASK 0xfffffffffffff000ULL
kono
parents:
diff changeset
61 #define MPX_L2_ADDR_MASK 0xfffffffffffffff8ULL
kono
parents:
diff changeset
62 #define MPX_L2_VALID_MASK 0x0000000000000001ULL
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 #define REG_IP_IDX REG_RIP
kono
parents:
diff changeset
65 #define REX_PREFIX "0x48, "
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 #define XSAVE_OFFSET_IN_FPMEM 0
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 #endif /* !__i386__ */
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 #define MPX_L1_SIZE ((1UL << NUM_L1_BITS) * sizeof (void *))
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 /* Get address of bounds directory. */
kono
parents:
diff changeset
74 void *
kono
parents:
diff changeset
75 get_bd ();