@@ -0,0 +1,75 @@
+/* mpxrt.h -*-C++-*-
+ *
+ *************************************************************************
+ *
+ * @copyright
+ * Copyright (C) 2014, 2015, Intel Corporation
+ * All rights reserved.
2015 only
+const uintptr_t MPX_L1_ADDR_MASK = 0xfffff000UL;
+const uintptr_t MPX_L2_ADDR_MASK = 0xfffffffcUL;
+const uintptr_t MPX_L2_VALID_MASK = 0x00000001UL;
Use defines
@@ -1,4 +1,5 @@
ALCLOCAL_AMFLAGS = -I .. -I ../config
+AM_CPPFLAGS = -I $(top_srcdir)
This is not reflected in ChangeLog
+/* The mpx_bt_entry struct represents a cell in bounds table.
+ *lb is the lower bound, *ub is the upper bound,
+ *p is the stored pointer. */
Bounds and pointer are in lb, ub, p, not in *lb, *ub, *p. Right?
+static inline void
+alloc_bt (void *ptr)
+{
+ __asm__ __volatile__ ("bndstx %%bnd0, (%0,%0)"::"r" (ptr):"%bnd0");
+}
This should be marked as bnd_legacy.
+/* move_bounds function copies N bytes from SRC to DST.
Really?
+ It also copies bounds for all pointers inside.
+ There are 3 parts of the algorithm:
+ 1) We copy everything till the end of the first bounds table SRC)
SRC is not a bounds table
+ 2) In loop we copy whole bound tables till the second-last one
+ 3) Data in the last bounds table is copied separately, after the loop.
+ If one of bound tables in SRC doesn't exist,
+ we skip it because there are no pointers.
+ Depending on the arrangement of SRC and DST we copy from the beginning
+ or from the end. */
+__attribute__ ((bnd_legacy)) static void *
+move_bounds (void *dst, const void *src, size_t n)
What is returned value for?
+void *
+__mpx_wrapper_memmove (void *dst, const void *src, size_t n)
+{
+ if (n == 0)
+ return dst;
+
+ __bnd_chk_ptr_bounds (dst, n);
+ __bnd_chk_ptr_bounds (src, n);
+
+ memmove (dst, src, n);
+ move_bounds (dst, src, n);
+ return dst;
}
You completely remove old algorithm which should be faster on small
sizes. __mpx_wrapper_memmove should become a dispatcher between old