Thu Dec 15 11:13:25 2011 UTC ()
Like intrleave_to_user:, intrleave_to_kernel: should also restore PID.
Moreover, disable transration.


(kiyohara)
diff -r1.20 -r1.21 src/sys/arch/powerpc/ibm4xx/trap_subr.S

cvs diff -r1.20 -r1.21 src/sys/arch/powerpc/ibm4xx/trap_subr.S (expand / switch to unified diff)

--- src/sys/arch/powerpc/ibm4xx/trap_subr.S 2011/12/15 11:01:45 1.20
+++ src/sys/arch/powerpc/ibm4xx/trap_subr.S 2011/12/15 11:13:25 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: trap_subr.S,v 1.20 2011/12/15 11:01:45 kiyohara Exp $ */ 1/* $NetBSD: trap_subr.S,v 1.21 2011/12/15 11:13:25 kiyohara Exp $ */
2 2
3/* 3/*
4 * Copyright 2001 Wasabi Systems, Inc. 4 * Copyright 2001 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. 7 * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -348,30 +348,43 @@ _C_LABEL(trapexit): @@ -348,30 +348,43 @@ _C_LABEL(trapexit):
348 lwz %r4,L_MD_ASTPENDING(%r13) 348 lwz %r4,L_MD_ASTPENDING(%r13)
349 andi. %r4,%r4,1 349 andi. %r4,%r4,1
350 beq trapleave_to_user 350 beq trapleave_to_user
351 351
352 li %r6,EXC_AST 352 li %r6,EXC_AST
353 stw %r6,FRAME_EXC(%r1) 353 stw %r6,FRAME_EXC(%r1)
354 b trapagain 354 b trapagain
355 355
356trapleave_to_kernel: 356trapleave_to_kernel:
357 lmw %r14, FRAME_R14(%r1) /* restore callee registers */ 357 lmw %r14, FRAME_R14(%r1) /* restore callee registers */
358 358
359intrleave_to_kernel: 359intrleave_to_kernel:
360 FRAME_RESTORE /* old SP is now in sprg1 */ 360 FRAME_RESTORE /* old SP is now in sprg1 */
 361
 362 mtsprg2 %r30
 363 mtsprg3 %r31
 364 mfmsr %r30
 365 li %r31,(PSL_DR|PSL_IR)@l
 366 andc %r30,%r30,%r31
 367 lwz %r31,FRAME_PID(%r1)
 368 TRAP_IF_ZERO(%r31)
361 /* 369 /*
362 * Now that we are done with the trapframe, we can load the original SP 370 * Now that we are done with the trapframe, we can load the original SP
363 */ 371 */
364 mfsprg1 %r1 372 mfsprg1 %r1
 373 mtmsr %r30 /* disable translation */
 374 isync
 375 mtpid %r31
 376 mfsprg3 %r31
 377 mfsprg2 %r30
365 rfi 378 rfi
366 ba . /* Protect against prefetch */ 379 ba . /* Protect against prefetch */
367 380
368trapleave_to_user: 381trapleave_to_user:
369 lmw %r14, FRAME_R14(%r1) /* restore callee registers */ 382 lmw %r14, FRAME_R14(%r1) /* restore callee registers */
370 383
371intrleave_to_user: 384intrleave_to_user:
372/* Now restore regs: */ 385/* Now restore regs: */
373 lwz %r3,FRAME_PID(%r1) 386 lwz %r3,FRAME_PID(%r1)
374 lwz %r4,FRAME_SRR1(%r1) 387 lwz %r4,FRAME_SRR1(%r1)
375 bl _C_LABEL(ctx_setup) 388 bl _C_LABEL(ctx_setup)
376 TRAP_IF_ZERO(%r3) 389 TRAP_IF_ZERO(%r3)
377 stw %r3,FRAME_PID(%r1) 390 stw %r3,FRAME_PID(%r1)