Changeset ee454eb in mainline for kernel/arch/sparc64/src/trap/trap_table.S
- Timestamp:
- 2006-08-30T15:50:29Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- beb3926a
- Parents:
- e11ae91
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/trap/trap_table.S
re11ae91 ree454eb 41 41 #include <arch/trap/exception.h> 42 42 #include <arch/trap/mmu.h> 43 #include <arch/mm/page.h> 43 44 #include <arch/stack.h> 44 45 #include <arch/regdef.h> … … 330 331 331 332 /* 333 * Normal window spills will go to the userspace window buffer. 334 */ 335 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate 336 337 /* 332 338 * Switch to kernel stack. The old stack is 333 339 * automatically saved in the old window's %sp … … 364 370 */ 365 371 1: 366 372 373 /* 374 * Other window spills will go to the userspace window buffer 375 * and normal spills will go to the kernel stack. 376 */ 377 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(0), %wstate 378 367 379 /* 368 380 * Copy arguments. … … 450 462 */ 451 463 flushw 452 mov %sp, %g 1464 mov %sp, %g2 453 465 stx %i0, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0] 454 466 stx %i1, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1] … … 460 472 stx %i7, [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I7] 461 473 wrpr %l0, 0, %cwp 462 mov %g 1, %sp474 mov %g2, %sp 463 475 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I0], %i0 464 476 ldx [%sp + PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE + STACK_BIAS + SAVED_I1], %i1 … … 472 484 /* 473 485 * OTHERWIN != 0 or fall-through from the OTHERWIN == 0 case. 486 * The CWP has already been restored to the value it had prior to the SAVE 487 * at the beginning of this function. 474 488 */ 475 489 0: 476 ! TODO: restore register windows from register window memory buffer 477 490 rdpr %tstate, %g1 491 andcc %g1, TSTATE_PRIV_BIT, %g0 ! if we are not returning to userspace..., 492 bnz 1f ! ...skip restoring userspace windows 493 nop 494 495 rdpr %cwp, %g1 496 rdpr %otherwin, %g2 497 498 /* 499 * Skip all OTHERWIN windows and descend to the first window 500 * in the userspace window buffer. 501 */ 502 sub %g1, %g2, %g3 503 dec %g3 504 and %g3, NWINDOW - 1, %g3 505 wrpr %g3, 0, %cwp 506 507 /* 508 * CWP is now in the window last saved in the userspace window buffer. 509 * Fill all windows stored in the buffer. 510 */ 511 clr %g4 512 0: andcc %g7, PAGE_WIDTH - 1, %g0 ! PAGE_SIZE alignment check 513 bz 0f ! %g7 is page-aligned, no more windows to refill 514 nop 515 516 add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7 517 ldx [%g7 + L0_OFFSET], %l0 518 ldx [%g7 + L1_OFFSET], %l1 519 ldx [%g7 + L2_OFFSET], %l2 520 ldx [%g7 + L3_OFFSET], %l3 521 ldx [%g7 + L4_OFFSET], %l4 522 ldx [%g7 + L5_OFFSET], %l5 523 ldx [%g7 + L6_OFFSET], %l6 524 ldx [%g7 + L7_OFFSET], %l7 525 ldx [%g7 + I0_OFFSET], %i0 526 ldx [%g7 + I1_OFFSET], %i1 527 ldx [%g7 + I2_OFFSET], %i2 528 ldx [%g7 + I3_OFFSET], %i3 529 ldx [%g7 + I4_OFFSET], %i4 530 ldx [%g7 + I5_OFFSET], %i5 531 ldx [%g7 + I6_OFFSET], %i6 532 ldx [%g7 + I7_OFFSET], %i7 533 534 dec %g3 535 and %g3, NWINDOW - 1, %g3 536 wrpr %g3, 0, %cwp ! switch to the preceeding window 537 538 ba 0b 539 inc %g4 540 541 0: 542 /* 543 * Switch back to the proper current window and adjust 544 * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN. 545 */ 546 wrpr %g1, 0, %cwp 547 add %g4, %g2, %g2 548 mov NWINDOW - 2, %g1 549 sub %g1, %g2, %g1 550 551 wrpr %g0, 0, %otherwin 552 wrpr %g1, 0, %cansave ! NWINDOW - 2 - CANRESTORE 553 wrpr %g2, 0, %canrestore ! OTHERWIN + windows in the buffer 554 wrpr %g2, 0, %cleanwin ! avoid information leak 555 556 /* 557 * Spills and fills will be processed by the {spill,fill}_1_normal 558 * handlers. 559 */ 560 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate 561 562 1: 478 563 restore 479 564 retry
Note:
See TracChangeset
for help on using the changeset viewer.