vm-intro basic code
This commit is contained in:
9
vm-intro/Makefile
Normal file
9
vm-intro/Makefile
Normal 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
17
vm-intro/README.md
Normal 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
11
vm-intro/va.c
Normal 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user