Initial revision

This commit is contained in:
Ben Gras
2005-04-21 14:53:53 +00:00
commit 9865aeaa79
2264 changed files with 411685 additions and 0 deletions

77
include/minix/callnr.h Executable file
View File

@@ -0,0 +1,77 @@
#define NCALLS 83 /* number of system calls allowed */
#define EXIT 1
#define FORK 2
#define READ 3
#define WRITE 4
#define OPEN 5
#define CLOSE 6
#define WAIT 7
#define CREAT 8
#define LINK 9
#define UNLINK 10
#define WAITPID 11
#define CHDIR 12
#define TIME 13
#define MKNOD 14
#define CHMOD 15
#define CHOWN 16
#define BRK 17
#define STAT 18
#define LSEEK 19
#define GETPID 20
#define MOUNT 21
#define UMOUNT 22
#define SETUID 23
#define GETUID 24
#define STIME 25
#define PTRACE 26
#define ALARM 27
#define FSTAT 28
#define PAUSE 29
#define UTIME 30
#define ACCESS 33
#define SYNC 36
#define KILL 37
#define RENAME 38
#define MKDIR 39
#define RMDIR 40
#define DUP 41
#define PIPE 42
#define TIMES 43
#define SETGID 46
#define GETGID 47
#define SIGNAL 48
#define IOCTL 54
#define FCNTL 55
#define EXEC 59
#define UMASK 60
#define CHROOT 61
#define SETSID 62
#define GETPGRP 63
/* The following are not system calls, but are processed like them. */
#define UNPAUSE 65 /* to MM or FS: check for EINTR */
#define REVIVE 67 /* to FS: revive a sleeping process */
#define TASK_REPLY 68 /* to FS: reply code from tty task */
/* Posix signal handling. */
#define SIGACTION 71
#define SIGSUSPEND 72
#define SIGPENDING 73
#define SIGPROCMASK 74
#define SIGRETURN 75
#define REBOOT 76
/* MINIX specific calls to support system services. */
#define SVRCTL 77
#define CMOSTIME 78
#define GETSYSINFO 79 /* to MM or FS */
#if ENABLE_MESSAGE_STATS
#define MSTATS 80
#endif
#define SETCACHE 81
#define FSTATFS 82

42
include/minix/cdrom.h Executable file
View File

@@ -0,0 +1,42 @@
/* This file contains some structures used by the Mitsumi cdrom driver.
*
* Feb 13 1995 Author: Michel R. Prevenier
*/
/* Index into the mss arrays */
#define MINUTES 0
#define SECONDS 1
#define SECTOR 2
struct cd_play_mss
{
u8_t begin_mss[3];
u8_t end_mss[3];
};
struct cd_play_track
{
u8_t begin_track;
u8_t end_track;
};
struct cd_disk_info
{
u8_t first_track;
u8_t last_track;
u8_t disk_length_mss[3];
u8_t first_track_mss[3];
};
struct cd_toc_entry
{
u8_t control_address;
u8_t track_nr;
u8_t index_nr;
u8_t track_time_mss[3];
u8_t reserved;
u8_t position_mss[3];
};

400
include/minix/com.h Executable file
View File

