diff options
author | benno <benno@FreeBSD.org> | 2002-05-09 14:15:51 +0000 |
---|---|---|
committer | benno <benno@FreeBSD.org> | 2002-05-09 14:15:51 +0000 |
commit | 9598d03e9c7f458edc0cc683cb412c58b71506e6 (patch) | |
tree | 208fd62df04d349faa5df8c1f998de83d17cdbf0 /sys/powerpc | |
parent | 2365994ce7c55d1f6954d1d67169a5fd81b76805 (diff) | |
download | FreeBSD-src-9598d03e9c7f458edc0cc683cb412c58b71506e6.zip FreeBSD-src-9598d03e9c7f458edc0cc683cb412c58b71506e6.tar.gz |
Add an assertion that we have a current pmap set before we try and return.
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/trap_subr.S | 9 | ||||
-rw-r--r-- | sys/powerpc/powerpc/trap_subr.S | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/powerpc/aim/trap_subr.S b/sys/powerpc/aim/trap_subr.S index f348768..809f7ab 100644 --- a/sys/powerpc/aim/trap_subr.S +++ b/sys/powerpc/aim/trap_subr.S @@ -48,6 +48,8 @@ .align 4 astpending: .long 0 +cpassert: + .asciz "attempting to return from kernel with no current pmap" /* * Data used during primary/secondary traps/interrupts @@ -634,7 +636,12 @@ _C_LABEL(ipkdbsize) = .-_C_LABEL(ipkdblow) /* Restore user & kernel access SR: */ \ mfsprg 2,0; \ lwz 2,PC_CURPMAP(2); \ - lwz 3,PM_SR+0(2); \ + cmpwi cr4,2,0; /* is curpmap NULL? */ \ + bne cr4,2f; \ + lis 3,cpassert@ha; /* if it is, panic */ \ + addi 3,3,cpassert@l; \ + b panic; \ +2: lwz 3,PM_SR+0(2); \ mtsr 0,3; /* restore SR0 */ \ lwz 3,PM_SR+4(2); \ mtsr 1,3; /* restore SR1 */ \ diff --git a/sys/powerpc/powerpc/trap_subr.S b/sys/powerpc/powerpc/trap_subr.S index f348768..809f7ab 100644 --- a/sys/powerpc/powerpc/trap_subr.S +++ b/sys/powerpc/powerpc/trap_subr.S @@ -48,6 +48,8 @@ .align 4 astpending: .long 0 +cpassert: + .asciz "attempting to return from kernel with no current pmap" /* * Data used during primary/secondary traps/interrupts @@ -634,7 +636,12 @@ _C_LABEL(ipkdbsize) = .-_C_LABEL(ipkdblow) /* Restore user & kernel access SR: */ \ mfsprg 2,0; \ lwz 2,PC_CURPMAP(2); \ - lwz 3,PM_SR+0(2); \ + cmpwi cr4,2,0; /* is curpmap NULL? */ \ + bne cr4,2f; \ + lis 3,cpassert@ha; /* if it is, panic */ \ + addi 3,3,cpassert@l; \ + b panic; \ +2: lwz 3,PM_SR+0(2); \ mtsr 0,3; /* restore SR0 */ \ lwz 3,PM_SR+4(2); \ mtsr 1,3; /* restore SR1 */ \ |