* remove "\r" nonsense
[mascara-docs.git] / i386 / i386.reference / PUSHA.htm
blob37d5386c7ec63fdefd6fe3b20c24748c664ac54b
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>80386 Programmer's Reference Manual -- Opcode PUSHA</TITLE>
5 </HEAD>
6 <BODY>
7 <B>up:</B> <A HREF="c17.htm">
8 Chapter 17 -- 80386 Instruction Set</A><BR>
9 <B>prev:</B><A HREF="PUSH.htm"> PUSH Push Operand onto the Stack</A><BR>
10 <B>next:</B><A HREF="PUSHF.htm"> PUSHF/PUSHFD Push Flags Register onto the Stack</A>
11 <P>
12 <HR>
13 <P>
14 <H1>PUSHA/PUSHAD -- Push all General Registers</H1>
16 <PRE>
17 Opcode Instruction Clocks Description
19 60 PUSHA 18 Push AX, CX, DX, BX, original SP, BP, SI, and
21 60 PUSHAD 18 Push EAX, ECX, EDX, EBX, original ESP, EBP,
22 ESI, and EDI
23 </PRE>
26 <H2>Operation</H2>
28 <PRE>
29 IF OperandSize = 16 (* PUSHA instruction *)
30 THEN
31 Temp := (SP);
32 Push(AX);
33 Push(CX);
34 Push(DX);
35 Push(BX);
36 Push(Temp);
37 Push(BP);
38 Push(SI);
39 Push(DI);
40 ELSE (* OperandSize = 32, PUSHAD instruction *)
41 Temp := (ESP);
42 Push(EAX);
43 Push(ECX);
44 Push(EDX);
45 Push(EBX);
46 Push(Temp);
47 Push(EBP);
48 Push(ESI);
49 Push(EDI);
50 FI;
51 </PRE>
53 <H2>Description</H2>
55 PUSHA and PUSHAD save the 16-bit or 32-bit general registers,
56 respectively, on the 80386 stack. PUSHA decrements the stack pointer
57 (SP) by 16 to hold the eight word values. PUSHAD decrements the
58 stack pointer (ESP) by 32 to hold the eight doubleword values. Because
59 the registers are pushed onto the stack in the order in which they were
60 given, they appear in the 16 or 32 new stack bytes in reverse order. The
61 last register pushed is DI or EDI.
63 <H2>Flags Affected</H2>
65 None
67 <H2>Protected Mode Exceptions</H2>
69 #SS(0) if the starting or ending stack address is outside the stack segment
70 limit; #PF(fault-code) for a page fault
72 <H2>Real Address Mode Exceptions</H2>
74 Before executing PUSHA or PUSHAD, the 80386 shuts down if SP or
75 ESP equals 1, 3, or 5; if SP or ESP equals 7, 9, 11, 13, or 15, exception
76 13 occurs
78 <H2>Virtual 8086 Mode Exceptions</H2>
80 Same exceptions as in real-address mode; #PF(fault-code) for a page
81 fault
84 <P>
85 <HR>
86 <P>
87 <B>up:</B> <A HREF="c17.htm">
88 Chapter 17 -- 80386 Instruction Set</A><BR>
89 <B>prev:</B><A HREF="PUSH.htm"> PUSH Push Operand onto the Stack</A><BR>
90 <B>next:</B><A HREF="PUSHF.htm"> PUSHF/PUSHFD Push Flags Register onto the Stack</A>
91 </BODY>