@@ -0,0 +1,400 @@
/*===========================================================================*
* System calls and magic process numbers *
*===========================================================================*/
/* Masks and flags for system calls. */
#define SYSCALL_FUNC 0x0F /* mask for system call function */
#define SYSCALL_FLAGS 0xF0 /* mask for system call flags */
#define NON_BLOCKING 0x10 /* don't block, but return */
/* System calls (numbers passed when trapping to the kernel) */
#define SEND 1 /* function code for sending messages */
#define RECEIVE 2 /* function code for receiving messages */
#define BOTH 3 /* function code for SEND + RECEIVE */
#define NB_SEND (SEND | NON_BLOCKING) /* non-blocking SEND */
#define NB_RECEIVE (RECEIVE | NON_BLOCKING) /* non-blocking RECEIVE */
/* Magic, invalid process numbers. */
#define ANY 0x7ace /* used to indicate 'any process' */
#define NONE 0x6ace /* used to indicate 'no process at all' */
#define SELF 0x8ace /* used to indicate 'own process' */
/*===========================================================================*
* Process numbers of processes in the system image *
*===========================================================================*/
/* The values of several task numbers depend on whether they or other tasks
* are enabled. They are defined as (PREVIOUS_TASK - ENABLE_TASK) in general.
* ENABLE_TASK is either 0 or 1, so a task either gets a new number, or gets
* the same number as the previous task and is further unused. Note that the
* order should correspond to the order in the task table defined in table.c.
*/
/* Kernel tasks. These all run in the same address space. */
#define RTL8139 IDLE - ENABLE_RTL8139 /* networking */
#define IDLE -4 /* runs when no one else can run */
#define CLOCK -3 /* alarms and other clock functions */
#define SYSTASK -2 /* request system functionality */
#define HARDWARE -1 /* used as source on notify() messages */
/* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
#define NR_TASKS (4 + ENABLE_RTL8139)
/* Magic numbers for controllers. Device driver mapping is dynamic. */
#define CTRLR(n) (NONE + (n))
/* User-level processes, that is, device drivers, servers, and INIT. */
#define MM_PROC_NR 0 /* memory manager */
#define FS_PROC_NR 1 /* file system */
#define IS_PROC_NR 5 /* information server */
#define TTY 6 /* terminal (TTY) driver */
#define MEMORY 8 /* memory driver (RAM disk, null, etc.) */
#define AT_WINI (MEMORY + ENABLE_AT_WINI) /* AT Winchester */
#define FLOPPY (AT_WINI + ENABLE_FLOPPY) /* floppy disk */
#define PRINTER (FLOPPY + ENABLE_PRINTER) /* Centronics */
#define INIT_PROC_NR (PRINTER + 1) /* init -- goes multiuser */
/* Number of first user process not part of the operating system. */
#define LOW_USER INIT_PROC_NR
/* The number of processes that are contained in the system image. */
#define IMAGE_SIZE (NR_TASKS + \
5 + ENABLE_AT_WINI + ENABLE_FLOPPY + \
ENABLE_PRINTER + 1 )
/*===========================================================================*
* Kernel notification types *
*===========================================================================*/
/* Kernel notification types. In principle, these can be sent to any process,
* so make sure that these types do not interfere with other message types.
* Notifications are prioritized because of the way they are unhold() and
* blocking notifications are delivered. The lowest numbers go first. The
* offset are used for the per-process notification bit maps.
*/
#define NR_NOTIFICATIONS 5 /* max. is # bits in notify_mask_t */
# define NOTIFICATION 333 /* offset for notification types */
# define HARD_INT NOTIFICATION + 0 /* hardware interrupt */
# define SYN_ALARM NOTIFICATION + 1 /* synchronous alarm */
# define KSIG_PENDING NOTIFICATION + 2 /* signal(s) pending */
# define NEW_KMESS NOTIFICATION + 3 /* new kernel message */
# define HARD_STOP NOTIFICATION + 4 /* system shutdown */
/*===========================================================================*
* Messages for BLOCK and CHARACTER device drivers *
*===========================================================================*/
#define CANCEL 0 /* general req to force a task to cancel */
#define DEV_READ 3 /* fcn code for reading from tty */
#define DEV_WRITE 4 /* fcn code for writing to tty */
#define DEV_IOCTL 5 /* fcn code for ioctl */
#define DEV_OPEN 6 /* fcn code for opening tty */
#define DEV_CLOSE 7 /* fcn code for closing tty */
#define DEV_SCATTER 8 /* fcn code for writing from a vector */
#define DEV_GATHER 9 /* fcn code for reading into a vector */
#define TTY_SETPGRP 10 /* fcn code for setpgroup */
#define TTY_EXIT 11 /* a process group leader has exited */
#define SUSPEND -998 /* used in interrupts when tty has no data */
/* Field names for messages to block and character device drivers. */
#define DEVICE m2_i1 /* major-minor device */
#define PROC_NR m2_i2 /* which (proc) wants I/O? */
#define COUNT m2_i3 /* how many bytes to transfer */
#define REQUEST m2_i3 /* ioctl request code */
#define POSITION m2_l1 /* file offset */
#define ADDRESS m2_p1 /* core buffer address */
/* Field names used in reply messages from tasks. */
#define REP_PROC_NR m2_i1 /* # of proc on whose behalf I/O was done */
#define REP_STATUS m2_i2 /* bytes transferred or error number */
/* Field names for messages to TTY driver. */
#define TTY_LINE DEVICE /* message parameter: terminal line */
#define TTY_REQUEST COUNT /* message parameter: ioctl request code */
#define TTY_SPEK POSITION/* message parameter: ioctl speed, erasing */
#define TTY_FLAGS m2_l2 /* message parameter: ioctl tty mode */
#define TTY_PGRP m2_i3 /* message parameter: process group */
/* Field names for the QIC 02 status reply from tape driver */
#define TAPE_STAT0 m2_l1
#define TAPE_STAT1 m2_l2
/* Major and minor device numbers for MEMORY driver. */
# define MEMORY_MAJOR 1 /* major device for memory devices */
# define RAM_DEV 0 /* minor device for /dev/ram */
# define MEM_DEV 1 /* minor device for /dev/mem */
# define KMEM_DEV 2 /* minor device for /dev/kmem */
# define NULL_DEV 3 /* minor device for /dev/null */
# define BOOT_DEV 4 /* minor device for /dev/boot */
# define DEV_RAM 0x0100 /* device number of /dev/ram */
# define DEV_BOOT 0x0104 /* device number of /dev/boot */
/*===========================================================================*
* Messages for networking layer *
*===========================================================================*/
/* Message types for network layer requests. */
#define NW_OPEN DEV_OPEN
#define NW_CLOSE DEV_CLOSE
#define NW_READ DEV_READ
#define NW_WRITE DEV_WRITE
#define NW_IOCTL DEV_IOCTL
#define NW_CANCEL CANCEL
/* Message types for data link layer requests. */
#define DL_WRITE 3
#define DL_WRITEV 4
#define DL_READ 5
#define DL_READV 6
#define DL_INIT 7
#define DL_STOP 8
#define DL_GETSTAT 9
/* Message type for data link layer replies. */
#define DL_INIT_REPLY 20
#define DL_TASK_REPLY 21
/* Field names for data link layer messages. */
#define DL_PORT m2_i1
#define DL_PROC m2_i2
#define DL_COUNT m2_i3
#define DL_MODE m2_l1
#define DL_CLCK m2_l2
#define DL_ADDR m2_p1
#define DL_STAT m2_l1
/* Bits in 'DL_STAT' field of DL replies. */
# define DL_PACK_SEND 0x01
# define DL_PACK_RECV 0x02
# define DL_READ_IP 0x04
/* Bits in 'DL_MODE' field of DL requests. */
# define DL_NOMODE 0x0
# define DL_PROMISC_REQ 0x2
# define DL_MULTI_REQ 0x4
# define DL_BROAD_REQ 0x8
/*===========================================================================*
* CLOCK request types and field names *
*===========================================================================*/
/* Clock library calls are dispatched via a call vector, so be careful when
* modifying the clock call numbers. The numbers here determine which call
* is made from the call vector.
*/
# define CLK_SIGNALRM 1 /* clk_signalrm(proc_nr, ticks) */
# define CLK_SYNCALRM 6 /* clk_syncalrm(proc_nr,exp_time,abs_time) */
# define CLK_FLAGALRM 7 /* clk_flagalrm(ticks, flag_ptr) */
/*===========================================================================*
* SYSTASK request types and field names *
*===========================================================================*/
/* System library calls are dispatched via a call vector, so be careful when
* modifying the system call numbers. The numbers here determine which call
* is made from the call vector.
*/
#define NR_SYS_CALLS 32 /* number of system calls */
# define SYS_TIMES 0 /* sys_times(proc_nr, bufptr) */
# define SYS_XIT 1 /* sys_xit(parent, proc) */
# define SYS_SIGCTL 3 /* sys_sigctl(req,pnr,sig,ctxt,flag,pnr,map) */
# define SYS_FORK 4 /* sys_fork(parent, child, pid) */
# define SYS_NEWMAP 5 /* sys_newmap(proc_nr, map_ptr) */
# define SYS_COPY 6 /* sys_copy(ptr) */
# define SYS_EXEC 7 /* sys_exec(proc_nr, new_sp) */
# define SYS_ABORT 9 /* sys_abort() */
# define SYS_KILL 10 /* sys_kill(proc_nr, sig) */
# define SYS_UMAP 11 /* sys_umap(proc_nr, etc) */
# define SYS_TRACE 13 /* sys_trace(req,pid,addr,data) */
# define SYS_VCOPY 14 /* sys_vcopy(src_p, dst_p, vcpy_s, vcpy_ptr) */
# define SYS_SIGNALRM 15 /* sys_signalrm(proc_nr, ticks) */
# define SYS_SYNCALRM 16 /* sys_syncalrm(proc_nr,exp_time,abs_time) */
# define SYS_FLAGALRM 17 /* sys_flagalrm(ticks, flag_ptr) */
# define SYS_SVRCTL 19 /* sys_svrctl(proc_nr, req, argp) */
# define SYS_SDEVIO 20 /* sys_sdevio(port, proc_nr, buf, count) */
# define SYS_GETINFO 22 /* sys_getinfo(what, whereto) */
# define SYS_DEVIO 23 /* sys_devio(port, value) */
# define SYS_VDEVIO 24 /* sys_vdevio(buf_ptr, nr_ports) */
# define SYS_IRQCTL 25 /* sys_irqctl() */
# define SYS_KMALLOC 26 /* sys_kmalloc(size, phys_base) */
# define SYS_IOPENABLE 27 /* sys_enable_iop() */
# define SYS_PHYS2SEG 28 /* sys_phys2seg(*seg, *off, phys) */
# define SYS_EXIT 29 /* sys_exit(status) */
# define SYS_VIRCOPY 30 /* sys_vircopy(src,seg,addr,dst,seg,addr,cnt) */
# define SYS_PHYSCOPY 31 /* sys_physcopy(src_addr,dst_addr,count) */
# define SYS_MSTATS 32
/* Field names for SYS_MEM, SYS_KMALLOC. */
#define MEM_CHUNK_BASE m4_l1 /* physical base address */
#define MEM_CHUNK_SIZE m4_l2 /* size of mem chunk */
#define MEM_TOT_SIZE m4_l3 /* total memory size */
#define MEM_CHUNK_TAG m4_l4 /* tag to identify chunk of mem */
/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
#define DIO_REQUEST m2_i3 /* device in or output */
# define DIO_INPUT 0 /* input */
# define DIO_OUTPUT 1 /* output */
#define DIO_TYPE m2_i1 /* flag indicating byte, word, or long */
# define DIO_BYTE 'b' /* byte type values */
# define DIO_WORD 'w' /* word type values */
# define DIO_LONG 'l' /* long type values */
#define DIO_PORT m2_l1 /* single port address */
#define DIO_VALUE m2_l2 /* single I/O value */
#define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */
#define DIO_VEC_SIZE m2_l2 /* number of elements in vector */
#define DIO_VEC_PROC m2_i2 /* number of process where vector is */
/* Field names for SYS_SIGNARLM, SYS_FLAGARLM, SYS_SYNCALRM. */
#define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */
#define ALRM_ABS_TIME m2_i2 /* set to 1 to use absolute alarm time */
#define ALRM_TIME_LEFT m2_l1 /* how many ticks were remaining */
#define ALRM_PROC_NR m2_i1 /* which process wants the alarm? */
#define ALRM_FLAG_PTR m2_p1 /* virtual address of timeout flag */
/* Field names for SYS_IRQCTL. */
#define IRQ_REQUEST m5_c1 /* what to do? */
# define IRQ_SETPOLICY 1 /* manage a slot of the IRQ table */
# define IRQ_ENABLE 2 /* enable interrupts */
# define IRQ_DISABLE 3 /* disable interrupts */
#define IRQ_VECTOR m5_c2 /* irq vector */
#define IRQ_POLICY m5_i1 /* options for IRQCTL request */
# define IRQ_READ_PORT 0x001 /* read port and return value */
# define IRQ_WRITE_PORT 0x002 /* write given value to port */
# define IRQ_STROBE 0x010 /* write masked value back to port */
# define IRQ_ECHO_VAL 0x020 /* write value read back to port */
# define IRQ_REENABLE 0x040 /* reenable IRQ line after interrupt */
# define IRQ_BYTE 0x100 /* byte values */
# define IRQ_WORD 0x200 /* word values */
# define IRQ_LONG 0x400 /* long values */
#define IRQ_PROC_NR m5_i2 /* process number, SELF, NONE */
#define IRQ_PORT m5_l1 /* port to read or write */
#define IRQ_VIR_ADDR m5_l2 /* address to store value read */
#define IRQ_MASK_VAL m5_l3 /* value or strobe mask */
/* Names of message field and paramaters for SYS_EXIT request. */
#define EXIT_STATUS m2_i1 /* zero for normal exit, non-zero else */
/* Field names for SYS_PHYS2SEG. */
#define SEG_SELECT m4_l1 /* segment selector returned */
#define SEG_OFFSET m4_l2 /* offset in segment returned */
#define SEG_PHYS m4_l3 /* physical address of segment */
#define SEG_SIZE m4_l4 /* segment size */
/* Field names for SYS_VIDCOPY. */
#define VID_REQUEST m4_l1 /* what to do? */
# define VID_VID_COPY 1 /* request vid_vid_copy() */
# define MEM_VID_COPY 2 /* request mem_vid_copy() */
#define VID_SRC_ADDR m4_l2 /* virtual address in memory */
#define VID_SRC_OFFSET m4_l3 /* offset in video memory */
#define VID_DST_OFFSET m4_l4 /* offset in video memory */
#define VID_CP_COUNT m4_l5 /* number of words to be copied */
/* Field names for SYS_ABORT. */
#define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */
#define ABRT_MON_PROC m1_i2 /* process where monitor params are */
#define ABRT_MON_LEN m1_i3 /* length of monitor params */
#define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */
/* Field names for SYS_COPY, _UMAP, _VIRCOPY, _PHYSCOPY. */
#define CP_SRC_SPACE m5_c1 /* T or D space (stack is also D) */
#define CP_SRC_PROC_NR m5_i1 /* process to copy from */
#define CP_SRC_ADDR m5_l1 /* address where data come from */
#define CP_DST_SPACE m5_c2 /* T or D space (stack is also D) */
#define CP_DST_PROC_NR m5_i2 /* process to copy to */
#define CP_DST_ADDR m5_l2 /* address where data go to */
#define CP_NR_BYTES m5_l3 /* number of bytes to copy */
/* Field names for SYS_VCOPY and SYS_VVIRCOPY. */
#define VCP_SRC_PROC m1_i1 /* process to copy from */
#define VCP_DST_PROC m1_i2 /* process to copy to */
#define VCP_VEC_SIZE m1_i3 /* size of copy vector */
#define VCP_VEC_ADDR m1_p1 /* pointer to copy vector */
/* Field names for SYS_GETINFO. */
#define I_REQUEST m7_i3 /* what info to get */
# define GET_KENVIRON 0 /* get kernel environment variables */
# define GET_IMAGE 1 /* get system image table */
# define GET_PROCTAB 2 /* get (kernel) process table */
# define GET_PROCNR 3 /* find nr of process with name */
# define GET_MONPARAMS 4 /* get monitor parameters */
# define GET_KENV 5 /* get kernel environment string */
# define GET_IRQTAB 6 /* get the IRQ table */
# define GET_KMESSAGES 7 /* get kernel messages */
# define GET_MEMCHUNKS 8 /* get base+size of mem chunks */
# define GET_KADDRESSES 9 /* get various kernel addresses */
# define GET_SCHEDINFO 10 /* get scheduling queues */
# define GET_PROC 11 /* get process slot if given process */
#define I_PROC_NR m7_i4 /* calling process */
#define I_VAL_PTR m7_p1 /* virtual address at caller */
#define I_VAL_LEN m7_i1 /* max length of value */
#define I_KEY_PTR m7_p2 /* virtual address of key to lookup */
#define I_KEY_LEN m7_i2 /* length of key to lookup */
/* Field names for SYS_TIMES. */
#define T_PROC_NR m4_l1 /* process to request time info for */
#define T_USER_TIME m4_l1 /* user time consumed by process */
#define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
#define T_CHILD_UTIME m4_l3 /* user time consumed by process' children */
#define T_CHILD_STIME m4_l4 /* sys time consumed by process' children */
#define T_BOOT_TICKS m4_l5 /* number of clock ticks since boot time */
/* Field names for SYS_TRACE, SYS_SVRCTL. */
#define CTL_PROC_NR m2_i1 /* process number of the caller */
#define CTL_REQUEST m2_i2 /* server control request */
#define CTL_MM_PRIV m2_i3 /* privilege as seen by MM */
#define CTL_ARG_PTR m2_p1 /* pointer to argument */
#define CTL_ADDRESS m2_l1 /* address at traced process' space */
#define CTL_DATA m2_l2 /* data field for tracing */
/* Field names for SYS_KILL, SYS_SIGCTL */
#define SIG_REQUEST m2_l2 /* MM signal control request */
#define S_GETSIG 0 /* get pending kernel signal */
#define S_ENDSIG 1 /* finish a kernel signal */
#define S_SENDSIG 2 /* POSIX style signal handling */
#define S_SIGRETURN 3 /* return from POSIX handling */
#define S_KILL 4 /* servers kills process with signal */
#define SIG_PROC m2_i1 /* process number for inform */
#define SIG_NUMBER m2_i2 /* signal number to send */
#define SIG_FLAGS m2_i3 /* signal flags field */
#define SIG_MAP m2_l1 /* used by kernel to pass signal bit map */
#define SIG_CTXT_PTR m2_p1 /* pointer to info to restore signal context */
/* Field names for SYS_FORK, _EXEC, _XIT, _GETSP, _GETMAP, _NEWMAP */
#define PR_PROC_NR m1_i1 /* indicates a (child) process */
#define PR_PPROC_NR m1_i2 /* indicates a (parent) process */
#define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
#define PR_TRACING m1_i3 /* flag to indicate tracing is on/ off */
#define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
#define PR_IP_PTR m1_p3 /* initial value for ip after exec */
#define PR_PID m1_i3 /* process id passed from MM to kernel */
#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap */
/*===========================================================================*
* Miscellaneous messages, mainly used by IS *
*===========================================================================*/
/* Miscellaneous request types and field names, e.g. used by IS server. */
#define PANIC_DUMPS 97 /* debug dumps at the TTY on RBT_PANIC */
#define FKEY_CONTROL 98 /* control a function key at the TTY */
#define FKEY_PRESSED 99 /* notify process of function key event */
# define FKEY_NUM m2_l1 /* fkey number excluding modifiers */
# define FKEY_CODE m2_l2 /* fkey code including modifiers */
# define FKEY_ENABLE m2_i1 /* enable or disable mapping */
#define DIAGNOSTICS 100 /* output a string without FS in between */
# define DIAG_PRINT_BUF m1_p1
# define DIAG_BUF_COUNT m1_i1
# define DIAG_PROC_NR m1_i2

