Changeset 0f250f9 in mainline for arch


Ignore:
Timestamp:
2006-03-17T18:07:56Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
69f293e
Parents:
6c6a19e6
Message:

Improved uspace threads.
ia64 needs fixing.

Location:
arch
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/src/userspace.c

    r6c6a19e6 r0f250f9  
    3131#include <arch/types.h>
    3232#include <arch.h>
    33 #include <proc/thread.h>
     33#include <proc/uarg.h>
    3434#include <mm/as.h>
    3535
     
    4040 *
    4141 */
    42 void userspace(uspace_arg_t *uarg)
     42void userspace(uspace_arg_t *kernel_uarg)
    4343{
    4444        ipl_t ipl;
     
    5252                          "pushq %3\n"
    5353                          "pushq %4\n"
     54                          "movq %5, %%rax\n"
    5455                          "iretq\n"
    5556                          : :
    5657                          "i" (gdtselector(UDATA_DES) | PL_USER),
    57                           "r" (uarg->uspace_stack+THREAD_STACK_SIZE),
     58                          "r" (kernel_uarg->uspace_stack+THREAD_STACK_SIZE),
    5859                          "r" (ipl),
    5960                          "i" (gdtselector(UTEXT_DES) | PL_USER),
    60                           "r" (uarg->uspace_entry));
     61                          "r" (kernel_uarg->uspace_entry),
     62                          "r" (kernel_uarg->uspace_uarg)
     63                          : "rax"
     64                          );
    6165       
    6266        /* Unreachable */
    63         for(;;);
     67        for(;;)
     68                ;
    6469}
  • arch/ia32/src/userspace.c

    r6c6a19e6 r0f250f9  
    3131#include <arch/types.h>
    3232#include <arch.h>
    33 #include <proc/thread.h>
     33#include <proc/uarg.h>
    3434#include <mm/as.h>
    3535
     
    4040 *
    4141 */
    42 void userspace(uspace_arg_t *uarg)
     42void userspace(uspace_arg_t *kernel_uarg)
    4343{
    4444        ipl_t ipl;
     
    4747
    4848        __asm__ volatile (
    49                 /* CLNT */
     49                /*
     50                 * Clear nested task flag.
     51                 */
    5052                "pushfl\n"
    5153                "pop %%eax\n"
    52                 "and $0xffffbfff,%%eax\n"
     54                "and $0xffffbfff, %%eax\n"
    5355                "push %%eax\n"
    5456                "popfl\n"
     
    5961                "pushl %3\n"
    6062                "pushl %4\n"
     63                "movl %5, %%eax\n"
    6164                "iret"
    6265                :
    63                 : "i" (selector(UDATA_DES) | PL_USER), "r" (uarg->uspace_stack+THREAD_STACK_SIZE),
    64                   "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "r" (uarg->uspace_entry)
     66                : "i" (selector(UDATA_DES) | PL_USER), "r" (kernel_uarg->uspace_stack+THREAD_STACK_SIZE),
     67                  "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "r" (kernel_uarg->uspace_entry),
     68                  "r" (kernel_uarg->uspace_uarg)
    6569                : "eax");
    6670       
  • arch/ia64/include/asm.h

    r6c6a19e6 r0f250f9  
    259259extern void asm_delay_loop(__u32 t);
    260260
    261 extern void switch_to_userspace(__address entry, __address sp, __address bsp, __u64 ipsr, __u64 rsc);
     261extern void switch_to_userspace(__address entry, __address sp, __address bsp, __address uspace_uarg, __u64 ipsr, __u64 rsc);
    262262
    263263#endif
  • arch/ia64/include/faddr.h

    r6c6a19e6 r0f250f9  
    3232#include <arch/types.h>
    3333
    34 static __address FADDR(void (* fptr)(void));
    35 
    3634/**
    3735 *
     
    4240 *
    4341 */
    44 inline __address FADDR(void (* fptr)(void)) {
     42static inline __address FADDR(void (* fptr)()) {
    4543        __address faddr;
    46 
    47         /*Deprecated assembler version*/
    48         /*     
    49         __asm__(
    50                 "ld8 %0 = [%1]\n\t"
    51                 : "=r" (faddr)
    52                 : "r" (fptr)
    53         );
    54         */
    5544
    5645        faddr = *((__address *)(fptr));;
  • arch/ia64/src/asm.S

    r6c6a19e6 r0f250f9  
    5555 * @param in1 Userspace stack pointer address.
    5656 * @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.
     57 * @param in3 Userspace address of thread uspace_arg_t structure.
     58 * @param in4 Value to be stored in IPSR.
     59 * @param in5 Value to be stored in RSC.
    5960 */
    6061.global switch_to_userspace
    6162switch_to_userspace:
    62         alloc loc0 = ar.pfs, 5, 3, 0, 0
     63        alloc loc0 = ar.pfs, 6, 3, 0, 0
    6364        rsm (PSR_IC_MASK | PSR_I_MASK)          /* disable interruption collection and interrupts */
    6465        srlz.d ;;
    6566        srlz.i ;;
    6667       
    67         mov cr.ipsr = in3
     68        mov cr.ipsr = in4
    6869        mov cr.iip = in0
    6970        mov r12 = in1
     
    8586       
    8687        mov ar.bspstore = in2 ;;
    87         mov ar.rsc = in4 ;;
     88        mov ar.rsc = in5 ;;
     89       
     90        mov r8 = in3
    8891       
    8992        rfi ;;
  • arch/ia64/src/ia64.c

    r6c6a19e6 r0f250f9  
    4242#include <userspace.h>
    4343#include <console/console.h>
    44 #include <proc/thread.h>
     44#include <proc/uarg.h>
    4545
    4646void arch_pre_mm_init(void)
     
    7474
    7575/** Enter userspace and never return. */
    76 void userspace(uspace_arg_t *uarg)
     76void userspace(uspace_arg_t *kernel_uarg)
    7777{
    7878        psr_t psr;
     
    9292        rsc.mode = 3;                           /* eager mode */
    9393
    94         switch_to_userspace(uarg->uspace_entry, uarg->uspace_stack+PAGE_SIZE-ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT), uarg->uspace_stack, psr.value, rsc.value);
     94        switch_to_userspace((__address) kernel_uarg->uspace_entry,
     95                            ((__address) kernel_uarg->uspace_stack)+PAGE_SIZE-ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT),
     96                            (__address) kernel_uarg->uspace_stack,
     97                            (__address) kernel_uarg->uspace_uarg,
     98                            psr.value, rsc.value);
    9599
    96100        while (1) {
  • arch/mips32/include/asm.h

    r6c6a19e6 r0f250f9  
    5858extern void cpu_halt(void);
    5959extern void asm_delay_loop(__u32 t);
    60 extern void userspace_asm(__address ustack);
     60extern void userspace_asm(__address ustack, __address uspace_uarg);
    6161
    6262#endif
  • arch/mips32/src/mips32.c

    r6c6a19e6 r0f250f9  
    3838#include <memstr.h>
    3939#include <proc/thread.h>
     40#include <proc/uarg.h>
    4041#include <print.h>
    4142
     
    121122__address supervisor_sp __attribute__ ((section (".text")));
    122123
    123 void userspace(uspace_arg_t *uarg)
     124void userspace(uspace_arg_t *kernel_uarg)
    124125{
    125126        /* EXL=1, UM=1, IE=1 */
     
    127128                                              cp0_status_um_bit |
    128129                                              cp0_status_ie_enabled_bit));
    129         cp0_epc_write(uarg->uspace_entry);
    130         userspace_asm(uarg->uspace_stack+PAGE_SIZE);
     130        cp0_epc_write((__address) kernel_uarg->uspace_entry);
     131        userspace_asm(((__address) kernel_uarg->uspace_stack+PAGE_SIZE), (__address) kernel_uarg->uspace_uarg);
    131132        while (1)
    132133                ;
  • arch/mips32/src/start.S

    r6c6a19e6 r0f250f9  
    227227userspace_asm:
    228228        add $sp, $a0, 0
    229         eret
    230         nop
    231 
     229        add $v0, $a1, 0
     230        eret
     231        nop
     232
Note: See TracChangeset for help on using the changeset viewer.