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


Ignore:
Timestamp:
2016-05-05T08:34:45Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
811770c
Parents:
4b0206c
Message:

Replace magic numbers with macros

File:
1 edited

Legend:

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

    r4b0206c r0f17bff  
    3939#include <abi/proc/uarg.h>
    4040#include <mm/as.h>
     41#include <arch/cpu.h>
     42#include <arch/asm.h>
    4143
    4244/** Enter userspace
     
    4749void userspace(uspace_arg_t *kernel_uarg)
    4850{
    49         ipl_t ipl = interrupts_disable();
     51        uint32_t eflags = read_eflags();
    5052       
    5153        asm volatile (
    52                 /*
    53                  * Clear nested task flag.
    54                  */
    55                 "pushfl\n"
    56                 "pop %%eax\n"
    57                 "and $0xffffbfff, %%eax\n"
    58                 "push %%eax\n"
    59                 "popfl\n"
    60                
    6154                /* Set up GS register (virtual register segment) */
    6255                "movl %[vreg_des], %%gs\n"
     
    6457                "pushl %[udata_des]\n"
    6558                "pushl %[stack_top]\n"
    66                 "pushl %[ipl]\n"
     59                "pushl %[eflags]\n"
    6760                "pushl %[utext_des]\n"
    6861                "pushl %[entry]\n"
     
    7467                "iret\n"
    7568                :
    76                 : [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
     69                : [eflags_mask] "i" (~EFLAGS_NT),
     70                  [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
    7771                  [stack_top] "r" ((uint8_t *) kernel_uarg->uspace_stack +
    7872                      kernel_uarg->uspace_stack_size),
    79                   [ipl] "r" (ipl),
     73                  [eflags] "r" ((eflags & ~(EFLAGS_NT)) | EFLAGS_IF),
    8074                  [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER),
    8175                  [entry] "r" (kernel_uarg->uspace_entry),
Note: See TracChangeset for help on using the changeset viewer.