summaryrefslogtreecommitdiffstats
path: root/src/tests/userprog/sc-boundary.c
blob: d889535cf279f9af2d5688fd0ef21a5c1caf0719 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Invokes a system call with the system call number and its
   argument on separate pages.  This must work. */

#include <syscall-nr.h>
#include "tests/userprog/boundary.h"
#include "tests/lib.h"
#include "tests/main.h"

void
test_main (void) 
{
  /* Put a syscall number at the end of one page
     and its argument at the beginning of another. */
  int *p = get_boundary_area ();
  p--;
  p[0] = SYS_EXIT;
  p[1] = 42;

  /* Invoke the system call. */
  asm volatile ("movl %0, %%esp; int $0x30" : : "g" (p));
  fail ("should have called exit(42)");
}