Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c8cd9a8 in mainline


Ignore:
Timestamp:
2010-07-14T12:29:35Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial
Children:
864e272
Parents:
a7220de
Message:

Preallocate space for the istate structure on the stack for the use by the
SYSENTER instruction.

Location:
kernel/arch/ia32/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/asm.S

    ra7220de rc8cd9a8  
    175175
    176176/*
    177  * Size of the entire istate structure including the error word and the
    178  * hardware-saved part.
    179  */
    180 #define ISTATE_REAL_SIZE  (ISTATE_SOFT_SIZE + 24)
    181 
    182 /*
    183177 * The SYSENTER syscall mechanism can be used for syscalls with
    184178 * four or fewer arguments. To pass these four arguments, we
     
    191185.global sysenter_handler
    192186sysenter_handler:
    193         subl $(ISTATE_REAL_SIZE), %esp
     187
     188        /*
     189         * Note that the space needed for the istate structure has been
     190         * preallocated on the stack by before_thread_runs_arch().
     191         */
    194192
    195193        /*
     
    260258        movl ISTATE_OFFSET_ESP(%esp), %ecx
    261259
    262         addl $(ISTATE_REAL_SIZE), %esp
    263        
    264260        sysexit   /* return to userspace */
    265261
  • kernel/arch/ia32/src/proc/scheduler.c

    ra7220de rc8cd9a8  
    3939#include <arch.h>
    4040#include <arch/context.h>  /* SP_DELTA */
     41#include <arch/interrupt.h>
    4142#include <arch/pm.h>
    4243#include <arch/asm.h>
     
    6364        if (CPU->arch.fi.bits.sep) {
    6465                /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */
    65                 write_msr(IA32_MSR_SYSENTER_ESP, kstk);
     66                write_msr(IA32_MSR_SYSENTER_ESP, kstk - sizeof(istate_t));
    6667        }
    6768       
Note: See TracChangeset for help on using the changeset viewer.