1 2 #include <features.h> 3 /* Sneaky, use the _linuxmt_ header files _not_ dos */ 4 #undef __SYSINC__ 5 #define __SYSINC__(__h_file) <linuxmt/__h_file> 6 7 #include <sys/types.h> 8 #include <sys/wait.h> 9 #include <sys/resource.h> 10 #include <sys/stat.h> 11 #include <sys/signal.h> 12 #include <sys/errno.h> 13 14 #include <stdio.h> 15 #include <ctype.h> 16 #include <dos.h> 17 #include <malloc.h> 18 #include <fcntl.h> 19 20 /* Function return vals */ 21 22 extern unsigned int elks_int(); 23 extern unsigned int run_cpu(); 24 25 /* Elks binary formats */ 26 27 #define EXEC_HEADER_SIZE 32 28 29 struct elks_exec_hdr 30 { 31 unsigned long type; 32 #define ELKS_COMBID 0x04100301L 33 #define ELKS_SPLITID 0x04200301L 34 unsigned long hlen; 35 unsigned long tseg; 36 unsigned long dseg; 37 unsigned long bseg; 38 unsigned long unused; 39 unsigned long chmem; 40 unsigned long unused2; 41 }; 42 43 /* Elks cpu structure. */ 44 45 struct fd_ref { 46 int ftype; 47 union { 48 int i; 49 FILE * f; 50 } fd; 51 } ; 52 53 struct segment { 54 unsigned int seg; 55 unsigned int size; 56 int ref_count; 57 }; 58 59 struct process 60 { 61 unsigned int ax; /* NOTE The order of this is _closely_ related to */ 62 unsigned int bx; /* the coroutine assembler */ 63 unsigned int cx; 64 unsigned int dx; 65 unsigned int di; 66 unsigned int si; 67 unsigned int bp; 68 unsigned int es; 69 70 unsigned int ds; /* start +16 +0 */ 71 unsigned int pc; /* start +16 +2 */ 72 unsigned int cs; /* start +16 +4 */ 73 unsigned int flgs; /* start +16 +6 */ 74 unsigned int ss; /* start +16 +8 */ 75 unsigned int sp; /* start +16 +10 */ 76 77 /* From here down only accessed from C */ 78 int pending_op; 79 struct process * next; 80 81 struct segment * text_seg; 82 struct segment * data_seg; 83 84 int pid; 85 int ppid; 86 int pgrp; 87 int umask; 88 int uid; 89 int gid; 90 int euid; 91 int egid; 92 int suid; 93 int sgid; 94 long ignmask, trpmask; 95 int sigtrap; 96 97 struct fd_ref fds[20]; 98 99 struct rusage ruse; 100 }; 101 102 extern struct process * proc; 103 extern unsigned int current_ds, current_stack; 104 extern int in_process; 105 extern int process_running; 106 extern int intr_pending; 107 108 /* Elks syscall interface */ 109 110 #define ELKSINT 0x80 111 typedef int (*Scallp)( /* int, int, int */ ); 112 extern Scallp syscalltab[]; 113 114 /******************************************************************************/ 115 116 #ifndef O_BINARY 117 #define O_BINARY 0 118 #endif 119 120