Re-factored sandbox into a single executable
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/mman.h>
|
||||
#include "vm.h"
|
||||
|
||||
/* amount of memory to allocate for system RAM in megabytes */
|
||||
#define SIMULATED_MEMORY_MB 16
|
||||
|
||||
#define MEMPTR(offset) ((void *)((uintptr_t)system_memory) + (offset))
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
printf("Hello, world!\n");
|
||||
|
||||
void *system_memory = mmap(
|
||||
NULL,
|
||||
SIMULATED_MEMORY_MB * 0x100000,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS,
|
||||
-1, 0);
|
||||
|
||||
if (system_memory == MAP_FAILED) {
|
||||
perror("mmap");
|
||||
fprintf(stderr, "cannot allocated simulated system RAM buffer\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
munmap(system_memory, SIMULATED_MEMORY_MB * 0x100000);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user