Rev 1857 | Rev 1860 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1857 | Rev 1858 | ||
|---|---|---|---|
| Line 489... | Line 489... | ||
| 489 | 0: |
489 | 0: |
| 490 | rdpr %tstate, %g1 |
490 | rdpr %tstate, %g1 |
| 491 | andcc %g1, TSTATE_PRIV_BIT, %g0 ! if we are not returning to userspace..., |
491 | andcc %g1, TSTATE_PRIV_BIT, %g0 ! if we are not returning to userspace..., |
| 492 | bnz 1f ! ...skip restoring userspace windows |
492 | bnz 1f ! ...skip restoring userspace windows |
| 493 | nop |
493 | nop |
| - | 494 | ||
| - | 495 | /* |
|
| - | 496 | * Spills and fills will be processed by the {spill,fill}_1_normal |
|
| - | 497 | * handlers. |
|
| - | 498 | */ |
|
| - | 499 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate |
|
| 494 | 500 | ||
| 495 | rdpr %cwp, %g1 |
501 | rdpr %cwp, %g1 |
| 496 | rdpr %otherwin, %g2 |
502 | rdpr %otherwin, %g2 |
| 497 | 503 | ||
| 498 | /* |
504 | /* |
| Line 543... | Line 549... | ||
| 543 | * Switch back to the proper current window and adjust |
549 | * Switch back to the proper current window and adjust |
| 544 | * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN. |
550 | * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN. |
| 545 | */ |
551 | */ |
| 546 | wrpr %g1, 0, %cwp |
552 | wrpr %g1, 0, %cwp |
| 547 | add %g4, %g2, %g2 |
553 | add %g4, %g2, %g2 |
| 548 | mov NWINDOW - 2, %g1 |
554 | cmp %g2, NWINDOW - 2 |
| - | 555 | bg 2f ! fix the CANRESTORE=NWINDOW-1 anomaly |
|
| - | 556 | mov NWINDOW - 2, %g1 ! use dealy slot for both cases |
|
| 549 | sub %g1, %g2, %g1 |
557 | sub %g1, %g2, %g1 |
| 550 | 558 | ||
| 551 | wrpr %g0, 0, %otherwin |
559 | wrpr %g0, 0, %otherwin |
| 552 | wrpr %g1, 0, %cansave ! NWINDOW - 2 - CANRESTORE |
560 | wrpr %g1, 0, %cansave ! NWINDOW - 2 - CANRESTORE |
| 553 | wrpr %g2, 0, %canrestore ! OTHERWIN + windows in the buffer |
561 | wrpr %g2, 0, %canrestore ! OTHERWIN + windows in the buffer |
| 554 | wrpr %g2, 0, %cleanwin ! avoid information leak |
562 | wrpr %g2, 0, %cleanwin ! avoid information leak |
| 555 | 563 | ||
| - | 564 | 1: |
|
| - | 565 | restore |
|
| - | 566 | retry |
|
| - | 567 | ||
| 556 | /* |
568 | /* |
| 557 | * Spills and fills will be processed by the {spill,fill}_1_normal |
569 | * We got here in order to avoid inconsistency of the window state registers. |
| 558 | * handlers. |
570 | * If the: |
| - | 571 | * |
|
| - | 572 | * save %g6, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
|
| - | 573 | * |
|
| - | 574 | * instruction trapped and spilled a register window into the userspace |
|
| - | 575 | * window buffer, we have just restored NWINDOW - 1 register windows. |
|
| - | 576 | * However, CANRESTORE can be only NWINDOW - 2 at most. |
|
| - | 577 | * |
|
| - | 578 | * The solution is to manually switch to (CWP - 1) mod NWINDOW |
|
| - | 579 | * and set the window state registers so that: |
|
| - | 580 | * |
|
| - | 581 | * CANRESTORE = NWINDOW - 2 |
|
| - | 582 | * CLEANWIN = NWINDOW - 2 |
|
| - | 583 | * CANSAVE = 0 |
|
| - | 584 | * OTHERWIN = 0 |
|
| - | 585 | * |
|
| - | 586 | * The RESTORE isntruction is therfore to be skipped. |
|
| 559 | */ |
587 | */ |
| - | 588 | 2: |
|
| - | 589 | wrpr %g0, 0, %otherwin |
|
| - | 590 | wrpr %g0, 0, %cansave |
|
| 560 | wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate |
591 | wrpr %g1, 0, %canrestore |
| - | 592 | wrpr %g1, 0, %cleanwin |
|
| 561 | 593 | ||
| 562 | 1: |
594 | rdpr %cwp, %g1 |
| 563 | restore |
595 | dec %g1 |
| - | 596 | and %g1, NWINDOW - 1, %g1 |
|
| - | 597 | wrpr %g1, 0, %cwp ! CWP-- |
|
| - | 598 | ||
| 564 | retry |
599 | retry |