Changeset b994a60 in mainline for arch/ia64/src


Ignore:
Timestamp:
2006-03-09T12:44:27Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
901122b
Parents:
cd373bb
Message:

ia64 work.
Changes to make userspace work (kernel part).
Use ski.conf from contrib directory to run Ski.

There is actually no appropriate syscall handler yet.

Location:
arch/ia64/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • arch/ia64/src/asm.S

    rcd373bb rb994a60  
    2727#
    2828
     29#include <arch/register.h>
     30
    2931.text
    3032
     
    4749        }
    4850        br halt
     51
     52/** Switch to userspace - low level code.
     53 *
     54 * @param in0 Userspace entry point address.
     55 * @param in1 Userspace stack pointer address.
     56 * @param in2 Userspace register stack pointer address.
     57 * @param in3 Value to be stored in IPSR.
     58 * @param in4 Value to be stored in RSC.
     59 */
     60.global switch_to_userspace
     61switch_to_userspace:
     62        alloc loc0 = ar.pfs, 5, 3, 0, 0
     63        rsm (PSR_IC_MASK | PSR_I_MASK)          /* disable interruption collection  and interrupts */
     64        srlz.d ;;
     65        srlz.i ;;
     66       
     67        mov cr.ipsr = in3
     68        mov cr.iip = in0
     69        mov r12 = in1
     70
     71        xor r1 = r1, r1
     72       
     73        mov loc1 = cr.ifs
     74        movl loc2 = PFM_MASK ;;
     75        and loc1 = loc2, loc1 ;;
     76        mov cr.ifs = loc1 ;;                    /* prevent decrementing BSP by rfi */
     77
     78        invala
     79       
     80        mov loc1 = ar.rsc ;;
     81        and loc1 = ~3, loc1 ;;                 
     82        mov ar.rsc = loc1 ;;                    /* put RSE into enforced lazy mode */
     83
     84        flushrs ;;
     85       
     86        mov ar.bspstore = in2 ;;
     87        mov ar.rsc = in4 ;;
     88       
     89        rfi ;;
  • arch/ia64/src/dummy.s

    rcd373bb rb994a60  
    3131.global calibrate_delay_loop
    3232.global asm_delay_loop
    33 .global userspace
    3433.global cpu_sleep
    3534.global dummy
     
    3837.global fpu_init
    3938
    40 userspace:
    4139calibrate_delay_loop:
    4240asm_delay_loop:
  • arch/ia64/src/ia64.c

    rcd373bb rb994a60  
    3232#include <arch/interrupt.h>
    3333#include <arch/barrier.h>
     34#include <arch/asm.h>
     35#include <arch/register.h>
    3436#include <arch/types.h>
    35 
     37#include <arch/context.h>
     38#include <arch/mm/page.h>
     39#include <mm/as.h>
     40#include <config.h>
     41#include <userspace.h>
    3642#include <console/console.h>
    3743
     
    4450        ski_init_console();
    4551        it_init();
     52        config.init_addr = INIT_ADDRESS;
     53        config.init_size = INIT_SIZE;
    4654}
    4755
     
    5462}
    5563
    56 
    5764void arch_post_smp_init(void)
    5865{
    5966}
     67
     68/** Enter userspace and never return. */
     69void userspace(void)
     70{
     71        psr_t psr;
     72        rsc_t rsc;
     73
     74        psr.value = psr_read();
     75        psr.cpl = PL_USER;
     76        psr.i = true;                           /* start with interrupts enabled */
     77        psr.ic = true;
     78        psr.ri = 0;                             /* start with instruction #0 */
     79
     80        __asm__ volatile ("mov %0 = ar.rsc\n" : "=r" (rsc.value));
     81        rsc.loadrs = 0;
     82        rsc.be = false;
     83        rsc.pl = PL_USER;
     84        rsc.mode = 3;                           /* eager mode */
     85
     86        switch_to_userspace(UTEXT_ADDRESS, USTACK_ADDRESS+PAGE_SIZE-1, USTACK_ADDRESS, psr.value, rsc.value);
     87
     88        while (1) {
     89                ;
     90        }
     91}
  • arch/ia64/src/ivt.S

    rcd373bb rb994a60  
    137137        st8 [r31] = r26, -8             /* save ar.ifs */
    138138       
    139         and r30 = ~3, r24 ;;
    140         mov ar.rsc = r30 ;;             /* place RSE in enforced lazy mode */
     139        and r24 = ~(RSC_PL_MASK), r24 ;;
     140        and r30 = ~(RSC_MODE_MASK), r24 ;;
     141        mov ar.rsc = r30 ;;             /* update RSE state */
    141142       
    142143        mov r27 = ar.rnat
     
    163164        st8 [r31] = r29, -8             /* save ar.bsp */
    164165       
    165         mov ar.rsc = r24                /* restore RSE's setting */
     166        mov ar.rsc = r24                /* restore RSE's setting + kernel privileges */
    166167       
    167168    /* steps 6 - 15 are done by heavyweight_handler_inner() */
     
    301302
    302303    /* 10. call handler */
     304        movl r1 = _hardcoded_load_address
     305   
    303306        mov b1 = loc2
    304307        br.call.sptk.many b0 = b1
  • arch/ia64/src/mm/tlb.c

    rcd373bb rb994a60  
    6464 * @param entry The rest of TLB entry as required by TLB insertion format.
    6565 */
    66 void dtc_mapping_insert(__address va, asid_t asid, tlb_entry_t entry) {
     66void dtc_mapping_insert(__address va, asid_t asid, tlb_entry_t entry)
     67{
    6768        tc_mapping_insert(va, asid, entry, true);
    6869}
     
    7475 * @param entry The rest of TLB entry as required by TLB insertion format.
    7576 */
    76 void itc_mapping_insert(__address va, asid_t asid, tlb_entry_t entry) {
     77void itc_mapping_insert(__address va, asid_t asid, tlb_entry_t entry)
     78{
    7779        tc_mapping_insert(va, asid, entry, false);
    7880}
     
    336338                }
    337339        }
    338        
     340
    339341        t = page_mapping_find(AS, va);
    340342        if (t) {
  • arch/ia64/src/start.S

    rcd373bb rb994a60  
    125125
    126126        # initialize gp (Global Pointer) register
    127         movl r1 = _hardcoded_load_address       ;;
     127        movl r1 = _hardcoded_load_address
    128128
    129129        /*
     
    132132        movl r14 = _hardcoded_ktext_size
    133133        movl r15 = _hardcoded_kdata_size
    134         movl r16 = _hardcoded_load_address
     134        movl r16 = _hardcoded_load_address ;;
    135135        addl r17 = @gprel(hardcoded_ktext_size), gp
    136136        addl r18 = @gprel(hardcoded_kdata_size), gp
Note: See TracChangeset for help on using the changeset viewer.