1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

Two fixups for dtrace

* Use the right incantation to get the next stack pointer.  Since powerpc uses
  special frames for traps, dereferencing the stack pointer straight up won't
  get us the next stack pointer in every case.
* Clear EE using the correct instruction sequence.  The PowerISA states that
  'andi.' ANDs the register with 0||<imm>, instead of sign extending or filling
  out the unavailable bits with 1.  Even if it did sign extend, PSL_EE is
  0x8000, so ~PSL_EE is 0x7fff, and the upper bits would be cleared.  Use rlwinm
  in the 32-bit case, and a two-rotate sequence in the 64-bit case, the latter
  chosen to follow the output generated by gcc.

MFC after:	1 week
This commit is contained in:
Justin Hibbits 2016-08-06 15:06:19 +00:00
parent b585cd3e2c
commit 161c415133
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303796
2 changed files with 8 additions and 2 deletions

View File

@ -67,7 +67,13 @@ dtrace_icookie_t dtrace_interrupt_disable(void)
*/
ASENTRY_NOPROF(dtrace_interrupt_disable)
mfmsr %r3
andi. %r0,%r3,~PSL_EE@l
#ifdef __powerpc64__
/* Two-instruction sequence to clear EE flag */
rldicl %r0,%r3,48,1
rotldi %r0,%r0,16
#else
rlwinm %r0,%r3,0,~PSL_EE /* Clear EE flag */
#endif
mtmsr %r0
blr
END(dtrace_interrupt_disable)

View File

@ -545,7 +545,7 @@ dtrace_getstackdepth(int aframes)
else
aframes--;
osp = sp;
sp = *(uintptr_t *)sp;
sp = dtrace_next_sp(sp);
}
if (depth < aframes)
return (0);