Changeset ed166f7 in mainline for kernel/arch/sparc64/src/asm.S


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/src/asm.S

    re0b241f red166f7  
    2929#include <arch/stack.h>
    3030#include <arch/regdef.h>
     31#include <arch/mm/mmu.h>
    3132
    3233.text
     
    144145read_from_ag_g7:
    145146        READ_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT
     147
     148
     149/** Switch to userspace.
     150 *
     151 * %o0  Userspace entry address.
     152 * %o1  Userspace stack pointer address.
     153 */
     154.global switch_to_userspace
     155switch_to_userspace:
     156        flushw
     157        wrpr %g0, 0, %cleanwin          ! avoid information leak
     158        save %o1, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
     159
     160        clr %i2
     161        clr %i3
     162        clr %i4
     163        clr %i5
     164        clr %i6
     165
     166        wrpr %g0, 1, %tl                ! enforce mapping via nucleus
     167
     168        rdpr %cwp, %g1
     169        wrpr %g1, TSTATE_IE_BIT, %tstate
     170        wrpr %i0, 0, %tnpc
     171       
     172        /*
     173         * Set primary context according to secondary context.
     174         * Secondary context has been already installed by
     175         * higher-level functions.
     176         */
     177        wr %g0, ASI_DMMU, %asi
     178        ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
     179        stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
     180        flush %i7
     181       
     182        done                            ! jump to userspace
Note: See TracChangeset for help on using the changeset viewer.