It is not nice to fake things we don't have; instead check explicitly

that we can get CS.
This commit is contained in:
christos 2014-04-16 02:14:44 +00:00
parent acaa1e700b
commit 035ceafe9d
2 changed files with 9 additions and 7 deletions

View File

@ -120,8 +120,6 @@ amd64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
regcache_raw_supply (regcache, AMD64_RBP_REGNUM, &pcb->pcb_rbp);
regcache_raw_supply (regcache, AMD64_FS_REGNUM, &pcb->pcb_fs);
regcache_raw_supply (regcache, AMD64_GS_REGNUM, &pcb->pcb_gs);
/* fake it to 0 so SEL_UPL is not set (our sniffer looks at CS) */
regcache_raw_supply (regcache, AMD64_CS_REGNUM, &zero);
return 1;
}

View File

@ -230,12 +230,16 @@ amd64nbsd_trapframe_sniffer (const struct frame_unwind *self,
{
ULONGEST cs;
const char *name;
volatile struct gdb_exception ex;
/* Check Current Privilege Level and bail out if we're not executing
in kernel space. */
cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
return 0;
TRY_CATCH (ex, RETURN_MASK_ERROR)
{
cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
return 0;
}
if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
throw_exception (ex);
find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
return (name && ((strcmp (name, "alltraps") == 0)