Merge branch 'nocomapi'
[syslinux/sherbszt.git] / core / stack.inc
blob838d6bab8ef79968b3f4b92f73c62f64acd8bc17
1 ; -----------------------------------------------------------------------
3 ;   Copyright 2005-2008 H. Peter Anvin - All Rights Reserved
4 ;   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
6 ;   This program is free software; you can redistribute it and/or modify
7 ;   it under the terms of the GNU General Public License as published by
8 ;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ;   Boston MA 02111-1307, USA; either version 2 of the License, or
10 ;   (at your option) any later version; incorporated herein by reference.
12 ; -----------------------------------------------------------------------
15 ; stack.inc
17 ; How to reset the stack pointer
20 %ifndef _STACK_INC
21 %define _STACK_INC
24 ; This macro resets the stack pointer (including SS), and sets
25 ; DS == ES == 0, interrupts on, DF = 0.
27 ; It takes a 16-bit register that can be safely clobbered as parameter.
29 %macro RESET_STACK_AND_SEGS 1
30                 xor %1,%1
31                 mov ds,%1
32                 mov es,%1
33                 lss esp,[BaseStack]
34                 mov dword [PMESP],__stack_end   ; Reset PM stack
35                 sti
36                 cld
37 %endmacro
39                 section .data16
40                 alignz 4
41                 global BaseStack:data hidden
42 BaseStack       dd StackHome            ; ESP of the "home" stack pointer
43                 dw 0                    ; SS of the "home" stack pointer
45                 section .text16
47 %endif ; _STACK_INC