From b8fad52c5cc17f704a0f2f790f33f8cd9b0dd9b2 Mon Sep 17 00:00:00 2001 From: Remzi Arpaci-Dusseau Date: Wed, 15 Aug 2018 12:20:03 -0500 Subject: [PATCH] vm-intro basic code --- vm-intro/Makefile | 9 +++++++++ vm-intro/README.md | 17 +++++++++++++++++ vm-intro/va.c | 11 +++++++++++ 3 files changed, 37 insertions(+) create mode 100644 vm-intro/Makefile create mode 100644 vm-intro/README.md create mode 100644 vm-intro/va.c 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; +} +