Ignore:
Timestamp:
2006-08-31T18:53:14Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6767c1d
Parents:
e0b241f
Message:

A lot of untested sparc64 stuff:

  • Write ASID to hardware when a thread is about to run in userspace.
  • Add userspace() and switch_to_userspace() functions.
  • Handle special cases when the userspace spill/fill handler causes MMU trap.
  • Resolve some TODOs in the existing sparc64 code.
  • sparc64 has now C99 compliant header guards.
  • Formatting and indentation fixes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/trap/mmu.h

    re0b241f red166f7  
    4343#include <arch/mm/mmu.h>
    4444#include <arch/mm/tte.h>
     45#include <arch/trap/regwin.h>
    4546
    4647#define TT_FAST_INSTRUCTION_ACCESS_MMU_MISS     0x64
     
    5152
    5253#ifdef __ASM__
     54
    5355.macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
    54         /*
    55          * First, try to refill TLB from TSB.
    56          */
     56        !
     57        ! First, try to refill TLB from TSB.
     58        !
    5759        ! TODO
    5860
     
    7577         * Note that branch-delay slots are used in order to save space.
    7678         */
    77 0:
     79
    7880        mov VA_DMMU_TAG_ACCESS, %g1
    7981        ldxa [%g1] ASI_DMMU, %g1                        ! read the faulting Context and VPN
     
    8587
    8688        or %g3, (TTE_CP|TTE_P|TTE_W), %g2               ! 8K pages are the default (encoded as 0)
    87         set 1, %g3
    88         sllx %g3, TTE_V_SHIFT, %g3
    89         or %g2, %g3, %g2
     89        mov 1, %g3
     90        sllx %g3, TTE_V_SHIFT, %g3
     91        or %g2, %g3, %g2
    9092        stxa %g2, [%g0] ASI_DTLB_DATA_IN_REG            ! identity map the kernel page
    9193        retry
     
    9395        /*
    9496         * Third, catch and handle special cases when the trap is caused by
    95          * some register window trap handler.
     97         * the userspace register window spill or fill handler. In case
     98         * one of these two traps caused this trap, we just lower the trap
     99         * level and service the DTLB miss. In the end, we restart
     100         * the offending SAVE or RESTORE.
    96101         */
    971020:
    98         ! TODO
     103        HANDLE_MMU_TRAPS_FROM_SPILL_OR_FILL
    99104
    100 0:
    101105        wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate
    102106        PREEMPTIBLE_HANDLER fast_data_access_mmu_miss
     
    104108
    105109.macro FAST_DATA_ACCESS_PROTECTION_HANDLER
     110        /*
     111         * First, try to refill TLB from TSB.
     112         */
     113        ! TODO
     114
     115        /*
     116         * The same special case as in FAST_DATA_ACCESS_MMU_MISS_HANDLER.
     117         */
     118        HANDLE_MMU_TRAPS_FROM_SPILL_OR_FILL
     119
    106120        wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate
    107121        PREEMPTIBLE_HANDLER fast_data_access_protection
    108122.endm
     123
     124/*
     125 * Macro used to lower TL when a MMU trap is caused by
     126 * the userspace register window spill or fill handler.
     127 */
     128.macro HANDLE_MMU_TRAPS_FROM_SPILL_OR_FILL
     129        rdpr %tl, %g1
     130        dec %g1
     131        brz %g1, 0f                     ! if TL was 1, skip
     132        nop
     133        wrpr %g1, 0, %tl                ! TL--
     134        rdpr %tt, %g2
     135        cmp %g2, TT_SPILL_1_NORMAL
     136        be 0f                           ! trap from spill_1_normal
     137        cmp %g2, TT_FILL_1_NORMAL
     138        be 0f                           ! trap from fill_1_normal
     139        inc %g1
     140        wrpr %g1, 0, %tl                ! another trap, TL++
     1410:
     142.endm
     143
    109144#endif /* __ASM__ */
    110145
Note: See TracChangeset for help on using the changeset viewer.