parent
769c280d05
commit
032708bd84
@ -1,12 +0,0 @@
|
|||||||
/*
|
|
||||||
* Below is the given application for lab2_1.
|
|
||||||
* This app runs in its own address space, in contrast with in direct mapping.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "user_lib.h"
|
|
||||||
#include "util/types.h"
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
printu("Hello world!\n");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Below is the given application for lab2_2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "user_lib.h"
|
||||||
|
#include "util/types.h"
|
||||||
|
|
||||||
|
struct my_structure {
|
||||||
|
char c;
|
||||||
|
int n;
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
struct my_structure* s = (struct my_structure*)naive_malloc();
|
||||||
|
s->c = 'a';
|
||||||
|
s->n = 1;
|
||||||
|
|
||||||
|
printu("s: %lx, {%c %d}\n", s, s->c, s->n);
|
||||||
|
|
||||||
|
naive_free(s);
|
||||||
|
exit(0);
|
||||||
|
}
|
Loading…
Reference in new issue