diff --git a/vm-intro/Makefile b/vm-intro/Makefile new file mode 100644 index 0000000..d2fc962 --- /dev/null +++ b/vm-intro/Makefile @@ -0,0 +1,9 @@ + +all: va + +clean: + rm -f va + +va: va.c + gcc -o va va.c -Wall + diff --git a/vm-intro/README.md b/vm-intro/README.md new file mode 100644 index 0000000..1fa4387 --- /dev/null +++ b/vm-intro/README.md @@ -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 +``` + diff --git a/vm-intro/va.c b/vm-intro/va.c new file mode 100644 index 0000000..f1547da --- /dev/null +++ b/vm-intro/va.c @@ -0,0 +1,11 @@ +#include +#include + +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; +} +