00001
00002
00003 #ifndef _SYSLIB_H
00004 #define _SYSLIB_H
00005
00006 #ifndef _TYPES_H
00007 #include <sys/types.h>
00008 #endif
00009
00010 #ifndef _IPC_H
00011 #include <minix/ipc.h>
00012 #endif
00013
00014 #ifndef _DEVIO_H
00015 #include <minix/devio.h>
00016 #endif
00017
00018
00019 struct reg86u;
00020
00021 #define SYSTASK SYSTEM
00022
00023
00024
00025
00026 _PROTOTYPE( int _taskcall, (int who, int syscallnr, message *msgptr));
00027
00028 _PROTOTYPE( int sys_abort, (int how, ...));
00029 _PROTOTYPE( int sys_enable_iop, (int proc));
00030 _PROTOTYPE( int sys_exec, (int proc, char *ptr,
00031 char *aout, vir_bytes initpc));
00032 _PROTOTYPE( int sys_fork, (int parent, int child, int *));
00033 _PROTOTYPE( int sys_newmap, (int proc, struct mem_map *ptr));
00034 _PROTOTYPE( int sys_exit, (int proc));
00035 _PROTOTYPE( int sys_trace, (int req, int proc, long addr, long *data_p));
00036
00037 _PROTOTYPE( int sys_privctl, (int proc, int req, int i, void *p));
00038 _PROTOTYPE( int sys_nice, (int proc, int priority));
00039
00040 _PROTOTYPE( int sys_int86, (struct reg86u *reg86p));
00041 _PROTOTYPE( int sys_vm_setbuf, (phys_bytes base, phys_bytes size,
00042 phys_bytes high));
00043 _PROTOTYPE( int sys_vm_map, (int proc_nr, int do_map,
00044 phys_bytes base, phys_bytes size, phys_bytes offset));
00045
00046
00047 #define sys_insb(port, proc_nr, buffer, count) \
00048 sys_sdevio(DIO_INPUT, port, DIO_BYTE, proc_nr, buffer, count)
00049 #define sys_insw(port, proc_nr, buffer, count) \
00050 sys_sdevio(DIO_INPUT, port, DIO_WORD, proc_nr, buffer, count)
00051 #define sys_outsb(port, proc_nr, buffer, count) \
00052 sys_sdevio(DIO_OUTPUT, port, DIO_BYTE, proc_nr, buffer, count)
00053 #define sys_outsw(port, proc_nr, buffer, count) \
00054 sys_sdevio(DIO_OUTPUT, port, DIO_WORD, proc_nr, buffer, count)
00055 _PROTOTYPE( int sys_sdevio, (int req, long port, int type, int proc_nr,
00056 void *buffer, int count));
00057
00058
00059 _PROTOTYPE( int sys_times, (int proc_nr, clock_t *ptr));
00060 _PROTOTYPE(int sys_setalarm, (clock_t exp_time, int abs_time));
00061
00062
00063 #define sys_irqdisable(hook_id) \
00064 sys_irqctl(IRQ_DISABLE, 0, 0, hook_id)
00065 #define sys_irqenable(hook_id) \
00066 sys_irqctl(IRQ_ENABLE, 0, 0, hook_id)
00067 #define sys_irqsetpolicy(irq_vec, policy, hook_id) \
00068 sys_irqctl(IRQ_SETPOLICY, irq_vec, policy, hook_id)
00069 #define sys_irqrmpolicy(irq_vec, hook_id) \
00070 sys_irqctl(IRQ_RMPOLICY, irq_vec, 0, hook_id)
00071 _PROTOTYPE ( int sys_irqctl, (int request, int irq_vec, int policy,
00072 int *irq_hook_id) );
00073
00074
00075 #define sys_biosin(bios_vir, dst_vir, bytes) \
00076 sys_vircopy(SELF, BIOS_SEG, bios_vir, SELF, D, dst_vir, bytes)
00077 #define sys_biosout(src_vir, bios_vir, bytes) \
00078 sys_vircopy(SELF, D, src_vir, SELF, BIOS_SEG, bios_vir, bytes)
00079 #define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
00080 sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
00081 #define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
00082 sys_vircopy(src_proc, T, src_vir, dst_proc, T, dst_vir, bytes)
00083 #define sys_stackcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
00084 sys_vircopy(src_proc, S, src_vir, dst_proc, S, dst_vir, bytes)
00085 _PROTOTYPE(int sys_vircopy, (int src_proc, int src_seg, vir_bytes src_vir,
00086 int dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
00087
00088 #define sys_abscopy(src_phys, dst_phys, bytes) \
00089 sys_physcopy(NONE, PHYS_SEG, src_phys, NONE, PHYS_SEG, dst_phys, bytes)
00090 _PROTOTYPE(int sys_physcopy, (int src_proc, int src_seg, vir_bytes src_vir,
00091 int dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
00092 _PROTOTYPE(int sys_memset, (unsigned long pattern,
00093 phys_bytes base, phys_bytes bytes));
00094
00095
00096 #if DEAD_CODE
00097 _PROTOTYPE(int sys_virvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
00098 _PROTOTYPE(int sys_physvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
00099 #endif
00100
00101 _PROTOTYPE(int sys_umap, (int proc_nr, int seg, vir_bytes vir_addr,
00102 vir_bytes bytes, phys_bytes *phys_addr));
00103 _PROTOTYPE(int sys_segctl, (int *index, u16_t *seg, vir_bytes *off,
00104 phys_bytes phys, vir_bytes size));
00105
00106
00107 #define sys_getkmessages(dst) sys_getinfo(GET_KMESSAGES, dst, 0,0,0)
00108 #define sys_getkinfo(dst) sys_getinfo(GET_KINFO, dst, 0,0,0)
00109 #define sys_getloadinfo(dst) sys_getinfo(GET_LOADINFO, dst, 0,0,0)
00110 #define sys_getmachine(dst) sys_getinfo(GET_MACHINE, dst, 0,0,0)
00111 #define sys_getproctab(dst) sys_getinfo(GET_PROCTAB, dst, 0,0,0)
00112 #define sys_getprivtab(dst) sys_getinfo(GET_PRIVTAB, dst, 0,0,0)
00113 #define sys_getproc(dst,nr) sys_getinfo(GET_PROC, dst, 0,0, nr)
00114 #define sys_getrandomness(dst) sys_getinfo(GET_RANDOMNESS, dst, 0,0,0)
00115 #define sys_getimage(dst) sys_getinfo(GET_IMAGE, dst, 0,0,0)
00116 #define sys_getirqhooks(dst) sys_getinfo(GET_IRQHOOKS, dst, 0,0,0)
00117 #define sys_getirqactids(dst) sys_getinfo(GET_IRQACTIDS, dst, 0,0,0)
00118 #define sys_getmonparams(v,vl) sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
00119 #define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
00120 #define sys_getlocktimings(dst) sys_getinfo(GET_LOCKTIMING, dst, 0,0,0)
00121 #define sys_getbiosbuffer(virp, sizep) sys_getinfo(GET_BIOSBUFFER, virp, \
00122 sizeof(*virp), sizep, sizeof(*sizep))
00123 _PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
00124 void *val_ptr2, int val_len2) );
00125
00126
00127 _PROTOTYPE(int sys_kill, (int proc, int sig) );
00128 _PROTOTYPE(int sys_sigsend, (int proc_nr, struct sigmsg *sig_ctxt) );
00129 _PROTOTYPE(int sys_sigreturn, (int proc_nr, struct sigmsg *sig_ctxt) );
00130 _PROTOTYPE(int sys_getksig, (int *k_proc_nr, sigset_t *k_sig_map) );
00131 _PROTOTYPE(int sys_endksig, (int proc_nr) );
00132
00133
00134
00135
00136
00137 _PROTOTYPE(int sys_voutb, (pvb_pair_t *pvb_pairs, int nr_ports) );
00138 _PROTOTYPE(int sys_voutw, (pvw_pair_t *pvw_pairs, int nr_ports) );
00139 _PROTOTYPE(int sys_voutl, (pvl_pair_t *pvl_pairs, int nr_ports) );
00140 _PROTOTYPE(int sys_vinb, (pvb_pair_t *pvb_pairs, int nr_ports) );
00141 _PROTOTYPE(int sys_vinw, (pvw_pair_t *pvw_pairs, int nr_ports) );
00142 _PROTOTYPE(int sys_vinl, (pvl_pair_t *pvl_pairs, int nr_ports) );
00143
00144
00145 #define sys_outb(p,v) sys_out((p), (unsigned long) (v), DIO_BYTE)
00146 #define sys_outw(p,v) sys_out((p), (unsigned long) (v), DIO_WORD)
00147 #define sys_outl(p,v) sys_out((p), (unsigned long) (v), DIO_LONG)
00148 _PROTOTYPE(int sys_out, (int port, unsigned long value, int type) );
00149
00150
00151 #define sys_inb(p,v) sys_in((p), (v), DIO_BYTE)
00152 #define sys_inw(p,v) sys_in((p), (v), DIO_WORD)
00153 #define sys_inl(p,v) sys_in((p), (v), DIO_LONG)
00154 _PROTOTYPE(int sys_in, (int port, unsigned long *value, int type) );
00155
00156
00157 _PROTOTYPE( void pci_init, (void) );
00158 _PROTOTYPE( void pci_init1, (char *name) );
00159 _PROTOTYPE( int pci_first_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
00160 _PROTOTYPE( int pci_next_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
00161 _PROTOTYPE( int pci_find_dev, (U8_t bus, U8_t dev, U8_t func,
00162 int *devindp) );
00163 _PROTOTYPE( void pci_reserve, (int devind) );
00164 _PROTOTYPE( void pci_ids, (int devind, u16_t *vidp, u16_t *didp) );
00165 _PROTOTYPE( void pci_rescan_bus, (U8_t busnr) );
00166 _PROTOTYPE( u8_t pci_attr_r8, (int devind, int port) );
00167 _PROTOTYPE( u16_t pci_attr_r16, (int devind, int port) );
00168 _PROTOTYPE( u32_t pci_attr_r32, (int devind, int port) );
00169 _PROTOTYPE( void pci_attr_w8, (int devind, int port, U8_t value) );
00170 _PROTOTYPE( void pci_attr_w16, (int devind, int port, U16_t value) );
00171 _PROTOTYPE( void pci_attr_w32, (int devind, int port, u32_t value) );
00172 _PROTOTYPE( char *pci_dev_name, (U16_t vid, U16_t did) );
00173 _PROTOTYPE( char *pci_slot_name, (int devind) );
00174
00175 #endif
00176