From 9598d03e9c7f458edc0cc683cb412c58b71506e6 Mon Sep 17 00:00:00 2001 From: benno Date: Thu, 9 May 2002 14:15:51 +0000 Subject: Add an assertion that we have a current pmap set before we try and return. --- sys/powerpc/aim/trap_subr.S | 9 ++++++++- sys/powerpc/powerpc/trap_subr.S | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'sys/powerpc') 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 */ \ -- cgit v1.1