InternalSwitchStack.S revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
af062818b47340eef15700d2f0211576ba3506eevboxsync#------------------------------------------------------------------------------
af062818b47340eef15700d2f0211576ba3506eevboxsync#
af062818b47340eef15700d2f0211576ba3506eevboxsync# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
af062818b47340eef15700d2f0211576ba3506eevboxsync# Portions copyright (c) 2011, Apple Inc. All rights reserved.<BR>
af062818b47340eef15700d2f0211576ba3506eevboxsync# This program and the accompanying materials
af062818b47340eef15700d2f0211576ba3506eevboxsync# are licensed and made available under the terms and conditions of the BSD License
af062818b47340eef15700d2f0211576ba3506eevboxsync# which accompanies this distribution. The full text of the license may be found at
af062818b47340eef15700d2f0211576ba3506eevboxsync# http://opensource.org/licenses/bsd-license.php.
af062818b47340eef15700d2f0211576ba3506eevboxsync#
af062818b47340eef15700d2f0211576ba3506eevboxsync# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
af062818b47340eef15700d2f0211576ba3506eevboxsync# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
af062818b47340eef15700d2f0211576ba3506eevboxsync#
af062818b47340eef15700d2f0211576ba3506eevboxsync# Module Name:
af062818b47340eef15700d2f0211576ba3506eevboxsync#
af062818b47340eef15700d2f0211576ba3506eevboxsync# InternalSwitchStack.S
af062818b47340eef15700d2f0211576ba3506eevboxsync#
af062818b47340eef15700d2f0211576ba3506eevboxsync# Abstract:
af062818b47340eef15700d2f0211576ba3506eevboxsync#
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync# Implementation of a stack switch on IA-32.
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync#
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync#------------------------------------------------------------------------------
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsyncASM_GLOBAL ASM_PFX(InternalSwitchStack)
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync#------------------------------------------------------------------------------
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync# VOID
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync# EFIAPI
af062818b47340eef15700d2f0211576ba3506eevboxsync# InternalSwitchStack (
af062818b47340eef15700d2f0211576ba3506eevboxsync# IN SWITCH_STACK_ENTRY_POINT EntryPoint,
af062818b47340eef15700d2f0211576ba3506eevboxsync# IN VOID *Context1, OPTIONAL
af062818b47340eef15700d2f0211576ba3506eevboxsync# IN VOID *Context2, OPTIONAL
af062818b47340eef15700d2f0211576ba3506eevboxsync# IN VOID *NewStack
af062818b47340eef15700d2f0211576ba3506eevboxsync# );
af062818b47340eef15700d2f0211576ba3506eevboxsync#------------------------------------------------------------------------------
af062818b47340eef15700d2f0211576ba3506eevboxsyncASM_PFX(InternalSwitchStack):
af062818b47340eef15700d2f0211576ba3506eevboxsync pushl %ebp
af062818b47340eef15700d2f0211576ba3506eevboxsync movl %esp, %ebp
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync movl 20(%ebp), %esp # switch stack
af062818b47340eef15700d2f0211576ba3506eevboxsync subl $8, %esp
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync movl 16(%ebp), %eax
af062818b47340eef15700d2f0211576ba3506eevboxsync movl %eax, 4(%esp)
af062818b47340eef15700d2f0211576ba3506eevboxsync movl 12(%ebp), %eax
af062818b47340eef15700d2f0211576ba3506eevboxsync movl %eax, (%esp)
af062818b47340eef15700d2f0211576ba3506eevboxsync pushl $0 # keeps gdb from unwinding stack
af062818b47340eef15700d2f0211576ba3506eevboxsync jmp *8(%ebp) # call and never return
af062818b47340eef15700d2f0211576ba3506eevboxsync
af062818b47340eef15700d2f0211576ba3506eevboxsync