Changeset add04f7 in mainline for kernel/arch/ia32/src/userspace.c


Ignore:
Timestamp:
2009-03-03T15:20:49Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f24d300
Parents:
deca67b
Message:

better inline assembler readability using the new symbolic syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/userspace.c

    rdeca67b radd04f7  
    2727 */
    2828
    29 /** @addtogroup ia32   
     29/** @addtogroup ia32
    3030 * @{
    3131 */
     
    4848void userspace(uspace_arg_t *kernel_uarg)
    4949{
    50         ipl_t ipl;
    51 
    52         ipl = interrupts_disable();
    53 
     50        ipl_t ipl = interrupts_disable();
     51       
    5452        asm volatile (
    5553                /*
     
    6159                "push %%eax\n"
    6260                "popfl\n"
    63 
     61               
    6462                /* Set up GS register (TLS) */
    65                 "movl %6, %%gs\n"
    66 
    67                 "pushl %0\n"
    68                 "pushl %1\n"
    69                 "pushl %2\n"
    70                 "pushl %3\n"
    71                 "pushl %4\n"
    72                 "movl %5, %%eax\n"
    73 
     63                "movl %[tls_des], %%gs\n"
     64               
     65                "pushl %[udata_des]\n"
     66                "pushl %[stack_size]\n"
     67                "pushl %[ipl]\n"
     68                "pushl %[utext_des]\n"
     69                "pushl %[entry]\n"
     70                "movl %[uarg], %%eax\n"
     71               
    7472                /* %ebx is defined to hold pcb_ptr - set it to 0 */
    75                 "xorl %%ebx, %%ebx\n"   
    76 
     73                "xorl %%ebx, %%ebx\n"
     74               
    7775                "iret\n"
    78                 :
    79                 : "i" (selector(UDATA_DES) | PL_USER),
    80                   "r" ((uint8_t *) kernel_uarg->uspace_stack +
    81                       THREAD_STACK_SIZE),
    82                   "r" (ipl),
    83                   "i" (selector(UTEXT_DES) | PL_USER),
    84                   "r" (kernel_uarg->uspace_entry),
    85                   "r" (kernel_uarg->uspace_uarg),
    86                   "r" (selector(TLS_DES))
     76                :
     77                : [udata_des] "i" (selector(UDATA_DES) | PL_USER),
     78                  [stack_size] "r" ((uint8_t *) kernel_uarg->uspace_stack + THREAD_STACK_SIZE),
     79                  [ipl] "r" (ipl),
     80                  [utext_des] "i" (selector(UTEXT_DES) | PL_USER),
     81                  [entry] "r" (kernel_uarg->uspace_entry),
     82                  [uarg] "r" (kernel_uarg->uspace_uarg),
     83                  [tls_des] "r" (selector(TLS_DES))
    8784                : "eax");
    8885       
    8986        /* Unreachable */
    90         for(;;)
    91                 ;
     87        while (1);
    9288}
    9389
Note: See TracChangeset for help on using the changeset viewer.