From: Richard Henderson <rth@redhat.com>
To: gdb-patches@gcc.gnu.org
Subject: [PATCH 3/3] Segment support for x86_64, part 1
Date: Tue, 03 Nov 2015 13:44:00 -0000 [thread overview]
Message-ID: <1446558190-13482-4-git-send-email-rth@redhat.com> (raw)
In-Reply-To: <1446558190-13482-1-git-send-email-rth@redhat.com>
* amd64-tdep.c (amd64_address_class_type_flags): New.
(amd64_address_class_type_flags_to_name): New.
(amd64_address_class_name_to_type_flags): New.
(amd64_init_abi): Register them.
---
gdb/amd64-tdep.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 6867a06..3f12796 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2890,7 +2890,55 @@ const struct regset amd64_fpregset =
NULL, amd64_supply_fpregset, amd64_collect_fpregset
};
\f
+/* Address classes. */
+static int
+amd64_address_class_type_flags (int byte_size, int dwarf2_addr_class)
+{
+ switch (dwarf2_addr_class)
+ {
+ case 1: /* __seg_fs */
+ return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
+ case 2: /* __seg_gs */
+ return TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2;
+ default:
+ return 0;
+ }
+}
+
+static const char *
+amd64_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
+{
+ if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
+ return "__seg_fs";
+ if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
+ return "__seg_gs";
+ return NULL;
+}
+
+static int
+amd64_address_class_name_to_type_flags (struct gdbarch *gdbarch,
+ const char *name,
+ int *type_flags_ptr)
+{
+ if (strcmp (name, "__seg_fs") == 0)
+ {
+ *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1;
+ return 1;
+ }
+ if (strcmp (name, "__seg_gs") == 0)
+ {
+ *type_flags_ptr = TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2;
+ return 1;
+ }
+ return 0;
+}
+
+/* ??? We ought to fill in address_to_pointer and pointer_to_address,
+ except that these hooks do not have access to the thread, or a
+ regcache for the thread. */
+
+\f
/* Figure out where the longjmp will land. Slurp the jmp_buf out of
%rdi. We expect its value to be a pointer to the jmp_buf structure
from which we extract the address that we will land at. This
@@ -3093,6 +3141,14 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_insn_is_call (gdbarch, amd64_insn_is_call);
set_gdbarch_insn_is_ret (gdbarch, amd64_insn_is_ret);
set_gdbarch_insn_is_jump (gdbarch, amd64_insn_is_jump);
+
+ /* Address handling. */
+ set_gdbarch_address_class_type_flags
+ (gdbarch, amd64_address_class_type_flags);
+ set_gdbarch_address_class_type_flags_to_name
+ (gdbarch, amd64_address_class_type_flags_to_name);
+ set_gdbarch_address_class_name_to_type_flags
+ (gdbarch, amd64_address_class_name_to_type_flags);
}
\f
--
2.4.3
next prev parent reply other threads:[~2015-11-03 13:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 13:43 [PATCH 0/3] Support for x86 segments as address classes Richard Henderson
2015-11-03 13:43 ` [PATCH 2/3] Use register cache for x86_64 ps_get_thread_area Richard Henderson
2015-11-03 13:44 ` [PATCH 1/3] Add amd64 registers fs_base and gs_base Richard Henderson
2015-11-03 13:44 ` Richard Henderson [this message]
2015-11-05 11:21 ` [PATCH 0/3] Support for x86 segments as address classes Pedro Alves
2015-11-05 14:15 ` Richard Henderson
2015-11-18 18:18 ` Ulrich Weigand
2015-11-05 14:18 ` [PATCH 4/3] Segment support for x86_64, part 2 Richard Henderson
2015-11-27 14:34 ` [PATCH 0/3] Support for x86 segments as address classes Gary Benson
2016-04-19 14:23 ` Tedeschi, Walfred
2016-04-19 14:44 ` Richard Henderson
2016-04-19 14:47 ` Walfred Tedeschi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446558190-13482-4-git-send-email-rth@redhat.com \
--to=rth@redhat.com \
--cc=gdb-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox