aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/vm/pt-grow-pusha.c
blob: f9762a512d1c5791bea793ad65f9d930e8f700c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* Expand the stack by 32 bytes all at once using the PUSHA
   instruction.
   This must succeed. */

#include <string.h>
#include "tests/arc4.h"
#include "tests/cksum.h"
#include "tests/lib.h"
#include "tests/main.h"

void
test_main (void)
{
  asm volatile
    ("movl %%esp, %%eax;"        /* Save a copy of the stack pointer. */
     "andl $0xfffff000, %%esp;"  /* Move stack pointer to bottom of page. */
     "pushal;"                   /* Push 32 bytes on stack at once. */
     "movl %%eax, %%esp"         /* Restore copied stack pointer. */
     : : : "eax");               /* Tell GCC we destroyed eax. */
}