X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgdbserver%2Flinux-low.c;h=7158a6798c91f42670a232343b252d5f835da999;hb=974c89e0882ddb03e294eca76a9e3d3bef90eacf;hp=6f703f589fe931c86c27bf750cf6ee144062befd;hpb=7ea79cb3affe1ae1d196f511ace044c015e0ccd3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 6f703f589f..7158a6798c 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -7423,6 +7423,53 @@ linux_get_pc_64bit (struct regcache *regcache) return pc; } +/* Fetch the entry MATCH from the auxv vector, where entries are length + WORDSIZE. If no entry was found, return zero. */ + +static CORE_ADDR +linux_get_auxv (int wordsize, CORE_ADDR match) +{ + gdb_byte *data = (gdb_byte *) alloca (2 * wordsize); + int offset = 0; + + gdb_assert (wordsize == 4 || wordsize == 8); + + while ((*the_target->read_auxv) (offset, data, 2 * wordsize) == 2 * wordsize) + { + if (wordsize == 4) + { + uint32_t *data_p = (uint32_t *)data; + if (data_p[0] == match) + return data_p[1]; + } + else + { + uint64_t *data_p = (uint64_t *)data; + if (data_p[0] == match) + return data_p[1]; + } + + offset += 2 * wordsize; + } + + return 0; +} + +/* See linux-low.h. */ + +CORE_ADDR +linux_get_hwcap (int wordsize) +{ + return linux_get_auxv (wordsize, AT_HWCAP); +} + +/* See linux-low.h. */ + +CORE_ADDR +linux_get_hwcap2 (int wordsize) +{ + return linux_get_auxv (wordsize, AT_HWCAP2); +} static struct target_ops linux_target_ops = { linux_create_inferior,