178
include/minix/config.h Executable file
View File

@@ -0,0 +1,178 @@
#ifndef _CONFIG_H
#define _CONFIG_H
/* Minix release and version numbers. */
#define OS_RELEASE "3"
#define OS_VERSION "0.1"
/* This file sets configuration parameters for the MINIX kernel, FS, and MM.
* It is divided up into two main sections. The first section contains
* user-settable parameters. In the second section, various internal system
* parameters are set based on the user-settable parameters.
*/
/*===========================================================================*
* This section contains user-settable parameters *
*===========================================================================*/
#define MACHINE IBM_PC /* Must be one of the names listed below */
#define IBM_PC 1 /* any 8088 or 80x86-based system */
#define SUN_4 40 /* any Sun SPARC-based system */
#define SUN_4_60 40 /* Sun-4/60 (aka SparcStation 1 or Campus) */
#define ATARI 60 /* ATARI ST/STe/TT (68000/68030) */
#define AMIGA 61 /* Commodore Amiga (68000) */
#define MACINTOSH 62 /* Apple Macintosh (68000) */
/* Word size in bytes (a constant equal to sizeof(int)). */
#if __ACK__
#define _WORD_SIZE _EM_WSIZE
#endif
/* Number of slots in the process table for non-kernel processes. */
#define NR_PROCS 64
/* The buffer cache should be made as large as you can afford. */
#if (MACHINE == IBM_PC && _WORD_SIZE == 2)
#define NR_BUFS 40 /* # blocks in the buffer cache */
#define NR_BUF_HASH 64 /* size of buf hash table; MUST BE POWER OF 2*/
#endif
#if (MACHINE == IBM_PC && _WORD_SIZE == 4)
#define NR_BUFS 128 /* # blocks in the buffer cache */
#define NR_BUF_HASH 1024 /* size of buf hash table; MUST BE POWER OF 2*/
#endif
#if (MACHINE == SUN_4_60)
#define NR_BUFS 512 /* # blocks in the buffer cache (<=1536) */
#define NR_BUF_HASH 512 /* size of buf hash table; MUST BE POWER OF 2*/
#endif
/* Defines for kernel configuration. */
#define AUTO_BIOS 0 /* xt_wini.c - use Western's autoconfig BIOS */
#define LINEWRAP 1 /* console.c - wrap lines at column 80 */
#define ALLOW_GAP_MESSAGES 1 /* proc.c - allow messages in the gap between
* the end of bss and lowest stack address */
#define KMESS_BUF_SIZE 512 /* size in B for kernel messages */
/* Number of controller tasks (/dev/cN device classes). */
#define NR_CTRLRS 2
/* Enable or disable the second level file system cache on the RAM disk. */
#define ENABLE_CACHE2 0
/* Enable or disable swapping processes to disk. */
#define ENABLE_SWAP 1
/* Enable or disable kernel calls (allows for minimal kernel). */
#define ENABLE_K_TRACING 1 /* process tracing can be disabled */
#define ENABLE_K_DEBUGGING 1 /* kernel debugging calls */
/* Include or exclude device drivers. Set to 1 to include, 0 to exclude. */
#define ENABLE_BIOS_WINI 0 /* enable BIOS winchester driver */
#define ENABLE_ESDI_WINI 0 /* enable ESDI winchester driver */
#define ENABLE_XT_WINI 0 /* enable XT winchester driver */
#define ENABLE_AHA1540 0 /* enable Adaptec 1540 SCSI driver */
#define ENABLE_FATFILE 0 /* enable FAT file virtual disk driver */
#define ENABLE_DOSFILE 0 /* enable DOS file virtual disk driver */
#define ENABLE_SB16 0 /* enable Soundblaster audio driver */
#define ENABLE_PCI 1 /* enable PCI device recognition */
/* Include or exclude user-level device drivers (and supporting servers). */
#define ENABLE_PRINTER 1 /* user-level Centronics printer driver */
#define ENABLE_FLOPPY 1 /* enable floppy disk driver */
#define ENABLE_AT_WINI 1 /* enable AT winchester driver */
#define ENABLE_ATAPI 1 /* add ATAPI support to AT driver */
/* DMA_SECTORS may be increased to speed up DMA based drivers. */
#define DMA_SECTORS 1 /* DMA buffer size (must be >= 1) */
/* Enable or disable networking drivers. */
#define ENABLE_DP8390 0 /* enable DP8390 ethernet driver */
#define ENABLE_WDETH 0 /* add Western Digital WD80x3 */
#define ENABLE_NE2000 0 /* add Novell NE1000/NE2000 */
#define ENABLE_3C503 0 /* add 3Com Etherlink II (3c503) */
#define ENABLE_RTL8139 1 /* enable Realtek 8139 (rtl8139) */
/* Include or exclude backwards compatibility code. */
#define ENABLE_BINCOMPAT 0 /* for binaries using obsolete calls */
#define ENABLE_SRCCOMPAT 0 /* for sources using obsolete calls */
/* Include or exclude security sensitive code, i.e., enable or disable certain
* code sections that would allow special priviliges to user-level processes.
*/
#define ENABLE_USERPRIV 1 /* allow special user mode privileges */
/* User mode privileges. Be careful to set these security related features.
* USERBIOS allows user processes to perform INT86, GLDT86, and SLDT86 MIOC
* calls; USERIOPL set the CPU's I/O Protection Level bits so that user
* processes can access I/O on opening /dev/mem/ or /dev/kmem/. In normal
* operation, only the kernel should be trusted to do all this. Note that
* ENABLE_USERPRIV must be set to 1 to allow the features anyway.
*/
#define ENABLE_USERBIOS 0 /* enable user mode BIOS calls */
#define ENABLE_LOOSELDT 0 /* allow imprecise, page based LDT entries */
#define ENABLE_USERIOPL 1 /* enable CPU's IOPL bits for /dev/(k)mem */
/* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the
* system can handle.
*/
#define NR_CONS 4 /* # system consoles (1 to 8) */
#define NR_RS_LINES 0 /* # rs232 terminals (0 to 4) */
#define NR_PTYS 0 /* # pseudo terminals (0 to 64) */
#define ENABLE_MESSAGE_STATS 0
/*===========================================================================*
* There are no user-settable parameters after this line *
*===========================================================================*/
/* Set the CHIP type based on the machine selected. The symbol CHIP is actually
* indicative of more than just the CPU. For example, machines for which
* CHIP == INTEL are expected to have 8259A interrrupt controllers and the
* other properties of IBM PC/XT/AT/386 types machines in general. */
#define INTEL 1 /* CHIP type for PC, XT, AT, 386 and clones */
#define M68000 2 /* CHIP type for Atari, Amiga, Macintosh */
#define SPARC 3 /* CHIP type for SUN-4 (e.g. SPARCstation) */
/* Set the FP_FORMAT type based on the machine selected, either hw or sw */
#define FP_NONE 0 /* no floating point support */
#define FP_IEEE 1 /* conform IEEE floating point standard */
#if (MACHINE == IBM_PC)
#define CHIP INTEL
#endif
#if (MACHINE == ATARI) || (MACHINE == AMIGA) || (MACHINE == MACINTOSH)
#define CHIP M68000
#endif
#if (MACHINE == SUN_4) || (MACHINE == SUN_4_60)
#define CHIP SPARC
#define FP_FORMAT FP_IEEE
#endif
#if (MACHINE == ATARI) || (MACHINE == SUN_4)
#define ASKDEV 1 /* ask for boot device */
#define FASTLOAD 1 /* use multiple block transfers to init ram */
#endif
#if (ATARI_TYPE == TT) /* and all other 68030's */
#define FPP
#endif
#ifndef FP_FORMAT
#define FP_FORMAT FP_NONE
#endif
#ifndef MACHINE
error "In <minix/config.h> please define MACHINE"
#endif
#ifndef CHIP
error "In <minix/config.h> please define MACHINE to have a legal value"
#endif
#if (MACHINE == 0)
error "MACHINE has incorrect value (0)"
#endif
#endif /* _CONFIG_H */

