projects
/
pintos-anon
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Add problem 1-1 solution.
[pintos-anon]
/
grading
/
userprog
/
sc-boundary.c
1
#include <inttypes.h>
2
#include <stdio.h>
3
#include <string.h>
4
#include <syscall-nr.h>
5
6
static void *
7
mk_boundary_array (void)
8
{
9
static char dst[8192];
10
return dst + (4096 - (uintptr_t) dst % 4096);
11
}
12
13
int
14
main (void)
15
{
16
int *p;
17
18
printf ("(sc-boundary) begin\n");
19
p = mk_boundary_array ();
20
p--;
21
p[0] = SYS_exit;
22
p[1] = 42;
23
asm volatile ("mov %0, %%esp; int $0x30"
24
:
25
: "g" (p));
26
printf ("(sc-boundary) failed\n");
27
return 1;
28
}