Date: Sat, 14 May 2011 14:55:15 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r221894 - head/sys/ia64/ia64 Message-ID: <201105141455.p4EEtFIW006710@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sat May 14 14:55:15 2011 New Revision: 221894 URL: http://svn.freebsd.org/changeset/base/221894 Log: Prefer switching the memory stack from user to kernel *before* switching the register stack. While the ordering doesn't matter, it creates an invariant not previously there: the memory stack pointer will always be larger than the register stack pointer. With this invariant in place, it's easier to add instrumentation code that detects a stack overflow because in such a scenario the memory stack pointer and register stack pointers have crossed each other. Aside: basic kernel operation needs about half the stack size (~16K) at most. We have plenty of head room on the kernel stack... Modified: head/sys/ia64/ia64/syscall.S Modified: head/sys/ia64/ia64/syscall.S ============================================================================== --- head/sys/ia64/ia64/syscall.S Sat May 14 14:47:19 2011 (r221893) +++ head/sys/ia64/ia64/syscall.S Sat May 14 14:55:15 2011 (r221894) @@ -239,21 +239,22 @@ ENTRY_NOPROFILE(epc_syscall, 8) ;; } { .mmi - mov ar.bspstore=r15 + mov r13=ar.k4 add r30=-SIZEOF_TRAPFRAME,r14 mov r20=sp ;; } { .mii - mov r13=ar.k4 + mov r21=ar.unat dep r30=0,r30,0,10 ;; add sp=-16,r30 ;; } { .mmi + mov ar.bspstore=r15 + ;; mov ar.rnat=r19 - mov r21=ar.unat add r31=8,r30 ;; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105141455.p4EEtFIW006710>