115
include/minix/const.h Executable file
View File

@@ -0,0 +1,115 @@
/* Copyright (C) 2001 by Prentice-Hall, Inc. See the copyright notice in
* the file /usr/src/LICENSE.
*/
#ifndef CHIP
#error CHIP is not defined
#endif
#define EXTERN extern /* used in *.h files */
#define PRIVATE static /* PRIVATE x limits the scope of x */
#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
#define FORWARD static /* some compilers require this to be 'static'*/
#define TRUE 1 /* used for turning integers into Booleans */
#define FALSE 0 /* used for turning integers into Booleans */
#define HZ 60 /* clock freq (software settable on IBM-PC) */
#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
#define NULL ((void *)0) /* null pointer */
#define CPVEC_NR 16 /* max # of entries in a SYS_VCOPY request */
#define CPVVEC_NR 64 /* max # of entries in a SYS_VCOPY request */
#define NR_IOREQS MIN(NR_BUFS, 64)
/* maximum number of entries in an iorequest */
#define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
#define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
#define LOCAL_SEG 0x0000 /* flags indicating local memory segment */
#define NR_LOCAL_SEGS 3 /* # local segments per process (fixed) */
#define T 0 /* proc[i].mem_map[T] is for text */
#define D 1 /* proc[i].mem_map[D] is for data */
#define S 2 /* proc[i].mem_map[S] is for stack */
#define REMOTE_SEG 0x0100 /* flags indicating remote memory segment */
#define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
#define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
#define NR_BIOS_SEGS 3 /* # BIOS memory regions (variable) */
/* Labels used to disable code sections for different reasons. */
#define DEAD_CODE 0 /* unused code in normal configuration */
#define FUTURE_CODE 0 /* new code to be activated + tested later */
#define TEMP_CODE 1 /* active code to be removed later */
/* Process name length in the process table, including '\0'. */
#define PROC_NAME_LEN 16
/* Miscellaneous */
#define BYTE 0377 /* mask for 8 bits */
#define READING 0 /* copy data to user */
#define WRITING 1 /* copy data from user */
#define NO_NUM 0x8000 /* used as numerical argument to panic() */
#define NIL_PTR (char *) 0 /* generally useful expression */
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
/* Macros. */
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* Memory is allocated in clicks. */
#if (CHIP == INTEL)
#define CLICK_SIZE 1024 /* unit in which memory is allocated */
#define CLICK_SHIFT 10 /* log2 of CLICK_SIZE */
#endif
#if (CHIP == SPARC) || (CHIP == M68000)
#define CLICK_SIZE 4096 /* unit in which memory is allocated */
#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
#endif
/* Click to byte conversions (and vice versa). */
#define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
#define HCLICK_SIZE 16 /* hardware segment conversion magic */
#if CLICK_SIZE >= HCLICK_SIZE
#define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
#else
#define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
#endif
#define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
#define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
#define ABS -999 /* this process means absolute memory */
/* Flag bits for i_mode in the inode. */
#define I_TYPE 0170000 /* this field gives inode type */
#define I_REGULAR 0100000 /* regular file, not dir or special */
#define I_BLOCK_SPECIAL 0060000 /* block special file */
#define I_DIRECTORY 0040000 /* file is a directory */
#define I_CHAR_SPECIAL 0020000 /* character special file */
#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
#define ALL_MODES 0006777 /* all bits for user, group and others */
#define RWX_MODES 0000777 /* mode bits for RWX only */
#define R_BIT 0000004 /* Rwx protection bit */
#define W_BIT 0000002 /* rWx protection bit */
#define X_BIT 0000001 /* rwX protection bit */
#define I_NOT_ALLOC 0000000 /* this inode is free */
/* Some limits. */
#define MAX_BLOCK_NR ((block_t) 077777777) /* largest block number */
#define HIGHEST_ZONE ((zone_t) 077777777) /* largest zone number */
#define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
#define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */
#define NO_BLOCK ((block_t) 0) /* absence of a block number */
#define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
#define NO_DEV ((dev_t) 0) /* absence of a device numb */

57
include/minix/devio.h Normal file
View File

@@ -0,0 +1,57 @@
/* This file provides basic types and some constants for the
* SYS_DEVIO and SYS_VDEVIO system calls, which allow user-level
* processes to perform device I/O.
*
* Created:
* Apr 08, 2004 by Jorrit N. Herder
*/
#ifndef _DEVIO_H
#define _DEVIO_H
#include <minix/config.h> /* needed to include <minix/type.h> */
#include <sys/types.h> /* u8_t, u16_t, u32_t needed */
/* We have different granularities of port I/O: 8, 16, 32 bits.
* Also see <ibm/portio.h>, which has functions for bytes, words,
* and longs. Hence, we need different (port,value)-pair types.
*/
typedef struct { u16_t port; u8_t value; } pvb_pair_t;
typedef struct { u16_t port; u16_t value; } pvw_pair_t;
typedef struct { u16_t port; u32_t value; } pvl_pair_t;
/* Macro shorthand to set (port,value)-pair. */
#define pv_set(pv, p, v) ((pv).port = (p), (pv).value = (v))
#define pv_ptr_set(pv_ptr, p, v) ((pv_ptr)->port = (p), (pv_ptr)->value = (v))
#if 0 /* no longer in use !!! */
/* Define a number of flags to indicate granularity we are using. */
#define MASK_GRANULARITY 0x000F /* not in use! does not match flags */
#define PVB_FLAG 'b'
#define PVW_FLAG 'w'
#define PVL_FLAG 'l'
/* Flags indicating whether request wants to do input or output. */
#define MASK_IN_OR_OUT 0x00F0
#define DEVIO_INPUT 0x0010
#define DEVIO_OUTPUT 0x0020
#endif /* 0 */
#if 0 /* no longer used !!! */
/* Define how large the (port,value)-pair buffer in the kernel is.
* This buffer is used to copy the (port,value)-pairs in kernel space.
*/
#define PV_BUF_SIZE 64 /* creates char pv_buf[PV_BUF_SIZE] */
/* Note that SYS_VDEVIO sends a pointer to a vector of (port,value)-pairs,
* whereas SYS_DEVIO includes a single (port,value)-pair in the messages.
* Calculate maximum number of (port,value)-pairs that can be handled
* in a single SYS_VDEVIO system call with above struct definitions.
*/
#define MAX_PVB_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvb_pair_t))
#define MAX_PVW_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvw_pair_t))
#define MAX_PVL_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvl_pair_t))
#endif /* 0 */
#endif /* _DEVIO_H */

26
include/minix/dl_eth.h Executable file
View File

