home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / amix / AmigaDOS-Emu.zoo / amiga.c next >
C/C++ Source or Header  |  1992-01-14  |  529b  |  28 lines

  1. #include <sys/types.h>
  2. #include <sys/mman.h>
  3. #include <fcntl.h>
  4. #include <osfcn.h>
  5. #include <stdlib.h>
  6. #include <errno.h>
  7. #include <stdio.h>
  8.  
  9. #include "arun.h"
  10.  
  11.  
  12. #define PAGE 2048
  13.  
  14. void amiga_init(void)
  15. {
  16.     int fd = open("/dev/zero", O_RDWR);
  17.     if (fd < 0 ||
  18.     mmap((caddr_t)0,
  19.          PAGE,
  20.          PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED,
  21.          fd, 0))
  22.     panic("can't map page zero: %s", strerror(errno));
  23.     (void)close(fd);
  24.     *(void **)4 = exec_init();
  25.     (void)mprotect((caddr_t)0, PAGE, PROT_READ);
  26.     dos_init();
  27. }
  28.