30 lines
476 B
C
30 lines
476 B
C
#include <am.h>
|
|
#include <nemu.h>
|
|
|
|
extern char _heap_start;
|
|
extern void *heap_alloc_ptr;
|
|
int main(const char *args);
|
|
|
|
Area heap = RANGE(&_heap_start, PMEM_END);
|
|
#ifndef MAINARGS
|
|
#define MAINARGS ""
|
|
#endif
|
|
static const char mainargs[] = MAINARGS;
|
|
|
|
void putch(char ch) {
|
|
outb(SERIAL_PORT, ch);
|
|
}
|
|
|
|
void halt(int code) {
|
|
nemu_trap(code);
|
|
|
|
// should not reach here
|
|
while (1);
|
|
}
|
|
|
|
|
|
void _trm_init() {
|
|
heap_alloc_ptr = heap.start;
|
|
int ret = main(mainargs);
|
|
halt(ret);
|
|
}
|