@@ -0,0 +1,26 @@
/* The eth_stat struct is used in a DL_GETSTAT request the the ehw_task. */
#ifndef _ETH_HW_H
#define _ETH_HW_H
typedef struct eth_stat
{
unsigned long ets_recvErr, /* # receive errors */
ets_sendErr, /* # send error */
ets_OVW, /* # buffer overwrite warnings */
ets_CRCerr, /* # crc errors of read */
ets_frameAll, /* # frames not alligned (# bits % 8 != 0) */
ets_missedP, /* # packets missed due to slow processing */
ets_packetR, /* # packets received */
ets_packetT, /* # packets transmitted */
ets_transDef, /* # transmission defered (Tx was busy) */
ets_collision, /* # collissions */
ets_transAb, /* # Tx aborted due to excess collisions */
ets_carrSense, /* # carrier sense lost */
ets_fifoUnder, /* # FIFO underruns (processor too busy) */
ets_fifoOver, /* # FIFO overruns (processor too busy) */
ets_CDheartbeat, /* # times unable to transmit collision sig*/
ets_OWC; /* # times out of window collision */
} eth_stat_t;
#endif /* _ETH_HW_H */

11
include/minix/fslib.h Executable file
View File

@@ -0,0 +1,11 @@
/* V1 and V2 file system disk to/from memory support functions. */
_PROTOTYPE( int bitmapsize, (bit_t _nr_bits, int block_size) );
_PROTOTYPE( unsigned conv2, (int _norm, int _w) );
_PROTOTYPE( long conv4, (int _norm, long _x) );
_PROTOTYPE( void conv_inode, (struct inode *_rip, d1_inode *_dip,
d2_inode *_dip2, int _rw_flag, int _magic) );
_PROTOTYPE( void old_icopy, (struct inode *_rip, d1_inode *_dip,
int _direction, int _norm));
_PROTOTYPE( void new_icopy, (struct inode *_rip, d2_inode *_dip,
int _direction, int _norm));

44
include/minix/ioctl.h Executable file
View File

@@ -0,0 +1,44 @@
/* minix/ioctl.h - Ioctl helper definitions. Author: Kees J. Bot
* 23 Nov 2002
*
* This file is included by every header file that defines ioctl codes.
*/
#ifndef _M_IOCTL_H
#define _M_IOCTL_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
#if _EM_WSIZE >= 4
/* Ioctls have the command encoded in the low-order word, and the size
* of the parameter in the high-order word. The 3 high bits of the high-
* order word are used to encode the in/out/void status of the parameter.
*/
#define _IOCPARM_MASK 0x1FFF
#define _IOC_VOID 0x20000000
#define _IOCTYPE_MASK 0xFFFF
#define _IOC_IN 0x40000000
#define _IOC_OUT 0x80000000
#define _IOC_INOUT (_IOC_IN | _IOC_OUT)
#define _IO(x,y) ((x << 8) | y | _IOC_VOID)
#define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
_IOC_OUT)
#define _IOW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
_IOC_IN)
#define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
_IOC_INOUT)
#else
/* No fancy encoding on a 16-bit machine. */
#define _IO(x,y) ((x << 8) | y)
#define _IOR(x,y,t) _IO(x,y)
#define _IOW(x,y,t) _IO(x,y)
#define _IORW(x,y,t) _IO(x,y)
#endif
int ioctl(int _fd, int _request, void *_data);
#endif /* _M_IOCTL_H */

107
include/minix/ipc.h Normal file
View File

