+/* Return target_desc to use for IPA, given the tdesc index passed by
+ gdbserver. */
+
+const struct target_desc *
+get_ipa_tdesc (int idx)
+{
+ switch (idx)
+ {
+ case X86_TDESC_MMX:
+ return tdesc_i386_mmx_linux;
+ case X86_TDESC_SSE:
+ return tdesc_i386_linux;
+ case X86_TDESC_AVX:
+ return tdesc_i386_avx_linux;
+ case X86_TDESC_MPX:
+ return tdesc_i386_mpx_linux;
+ case X86_TDESC_AVX_MPX:
+ return tdesc_i386_avx_mpx_linux;
+ case X86_TDESC_AVX512:
+ return tdesc_i386_avx512_linux;
+ default:
+ internal_error (__FILE__, __LINE__,
+ "unknown ipa tdesc index: %d", idx);
+ return tdesc_i386_linux;
+ }
+}
+
+/* Allocate buffer for the jump pads. On i386, we can reach an arbitrary
+ address with a jump instruction, so just allocate normally. */
+
+void *
+alloc_jump_pad_buffer (size_t size)
+{
+ void *res = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+
+ if (res == MAP_FAILED)
+ return NULL;
+
+ return res;
+}
+