diff options
author | marcel <marcel@FreeBSD.org> | 2011-05-14 14:55:15 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2011-05-14 14:55:15 +0000 |
commit | 8f1059ecb57c351a33f35dc535a32037e62755fa (patch) | |
tree | c62b1a26637e90e3ee6cb496cb96cfe194a43d18 /sys/ia64 | |
parent | dce7f9162949af4d10251f74426f436b34356d90 (diff) | |
download | FreeBSD-src-8f1059ecb57c351a33f35dc535a32037e62755fa.zip FreeBSD-src-8f1059ecb57c351a33f35dc535a32037e62755fa.tar.gz |
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...
Diffstat (limited to 'sys/ia64')
-rw-r--r-- | sys/ia64/ia64/syscall.S | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/ia64/ia64/syscall.S b/sys/ia64/ia64/syscall.S index b35523a..ef559e8 100644 --- a/sys/ia64/ia64/syscall.S +++ b/sys/ia64/ia64/syscall.S @@ -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 ;; } |