@@ -0,0 +1,107 @@
#ifndef _IPC_H
#define _IPC_H
/*==========================================================================*
* Types relating to messages. *
*==========================================================================*/
#define M1 1
#define M3 3
#define M4 4
#define M3_STRING 14
typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;
typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;
typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;
typedef struct {long m4l1, m4l2, m4l3, m4l4, m4l5;} mess_4;
typedef struct {short m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5;
#if 0
typedef struct {int m6i1, m6i2, m6i3; long m6l1; char *m6c1;} mess_6;
#endif
typedef struct {int m7i1, m7i2, m7i3, m7i4; char *m7p1, *m7p2;} mess_7;
typedef struct {
int m_source; /* who sent the message */
int m_type; /* what kind of message is it */
union {
mess_1 m_m1;
mess_2 m_m2;
mess_3 m_m3;
mess_4 m_m4;
mess_5 m_m5;
#if 0
mess_6 m_m6;
#endif
mess_7 m_m7;
} m_u;
} message;
/* The following defines provide names for useful members. */
#define m1_i1 m_u.m_m1.m1i1
#define m1_i2 m_u.m_m1.m1i2
#define m1_i3 m_u.m_m1.m1i3
#define m1_p1 m_u.m_m1.m1p1
#define m1_p2 m_u.m_m1.m1p2
#define m1_p3 m_u.m_m1.m1p3
#define m2_i1 m_u.m_m2.m2i1
#define m2_i2 m_u.m_m2.m2i2
#define m2_i3 m_u.m_m2.m2i3
#define m2_l1 m_u.m_m2.m2l1
#define m2_l2 m_u.m_m2.m2l2
#define m2_p1 m_u.m_m2.m2p1
#define m3_i1 m_u.m_m3.m3i1
#define m3_i2 m_u.m_m3.m3i2
#define m3_p1 m_u.m_m3.m3p1
#define m3_ca1 m_u.m_m3.m3ca1
#define m4_l1 m_u.m_m4.m4l1
#define m4_l2 m_u.m_m4.m4l2
#define m4_l3 m_u.m_m4.m4l3
#define m4_l4 m_u.m_m4.m4l4
#define m4_l5 m_u.m_m4.m4l5
#define m5_c1 m_u.m_m5.m5c1
#define m5_c2 m_u.m_m5.m5c2
#define m5_i1 m_u.m_m5.m5i1
#define m5_i2 m_u.m_m5.m5i2
#define m5_l1 m_u.m_m5.m5l1
#define m5_l2 m_u.m_m5.m5l2
#define m5_l3 m_u.m_m5.m5l3
#if 0
#define m6_i1 m_u.m_m6.m6i1
#define m6_i2 m_u.m_m6.m6i2
#define m6_i3 m_u.m_m6.m6i3
#define m6_l1 m_u.m_m6.m6l1
#define m6_c1 m_u.m_m6.m6c1
#endif
#define m7_i1 m_u.m_m7.m7i1
#define m7_i2 m_u.m_m7.m7i2
#define m7_i3 m_u.m_m7.m7i3
#define m7_i4 m_u.m_m7.m7i4
#define m7_p1 m_u.m_m7.m7p1
#define m7_p2 m_u.m_m7.m7p2
/*==========================================================================*
* Minix run-time system (IPC). *
*==========================================================================*/
/* Hide names to avoid name space pollution. */
#define sendrec _sendrec
#define receive _receive
#define send _send
#define nb_receive _nb_receive
#define nb_send _nb_send
_PROTOTYPE( int sendrec, (int src_dest, message *m_ptr) );
_PROTOTYPE( int receive, (int src, message *m_ptr) );
_PROTOTYPE( int send, (int dest, message *m_ptr) );
_PROTOTYPE( int nb_receive, (int src, message *m_ptr) );
_PROTOTYPE( int nb_send, (int dest, message *m_ptr) );
#endif /* _IPC_H */

87
include/minix/jmp_buf.h Executable file
View File

@@ -0,0 +1,87 @@
/* This file is intended for use by assembly language programs that
* need to manipulate a jmp_buf. It may only be used by those systems
* for which a jmp_buf is identical to a struct sigcontext.
*/
#ifndef _JMP_BUF_H
#define _JMP_BUF_H
#if !defined(CHIP)
#include "error, configuration is not known"
#endif
#if (CHIP == INTEL)
#if _WORD_SIZE == 4
#define JB_FLAGS 0
#define JB_MASK 4
#define JB_GS 8
#define JB_FS 10
#define JB_ES 12
#define JB_DS 14
#define JB_DI 16
#define JB_SI 20
#define JB_BP 24
#define JB_ST 28
#define JB_BX 32
#define JB_DX 36
#define JB_CX 40
#define JB_AX 44
#define JB_RETADR 48
#define JB_IP 52
#define JB_CS 56
#define JB_PSW 60
#define JB_SP 64
#define JB_SS 68
#else /* _WORD_SIZE == 2 */
#define JB_FLAGS 0
#define JB_MASK 2
#define JB_ES 6
#define JB_DS 8
#define JB_DI 10
#define JB_SI 12
#define JB_BP 14
#define JB_ST 16
#define JB_BX 18
#define JB_DX 20
#define JB_CX 22
#define JB_AX 24
#define JB_RETADR 26
#define JB_IP 28
#define JB_CS 30
#define JB_PSW 32
#define JB_SP 34
#define JB_SS 36
#endif /* _WORD_SIZE == 2 */
#else /* !(CHIP == INTEL) */
#if (CHIP == M68000)
#define JB_FLAGS 0
#define JB_MASK 2
#define JB_RETREG 6
#define JB_D1 10
#define JB_D2 14
#define JB_D3 18
#define JB_D4 22
#define JB_D5 26
#define JB_D6 20
#define JB_D7 34
#define JB_A0 38
#define JB_A1 42
#define JB_A2 46
#define JB_A3 50
#define JB_A4 54
#define JB_A5 58
#define JB_A6 62
#define JB_SP 66
#define JB_PC 70
#define JB_PSW 74
#else /* !(CHIP == INTEL) && !(CHIP == M68000) */
#include "error, CHIP is not supported"
#endif /* (CHIP == INTEL) */
/* Defines from C headers needed in assembly code. The headers have too
* much C stuff to used directly.
*/
#define SIG_BLOCK 0 /* must agree with <signal.h> */
#define SC_SIGCONTEXT 2 /* must agree with <sys/sigcontext.h> */
#define SC_NOREGLOCALS 4 /* must agree with <sys/sigcontext.h> */
#endif /* _JMP_BUF_H */

146
include/minix/keymap.h Executable file
View File

@@ -0,0 +1,146 @@
/* keymap.h - defines for keymapping Author: Marcus Hampel
*/
#ifndef _SYS__KEYMAP_H
#define _SYS__KEYMAP_H
#define C(c) ((c) & 0x1F) /* Map to control code */
#define A(c) ((c) | 0x80) /* Set eight bit (ALT) */
#define CA(c) A(C(c)) /* Control-Alt */
#define L(c) ((c) | HASCAPS) /* Add "Caps Lock has effect" attribute */
#define EXT 0x0100 /* Normal function keys */
#define CTRL 0x0200 /* Control key */
#define SHIFT 0x0400 /* Shift key */
#define ALT 0x0800 /* Alternate key */
#define EXTKEY 0x1000 /* extended keycode */
#define HASCAPS 0x8000 /* Caps Lock has effect */
/* Scan code conversion. */
#define KEY_RELEASE 0200
#define ASCII_MASK 0177
/* Numeric keypad */
#define HOME (0x01 + EXT)
#define END (0x02 + EXT)
#define UP (0x03 + EXT)
#define DOWN (0x04 + EXT)
#define LEFT (0x05 + EXT)
#define RIGHT (0x06 + EXT)
#define PGUP (0x07 + EXT)
#define PGDN (0x08 + EXT)
#define MID (0x09 + EXT)
#define NMIN (0x0A + EXT)
#define PLUS (0x0B + EXT)
#define INSRT (0x0C + EXT)
/* Alt + Numeric keypad */
#define AHOME (0x01 + ALT)
#define AEND (0x02 + ALT)
#define AUP (0x03 + ALT)
#define ADOWN (0x04 + ALT)
#define ALEFT (0x05 + ALT)
#define ARIGHT (0x06 + ALT)
#define APGUP (0x07 + ALT)
#define APGDN (0x08 + ALT)
#define AMID (0x09 + ALT)
#define ANMIN (0x0A + ALT)
#define APLUS (0x0B + ALT)
#define AINSRT (0x0C + ALT)
/* Ctrl + Numeric keypad */
#define CHOME (0x01 + CTRL)
#define CEND (0x02 + CTRL)
#define CUP (0x03 + CTRL)
#define CDOWN (0x04 + CTRL)
#define CLEFT (0x05 + CTRL)
#define CRIGHT (0x06 + CTRL)
#define CPGUP (0x07 + CTRL)
#define CPGDN (0x08 + CTRL)
#define CMID (0x09 + CTRL)
#define CNMIN (0x0A + CTRL)
#define CPLUS (0x0B + CTRL)
#define CINSRT (0x0C + CTRL)
/* Lock keys */
#define CALOCK (0x0D + EXT) /* caps lock */
#define NLOCK (0x0E + EXT) /* number lock */
#define SLOCK (0x0F + EXT) /* scroll lock */
/* Function keys */
#define F1 (0x10 + EXT)
#define F2 (0x11 + EXT)
#define F3 (0x12 + EXT)
#define F4 (0x13 + EXT)
#define F5 (0x14 + EXT)
#define F6 (0x15 + EXT)
#define F7 (0x16 + EXT)
#define F8 (0x17 + EXT)
#define F9 (0x18 + EXT)
#define F10 (0x19 + EXT)
#define F11 (0x1A + EXT)
#define F12 (0x1B + EXT)
/* Alt+Fn */
#define AF1 (0x10 + ALT)
#define AF2 (0x11 + ALT)
#define AF3 (0x12 + ALT)
#define AF4 (0x13 + ALT)
#define AF5 (0x14 + ALT)
#define AF6 (0x15 + ALT)
#define AF7 (0x16 + ALT)
#define AF8 (0x17 + ALT)
#define AF9 (0x18 + ALT)
#define AF10 (0x19 + ALT)
#define AF11 (0x1A + ALT)
#define AF12 (0x1B + ALT)
/* Ctrl+Fn */
#define CF1 (0x10 + CTRL)
#define CF2 (0x11 + CTRL)
#define CF3 (0x12 + CTRL)
#define CF4 (0x13 + CTRL)
#define CF5 (0x14 + CTRL)
#define CF6 (0x15 + CTRL)
#define CF7 (0x16 + CTRL)
#define CF8 (0x17 + CTRL)
#define CF9 (0x18 + CTRL)
#define CF10 (0x19 + CTRL)
#define CF11 (0x1A + CTRL)
#define CF12 (0x1B + CTRL)
/* Shift+Fn */
#define SF1 (0x10 + SHIFT)
#define SF2 (0x11 + SHIFT)
#define SF3 (0x12 + SHIFT)
#define SF4 (0x13 + SHIFT)
#define SF5 (0x14 + SHIFT)
#define SF6 (0x15 + SHIFT)
#define SF7 (0x16 + SHIFT)
#define SF8 (0x17 + SHIFT)
#define SF9 (0x18 + SHIFT)
#define SF10 (0x19 + SHIFT)
#define SF11 (0x1A + SHIFT)
#define SF12 (0x1B + SHIFT)
/* Alt+Shift+Fn */
#define ASF1 (0x10 + ALT + SHIFT)
#define ASF2 (0x11 + ALT + SHIFT)
#define ASF3 (0x12 + ALT + SHIFT)
#define ASF4 (0x13 + ALT + SHIFT)
#define ASF5 (0x14 + ALT + SHIFT)
#define ASF6 (0x15 + ALT + SHIFT)
#define ASF7 (0x16 + ALT + SHIFT)
#define ASF8 (0x17 + ALT + SHIFT)
#define ASF9 (0x18 + ALT + SHIFT)
#define ASF10 (0x19 + ALT + SHIFT)
#define ASF11 (0x1A + ALT + SHIFT)
#define ASF12 (0x1B + ALT + SHIFT)
#define MAP_COLS 6 /* Number of columns in keymap */
#define NR_SCAN_CODES 0x80 /* Number of scan codes (rows in keymap) */
typedef unsigned short keymap_t[NR_SCAN_CODES * MAP_COLS];
#define KEY_MAGIC "KMAZ" /* Magic number of keymap file */
#endif /* _SYS__KEYMAP_H */

23
include/minix/minlib.h Executable file
View File

@@ -0,0 +1,23 @@
#ifndef _MINLIB
#define _MINLIB
#ifndef _ANSI_H
#include <ansi.h>
#endif
/* Miscellaneous BSD. */
_PROTOTYPE(void swab, (char *_from, char *_to, int _count));
_PROTOTYPE(char *itoa, (int _n));
_PROTOTYPE(char *getpass, (const char *_prompt));
/* Miscellaneous MINIX. */
_PROTOTYPE(void std_err, (char *_s));
_PROTOTYPE(void prints, (const char *_s, ...));
_PROTOTYPE(int fsversion, (char *_dev, char *_prog));
_PROTOTYPE(int getprocessor, (void));
_PROTOTYPE(int load_mtab, (char *_prog_name));
_PROTOTYPE(int rewrite_mtab, (char *_prog_name));
_PROTOTYPE(int get_mtab_entry, (char *_s1, char *_s2, char *_s3, char *_s4));
_PROTOTYPE(int put_mtab_entry, (char *_s1, char *_s2, char *_s3, char *_s4));
#endif

21
include/minix/partition.h Executable file
View File

@@ -0,0 +1,21 @@
/* minix/partition.h Author: Kees J. Bot
* 7 Dec 1995
* Place of a partition on disk and the disk geometry,
* for use with the DIOCGETP and DIOCSETP ioctl's.
*/
#ifndef _MINIX__PARTITION_H
#define _MINIX__PARTITION_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
struct partition {
u64_t base; /* byte offset to the partition start */
u64_t size; /* number of bytes in the partition */
unsigned cylinders; /* disk geometry */
unsigned heads;
unsigned sectors;
};
#endif /* _MINIX__PARTITION_H */

View File

@@ -0,0 +1,36 @@
#ifndef __SERVERASSERT_H
#define __SERVERASSERT_H
/* This file contains functions and macros used for debugging within
* system servers. Also see <assert.h> which is used in regular programs.
*/
#ifndef NDEBUG /* 8086 must do without training wheels. */
#define NDEBUG (_WORD_SIZE == 2)
#endif
#if !NDEBUG
#define INIT_SERVER_ASSERT static char *server_assert_file= __FILE__;
void server_assert_failed(char *file, int line, char *what);
void server_compare_failed(char *file, int line, int lhs, char *what, int rhs);
#define server_assert(x) (!(x) ? server_assert_failed( \
server_assert_file, __LINE__, #x) : (void) 0)
#define server_compare(a,t,b) (!((a) t (b)) ? server_compare_failed( \
server_assert_file, __LINE__, (a), #a " " #t " " #b, (b)) : (void) 0)
#else /* NDEBUG */
#define INIT_SERVER_ASSERT /* nothing */
#define server_assert(x) (void) 0
#define server_compare(a,t,b) (void) 0
#endif /* NDEBUG */
#endif /* __SERVERASSERT_H */

46
include/minix/sound.h Executable file
View File

@@ -0,0 +1,46 @@
/* Definitions used by /dev/audio and /dev/mixer.
*
* Feb 13 1995 Author: Michel R. Prevenier
*/
#ifndef SOUND_H
#define SOUND_H
/* ------- Mixer stuff ------- */
/* Available devices */
enum Device
{
Master, /* Master volume */
Dac, /* DSP, digitized sound */
Fm, /* Fm synthesized sound */
Cd, /* Compact */
Line, /* Line in */
Mic, /* Microphone */
Speaker, /* Pc speaker */
Treble, /* Treble */
Bass /* Bass */
};
enum InputState
{
ON, OFF
};
/* Volume levels range from 0 to 31, bass & treble range from 0 to 15 */
struct volume_level
{
enum Device device;
int left;
int right;
};
struct inout_ctrl
{
enum Device device;
enum InputState left;
enum InputState right;
};
#endif /* SOUND_H */

48
include/minix/swap.h Executable file
View File

@@ -0,0 +1,48 @@
/*
minix/swap.h
Defines the super block of swap partitions and some useful constants.
Created: Aug 2, 1992 by Philip Homburg
*/
#ifndef _MINIX__SWAP_H
#define _MINIX__SWAP_H
/* Two possible layouts for a partition with swapspace:
*
* Sector Swap partition FS+swap partition
*
* 0 - 1 bootblock bootblock
* 2 swap header FS header
* 3 blank swap header
* 4 - m swapspace file system
* m+1 - n - swapspace
*/
#define SWAP_MAGIC0 0x9D
#define SWAP_MAGIC1 0xC3
#define SWAP_MAGIC2 0x01
#define SWAP_MAGIC3 0x82
typedef struct swap_hdr
{
u8_t sh_magic[4];
u8_t sh_version;
u8_t sh_dummy[3];
u32_t sh_offset;
u32_t sh_swapsize;
i32_t sh_priority;
} swap_hdr_t;
#define SWAP_BOOTOFF 1024
#define SWAP_OFFSET 2048
#define OPTSWAP_BOOTOFF (1024+512)
#define SH_VERSION 1
#define SH_PRIORITY 0
#endif /* _MINIX__SWAP_H */
/*
* $PchId: swap.h,v 1.6 1996/04/10 20:25:48 philip Exp $
*/

169
include/minix/syslib.h Executable file
View File

@@ -0,0 +1,169 @@
/* Prototypes for system library functions.
*
* Changes:
* Nov 15, 2004 unified sys_sigctl calls (Jorrit N. Herder)
* Oct 28, 2004 added nb_send, nb_receive (Jorrit N. Herder)
* Oct 26, 2004 added sys_sdevio (Jorrit N. Herder)
* Oct 18, 2004 added sys_irqctl (Jorrit N. Herder)
* Oct 10, 2004 removed sys_findproc (Jorrit N. Herder)
* Sep 23, 2004 added sys_getsig (Jorrit N. Herder)
* Sep 09, 2004 added sys_physcopy, sys_vircopy (Jorrit N. Herder)
* Sep 02, 2004 added sys_exit (Jorrit N. Herder)
* Aug 15, 2004 added sys_getinfo (Jorrit N. Herder)
* Jul 23, 2004 added sys_umap (Jorrit N. Herder)
* Jul 13, 2004 added sys_enable_iop, sys_phys2seg (Jorrit N. Herder)
* Mar 20, 2004 added sys_devio, sys_vdevio (Jorrit N. Herder)
*/
#ifndef _SYSLIB_H
#define _SYSLIB_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
#ifndef _IPC_H
#include <minix/ipc.h>
#endif
#ifndef _DEVIO_H
#include <minix/devio.h>
#endif
/*==========================================================================*
* Minix system library. *
*==========================================================================*/
_PROTOTYPE( int printf, (const char *fmt, ...) );
_PROTOTYPE( void kputc, (int c) );
_PROTOTYPE( int _taskcall, (int who, int syscallnr, message *msgptr) );
_PROTOTYPE( int sys_abort, (int how, ...) );
_PROTOTYPE( int sys_adjmap, (int proc, struct mem_map *ptr,
vir_clicks data_clicks, vir_clicks sp) );
_PROTOTYPE( int sys_copy, (int src_proc, int src_seg, phys_bytes src_vir,
int dst_proc, int dst_seg, phys_bytes dst_vir, phys_bytes bytes));
_PROTOTYPE( int sys_exec, (int proc, char *ptr, int traced,
char *aout, vir_bytes initpc) );
_PROTOTYPE( int sys_execmap, (int proc, struct mem_map *ptr) );
_PROTOTYPE( int sys_fork, (int parent, int child, int pid) );
_PROTOTYPE( int sys_getsp, (int proc, vir_bytes *newsp) );
_PROTOTYPE( int sys_newmap, (int proc, struct mem_map *ptr) );
_PROTOTYPE( int sys_getmap, (int proc, struct mem_map *ptr) );
_PROTOTYPE( int sys_times, (int proc_nr, clock_t *ptr) );
_PROTOTYPE( int sys_getuptime, (clock_t *ticks) );
_PROTOTYPE( int sys_trace, (int req, int proc, long addr, long *data_p) );
_PROTOTYPE( int sys_xit, (int parent, int proc) );
_PROTOTYPE( int sys_kill, (int proc, int sig) );
_PROTOTYPE( int sys_svrctl, (int proc, int req, int priv,vir_bytes argp));
/*==========================================================================*
* New prototypes since MINIX release 2 (Jorrit N. Herder) *
*==========================================================================*/
/* Shorthands for sys_sdevio() system call. */
#define sys_insb(port, proc_nr, buffer, count) \
sys_sdevio(DIO_INPUT, port, DIO_BYTE, proc_nr, buffer, count)
#define sys_insw(port, proc_nr, buffer, count) \
sys_sdevio(DIO_INPUT, port, DIO_WORD, proc_nr, buffer, count)
#define sys_outsb(port, proc_nr, buffer, count) \
sys_sdevio(DIO_OUTPUT, port, DIO_BYTE, proc_nr, buffer, count)
#define sys_outsw(port, proc_nr, buffer, count) \
sys_sdevio(DIO_OUTPUT, port, DIO_WORD, proc_nr, buffer, count)
_PROTOTYPE( int sys_sdevio, (int req, long port, int type, int proc_nr,
void *buffer, int count) );
/* Clock functionality: (un)schedule an alarm call. */
_PROTOTYPE(int sys_flagalrm, (clock_t ticks, int *flag_ptr) );
_PROTOTYPE(int sys_signalrm, (int proc_nr, clock_t *ticks) );
_PROTOTYPE(int sys_syncalrm, (int proc_nr, clock_t exp_time, int abs_time) );
/* Shorthands for sys_irqctl() system call. */
#define sys_irqdisable(irq_vec) \
sys_irqctl(IRQ_DISABLE, irq_vec, 0, 0, 0, 0, 0)
#define sys_irqenable(irq_vec) \
sys_irqctl(IRQ_ENABLE, irq_vec, 0, 0, 0, 0, 0)
#define sys_irqsetpolicy(irq_vec, policy, proc_nr, port, val_ptr, mask_val) \
sys_irqctl(IRQ_SETPOLICY, irq_vec, policy, proc_nr, port, val_ptr, mask_val)
_PROTOTYPE ( int sys_irqctl, (int request, int irq_vec, int policy,
int proc_nr, long port, void *val_ptr, long mask_val) );
/* Shorthands for sys_vircopy() system call. */
#define sys_biosin(bios_vir, dst_vir, bytes) \
sys_vircopy(SELF, BIOS_SEG, bios_vir, SELF, D, dst_vir, bytes)
#define sys_biosout(src_vir, bios_vir, bytes) \
sys_vircopy(SELF, D, src_vir, SELF, BIOS_SEG, bios_vir, bytes)
#define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
#define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, T, src_vir, dst_proc, T, dst_vir, bytes)
#define sys_stackcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, S, src_vir, dst_proc, S, dst_vir, bytes)
_PROTOTYPE(int sys_vircopy, (int src_proc, int src_seg, vir_bytes src_vir,
int dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes) );
_PROTOTYPE(int sys_physcopy, (phys_bytes src_phys, phys_bytes dst_phys,
phys_bytes bytes) );
_PROTOTYPE(int sys_umap, (int proc_nr, int seg, vir_bytes vir_addr,
vir_bytes bytes, phys_bytes *phys_addr) );
_PROTOTYPE(int sys_phys2seg, (u16_t *seg,vir_bytes *off,phys_bytes phys, vir_bytes size));
_PROTOTYPE(int sys_enable_iop, (int proc_nr) );
_PROTOTYPE(int sys_kmalloc, (size_t size, phys_bytes *phys_base) );
/* Shorthands for sys_getinfo() system call. */
#define sys_getkmessages(dst) sys_getinfo(GET_KMESSAGES, dst, 0,0,0)
#define sys_getkenviron(dst) sys_getinfo(GET_KENVIRON, dst, 0,0,0)
#define sys_getproctab(dst) sys_getinfo(GET_PROCTAB, dst, 0,0,0)
#define sys_getproc(dst,nr) sys_getinfo(GET_PROC, dst, 0,0, nr)
#define sys_getprocnr(dst,k,kl) sys_getinfo(GET_PROCNR, dst, 0,k,kl)
#define sys_getimage(dst) sys_getinfo(GET_IMAGE, dst, 0,0,0)
#define sys_getirqtab(dst) sys_getinfo(GET_IRQTAB, dst, 0,0,0)
#define sys_getmemchunks(dst) sys_getinfo(GET_MEMCHUNKS, dst, 0,0,0)
#define sys_getmonparams(v,vl) sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
#define sys_getkenv(k,kl,v,vl) sys_getinfo(GET_KENV, v,vl, k,kl)
#define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
#define sys_getkaddr(dst) sys_getinfo(GET_KADDRESSES, dst, 0,0,0)
_PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
void *key_ptr, int key_len) );
_PROTOTYPE(int sys_exit, (int status) );
/* Shorthands for sys_sigctl() system call. */
#define sys_getsig(proc_nr, sig_map) \
sys_sigctl(S_GETSIG, 0,0,0, proc_nr, sig_map)
#define sys_endsig(proc_nr) \
sys_sigctl(S_ENDSIG, proc_nr, 0,0,0,0)
#define sys_sendsig(proc_nr, sig_ctxt) \
sys_sigctl(S_SENDSIG, proc_nr, sig_ctxt, 0,0,0)
#define sys_sigreturn(proc_nr, sig_ctxt, flags) \
sys_sigctl(S_SIGRETURN, proc_nr, sig_ctxt, flags, 0,0)
_PROTOTYPE(int sys_sigctl, (int request, int proc_nr, struct sigmsg *sig_ctxt,
int flags, int *k_proc_nr, sigset_t *k_sig_map) );
/* NOTE: two different approaches were used to distinguish the device I/O
* types 'byte', 'word', 'long': the latter uses #define and results in a
* smaller implementation, but looses the static type checking.
*/
_PROTOTYPE(int sys_voutb, (pvb_pair_t *pvb_pairs, int nr_ports) );
_PROTOTYPE(int sys_voutw, (pvw_pair_t *pvw_pairs, int nr_ports) );
_PROTOTYPE(int sys_voutl, (pvl_pair_t *pvl_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinb, (pvb_pair_t *pvb_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinw, (pvw_pair_t *pvw_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinl, (pvl_pair_t *pvl_pairs, int nr_ports) );
/* Shorthands for sys_out() system call. */
#define sys_outb(p,v) sys_out((p), (unsigned long) (v), DIO_BYTE)
#define sys_outw(p,v) sys_out((p), (unsigned long) (v), DIO_WORD)
#define sys_outl(p,v) sys_out((p), (unsigned long) (v), DIO_LONG)
_PROTOTYPE(int sys_out, (int port, unsigned long value, int type) );
/* Shorthands for sys_in() system call. */
#define sys_inb(p,v) sys_in((p), (unsigned long*) (v), DIO_BYTE)
#define sys_inw(p,v) sys_in((p), (unsigned long*) (v), DIO_WORD)
#define sys_inl(p,v) sys_in((p), (unsigned long*) (v), DIO_LONG)
_PROTOTYPE(int sys_in, (int port, unsigned long *value, int type) );
#endif /* _SYSLIB_H */

103
include/minix/type.h Executable file
View File

@@ -0,0 +1,103 @@
#ifndef _TYPE_H
#define _TYPE_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
/* Type definitions. */
typedef unsigned int vir_clicks; /* virtual addresses and lengths in clicks */
typedef unsigned long phys_bytes;/* physical addresses and lengths in bytes */
typedef unsigned int phys_clicks;/* physical addresses and lengths in clicks */
#if (CHIP == INTEL)
typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */
#endif
#if (CHIP == M68000)
typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
#endif
#if (CHIP == SPARC)
typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
#endif
struct mem_map {
vir_clicks mem_vir; /* virtual address */
phys_clicks mem_phys; /* physical address */
vir_clicks mem_len; /* length */
};
struct far_mem {
phys_clicks mem_phys; /* physical address */
vir_clicks mem_len; /* length */
};
typedef struct {
vir_bytes iov_addr; /* address of an I/O buffer */
vir_bytes iov_size; /* sizeof an I/O buffer */
} iovec_t;
typedef struct {
vir_bytes cpv_src; /* src address of data */
vir_bytes cpv_dst; /* dst address of data */
vir_bytes cpv_size; /* size of data */
} cpvec_t;
/* virtual copy vector */
typedef struct {
int cpvv_src_seg, cpvv_dst_seg; /* src & dst segments */
vir_bytes cpvv_src; /* src address of data */
vir_bytes cpvv_dst; /* dst address of data */
vir_bytes cpvv_size; /* size of data */
} cpvvec_t;
/* MM passes the address of a structure of this type to KERNEL when
* do_sendsig() is invoked as part of the signal catching mechanism.
* The structure contain all the information that KERNEL needs to build
* the signal stack.
*/
struct sigmsg {
int sm_signo; /* signal number being caught */
unsigned long sm_mask; /* mask to restore when handler returns */
vir_bytes sm_sighandler; /* address of handler */
vir_bytes sm_sigreturn; /* address of _sigreturn in C library */
vir_bytes sm_stkptr; /* user stack pointer */
};
#define MESS_SIZE (sizeof(message)) /* might need usizeof from fs here */
#define NIL_MESS ((message *) 0)
struct psinfo { /* information for the ps(1) program */
u16_t nr_tasks, nr_procs; /* NR_TASKS and NR_PROCS constants. */
vir_bytes proc, mproc, fproc; /* addresses of the main process tables. */
};
/* This is used to obtain system information through SYS_GETINFO. */
struct kenviron {
int pc_at;
int ps_mca;
int processor;
int protected;
int ega;
int vga;
vir_bytes proc_addr; /* virtual address of process table */
phys_bytes kmem_base; /* kernel memory layout (/dev/kmem) */
phys_bytes kmem_size;
phys_bytes bootfs_base; /* FS image from boot image (/dev/boot) */
phys_bytes bootfs_size;
phys_bytes params_base; /* parameters passed by boot monitor */
phys_bytes params_size;
};
/* The kernel outputs messages in a local buffer, which can be requested and
* printed by the TTY driver. The buffer structure is defined here.
*/
struct kmessages {
int km_next; /* next index to write */
int km_size; /* current size in buffer */
char km_buf[KMESS_BUF_SIZE]; /* buffer for messages */
};
#endif /* _TYPE_H */

33
include/minix/u64.h Executable file
View File

@@ -0,0 +1,33 @@
/* minix/u64.h Author: Kees J. Bot
* 7 Dec 1995
* Functions to manipulate 64 bit disk addresses.
*/
#ifndef _MINIX__U64_H
#define _MINIX__U64_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
u64_t add64(u64_t i, u64_t j);
u64_t add64u(u64_t i, unsigned j);
u64_t add64ul(u64_t i, unsigned long j);
u64_t sub64(u64_t i, u64_t j);
u64_t sub64u(u64_t i, unsigned j);
u64_t sub64ul(u64_t i, unsigned long j);
unsigned diff64(u64_t i, u64_t j);
u64_t cvu64(unsigned i);
u64_t cvul64(unsigned long i);
unsigned cv64u(u64_t i);
unsigned long cv64ul(u64_t i);
unsigned long div64u(u64_t i, unsigned j);
unsigned rem64u(u64_t i, unsigned j);
u64_t mul64u(unsigned long i, unsigned j);
int cmp64(u64_t i, u64_t j);
int cmp64u(u64_t i, unsigned j);
int cmp64ul(u64_t i, unsigned long j);
unsigned long ex64lo(u64_t i);
unsigned long ex64hi(u64_t i);
u64_t make64(unsigned long lo, unsigned long hi);
#endif /* _MINIX__U64_H */

52
include/minix/utils.h Normal file
View File

@@ -0,0 +1,52 @@
#ifndef _EXTRALIB_H
#define _EXTRALIB_H
/* Extra system library definitions to support device drivers and servers.
*
* Created:
* Mar 15, 2004 by Jorrit N. Herder
*
* Changes:
* Mar 18, 2005: added tick_delay
* Mar 15, 2005: added get_proc_nr
* Oct 01, 2004: added env_parse, env_prefix, env_panic
* Jul 13, 2004: added fkey_ctl
* Apr 28, 2004: added server_report, server_panic, server_assert
* Mar 31, 2004: setup like other libraries, such as syslib
*/
/*==========================================================================*
* Miscellaneous helper functions.
*==========================================================================*/
#include <minix/serverassert.h>
/* Environment parsing return values. */
#define EP_BUF_SIZE 128 /* local buffer for env value */
#define EP_UNSET 0 /* variable not set */
#define EP_OFF 1 /* var = off */
#define EP_ON 2 /* var = on (or field left blank) */
#define EP_SET 3 /* var = 1:2:3 (nonblank field) */
#define EP_EGETKENV 4 /* sys_getkenv() failed ... */
_PROTOTYPE(int get_mon_param, (char *key, char *value, int max_size) );
_PROTOTYPE(int env_prefix, (char *env, char *prefix) );
_PROTOTYPE(void env_panic, (char *key) );
_PROTOTYPE(int env_parse, (char *env, char *fmt, int field, long *param,
long min, long max) );
#define fkey_enable(fkey) fkey_ctl(fkey, 1)
#define fkey_disable(fkey) fkey_ctl(fkey, 0)
_PROTOTYPE(int fkey_ctl, (int fkey_code, int enable_disable) );
_PROTOTYPE(void server_report, (char *who, char *mess, int num) );
_PROTOTYPE(void server_panic, (char *who, char *mess, int num) );
#define get_own_proc_nr(where) get_proc_nr((where), NULL)
_PROTOTYPE(int get_proc_nr, (int *proc_nr, char *proc_name) );
_PROTOTYPE(int tick_delay, (clock_t ticks));
#endif /* _EXTRALIB_H */