Changeset 9f52563 in mainline for arch


Ignore:
Timestamp:
2006-03-17T01:34:36Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8a0b0669
Parents:
5fceec7
Message:

Support for user space threads.

Location:
arch
Files:
5 edited

Legend:

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

    r5fceec7 r9f52563  
    4040 *
    4141 */
    42 void userspace(__address entry)
     42void userspace(uspace_arg_t *uarg)
    4343{
    4444        ipl_t ipl;
     
    4747
    4848        __asm__ volatile (""
    49                           "movq %0, %%rax;"                   
    50                           "movq %1, %%rbx;"
    51                           "movq %2, %%rcx;"
    52                           "movq %3, %%rdx;"
    53                           "movq %4, %%rsi;"
    54                           "pushq %%rax;"
    55                           "pushq %%rbx;"
    56                           "pushq %%rcx;"
    57                           "pushq %%rdx;"
    58                           "pushq %%rsi;"
    59                           "iretq;"
    60                           : : "i" (gdtselector(UDATA_DES) | PL_USER),
    61                           "i" (USTACK_ADDRESS+THREAD_STACK_SIZE),
     49                          "pushq %0\n"
     50                          "pushq %1\n"
     51                          "pushq %2\n"
     52                          "pushq %3\n"
     53                          "pushq %4\n"
     54                          "iretq\n"
     55                          : :
     56                          "i" (gdtselector(UDATA_DES) | PL_USER),
     57                          "r" (uarg->uspace_stack+THREAD_STACK_SIZE),
    6258                          "r" (ipl),
    6359                          "i" (gdtselector(UTEXT_DES) | PL_USER),
    64                           "r" (entry));
     60                          "r" (uarg->uspace_entry));
    6561       
    6662        /* Unreachable */
  • arch/ia32/include/fpu_context.h

    r5fceec7 r9f52563  
    4040
    4141struct fpu_context {
    42         /* TODO: We need malloc that aligns structures on 16-byte boundary */
    4342        __u8 fpu[512];          /* FXSAVE & FXRSTOR storage area */
    4443};
  • arch/ia32/src/userspace.c

    r5fceec7 r9f52563  
    4040 *
    4141 */
    42 void userspace(__address entry)
     42void userspace(uspace_arg_t *uarg)
    4343{
    4444        ipl_t ipl;
     
    6161                "iret"
    6262                :
    63                 : "i" (selector(UDATA_DES) | PL_USER), "r" (USTACK_ADDRESS+(THREAD_STACK_SIZE)), "r" (ipl), "i" (selector(UTEXT_DES) | PL_USER), "r" (entry)
     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)
    6465                : "eax");
    6566       
  • arch/ia64/src/ia64.c

    r5fceec7 r9f52563  
    4242#include <userspace.h>
    4343#include <console/console.h>
     44#include <proc/thread.h>
    4445
    4546void arch_pre_mm_init(void)
     
    7374
    7475/** Enter userspace and never return. */
    75 void userspace(__address entry)
     76void userspace(uspace_arg_t *uarg)
    7677{
    7778        psr_t psr;
     
    9192        rsc.mode = 3;                           /* eager mode */
    9293
    93         switch_to_userspace(entry, USTACK_ADDRESS+PAGE_SIZE-ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT), USTACK_ADDRESS, psr.value, rsc.value);
     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);
    9495
    9596        while (1) {
  • arch/mips32/src/mips32.c

    r5fceec7 r9f52563  
    121121__address supervisor_sp __attribute__ ((section (".text")));
    122122
    123 void userspace(__address entry)
     123void userspace(uspace_arg_t *uarg)
    124124{
    125125        /* EXL=1, UM=1, IE=1 */
     
    127127                                              cp0_status_um_bit |
    128128                                              cp0_status_ie_enabled_bit));
    129         cp0_epc_write(entry);
    130         userspace_asm(USTACK_ADDRESS+PAGE_SIZE);
     129        cp0_epc_write(uarg->uspace_entry);
     130        userspace_asm(uarg->uspace_stack+PAGE_SIZE);
    131131        while (1)
    132132                ;
Note: See TracChangeset for help on using the changeset viewer.