vm-intro basic code

This commit is contained in:
Remzi Arpaci-Dusseau
2018-08-15 12:20:03 -05:00
parent a072c9f934
commit b8fad52c5c
3 changed files with 37 additions and 0 deletions

9
vm-intro/Makefile Normal file
View File

@@ -0,0 +1,9 @@
all: va
clean:
rm -f va
va: va.c
gcc -o va va.c -Wall

17
vm-intro/README.md Normal file
View File

@@ -0,0 +1,17 @@
# Overview
Code from OSTEP chapter [The Abstraction: Address Spaces](http://pages.cs.wisc.edu/~remzi/OSTEP/vm-intro.pdf).
To compile, just type:
```
prompt> make
```
See the highly primitive `Makefile` for details.
Then, run it:
```
prompt> ./virtual-addresses
```

11
vm-intro/va.c Normal file
View File

@@ -0,0 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
printf("location of code : %p\n", main);
printf("location of heap : %p\n", malloc(1));
int x = 3;
printf("location of stack : %p\n", &x);
return 0;
}