Move shared headers in common/include

Headers that will be shared between old includes and NetBSD-like includes
are moved into common/include tree. They are still copied in /usr/include
in 'make includes', so compilation and programs aren't be affected.
This commit is contained in:
Gianluca Guida
2011-02-06 22:59:02 +00:00
parent 0203ea37bf
commit fa59fc6eb4
71 changed files with 66 additions and 25 deletions

View File

@@ -1,76 +0,0 @@
/* The <minix/ansi.h> header attempts to decide whether the compiler has enough
* conformance to Standard C for Minix to take advantage of. If so, the
* symbol _ANSI is defined (as 31459). Otherwise _ANSI is not defined
* here, but it may be defined by applications that want to bend the rules.
* The magic number in the definition is to inhibit unnecessary bending
* of the rules. (For consistency with the new '#ifdef _ANSI" tests in
* the headers, _ANSI should really be defined as nothing, but that would
* break many library routines that use "#if _ANSI".)
* If _ANSI ends up being defined, a macro
*
* _PROTOTYPE(function, params)
*
* is defined. This macro expands in different ways, generating either
* ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)
* prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc
* in such a way that they are portable over both ANSI and K&R compilers.
* The appropriate macros are defined here.
*/
#ifndef _MINIX_ANSI_H
#define _MINIX_ANSI_H
#if __STDC__ == 1
#define _ANSI 31459 /* compiler claims full ANSI conformance */
#endif
#ifdef __GNUC__
#define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */
#endif
#define _VOIDSTAR void *
#define _VOID void
#ifdef _ANSI
/* Keep everything for ANSI prototypes. */
#define _PROTOTYPE(function, params) function params
#define _ARGS(params) params
#define _CONST const
#define _VOLATILE volatile
#define _SIZET size_t
#else
/* Throw away the parameters for K&R prototypes. */
#define _PROTOTYPE(function, params) function()
#define _ARGS(params) ()
#define _CONST
#define _VOLATILE
#define _SIZET int
#endif /* _ANSI */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
#define __LONG_LONG_SUPPORTED 1
#endif
/* This should be defined as restrict when a C99 compiler is used. */
#define _RESTRICT
/* Setting any of _MINIX, _POSIX_C_SOURCE or _POSIX2_SOURCE implies
* _POSIX_SOURCE. (Seems wrong to put this here in ANSI space.)
*/
#if defined(_MINIX) || _POSIX_C_SOURCE > 0 || defined(_POSIX2_SOURCE)
#undef _POSIX_SOURCE
#define _POSIX_SOURCE 1
#endif
/* What is a va_list? */
#include <stdarg.h>
#define _BSD_VA_LIST_ va_list
#endif /* _MINIX_ANSI_H */

View File

@@ -1,20 +0,0 @@
#ifndef _BITMAP_H
#define _BITMAP_H
/* Bit map operations to manipulate bits of a simple mask variable. */
#define bit_set(mask, n) ((mask) |= (1 << (n)))
#define bit_unset(mask, n) ((mask) &= ~(1 << (n)))
#define bit_isset(mask, n) ((mask) & (1 << (n)))
#define bit_empty(mask) ((mask) = 0)
#define bit_fill(mask) ((mask) = ~0)
/* Definitions previously in kernel/const.h */
#define BITCHUNK_BITS (sizeof(bitchunk_t) * CHAR_BIT)
#define BITMAP_CHUNKS(nr_bits) (((nr_bits)+BITCHUNK_BITS-1)/BITCHUNK_BITS)
#define MAP_CHUNK(map,bit) (map)[((bit)/BITCHUNK_BITS)]
#define CHUNK_OFFSET(bit) ((bit)%BITCHUNK_BITS)
#define GET_BIT(map,bit) ( MAP_CHUNK(map,bit) & (1 << CHUNK_OFFSET(bit) ))
#define SET_BIT(map,bit) ( MAP_CHUNK(map,bit) |= (1 << CHUNK_OFFSET(bit) ))
#define UNSET_BIT(map,bit) ( MAP_CHUNK(map,bit) &= ~(1 << CHUNK_OFFSET(bit) ))
#endif /* _BITMAP_H */

View File

@@ -1,121 +0,0 @@
#define NCALLS 113 /* 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 MINIX_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 SYMLINK 45
#define SETGID 46
#define GETGID 47
#define SIGNAL 48
#define RDLNK 49
#define LSTAT 50
#define IOCTL 54
#define FCNTL 55
#define FS_READY 57
#define EXEC 59
#define UMASK 60
#define CHROOT 61
#define SETSID 62
#define GETPGRP 63
#define ITIMER 64
#define GETGROUPS 65
#define SETGROUPS 66
#define GETMCONTEXT 67
#define SETMCONTEXT 68
/* Posix signal handling. */
#define SIGACTION 71
#define SIGSUSPEND 72
#define SIGPENDING 73
#define SIGPROCMASK 74
#define SIGRETURN 75
#define REBOOT 76
#define SVRCTL 77
#define SYSUNAME 78
#define GETSYSINFO 79 /* to PM or VFS (obsolete) */
#define GETDENTS 80 /* to VFS */
#define LLSEEK 81 /* to VFS */
#define FSTATFS 82 /* to VFS */
#define STATVFS 83 /* to VFS */
#define FSTATVFS 84 /* to VFS */
#define SELECT 85 /* to VFS */
#define FCHDIR 86 /* to VFS */
#define FSYNC 87 /* to VFS */
#define GETPRIORITY 88 /* to PM */
#define SETPRIORITY 89 /* to PM */
#define GETTIMEOFDAY 90 /* to PM */
#define SETEUID 91 /* to PM */
#define SETEGID 92 /* to PM */
#define TRUNCATE 93 /* to VFS */
#define FTRUNCATE 94 /* to VFS */
#define FCHMOD 95 /* to VFS */
#define FCHOWN 96 /* to VFS */
#define GETSYSINFO_UP 97 /* to PM (obsolete) */
#define SPROF 98 /* to PM */
#define CPROF 99 /* to PM */
/* Calls provided by PM and FS that are not part of the API */
#define EXEC_NEWMEM 100 /* from VFS or RS to PM: new memory map for
* exec
*/
#define SRV_FORK 101 /* to PM: special fork call for RS */
#define EXEC_RESTART 102 /* to PM: final part of exec for RS */
#define PROCSTAT 103 /* to PM */
#define GETPROCNR 104 /* to PM */
#define GETEPINFO 107 /* to PM: get pid/uid/gid of an endpoint */
#define ADDDMA 108 /* to PM: inform PM about a region of memory
* that is used for bus-master DMA
*/
#define DELDMA 109 /* to PM: inform PM that a region of memory
* that is no longer used for bus-master DMA
*/
#define GETDMA 110 /* to PM: ask PM for a region of memory
* that should not be used for bus-master DMA
* any longer
*/
#define SRV_KILL 111 /* to PM: special kill call for RS */
#define GCOV_FLUSH 112 /* flush gcov data from server to gcov files */
#define TASK_REPLY 121 /* to VFS: reply code from drivers, not
* really a standalone call.
*/
#define MAPDRIVER 122 /* to VFS, map a device */

File diff suppressed because it is too large Load Diff

View File

@@ -1,49 +0,0 @@
/* Definitions for compiler-specific features. */
#ifndef _MINIX_COMPILER_H
#define _MINIX_COMPILER_H
/*===========================================================================*
* Compiler overrides *
*===========================================================================*/
/* ACK */
#ifdef __ACK__
#include <minix/compiler-ack.h>
#endif
/*===========================================================================*
* Default values *
*===========================================================================*/
/*
* cdecl calling convention expects the callee to pop the hidden pointer on
* struct return. For example, GCC and LLVM comply with this (tested on IA32).
*/
#ifndef BYTES_TO_POP_ON_STRUCT_RETURN
#define BYTES_TO_POP_ON_STRUCT_RETURN $4
#endif
/*
* cdecl calling convention requires to push arguments on the stack in a
* reverse order to easily support variadic arguments. Thus, instead of
* using the proper stdarg.h macros (that nowadays are
* compiler-dependant), it may be tempting to directly take the address of
* the last argument and considering it as the start of an array. This is
* a shortcut that avoid looping to get all the arguments as the CPU
* already pushed them on the stack before the call to the function.
*
* Unfortunately, such an assumption is strictly compiler-dependant and
* compilers are free to move the last argument on the stack, as a local
* variable, and return the address of the location where the argument was
* stored, if asked for. This will break things as the rest of the array's
* argument are stored elsewhere (typically, a couple of words above the
* location where the argument was stored).
*
* Conclusion: if unsure on what the compiler may do, do not make any
* assumption and use the right (typically compiler-dependant) macros.
*/
#ifndef FUNC_ARGS_ARRAY
#define FUNC_ARGS_ARRAY 0
#endif
#endif /* _MINIX_COMPILER_H */

View File

@@ -1,125 +0,0 @@
#ifndef _CONFIG_H
#define _CONFIG_H
/* Minix release and version numbers. */
#define OS_RELEASE "3"
#define OS_VERSION "1.9"
/* This file sets configuration parameters for the MINIX kernel, FS, and PM.
* 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.
*
* Parts of config.h have been moved to sys_config.h, which can be included
* by other include files that wish to get at the configuration data, but
* don't want to pollute the users namespace. Some editable values have
* gone there.
*
*/
/* The MACHINE (called _MINIX_MACHINE) setting can be done
* in <minix/machine.h>.
*/
#include <minix/sys_config.h>
#define MACHINE _MINIX_MACHINE
#define IBM_PC _MACHINE_IBM_PC
/* Number of slots in the process table for non-kernel processes. The number
* of system processes defines how many processes with special privileges
* there can be. User processes share the same properties and count for one.
*
* These can be changed in sys_config.h.
*/
#define NR_PROCS _NR_PROCS
#define NR_SYS_PROCS _NR_SYS_PROCS
#define NR_SYS_CHUNKS BITMAP_CHUNKS(NR_SYS_PROCS)
/* Number of controller tasks (/dev/cN device classes). */
#define NR_CTRLRS 2
/* DMA_SECTORS may be increased to speed up DMA based drivers. */
#define DMA_SECTORS 1 /* DMA buffer size (must be >= 1) */
/* Which processes should receive diagnostics from the kernel and system?
* Directly sending it to TTY only displays the output. Sending it to the
* log driver will cause the diagnostics to be buffered and displayed.
* Messages are sent by src/lib/sysutil/kputc.c to these processes, in
* the order of this array, which must be terminated by NONE. This is used
* by drivers and servers that printf().
* The kernel does this for its own kprintf() in kernel/utility.c, also using
* this array, but a slightly different mechanism.
*/
#define OUTPUT_PROCS_ARRAY { TTY_PROC_NR, LOG_PROC_NR, NONE }
/* 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 4 /* # rs232 terminals (0 to 4) */
#define NR_PTYS 32 /* # pseudo terminals (0 to 64) */
/* This feature enable the counting of system calls in PM and FS */
#define ENABLE_SYSCALL_STATS 0
/* Max. number of I/O ranges that can be assigned to a process */
#define NR_IO_RANGE 64
/* Max. number of device memory ranges that can be assigned to a process */
#define NR_MEM_RANGE 20
/* Max. number of IRQs that can be assigned to a process */
#define NR_IRQ 8
/* Scheduling priorities. Values must start at zero (highest
* priority) and increment.
*/
#define NR_SCHED_QUEUES 16 /* MUST equal minimum priority + 1 */
#define TASK_Q 0 /* highest, used for kernel tasks */
#define MAX_USER_Q 0 /* highest priority for user processes */
#define USER_Q ((MIN_USER_Q - MAX_USER_Q) / 2 + MAX_USER_Q) /* default
(should correspond to nice 0) */
#define MIN_USER_Q (NR_SCHED_QUEUES - 1) /* minimum priority for user
processes */
/* default scheduling quanta */
#define USER_QUANTUM 200
/* defualt user process cpu */
#define USER_DEFAULT_CPU -1 /* use the default cpu or do not change the
current one */
/*===========================================================================*
* 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 _CHIP_INTEL /* CHIP type for PC, XT, AT, 386 and clones */
#define M68000 _CHIP_M68000 /* CHIP type for Atari, Amiga, Macintosh */
#define SPARC _CHIP_SPARC /* 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 _FP_NONE /* no floating point support */
#define FP_IEEE _FP_IEEE /* conform IEEE floating point standard */
/* _MINIX_CHIP is defined in sys_config.h. */
#define CHIP _MINIX_CHIP
/* _MINIX_FP_FORMAT is defined in sys_config.h. */
#define FP_FORMAT _MINIX_FP_FORMAT
/* _ASKDEV and _FASTLOAD are defined in sys_config.h. */
#define ASKDEV _ASKDEV
#define FASTLOAD _FASTLOAD
/* Enable or disable system profiling. */
#define SPROFILE 1 /* statistical profiling */
#define CPROFILE 0 /* call profiling */
/* PCI configuration parameters */
#define NR_PCIBUS 40
#define NR_PCIDEV 50
#endif /* _CONFIG_H */

View File

@@ -1,195 +0,0 @@
#ifndef _MINIX_CONST_H
#define _MINIX_CONST_H
#ifndef CHIP
#error CHIP is not defined
#endif
/* The UNUSED annotation tells the compiler or lint not to complain
* about an unused variable or function parameter.
*
* A number of different annotations are used, depending on the
* compiler or checker that is looking at the code.
*
* Note that some variants rename the parameter, so if you use
* the parameter after all, you'll get a complaint about a missing
* variable.
*
* You use it like this:
*
* void foo(int UNUSED(x)){}
*/
#ifndef UNUSED
#if defined _lint
# define UNUSED(v) /*lint -e(715,818)*/ v
#elif defined(__GNUC__)
# define UNUSED(v) UNUSED_ ## v __attribute((unused))
#elif defined __LCLINT__
# define UNUSED(v) /*@unused@*/ v
#else
# define UNUSED(v) _UNUSED_ ## v
#endif
#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 DEFAULT_HZ 60 /* clock freq (software settable on IBM-PC) */
#define SUPER_USER ((uid_t) 0) /* uid_t of superuser */
#include <sys/null.h> /* NULL Pointer */
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
#define NR_IOREQS 64
/* maximum number of entries in an iorequest */
/* Message passing constants. */
#define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
/* Memory related constants. */
#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) */
#define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
#define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
#define VM_D (LOCAL_VM_SEG | D)
#define VM_T (LOCAL_VM_SEG | T)
#define MEM_GRANT 3
#define VM_GRANT (LOCAL_VM_SEG | MEM_GRANT)
/* 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 PM 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 HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
/* Memory is allocated in clicks. */
#if (CHIP == INTEL)
#define CLICK_SIZE 4096 /* unit in which memory is allocated */
#define CLICK_SHIFT 12 /* 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 alignment macros. */
#define CLICK_FLOOR(n) (((vir_bytes)(n) / CLICK_SIZE) * CLICK_SIZE)
#define CLICK_CEIL(n) CLICK_FLOOR((vir_bytes)(n) + CLICK_SIZE-1)
/* Sizes of memory tables. The boot monitor distinguishes three memory areas,
* namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
* for DOS MINIX.
*/
#define NR_MEMS 8
/* 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_UNIX_SOCKET 0140000 /* unix domain socket */
#define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
#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 I_SET_STCKY_BIT 0001000 /* sticky bit */
#define ALL_MODES 0007777 /* 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_INODE_NR ((ino_t) 037777777777) /* largest inode number */
#define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
#define UMAX_FILE_POS ((unsigned) 0x7FFFFFFF) /* largest legal file offset */
#define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
#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 */
#define NO_LINK ((nlink_t) 0) /* absence of incoming links */
#define INVAL_UID ((uid_t) -1) /* invalid uid value */
#define INVAL_GID ((gid_t) -1) /* invalid gid value */
#define SERVARNAME "cttyline"
/* Bits for the system property flags in boot image processes. */
#define PROC_FULLVM 0x100 /* VM sets and manages full pagetable */
/* Bits for s_flags in the privilege structure. */
#define PREEMPTIBLE 0x002 /* kernel tasks are not preemptible */
#define BILLABLE 0x004 /* some processes are not billable */
#define DYN_PRIV_ID 0x008 /* privilege id assigned dynamically */
#define SYS_PROC 0x010 /* system processes have own priv structure */
#define CHECK_IO_PORT 0x020 /* check if I/O request is allowed */
#define CHECK_IRQ 0x040 /* check if IRQ can be used */
#define CHECK_MEM 0x080 /* check if (VM) mem map request is allowed */
#define ROOT_SYS_PROC 0x100 /* this is a root system process instance */
#define VM_SYS_PROC 0x200 /* this is a vm system process instance */
#define LU_SYS_PROC 0x400 /* this is a live updated sys proc instance */
#define RST_SYS_PROC 0x800 /* this is a restarted sys proc instance */
/* Bits for device driver flags managed by RS and VFS. */
#define DRV_FORCED 0x01 /* driver is mapped even if not alive yet */
/* Values for the "verbose" boot monitor variable */
#define VERBOSEBOOT_QUIET 0
#define VERBOSEBOOT_BASIC 1
#define VERBOSEBOOT_EXTRA 2
#define VERBOSEBOOT_MAX 3
#define VERBOSEBOOTVARNAME "verbose"
/* magic value to put in struct proc entries for sanity checks. */
#define PMAGIC 0xC0FFEE1
#endif /* _MINIX_CONST_H */

View File

@@ -1,22 +0,0 @@
#ifndef _MINIX_DEBUG_H
#define _MINIX_DEBUG_H 1
/* For reminders of things to be fixed. */
#define FIXME(str) { static int fixme_warned = 0; \
if(!fixme_warned) { \
printf("FIXME: %s:%d: %s\n", __FILE__, __LINE__, str);\
fixme_warned = 1; \
} \
}
#define NOT_REACHABLE do { \
panic("NOT_REACHABLE at %s:%d", __FILE__, __LINE__); \
for(;;); \
} while(0)
#define NOT_IMPLEMENTED do { \
panic("NOT_IMPLEMENTED at %s:%d", __FILE__, __LINE__); \
} while(0)
#endif /* _MINIX_DEBUG_H */

View File

@@ -1,68 +0,0 @@
/* 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/sys_config.h> /* needed to include <minix/type.h> */
#include <minix/types.h> /* u8_t, u16_t, u32_t needed */
typedef u16_t port_t;
/* 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) do { \
u32_t _p = (p), _v = (v); \
(pv).port = _p; \
(pv).value = _v; \
if((pv).port != _p || (pv).value != _v) { \
printf("%s:%d: actual port: 0x%x != 0x%lx || " \
"actual value: 0x%x != 0x%lx\n", \
__FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
panic("pv_set(" #pv ", " #p ", " #v ")"); \
} \
} while(0)
#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 */

View File

@@ -1,77 +0,0 @@
/* Prototypes and definitions for DS interface. */
#ifndef _MINIX_DS_H
#define _MINIX_DS_H
#include <minix/types.h>
#include <minix/endpoint.h>
/* Flags. */
#define DSF_IN_USE 0x001 /* entry is in use */
#define DSF_PRIV_RETRIEVE 0x002 /* only owner can retrieve */
#define DSF_PRIV_OVERWRITE 0x004 /* only owner can overwrite */
#define DSF_PRIV_SNAPSHOT 0x004 /* only owner can take a snapshot */
#define DSF_PRIV_SUBSCRIBE 0x008 /* only owner can subscribe */
#define DSF_TYPE_U32 0x010 /* u32 data type */
#define DSF_TYPE_STR 0x020 /* string data type */
#define DSF_TYPE_MEM 0x040 /* memory range data type */
#define DSF_TYPE_MAP 0x080 /* mapped memory range data type */
#define DSF_TYPE_LABEL 0x100 /* label data type */
#define DSF_MASK_TYPE 0xFF0 /* mask for type flags. */
#define DSF_MASK_INTERNAL 0xFFF /* mask for internal flags. */
#define DSF_OVERWRITE 0x01000 /* overwrite if entry exists */
#define DSF_INITIAL 0x02000 /* check subscriptions immediately */
#define DSMF_MAP_MAPPED 0x10000 /* map mapped memory range */
#define DSMF_COPY_MAPPED 0x20000 /* copy mapped memory range */
#define DSMF_COPY_SNAPSHOT 0x40000 /* copy snapshot */
/* DS constants. */
#define DS_MAX_KEYLEN 80 /* Max length of a key, including '\0'. */
/* DS events. */
#define DS_DRIVER_UP 1
/* ds.c */
/* U32 */
_PROTOTYPE( int ds_publish_u32, (const char *name, u32_t val, int flags));
_PROTOTYPE( int ds_retrieve_u32, (const char *name, u32_t *val));
_PROTOTYPE( int ds_delete_u32, (const char *ds_name));
/* STRING */
_PROTOTYPE( int ds_publish_str, (const char *name, char *val, int flags));
_PROTOTYPE( int ds_retrieve_str, (const char *name, char *val, size_t len));
_PROTOTYPE( int ds_delete_str, (const char *ds_name));
/* MEM */
_PROTOTYPE( int ds_publish_mem, (const char *ds_name, void *vaddr,
size_t length, int flags));
_PROTOTYPE( int ds_retrieve_mem, (const char *ds_name, char *vaddr,
size_t *length));
_PROTOTYPE( int ds_delete_mem, (const char *ds_name));
/* MAP */
_PROTOTYPE( int ds_publish_map, (const char *ds_name, void *vaddr,
size_t length, int flags));
_PROTOTYPE( int ds_snapshot_map, (const char *ds_name, int *nr_snapshot));
_PROTOTYPE( int ds_retrieve_map, (const char *ds_name, char *vaddr,
size_t *length, int nr_snapshot, int flags));
_PROTOTYPE( int ds_delete_map, (const char *ds_name));
/* LABEL */
_PROTOTYPE( int ds_publish_label, (const char *ds_name, endpoint_t endpoint,
int flags));
_PROTOTYPE( int ds_retrieve_label_name, (char *ds_name, endpoint_t endpoint));
_PROTOTYPE( int ds_retrieve_label_endpt, (const char *ds_name,
endpoint_t *endpoint));
_PROTOTYPE( int ds_delete_label, (const char *ds_name));
/* Subscribe and check. */
_PROTOTYPE( int ds_subscribe, (const char *regex, int flags));
_PROTOTYPE( int ds_check, (char *ds_name, int *type, endpoint_t *owner_e));
#endif /* _MINIX_DS_H */

View File

@@ -1,28 +0,0 @@
#ifndef _MINIX_ENDPOINT_H
#define _MINIX_ENDPOINT_H 1
#include <minix/sys_config.h>
#include <minix/com.h>
#include <limits.h>
#include <minix/type.h>
/* The point of the padding in 'generation size' is to
* allow for certain bogus endpoint numbers such as NONE, ANY, etc.
*
* The _MAX_MAGIC_PROC is defined by <minix/com.h>. That include
* file defines some magic process numbers such as ANY and NONE,
* and must never be a valid endpoint number. Therefore we make sure
* the generation size is big enough to start the next generation
* above the highest magic number.
*/
#define _ENDPOINT_GENERATION_SIZE (MAX_NR_TASKS+_MAX_MAGIC_PROC+1)
#define _ENDPOINT_MAX_GENERATION (INT_MAX/_ENDPOINT_GENERATION_SIZE-1)
/* Generation + Process slot number <-> endpoint. */
#define _ENDPOINT(g, p) ((endpoint_t)((g) * _ENDPOINT_GENERATION_SIZE + (p)))
#define _ENDPOINT_G(e) (((e)+MAX_NR_TASKS) / _ENDPOINT_GENERATION_SIZE)
#define _ENDPOINT_P(e) \
((((e)+MAX_NR_TASKS) % _ENDPOINT_GENERATION_SIZE) - MAX_NR_TASKS)
#endif

View File

@@ -1,16 +0,0 @@
#include <sys/types.h>
#include <lib.h>
#include <stdlib.h>
#include <minix/syslib.h>
/* opcodes for use in gcov buffer */
#define GCOVOP_OPEN 23
#define GCOVOP_WRITE 24
#define GCOVOP_CLOSE 25
#define GCOVOP_END 26
/* More information on the GCOV Minix Wiki page. */
int gcov_flush_svr(char *buff, int buff_sz, int server_nr);
extern void __gcov_flush (void);
int do_gcov_flush_impl(message *msg);

View File

@@ -1,68 +0,0 @@
/* 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 <minix/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 0x0FFF
#define _IOCPARM_MASK_BIG 0x0FFFFF
#define _IOC_VOID 0x20000000
#define _IOCTYPE_MASK 0xFFFF
#define _IOC_IN 0x40000000
#define _IOC_OUT 0x80000000
#define _IOC_INOUT (_IOC_IN | _IOC_OUT)
/* Flag indicating ioctl format with only one type field, and more bits
* for the size field (using mask _IOCPARM_MASK_BIG).
*/
#define _IOC_BIG 0x10000000
#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)
#define _IOW_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
| _IOC_IN | _IOC_BIG)
#define _IOR_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
| _IOC_OUT | _IOC_BIG)
#define _IORW_BIG(y,t) (y | ((sizeof(t) & _IOCPARM_MASK_BIG) << 8) \
| _IOC_INOUT | _IOC_BIG)
/* Decode an ioctl call. */
#define _MINIX_IOCTL_SIZE(i) (((i) >> 16) & _IOCPARM_MASK)
#define _MINIX_IOCTL_IOR(i) ((i) & _IOC_OUT)
#define _MINIX_IOCTL_IORW(i) ((i) & _IOC_INOUT)
#define _MINIX_IOCTL_IOW(i) ((i) & _IOC_IN)
/* Recognize and decode size of a 'big' ioctl call. */
#define _MINIX_IOCTL_BIG(i) ((i) & _IOC_BIG)
#define _MINIX_IOCTL_SIZE_BIG(i) (((i) >> 8) & _IOCPARM_MASK_BIG)
#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 */

View File

@@ -1,159 +0,0 @@
#ifndef _IPC_H
#define _IPC_H
#include <minix/ipcconst.h>
#include <minix/type.h>
/*==========================================================================*
* Types relating to messages. *
*==========================================================================*/
#define M1 1
#define M3 3
#define M4 4
#define M3_STRING 14 /* legacy m3_ca1 size (must not be changed) */
#define M3_LONG_STRING 16 /* current m3_ca1 size (may be increased) */
typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;
typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;
short m2s1;} mess_2;
typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_LONG_STRING];} mess_3;
typedef struct {long m4l1, m4l2, m4l3, m4l4, m4l5;} mess_4;
typedef struct {short m5s1, m5s2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5;
typedef struct {long m6l1, m6l2, m6l3; short m6s1, m6s2, m6s3; char m6c1, m6c2;
char *m6p1, *m6p2;} mess_6;
typedef struct {int m7i1, m7i2, m7i3, m7i4, m7i5; char *m7p1, *m7p2;} mess_7;
typedef struct {int m8i1, m8i2; char *m8p1, *m8p2, *m8p3, *m8p4;} mess_8;
typedef struct {long m9l1, m9l2, m9l3, m9l4, m9l5;
short m9s1, m9s2, m9s3, m9s4; } mess_9;
typedef struct {
endpoint_t 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;
mess_7 m_m7;
mess_8 m_m8;
mess_6 m_m6;
mess_9 m_m9;
} 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 m2_s1 m_u.m_m2.m2s1
#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_s1 m_u.m_m5.m5s1
#define m5_s2 m_u.m_m5.m5s2
#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
#define m6_l1 m_u.m_m6.m6l1
#define m6_l2 m_u.m_m6.m6l2
#define m6_l3 m_u.m_m6.m6l3
#define m6_s1 m_u.m_m6.m6s1
#define m6_s2 m_u.m_m6.m6s2
#define m6_s3 m_u.m_m6.m6s3
#define m6_c1 m_u.m_m6.m6c1
#define m6_c2 m_u.m_m6.m6c2
#define m6_p1 m_u.m_m6.m6p1
#define m6_p2 m_u.m_m6.m6p2
#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_i5 m_u.m_m7.m7i5
#define m7_p1 m_u.m_m7.m7p1
#define m7_p2 m_u.m_m7.m7p2
#define m8_i1 m_u.m_m8.m8i1
#define m8_i2 m_u.m_m8.m8i2
#define m8_p1 m_u.m_m8.m8p1
#define m8_p2 m_u.m_m8.m8p2
#define m8_p3 m_u.m_m8.m8p3
#define m8_p4 m_u.m_m8.m8p4
#define m9_l1 m_u.m_m9.m9l1
#define m9_l2 m_u.m_m9.m9l2
#define m9_l3 m_u.m_m9.m9l3
#define m9_l4 m_u.m_m9.m9l4
#define m9_l5 m_u.m_m9.m9l5
#define m9_s1 m_u.m_m9.m9s1
#define m9_s2 m_u.m_m9.m9s2
#define m9_s3 m_u.m_m9.m9s3
#define m9_s4 m_u.m_m9.m9s4
/*==========================================================================*
* Minix run-time system (IPC). *
*==========================================================================*/
/* Datastructure for asynchronous sends */
typedef struct asynmsg
{
unsigned flags;
endpoint_t dst;
int result;
message msg;
} asynmsg_t;
/* Defines for flags field */
#define AMF_EMPTY 0 /* slot is not inuse */
#define AMF_VALID 1 /* slot contains message */
#define AMF_DONE 2 /* Kernel has processed the message. The
* result is stored in 'result'
*/
#define AMF_NOTIFY 4 /* Send a notification when AMF_DONE is set */
#define AMF_NOREPLY 8 /* Not a reply message for a SENDREC */
/* Hide names to avoid name space pollution. */
#define echo _echo
#define notify _notify
#define sendrec _sendrec
#define receive _receive
#define send _send
#define sendnb _sendnb
#define senda _senda
_PROTOTYPE( int echo, (message *m_ptr) );
_PROTOTYPE( int notify, (endpoint_t dest) );
_PROTOTYPE( int sendrec, (endpoint_t src_dest, message *m_ptr) );
_PROTOTYPE( int receive, (endpoint_t src, message *m_ptr, int *status_ptr));
_PROTOTYPE( int send, (endpoint_t dest, message *m_ptr) );
_PROTOTYPE( int sendnb, (endpoint_t dest, message *m_ptr) );
_PROTOTYPE( int senda, (asynmsg_t *table, size_t count) );
_PROTOTYPE( int _do_kernel_call, (message *m_ptr) );
#endif /* _IPC_H */

View File

@@ -1,29 +0,0 @@
#ifndef _IPC_CONST_H
#define _IPC_CONST_H
/* System call numbers that are passed when trapping to the kernel. */
#define SEND 1 /* blocking send */
#define RECEIVE 2 /* blocking receive */
#define SENDREC 3 /* SEND + RECEIVE */
#define NOTIFY 4 /* asynchronous notify */
#define SENDNB 5 /* nonblocking send */
#define SENDA 16 /* asynchronous send */
#define IPCNO_HIGHEST SENDA
/* Macros for IPC status code manipulation. */
#define IPC_STATUS_CALL_SHIFT 0
#define IPC_STATUS_CALL_MASK 0x3F
#define IPC_STATUS_CALL(status) \
(((status) >> IPC_STATUS_CALL_SHIFT) & IPC_STATUS_CALL_MASK)
#define IPC_STATUS_CALL_TO(call) \
(((call) & IPC_STATUS_CALL_MASK) << IPC_STATUS_CALL_SHIFT)
#define IPC_FLG_MSG_FROM_KERNEL 1 /* this message originated in the kernel on
behalf of a process, this is a trusted
message, never reply to the sender
*/
#define IPC_STATUS_FLAGS_SHIFT 16
#define IPC_STATUS_FLAGS(flgs) ((flgs) << IPC_STATUS_FLAGS_SHIFT)
#define IPC_STATUS_FLAGS_TEST(status, flgs) \
(((status) >> IPC_STATUS_FLAGS_SHIFT) & (flgs))
#endif /* IPC_CONST_H */

View File

@@ -1,146 +0,0 @@
/* 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 */

View File

@@ -1,12 +0,0 @@
/* The <minix/limits.h> header defines the Minix values for some MINIX
* constants. Both the MINIX constants and the non-posix constants
* refer to these underlying definitions.
*/
#ifndef _MINIX_LIMITS_H
#define _MINIX_LIMITS_H
#define __MINIX_OPEN_MAX 255 /* a process may have 255 files open */
#define __MINIX_PATH_MAX 255 /* a pathname may contain 255 chars */
#endif /* _MINIX_LIMITS_H */

View File

@@ -1,34 +0,0 @@
#ifndef _MINLIB
#define _MINLIB
#ifndef _MINIX_ANSI_H
#include <minix/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, (const char *_s));
_PROTOTYPE(void prints, (const char *_s, ...));
_PROTOTYPE(int fsversion, (char *_dev, char *_prog));
_PROTOTYPE(int getprocessor, (void));
_PROTOTYPE(void _cpuid, (u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx));
_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));
/* read_tsc() and friends */
_PROTOTYPE(void read_tsc, (u32_t *hi, u32_t *lo));
_PROTOTYPE(void read_tsc_64, (u64_t *t));
/* return values for fsversion */
#define FSVERSION_MFS1 0x00001
#define FSVERSION_MFS2 0x00002
#define FSVERSION_MFS3 0x00003
#define FSVERSION_EXT2 0x10002
#endif

View File

@@ -1,23 +0,0 @@
/*
minix/portio.h
Created: Jan 15, 1992 by Philip Homburg
*/
#ifndef _PORTIO_H_
#define _PORTIO_H_
#ifndef _TYPES_H
#include <minix/types.h>
#endif
unsigned inb(u16_t _port);
unsigned inw(u16_t _port);
unsigned inl(u16_t _port);
void outb(u16_t _port, u8_t _value);
void outw(u16_t _port, u16_t _value);
void outl(u16_t _port, u32_t _value);
void intr_disable(void);
void intr_enable(void);
#endif /* _PORTIO_H_ */

View File

@@ -1,99 +0,0 @@
/* Privilege-related definitions. */
#ifndef _MINIX_PRIV_H
#define _MINIX_PRIV_H
#include <minix/com.h>
#include <minix/config.h>
/* Static privilege id definitions. */
#define NR_STATIC_PRIV_IDS NR_BOOT_PROCS
#define is_static_priv_id(id) (id >= 0 && id < NR_STATIC_PRIV_IDS)
#define static_priv_id(n) (NR_TASKS + (n))
/* Unprivileged user processes all share the privilege structure of the
* user processesess.
* This id must be fixed because it is used to check send mask entries.
*/
#define USER_PRIV_ID static_priv_id(ROOT_USR_PROC_NR)
/* Specifies a null privilege id.
*/
#define NULL_PRIV_ID (-1)
/* Allowed targets. */
#define NO_M (-1) /* no targets allowed */
#define ALL_M (-2) /* all targets allowed */
/* Allowed calls. */
#define NO_C (-1) /* no calls allowed */
#define ALL_C (-2) /* all calls allowed */
#define NULL_C (-3) /* null call entry */
/*
* Default privilege settings used in the system
*/
/* privilege flags */
#define IDL_F (SYS_PROC | BILLABLE) /* idle task is not preemptible as we
* don't want it to interfere with the
* timer tick interrupt handler code.
* Unlike other processes idle task is
* handled in a special way and is
* preempted always if timer tick occurs
* and there is another runnable process
*/
#define TSK_F (SYS_PROC) /* other kernel tasks */
#define SRV_F (SYS_PROC | PREEMPTIBLE) /* system services */
#define DSRV_F (SRV_F | DYN_PRIV_ID) /* dynamic system services */
#define RSYS_F (SRV_F | ROOT_SYS_PROC) /* root sys proc */
#define VM_F (SYS_PROC | VM_SYS_PROC) /* vm */
#define USR_F (BILLABLE | PREEMPTIBLE) /* user processes */
#define IMM_F (ROOT_SYS_PROC | VM_SYS_PROC | PREEMPTIBLE) /* immutable */
/* allowed traps */
#define CSK_T (1 << RECEIVE) /* clock and system */
#define TSK_T 0 /* other kernel tasks */
#define SRV_T (~0) /* system services */
#define DSRV_T (~0) /* dynamic system services */
#define USR_T (1 << SENDREC) /* user processes */
/* allowed targets */
#define TSK_M NO_M /* all kernel tasks */
#define SRV_M ALL_M /* system services */
#define DSRV_M ALL_M /* dynamic system services */
#define USR_M ALL_M /* user processes */
/* allowed kernel calls */
#define TSK_KC NO_C /* all kernel tasks */
#define SRV_KC ALL_C /* dynamic system services */
#define DSRV_KC ALL_C /* default sys proc */
#define USR_KC NO_C /* user processes */
/* allowed vm calls */
#define SRV_VC ALL_C /* dynamic system services */
#define DSRV_VC ALL_C /* default sys proc */
#define USR_VC ALL_C /* user processes */
/* signal manager */
#define SRV_SM ROOT_SYS_PROC_NR /* system services */
#define DSRV_SM ROOT_SYS_PROC_NR /* dynamic system services */
#define USR_SM PM_PROC_NR /* user processes */
/* scheduler */
#define SRV_SCH KERNEL /* system services */
#define DSRV_SCH SCHED_PROC_NR /* dynamic system services */
#define USR_SCH NONE /* user processes */
/* scheduling priority queue. */
#define SRV_Q USER_Q /* system services */
#define DSRV_Q USER_Q /* dynamic system services */
#define USR_Q USER_Q /* user processes */
/* scheduling quantum. */
#define SRV_QT USER_QUANTUM /* system services */
#define DSRV_QT USER_QUANTUM /* dynamic system services */
#define USR_QT USER_QUANTUM /* user processes */
/* default CPU */
#define DSRV_CPU USER_DEFAULT_CPU
#endif /* _MINIX_PRIV_H */

View File

@@ -1,114 +0,0 @@
#ifndef _PROFILE_H
#define _PROFILE_H
#include <minix/ansi.h>
#include <minix/type.h>
/*
* Types relating to system profiling. Types are supplied for both
* statistical profiling and call profiling.
*/
#if SPROFILE
# define PROF_START 0 /* start statistical profiling */
# define PROF_STOP 1 /* stop statistical profiling */
#define PROF_RTC 0 /* RTC based profiling */
#define PROF_NMI 1 /* NMI based profiling, profiles kernel too */
/* Info struct to be copied to from kernel to user program. */
struct sprof_info_s {
int mem_used;
int total_samples;
int idle_samples;
int system_samples;
int user_samples;
} sprof_info_inst;
/* What a profiling sample looks like (used for sizeof()). */
struct sprof_sample {
endpoint_t proc;
void * pc;
};
struct sprof_proc {
endpoint_t proc;
char name[8];
};
#endif /* SPROFILE */
#include <minix/types.h>
# define PROF_GET 2 /* get call profiling tables */
# define PROF_RESET 3 /* reset call profiling tables */
/* Hash table size in each profiled process is table size + index size.
*
* Table size = CPROF_TABLE_SIZE * (CPROF_CPATH_MAX_LEN + 16).
* Index size = CPROF_INDEX_SIZE * 4;
*
* Making CPROF_CPATH_MAX_LEN too small may cause call path overruns.
* Making CPROF_TABLE_SIZE too small may cause table overruns.
*
* There are some restrictions: processes in the boot image are loaded
* below 16 MB and the kernel is loaded in lower memory (below 640 kB). The
* latter is reason to use a different size for the kernel table.
*/
#define CPROF_TABLE_SIZE_OTHER 3000 /* nr of slots in hash table */
#define CPROF_TABLE_SIZE_KERNEL 1500 /* kernel has a smaller table */
#define CPROF_CPATH_MAX_LEN 256 /* len of cpath string field: */
/* MUST BE MULTIPLE OF WORDSIZE */
#define CPROF_INDEX_SIZE (10*1024)/* size of index to hash table */
#define CPROF_STACK_SIZE 24 /* size of call stack */
#define CPROF_PROCNAME_LEN 8 /* len of proc name field */
#define CPROF_CPATH_OVERRUN 0x1 /* call path overrun */
#define CPROF_STACK_OVERRUN 0x2 /* call stack overrun */
#define CPROF_TABLE_OVERRUN 0x4 /* hash table overrun */
#define CPROF_ANNOUNCE_OTHER 1 /* processes announce their profiling
* data on n-th entry of procentry */
#define CPROF_ACCOUNCE_KERNEL 10000 /* kernel announces not directly */
/* Prototype for function called by procentry to get size of table. */
_PROTOTYPE(int profile_get_tbl_size, (void) );
/* Prototype for function called by procentry to get announce number. */
_PROTOTYPE(int profile_get_announce, (void) );
/* Prototype for function called by procentry to announce control struct
* and table locations to the kernel. */
_PROTOTYPE(void profile_register, (void *ctl_ptr, void *tbl_ptr) );
/* Info struct to be copied from kernel to user program. */
struct cprof_info_s {
int mem_used;
int err;
} cprof_info_inst;
/* Data structures for control structure and profiling data table in the
* in the profiled processes.
*/
struct cprof_ctl_s {
int reset; /* kernel sets to have table reset */
int slots_used; /* proc writes nr slots used in table */
int err; /* proc writes errors that occurred */
} cprof_ctl_inst;
struct cprof_tbl_s {
struct cprof_tbl_s *next; /* next in chain */
char cpath[CPROF_CPATH_MAX_LEN]; /* string with call path */
int calls; /* nr of executions of path */
u64_t cycles; /* execution time of path, in cycles */
} cprof_tbl_inst;
_PROTOTYPE( int sprofile, (int action, int size, int freq, int type,
void *ctl_ptr, void *mem_ptr) );
_PROTOTYPE( int cprofile, (int action, int size, void *ctl_ptr,
void *mem_ptr) );
#endif /* PROFILE_H */

View File

@@ -1,120 +0,0 @@
#ifndef RS_H
#define RS_H
/*
minix/rs.h
Interface to the reincarnation server
*/
#include <minix/bitmap.h>
#include <minix/com.h>
/* RSS definitions. */
#define RSS_NR_IRQ 16
#define RSS_NR_IO 16
#define RSS_IRQ_ALL (RSS_NR_IRQ+1)
#define RSS_IO_ALL (RSS_NR_IO+1)
#define RSS_IPC_ALL "IPC_ALL"
#define RSS_IPC_ALL_SYS "IPC_ALL_SYS"
/* RSS flags. */
#define RSS_COPY 0x01 /* keep an in-memory copy of the binary */
#define RSS_REUSE 0x04 /* Try to reuse previously copied binary */
#define RSS_NOBLOCK 0x08 /* unblock caller immediately */
#define RSS_REPLICA 0x10 /* keep a replica of the service */
#define RSS_SELF_LU 0x20 /* perform self update */
#define RSS_SYS_BASIC_CALLS 0x40 /* include basic kernel calls */
#define RSS_VM_BASIC_CALLS 0x80 /* include basic vm calls */
/* Common definitions. */
#define RS_NR_CONTROL 8
#define RS_NR_PCI_DEVICE 32
#define RS_NR_PCI_CLASS 4
#define RS_MAX_LABEL_LEN 16
/* CPU special values */
#define RS_CPU_DEFAULT -1 /* use the default cpu or do not change the current one */
#define RS_CPU_BSP -2 /* use the bootstrap cpu */
/* Labels are copied over separately. */
struct rss_label
{
char *l_addr;
size_t l_len;
};
/* Arguments needed to start a new driver or server */
struct rs_start
{
unsigned rss_flags;
char *rss_cmd;
size_t rss_cmdlen;
uid_t rss_uid;
endpoint_t rss_sigmgr;
endpoint_t rss_scheduler;
int rss_priority;
int rss_quantum;
int rss_major;
int rss_dev_style;
long rss_period;
char *rss_script;
size_t rss_scriptlen;
int rss_nr_irq;
int rss_irq[RSS_NR_IRQ];
int rss_nr_io;
struct { unsigned base; unsigned len; } rss_io[RSS_NR_IO];
int rss_nr_pci_id;
struct { u16_t vid; u16_t did; } rss_pci_id[RS_NR_PCI_DEVICE];
int rss_nr_pci_class;
struct { u32_t pciclass; u32_t mask; } rss_pci_class[RS_NR_PCI_CLASS];
bitchunk_t rss_system[SYS_CALL_MASK_SIZE];
struct rss_label rss_label;
char *rss_ipc;
size_t rss_ipclen;
bitchunk_t rss_vm[VM_CALL_MASK_SIZE];
int rss_nr_control;
struct rss_label rss_control[RS_NR_CONTROL];
/*
* SMP specific data
*
* must be at the end of the structure for binary compatibility with
* non-smp sysytems
*/
int rss_cpu;
};
/* ACL information for access to PCI devices */
struct rs_pci
{
char rsp_label[RS_MAX_LABEL_LEN];
int rsp_endpoint;
int rsp_nr_device;
struct { u16_t vid; u16_t did; } rsp_device[RS_NR_PCI_DEVICE];
int rsp_nr_class;
struct { u32_t pciclass; u32_t mask; } rsp_class[RS_NR_PCI_CLASS];
};
/* Definition of a public entry of the system process table. */
struct rprocpub {
short in_use; /* set when the entry is in use */
unsigned sys_flags; /* sys flags */
endpoint_t endpoint; /* process endpoint number */
int dev_flags; /* device flags */
dev_t dev_nr; /* major device number */
int dev_style; /* device style */
int dev_style2; /* device style for next major dev number */
char label[RS_MAX_LABEL_LEN]; /* label of this service */
char proc_name[RS_MAX_LABEL_LEN]; /* process name of this service */
bitchunk_t vm_call_mask[VM_CALL_MASK_SIZE]; /* vm call mask */
struct rs_pci pci_acl; /* pci acl */
};
_PROTOTYPE( int minix_rs_lookup, (const char *name, endpoint_t *value));
#endif

View File

@@ -1,90 +0,0 @@
#ifndef _MINIX_SAFECOPIES_H
#define _MINIX_SAFECOPIES_H 1
#include <minix/sys_config.h>
#include <minix/types.h>
#include <minix/vm.h>
#include <stdint.h>
typedef struct {
int cp_flags; /* CPF_* below */
union {
struct {
/* CPF_DIRECT */
endpoint_t cp_who_to; /* grantee */
vir_bytes cp_start; /* memory */
size_t cp_len; /* size in bytes */
char cp_reserved[8]; /* future use */
} cp_direct;
struct {
/* CPF_INDIRECT */
endpoint_t cp_who_to; /* grantee */
endpoint_t cp_who_from; /* previous granter */
cp_grant_id_t cp_grant; /* previous grant */
char cp_reserved[8];/* future use */
} cp_indirect;
struct {
/* CPF_MAGIC */
endpoint_t cp_who_from; /* granter */
endpoint_t cp_who_to; /* grantee */
vir_bytes cp_start; /* memory */
size_t cp_len; /* size in bytes */
char cp_reserved[8]; /* future use */
} cp_magic;
} cp_u;
char cp_reserved[8]; /* future use */
} cp_grant_t;
/* Vectored safecopy. */
struct vscp_vec {
/* Exactly one of the following must be SELF. */
endpoint_t v_from; /* source */
endpoint_t v_to; /* destination */
cp_grant_id_t v_gid; /* grant id of other process */
size_t v_offset; /* offset in other grant */
vir_bytes v_addr; /* address in copier's space */
size_t v_bytes; /* no. of bytes */
};
/* Invalid grant number. */
#define GRANT_INVALID ((cp_grant_id_t) -1)
#define GRANT_VALID(g) ((g) > GRANT_INVALID)
/* Operations: any combination is ok. */
#define CPF_READ 0x000001 /* Granted process may read. */
#define CPF_WRITE 0x000002 /* Granted process may write. */
#define CPF_MAP 0x000004 /* Granted process may map. */
/* Internal flags. */
#define CPF_USED 0x000100 /* Grant slot in use. */
#define CPF_DIRECT 0x000200 /* Grant from this process to another. */
#define CPF_INDIRECT 0x000400 /* Grant from grant to another. */
#define CPF_MAGIC 0x000800 /* Grant from any to any. */
#define CPF_VALID 0x001000 /* Grant slot contains valid grant. */
/* Prototypes for functions in libsys. */
_PROTOTYPE( cp_grant_id_t cpf_grant_direct, (endpoint_t, vir_bytes, size_t, int));
_PROTOTYPE( cp_grant_id_t cpf_grant_indirect, (endpoint_t, endpoint_t, cp_grant_id_t));
_PROTOTYPE( cp_grant_id_t cpf_grant_magic, (endpoint_t, endpoint_t, vir_bytes, size_t, int));
_PROTOTYPE( int cpf_revoke, (cp_grant_id_t grant_id));
_PROTOTYPE( int cpf_lookup, (cp_grant_id_t g, endpoint_t *ep, endpoint_t *ep2));
_PROTOTYPE( int cpf_getgrants, (cp_grant_id_t *grant_ids, int n));
_PROTOTYPE( int cpf_setgrant_direct, (cp_grant_id_t g, endpoint_t who,
vir_bytes addr, size_t size, int access));
_PROTOTYPE( int cpf_setgrant_indirect, (cp_grant_id_t g, endpoint_t who_to,
endpoint_t who_from, cp_grant_id_t his_g));
_PROTOTYPE( int cpf_setgrant_magic, (cp_grant_id_t g, endpoint_t who_to,
endpoint_t who_from, vir_bytes addr, size_t bytes, int access));
_PROTOTYPE( int cpf_setgrant_disable, (cp_grant_id_t grant_id));
_PROTOTYPE( void cpf_reload, (void));
/* Set a process' grant table location and size (in-kernel only). */
#define _K_SET_GRANT_TABLE(rp, ptr, entries) \
priv(rp)->s_grant_table= (ptr); \
priv(rp)->s_grant_entries= (entries);
#endif /* _MINIX_SAFECOPIES_H */

View File

@@ -1,235 +0,0 @@
/* Prototypes for System Event Framework (SEF) functions. */
#ifndef _SEF_H
#define _SEF_H
#include <minix/ipc.h>
/* SEF entry points for system processes. */
_PROTOTYPE( void sef_startup, (void) );
_PROTOTYPE( int sef_receive_status, (endpoint_t src, message *m_ptr,
int *status_ptr) );
_PROTOTYPE( void sef_exit, (int status) );
#define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)
/* SEF Debug. */
#include <stdio.h>
#define sef_dprint printf
#define sef_debug_begin() (void)(NULL)
#define sef_debug_end() (void)(NULL)
/*===========================================================================*
* SEF Init *
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_INIT_REQUESTS 1
#define IS_SEF_INIT_REQUEST(mp) ((mp)->m_type == RS_INIT \
&& (mp)->m_source == RS_PROC_NR)
/* Type definitions. */
typedef struct {
cp_grant_id_t rproctab_gid;
endpoint_t endpoint;
endpoint_t old_endpoint;
} sef_init_info_t;
/* Callback type definitions. */
typedef int(*sef_cb_init_t)(int type, sef_init_info_t *info);
typedef int(*sef_cb_init_response_t)(message *m_ptr);
/* Callback registration helpers. */
_PROTOTYPE( void sef_setcb_init_fresh, (sef_cb_init_t cb));
_PROTOTYPE( void sef_setcb_init_lu, (sef_cb_init_t cb));
_PROTOTYPE( void sef_setcb_init_restart, (sef_cb_init_t cb));
_PROTOTYPE( void sef_setcb_init_response, (sef_cb_init_response_t cb) );
/* Predefined callback implementations. */
_PROTOTYPE( int sef_cb_init_null, (int type, sef_init_info_t *info) );
_PROTOTYPE( int sef_cb_init_response_null, (message *m_ptr) );
_PROTOTYPE( int sef_cb_init_fail, (int type, sef_init_info_t *info) );
_PROTOTYPE( int sef_cb_init_crash, (int type, sef_init_info_t *info) );
_PROTOTYPE( int sef_cb_init_response_rs_reply, (message *m_ptr) );
/* Macros for predefined callback implementations. */
#define SEF_CB_INIT_FRESH_NULL sef_cb_init_null
#define SEF_CB_INIT_LU_NULL sef_cb_init_null
#define SEF_CB_INIT_RESTART_NULL sef_cb_init_null
#define SEF_CB_INIT_RESPONSE_NULL sef_cb_init_response_null
#define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_null
#define SEF_CB_INIT_LU_DEFAULT sef_cb_init_null
#define SEF_CB_INIT_RESTART_DEFAULT sef_cb_init_null
#define SEF_CB_INIT_RESPONSE_DEFAULT sef_cb_init_response_rs_reply
/* Init types. */
#define SEF_INIT_FRESH 0 /* init fresh */
#define SEF_INIT_LU 1 /* init after live update */
#define SEF_INIT_RESTART 2 /* init after restart */
/* Debug. */
#define SEF_INIT_DEBUG_DEFAULT 0
#ifndef SEF_INIT_DEBUG
#define SEF_INIT_DEBUG SEF_INIT_DEBUG_DEFAULT
#endif
#define sef_init_dprint sef_dprint
#define sef_init_debug_begin sef_debug_begin
#define sef_init_debug_end sef_debug_end
/*===========================================================================*
* SEF Ping *
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_PING_REQUESTS 1
#define IS_SEF_PING_REQUEST(mp, status) (is_ipc_notify(status) \
&& (mp)->m_source == RS_PROC_NR)
/* Callback type definitions. */
typedef void(*sef_cb_ping_reply_t)(endpoint_t source);
/* Callback registration helpers. */
_PROTOTYPE( void sef_setcb_ping_reply, (sef_cb_ping_reply_t cb));
/* Predefined callback implementations. */
_PROTOTYPE( void sef_cb_ping_reply_null, (endpoint_t source) );
_PROTOTYPE( void sef_cb_ping_reply_pong, (endpoint_t source) );
/* Macros for predefined callback implementations. */
#define SEF_CB_PING_REPLY_NULL sef_cb_ping_reply_null
#define SEF_CB_PING_REPLY_DEFAULT sef_cb_ping_reply_pong
/* Debug. */
#define SEF_PING_DEBUG_DEFAULT 0
#ifndef SEF_PING_DEBUG
#define SEF_PING_DEBUG SEF_PING_DEBUG_DEFAULT
#endif
#define sef_ping_dprint sef_dprint
#define sef_ping_debug_begin sef_debug_begin
#define sef_ping_debug_end sef_debug_end
/*===========================================================================*
* SEF Live update *
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_LU_REQUESTS 1
#define IS_SEF_LU_REQUEST(mp, status) ((mp)->m_type == RS_LU_PREPARE \
&& (mp)->m_source == RS_PROC_NR)
/* Callback type definitions. */
typedef int(*sef_cb_lu_prepare_t)(int);
typedef int(*sef_cb_lu_state_isvalid_t)(int);
typedef void(*sef_cb_lu_state_changed_t)(int, int);
typedef void(*sef_cb_lu_state_dump_t)(int);
typedef int(*sef_cb_lu_state_save_t)(int);
typedef int(*sef_cb_lu_response_t)(message *m_ptr);
/* Callback registration helpers. */
_PROTOTYPE( void sef_setcb_lu_prepare, (sef_cb_lu_prepare_t cb) );
_PROTOTYPE( void sef_setcb_lu_state_isvalid, (sef_cb_lu_state_isvalid_t cb) );
_PROTOTYPE( void sef_setcb_lu_state_changed, (sef_cb_lu_state_changed_t cb) );
_PROTOTYPE( void sef_setcb_lu_state_dump, (sef_cb_lu_state_dump_t cb) );
_PROTOTYPE( void sef_setcb_lu_state_save, (sef_cb_lu_state_save_t cb) );
_PROTOTYPE( void sef_setcb_lu_response, (sef_cb_lu_response_t cb) );
/* Predefined callback implementations. */
_PROTOTYPE( int sef_cb_lu_prepare_null, (int state) );
_PROTOTYPE( int sef_cb_lu_state_isvalid_null, (int state) );
_PROTOTYPE( void sef_cb_lu_state_changed_null, (int old_state, int state) );
_PROTOTYPE( void sef_cb_lu_state_dump_null, (int state) );
_PROTOTYPE( int sef_cb_lu_state_save_null, (int state) );
_PROTOTYPE( int sef_cb_lu_response_null, (message *m_ptr) );
_PROTOTYPE( int sef_cb_lu_prepare_always_ready, (int state) );
_PROTOTYPE( int sef_cb_lu_prepare_never_ready, (int state) );
_PROTOTYPE( int sef_cb_lu_prepare_crash, (int state) );
_PROTOTYPE( int sef_cb_lu_state_isvalid_standard, (int state) );
_PROTOTYPE( int sef_cb_lu_state_isvalid_workfree, (int state) );
_PROTOTYPE( int sef_cb_lu_response_rs_reply, (message *m_ptr) );
/* Macros for predefined callback implementations. */
#define SEF_CB_LU_PREPARE_NULL sef_cb_lu_prepare_null
#define SEF_CB_LU_STATE_ISVALID_NULL sef_cb_lu_state_isvalid_null
#define SEF_CB_LU_STATE_CHANGED_NULL sef_cb_lu_state_changed_null
#define SEF_CB_LU_STATE_DUMP_NULL sef_cb_lu_state_dump_null
#define SEF_CB_LU_STATE_SAVE_NULL sef_cb_lu_state_save_null
#define SEF_CB_LU_RESPONSE_NULL sef_cb_lu_response_null
#define SEF_CB_LU_PREPARE_DEFAULT sef_cb_lu_prepare_null
#define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_null
#define SEF_CB_LU_STATE_CHANGED_DEFAULT sef_cb_lu_state_changed_null
#define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_null
#define SEF_CB_LU_STATE_SAVE_DEFAULT sef_cb_lu_state_save_null
#define SEF_CB_LU_RESPONSE_DEFAULT sef_cb_lu_response_rs_reply
/* Standard live update states. */
#define SEF_LU_STATE_NULL 0 /* null state */
#define SEF_LU_STATE_WORK_FREE 1 /* no work in progress */
#define SEF_LU_STATE_REQUEST_FREE 2 /* no request in progress */
#define SEF_LU_STATE_PROTOCOL_FREE 3 /* no protocol in progress */
#define SEF_LU_STATE_CUSTOM_BASE (SEF_LU_STATE_PROTOCOL_FREE+1)
#define SEF_LU_STATE_IS_STANDARD(s) ((s) > SEF_LU_STATE_NULL \
&& (s) < SEF_LU_STATE_CUSTOM_BASE)
/* Debug. */
#define SEF_LU_DEBUG_DEFAULT 1
#ifndef SEF_LU_DEBUG
#define SEF_LU_DEBUG SEF_LU_DEBUG_DEFAULT
#endif
#define sef_lu_dprint sef_dprint
#define sef_lu_debug_begin sef_debug_begin
#define sef_lu_debug_end sef_debug_end
/*===========================================================================*
* SEF Signal *
*===========================================================================*/
/* What to intercept. */
#define INTERCEPT_SEF_SIGNAL_REQUESTS 1
#define IS_SEF_SIGNAL_REQUEST(mp, status) \
(((mp)->m_type == SIGS_SIGNAL_RECEIVED && (mp)->m_source < INIT_PROC_NR) \
|| (is_ipc_notify(status) && (mp)->m_source == SYSTEM))
/* Callback type definitions. */
typedef void(*sef_cb_signal_handler_t)(int signo);
typedef int(*sef_cb_signal_manager_t)(endpoint_t target, int signo);
typedef int(*sef_cb_gcov_t)(message *msg);
/* Callback registration helpers. */
_PROTOTYPE( void sef_setcb_signal_handler, (sef_cb_signal_handler_t cb));
_PROTOTYPE( void sef_setcb_signal_manager, (sef_cb_signal_manager_t cb));
_PROTOTYPE( void sef_setcb_gcov, (sef_cb_gcov_t cb));
/* Predefined callback implementations. */
_PROTOTYPE( void sef_cb_signal_handler_null, (int signo) );
_PROTOTYPE( int sef_cb_signal_manager_null, (endpoint_t target, int signo) );
_PROTOTYPE( void sef_cb_signal_handler_term, (int signo) );
_PROTOTYPE( void sef_cb_signal_handler_posix_default, (int signo) );
/* Macros for predefined callback implementations. */
#define SEF_CB_SIGNAL_HANDLER_NULL sef_cb_signal_handler_null
#define SEF_CB_SIGNAL_MANAGER_NULL sef_cb_signal_manager_null
#define SEF_CB_SIGNAL_HANDLER_DEFAULT sef_cb_signal_handler_null
#define SEF_CB_SIGNAL_MANAGER_DEFAULT sef_cb_signal_manager_null
/* Debug. */
#define SEF_SIGNAL_DEBUG_DEFAULT 0
#ifndef SEF_SIGNAL_DEBUG
#define SEF_SIGNAL_DEBUG SEF_SIGNAL_DEBUG_DEFAULT
#endif
#define sef_signal_dprint sef_dprint
#define sef_signal_debug_begin sef_debug_begin
#define sef_signal_debug_end sef_debug_end
#endif /* _SEF_H */

View File

@@ -1,38 +0,0 @@
/* Prototypes for condition spinning helper functions (part of libsys). */
#ifndef _MINIX_SPIN_H
#define _MINIX_SPIN_H
/* Opaque spin state structure. */
typedef struct {
int s_state;
u32_t s_usecs;
u64_t s_base_tsc;
clock_t s_base_uptime;
int s_timeout;
} spin_t;
/* Functions. */
_PROTOTYPE( void spin_init, (spin_t *s, u32_t usecs) );
_PROTOTYPE( int spin_check, (spin_t *s) );
/* Macros. */
/* Execute a loop for at least 'u' microseconds, using spin object 's'.
* The body of the loop is guaranteed to be executed at least once.
*/
#define SPIN_FOR(s,u) \
for (spin_init((s), (u)); spin_check((s)); )
/* Return whether spin object 's' timed out after a loop. */
#define SPIN_TIMEOUT(s) ((s)->s_timeout)
/* Spin until the given condition becomes true, or 'u' microseconds expired.
* The condition is guaranteed to be checked at least once.
*/
#define SPIN_UNTIL(c,u) do { \
spin_t s; \
SPIN_FOR(&s,(u)) \
if (c) break; \
} while (0)
#endif /* _MINIX_SPIN_H */

View File

@@ -1,57 +0,0 @@
#ifndef _MINIX_SYS_CONFIG_H
#define _MINIX_SYS_CONFIG_H 1
/*===========================================================================*
* This section contains user-settable parameters *
*===========================================================================*/
#define _MINIX_MACHINE _MACHINE_IBM_PC
#define _MACHINE_IBM_PC 1 /* any 8088 or 80x86-based system */
/* Word size in bytes (a constant equal to sizeof(int)). */
#if __ACK__ || __GNUC__
#define _WORD_SIZE _EM_WSIZE
#define _PTR_SIZE _EM_WSIZE
#endif
#define _NR_PROCS 256
#define _NR_SYS_PROCS 64
/* 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 _CHIP_INTEL 1 /* CHIP type for PC, XT, AT, 386 and clones */
#define _CHIP_M68000 2 /* CHIP type for Atari, Amiga, Macintosh */
#define _CHIP_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 (_MINIX_MACHINE == _MACHINE_IBM_PC)
#define _MINIX_CHIP _CHIP_INTEL
#endif
#ifndef _MINIX_FP_FORMAT
#define _MINIX_FP_FORMAT _FP_NONE
#endif
#ifndef _MINIX_MACHINE
error "In <minix/sys_config.h> please define _MINIX_MACHINE"
#endif
#ifndef _MINIX_CHIP
error "In <minix/sys_config.h> please define _MINIX_MACHINE to have a legal value"
#endif
#if (_MINIX_MACHINE == 0)
error "_MINIX_MACHINE has incorrect value (0)"
#endif
/* Kernel debug checks */
#define DEBUG_LOCK_CHECK 1 /* Interrupt Lock/unlock sanity checking. */
#define _KMESS_BUF_SIZE 10000
#endif /* _MINIX_SYS_CONFIG_H */

View File

@@ -1,20 +0,0 @@
#ifndef _MINIX_SYSINFO_H
#define _MINIX_SYSINFO_H
#include <minix/endpoint.h>
#include <minix/type.h>
_PROTOTYPE( int getsysinfo, (endpoint_t who, int what, void *where) );
/* What system info to retrieve with sysgetinfo(). */
#define SI_PROC_TAB 2 /* copy of entire process table */
#define SI_DMAP_TAB 3 /* get device <-> driver mappings */
#define SI_DATA_STORE 5 /* get copy of data store mappings */
#define SI_SUBSCRIPTION 6 /* get copy of data store subscriptions */
#define SI_LOADINFO 7 /* get copy of load average structure */
#define SI_CALL_STATS 9 /* system call statistics */
#define SI_PROCPUB_TAB 11 /* copy of public entries of process table */
#endif

View File

@@ -1,274 +0,0 @@
/* Prototypes for system library functions. */
#ifndef _SYSLIB_H
#define _SYSLIB_H
#ifndef _TYPES_H
#include <minix/types.h>
#endif
#ifndef _IPC_H
#include <minix/ipc.h>
#endif
#include <minix/u64.h>
#ifndef _DEVIO_H
#include <minix/devio.h>
#endif
#include <minix/safecopies.h>
#include <minix/sef.h>
#include <machine/mcontext.h>
/* Forward declaration */
struct reg86u;
struct rs_pci;
#define SYSTASK SYSTEM
/*==========================================================================*
* Minix system library. *
*==========================================================================*/
_PROTOTYPE( int _taskcall, (endpoint_t who, int syscallnr, message *msgptr));
_PROTOTYPE( int _kernel_call, (int syscallnr, message *msgptr));
_PROTOTYPE( int sys_abort, (int how, ...));
_PROTOTYPE( int sys_enable_iop, (endpoint_t proc_ep));
_PROTOTYPE( int sys_exec, (endpoint_t proc_ep, char *ptr,
char *aout, vir_bytes initpc));
_PROTOTYPE( int sys_fork, (endpoint_t parent, endpoint_t child, endpoint_t *,
struct mem_map *ptr, u32_t vm, vir_bytes *));
_PROTOTYPE( int sys_newmap, (endpoint_t proc_ep, struct mem_map *ptr));
_PROTOTYPE( int sys_clear, (endpoint_t proc_ep));
_PROTOTYPE( int sys_exit, (void));
_PROTOTYPE( int sys_trace, (int req, endpoint_t proc_ep, long addr, long *data_p));
_PROTOTYPE( int sys_schedule, (endpoint_t proc_ep, int priority,
int quantum, int cpu));
_PROTOTYPE( int sys_schedctl, (unsigned flags, endpoint_t proc_ep,
int priority, int quantum, int cpu));
/* Shorthands for sys_runctl() system call. */
#define sys_stop(proc_ep) sys_runctl(proc_ep, RC_STOP, 0)
#define sys_delay_stop(proc_ep) sys_runctl(proc_ep, RC_STOP, RC_DELAY)
#define sys_resume(proc_ep) sys_runctl(proc_ep, RC_RESUME, 0)
_PROTOTYPE( int sys_runctl, (endpoint_t proc_ep, int action, int flags));
_PROTOTYPE( int sys_update, (endpoint_t src_ep, endpoint_t dst_ep));
_PROTOTYPE( int sys_statectl, (int request));
_PROTOTYPE( int sys_privctl, (endpoint_t proc_ep, int req, void *p));
_PROTOTYPE( int sys_privquery_mem, (endpoint_t proc_ep,
phys_bytes physstart, phys_bytes physlen));
_PROTOTYPE( int sys_setgrant, (cp_grant_t *grants, int ngrants));
_PROTOTYPE( int sys_int86, (struct reg86u *reg86p));
_PROTOTYPE( int sys_vm_setbuf, (phys_bytes base, phys_bytes size,
phys_bytes high));
_PROTOTYPE( int sys_vm_map, (endpoint_t proc_ep, int do_map,
phys_bytes base, phys_bytes size, phys_bytes offset));
_PROTOTYPE( int sys_vmctl, (endpoint_t who, int param, u32_t value));
_PROTOTYPE( int sys_vmctl_get_cr3_i386, (endpoint_t who, u32_t *cr3) );
_PROTOTYPE( int sys_vmctl_get_memreq, (endpoint_t *who, vir_bytes *mem,
vir_bytes *len, int *wrflag, endpoint_t *who_s, vir_bytes *mem_s,
endpoint_t *) );
_PROTOTYPE( int sys_vmctl_enable_paging, (void * data));
_PROTOTYPE( int sys_readbios, (phys_bytes address, void *buf, size_t size));
_PROTOTYPE( int sys_stime, (time_t boottime));
_PROTOTYPE( int sys_sysctl, (int ctl, char *arg1, int arg2));
_PROTOTYPE( int sys_sysctl_stacktrace, (endpoint_t who));
_PROTOTYPE( int sys_vmctl_get_mapping, (int index, phys_bytes *addr,
phys_bytes *len, int *flags));
_PROTOTYPE( int sys_vmctl_reply_mapping, (int index, vir_bytes addr));
_PROTOTYPE( int sys_vmctl_set_addrspace, (endpoint_t who,
phys_bytes ptroot, void *ptroot_v));
/* Shorthands for sys_sdevio() system call. */
#define sys_insb(port, proc_ep, buffer, count) \
sys_sdevio(DIO_INPUT_BYTE, port, proc_ep, buffer, count, 0)
#define sys_insw(port, proc_ep, buffer, count) \
sys_sdevio(DIO_INPUT_WORD, port, proc_ep, buffer, count, 0)
#define sys_outsb(port, proc_ep, buffer, count) \
sys_sdevio(DIO_OUTPUT_BYTE, port, proc_ep, buffer, count, 0)
#define sys_outsw(port, proc_ep, buffer, count) \
sys_sdevio(DIO_OUTPUT_WORD, port, proc_ep, buffer, count, 0)
#define sys_safe_insb(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_INPUT_BYTE, port, ept, (void*)grant, count, offset)
#define sys_safe_outsb(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_OUTPUT_BYTE, port, ept, (void*)grant, count, offset)
#define sys_safe_insw(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_INPUT_WORD, port, ept, (void*)grant, count, offset)
#define sys_safe_outsw(port, ept, grant, offset, count) \
sys_sdevio(DIO_SAFE_OUTPUT_WORD, port, ept, (void*)grant, count, offset)
_PROTOTYPE( int sys_sdevio, (int req, long port, endpoint_t proc_ep,
void *buffer, int count, vir_bytes offset));
_PROTOTYPE(void *alloc_contig, (size_t len, int flags, phys_bytes *phys));
_PROTOTYPE(int free_contig, (void *addr, size_t len));
#define AC_ALIGN4K 0x01
#define AC_LOWER16M 0x02
#define AC_ALIGN64K 0x04
#define AC_LOWER1M 0x08
/* Clock functionality: get system times, (un)schedule an alarm call, or
* retrieve/set a process-virtual timer.
*/
_PROTOTYPE( int sys_times, (endpoint_t proc_ep, clock_t *user_time,
clock_t *sys_time, clock_t *uptime, time_t *boottime));
_PROTOTYPE(int sys_setalarm, (clock_t exp_time, int abs_time));
_PROTOTYPE( int sys_vtimer, (endpoint_t proc_nr, int which, clock_t *newval,
clock_t *oldval));
/* Shorthands for sys_irqctl() system call. */
#define sys_irqdisable(hook_id) \
sys_irqctl(IRQ_DISABLE, 0, 0, hook_id)
#define sys_irqenable(hook_id) \
sys_irqctl(IRQ_ENABLE, 0, 0, hook_id)
#define sys_irqsetpolicy(irq_vec, policy, hook_id) \
sys_irqctl(IRQ_SETPOLICY, irq_vec, policy, hook_id)
#define sys_irqrmpolicy(hook_id) \
sys_irqctl(IRQ_RMPOLICY, 0, 0, hook_id)
_PROTOTYPE ( int sys_irqctl, (int request, int irq_vec, int policy,
int *irq_hook_id) );
/* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
#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, (endpoint_t src_proc, int src_s, vir_bytes src_v,
endpoint_t dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
#define sys_abscopy(src_phys, dst_phys, bytes) \
sys_physcopy(NONE, PHYS_SEG, src_phys, NONE, PHYS_SEG, dst_phys, bytes)
_PROTOTYPE(int sys_physcopy, (endpoint_t src_proc, int src_seg, vir_bytes src_vir,
endpoint_t dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
/* Grant-based copy functions. */
_PROTOTYPE(int sys_safecopyfrom, (endpoint_t source, cp_grant_id_t grant,
vir_bytes grant_offset, vir_bytes my_address, size_t bytes, int my_seg));
_PROTOTYPE(int sys_safecopyto, (endpoint_t dest, cp_grant_id_t grant,
vir_bytes grant_offset, vir_bytes my_address, size_t bytes, int my_seg));
_PROTOTYPE(int sys_vsafecopy, (struct vscp_vec *copyvec, int elements));
_PROTOTYPE(int sys_memset, (unsigned long pattern,
phys_bytes base, phys_bytes bytes));
/* Grant-based map functions. */
_PROTOTYPE(int sys_safemap, (endpoint_t grantor, cp_grant_id_t grant,
vir_bytes grant_offset, vir_bytes my_address, size_t bytes, int my_seg,
int writable));
_PROTOTYPE(int sys_saferevmap_gid, (cp_grant_id_t grant));
_PROTOTYPE(int sys_saferevmap_addr, (vir_bytes addr));
_PROTOTYPE(int sys_safeunmap, (int my_seg, vir_bytes my_address));
_PROTOTYPE(int sys_umap, (endpoint_t proc_ep, int seg, vir_bytes vir_addr,
vir_bytes bytes, phys_bytes *phys_addr));
_PROTOTYPE(int sys_umap_data_fb, (endpoint_t proc_ep, vir_bytes vir_addr,
vir_bytes bytes, phys_bytes *phys_addr));
_PROTOTYPE(int sys_segctl, (int *index, u16_t *seg, vir_bytes *off,
phys_bytes phys, vir_bytes size));
/* Shorthands for sys_getinfo() system call. */
#define sys_getkmessages(dst) sys_getinfo(GET_KMESSAGES, dst, 0,0,0)
#define sys_getkinfo(dst) sys_getinfo(GET_KINFO, dst, 0,0,0)
#define sys_getloadinfo(dst) sys_getinfo(GET_LOADINFO, dst, 0,0,0)
#define sys_getmachine(dst) sys_getinfo(GET_MACHINE, dst, 0,0,0)
#define sys_getcpuinfo(dst) sys_getinfo(GET_CPUINFO, dst, 0,0,0)
#define sys_getproctab(dst) sys_getinfo(GET_PROCTAB, dst, 0,0,0)
#define sys_getprivtab(dst) sys_getinfo(GET_PRIVTAB, dst, 0,0,0)
#define sys_getproc(dst,nr) sys_getinfo(GET_PROC, dst, 0,0, nr)
#define sys_getrandomness(dst) sys_getinfo(GET_RANDOMNESS, dst, 0,0,0)
#define sys_getrandom_bin(d,b) sys_getinfo(GET_RANDOMNESS_BIN, d, 0,0,b)
#define sys_getimage(dst) sys_getinfo(GET_IMAGE, dst, 0,0,0)
#define sys_getirqhooks(dst) sys_getinfo(GET_IRQHOOKS, dst, 0,0,0)
#define sys_getirqactids(dst) sys_getinfo(GET_IRQACTIDS, dst, 0,0,0)
#define sys_getmonparams(v,vl) sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
#define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
#define sys_getpriv(dst, nr) sys_getinfo(GET_PRIV, dst, 0,0, nr)
#define sys_getidletsc(dst) sys_getinfo(GET_IDLETSC, dst, 0,0,0)
#define sys_getaoutheader(dst,nr) sys_getinfo(GET_AOUTHEADER, dst, 0,0,nr)
_PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
void *val_ptr2, int val_len2) );
_PROTOTYPE(int sys_whoami, (endpoint_t *ep, char *name, int namelen,
int *priv_flags));
/* Signal control. */
_PROTOTYPE(int sys_kill, (endpoint_t proc_ep, int sig) );
_PROTOTYPE(int sys_sigsend, (endpoint_t proc_ep, struct sigmsg *sig_ctxt) );
_PROTOTYPE(int sys_sigreturn, (endpoint_t proc_ep, struct sigmsg *sig_ctxt) );
_PROTOTYPE(int sys_getksig, (endpoint_t *proc_ep, sigset_t *k_sig_map) );
_PROTOTYPE(int sys_endksig, (endpoint_t proc_ep) );
/* 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), (v), _DIO_BYTE)
#define sys_inw(p,v) sys_in((p), (v), _DIO_WORD)
#define sys_inl(p,v) sys_in((p), (v), _DIO_LONG)
_PROTOTYPE(int sys_in, (int port, unsigned long *value, int type) );
/* pci.c */
_PROTOTYPE( void pci_init, (void) );
_PROTOTYPE( void pci_init1, (char *name) );
_PROTOTYPE( int pci_first_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
_PROTOTYPE( int pci_next_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
_PROTOTYPE( int pci_find_dev, (u8_t bus, u8_t dev, u8_t func,
int *devindp) );
_PROTOTYPE( void pci_reserve, (int devind) );
_PROTOTYPE( int pci_reserve_ok, (int devind) );
_PROTOTYPE( void pci_ids, (int devind, u16_t *vidp, u16_t *didp) );
_PROTOTYPE( void pci_rescan_bus, (u8_t busnr) );
_PROTOTYPE( u8_t pci_attr_r8, (int devind, int port) );
_PROTOTYPE( u16_t pci_attr_r16, (int devind, int port) );
_PROTOTYPE( u32_t pci_attr_r32, (int devind, int port) );
_PROTOTYPE( void pci_attr_w8, (int devind, int port, u8_t value) );
_PROTOTYPE( void pci_attr_w16, (int devind, int port, u16_t value) );
_PROTOTYPE( void pci_attr_w32, (int devind, int port, u32_t value) );
_PROTOTYPE( char *pci_dev_name, (u16_t vid, u16_t did) );
_PROTOTYPE( char *pci_slot_name, (int devind) );
_PROTOTYPE( int pci_set_acl, (struct rs_pci *rs_pci) );
_PROTOTYPE( int pci_del_acl, (endpoint_t proc_ep) );
_PROTOTYPE( int pci_get_bar, (int devind, int port, u32_t *base,
u32_t *size, int *ioflag) );
/* Profiling. */
_PROTOTYPE( int sys_sprof, (int action, int size, int freq, int type,
endpoint_t endpt, void *ctl_ptr, void *mem_ptr) );
_PROTOTYPE( int sys_cprof, (int action, int size, endpoint_t endpt,
void *ctl_ptr, void *mem_ptr) );
_PROTOTYPE( int sys_profbuf, (void *ctl_ptr, void *mem_ptr) );
/* machine context */
_PROTOTYPE( int sys_getmcontext, (endpoint_t proc, mcontext_t *mcp) );
_PROTOTYPE( int sys_setmcontext, (endpoint_t proc, mcontext_t *mcp) );
/* input */
_PROTOTYPE( int tty_input_inject, (int type, int code, int val) );
#endif /* _SYSLIB_H */

View File

@@ -1,92 +0,0 @@
#ifndef _MINIX_SYSUTIL_H
#define _MINIX_SYSUTIL_H 1
#include <minix/ipc.h>
#include <sys/cdefs.h>
/* Extra system library definitions to support device drivers and servers.
*
* Created:
* Mar 15, 2004 by Jorrit N. Herder
*
* Changes:
* May 31, 2005: added printf, kputc (relocated from syslib)
* May 31, 2005: added getuptime
* Mar 18, 2005: added tickdelay
* Oct 01, 2004: added env_parse, env_prefix, env_panic
* Jul 13, 2004: added fkey_ctl
* Apr 28, 2004: added report, panic
* Mar 31, 2004: setup like other libraries, such as syslib
*/
/*==========================================================================*
* Miscellaneous helper functions.
*==========================================================================*/
/* 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 ... */
extern int env_argc;
extern char **env_argv;
_PROTOTYPE( void env_setargs, (int argc, char *argv[]) );
_PROTOTYPE( int env_get_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_map(fkeys, sfkeys) fkey_ctl(FKEY_MAP, (fkeys), (sfkeys))
#define fkey_unmap(fkeys, sfkeys) fkey_ctl(FKEY_UNMAP, (fkeys), (sfkeys))
#define fkey_events(fkeys, sfkeys) fkey_ctl(FKEY_EVENTS, (fkeys), (sfkeys))
_PROTOTYPE( int fkey_ctl, (int req, int *fkeys, int *sfkeys) );
_PROTOTYPE( int printf, (const char *fmt, ...));
_PROTOTYPE( void kputc, (int c));
_PROTOTYPE( __dead void panic, (const char *fmt, ...));
_PROTOTYPE( int getuptime, (clock_t *ticks));
_PROTOTYPE( int getuptime2, (clock_t *ticks, time_t *boottime));
_PROTOTYPE( int tickdelay, (clock_t ticks));
_PROTOTYPE( int tsc_calibrate, (void));
_PROTOTYPE( u32_t sys_hz, (void));
_PROTOTYPE( double getidle, (void));
_PROTOTYPE( void util_stacktrace, (void));
_PROTOTYPE( void util_nstrcat, (char *str, unsigned long n) );
_PROTOTYPE( void util_stacktrace_strcat, (char *));
_PROTOTYPE( int micro_delay, (u32_t micros));
_PROTOTYPE( u32_t tsc_64_to_micros, (u64_t tsc));
_PROTOTYPE( u32_t tsc_to_micros, (u32_t low, u32_t high));
_PROTOTYPE( u32_t tsc_get_khz, (void));
_PROTOTYPE( u32_t micros_to_ticks, (u32_t micros));
_PROTOTYPE( void ser_putc, (char c));
_PROTOTYPE( void get_randomness, (struct k_randomness *, int));
#define asynsend(ep, msg) asynsend3(ep, msg, 0)
_PROTOTYPE( int asynsend3, (endpoint_t ep, message *msg, int flags));
#define ASSERT(c) if(!(c)) { panic("%s:%d: assert %s failed", __FILE__, __LINE__, #c); }
/* timing library */
#define TIMING_CATEGORIES 20
#define TIMING_POINTS 20 /* timing resolution */
#define TIMING_CATEGORIES 20
#define TIMING_NAME 10
struct util_timingdata {
char names[TIMING_NAME];
unsigned long lock_timings[TIMING_POINTS];
unsigned long lock_timings_range[2];
unsigned long binsize, resets, misses, measurements;
unsigned long starttimes[2]; /* nonzero if running */
};
typedef struct util_timingdata util_timingdata_t;
#endif /* _MINIX_SYSUTIL_H */

View File

@@ -1,16 +0,0 @@
#ifndef _MINIX_TIMERS_H
#define _MINIX_TIMERS_H
/* Timers abstraction for system processes. This would be in minix/sysutil.h
* if it weren't for naming conflicts.
*/
#include <timers.h>
_PROTOTYPE( void init_timer, (timer_t *tp));
_PROTOTYPE( void set_timer, (timer_t *tp, int ticks, tmr_func_t watchdog,
int arg));
_PROTOTYPE( void cancel_timer, (timer_t *tp));
_PROTOTYPE( void expire_timers, (clock_t now));
#endif /* _MINIX_TIMERS_H */

View File

@@ -1,215 +0,0 @@
#ifndef _TYPE_H
#define _TYPE_H
#ifndef _MINIX_SYS_CONFIG_H
#include <minix/sys_config.h>
#endif
#ifndef _TYPES_H
#include <minix/types.h>
#endif
#include <stdint.h>
/* Type definitions. */
typedef unsigned int vir_clicks; /* virtual addr/length in clicks */
typedef unsigned long phys_bytes; /* physical addr/length in bytes */
typedef unsigned int phys_clicks; /* physical addr/length in clicks */
typedef int endpoint_t; /* process identifier */
typedef int32_t cp_grant_id_t; /* A grant ID. */
#if (_MINIX_CHIP == _CHIP_INTEL)
typedef long unsigned int vir_bytes; /* virtual addresses/lengths in bytes */
#endif
#if (_MINIX_CHIP == _CHIP_M68000)
typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
#endif
#if (_MINIX_CHIP == _CHIP_SPARC)
typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
#endif
/* Memory map for local text, stack, data segments. */
struct mem_map {
vir_clicks mem_vir; /* virtual address */
phys_clicks mem_phys; /* physical address */
vir_clicks mem_len; /* length */
};
/* Memory map for remote memory areas, e.g., for the RAM disk. */
struct far_mem {
int in_use; /* entry in use, unless zero */
phys_clicks mem_phys; /* physical address */
vir_clicks mem_len; /* length */
};
/* Structure for virtual copying by means of a vector with requests. */
struct vir_addr {
endpoint_t proc_nr_e;
int segment;
vir_bytes offset;
};
#define phys_cp_req vir_cp_req
struct vir_cp_req {
struct vir_addr src;
struct vir_addr dst;
phys_bytes count;
};
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 {
cp_grant_id_t iov_grant; /* grant ID of an I/O buffer */
vir_bytes iov_size; /* sizeof an I/O buffer */
} iovec_s_t;
/* PM passes the address of a structure of this type to KERNEL when
* sys_sigsend() 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 */
};
/* This is used to obtain system information through SYS_GETINFO. */
struct kinfo {
phys_bytes code_base; /* base of kernel code */
phys_bytes code_size;
phys_bytes data_base; /* base of kernel data */
phys_bytes data_size;
vir_bytes proc_addr; /* virtual address of process table */
phys_bytes _kmem_base; /* kernel memory layout (/dev/kmem) */
phys_bytes _kmem_size;
phys_bytes bootdev_base; /* boot device from boot image (/dev/boot) */
phys_bytes bootdev_size;
phys_bytes ramdev_base; /* boot device from boot image (/dev/boot) */
phys_bytes ramdev_size;
phys_bytes _params_base; /* parameters passed by boot monitor */
phys_bytes _params_size;
int nr_procs; /* number of user processes */
int nr_tasks; /* number of kernel tasks */
char release[6]; /* kernel release number */
char version[6]; /* kernel version number */
};
/* Load data accounted every this no. of seconds. */
#define _LOAD_UNIT_SECS 6 /* Changing this breaks ABI. */
/* Load data history is kept for this long. */
#define _LOAD_HISTORY_MINUTES 15 /* Changing this breaks ABI. */
#define _LOAD_HISTORY_SECONDS (60*_LOAD_HISTORY_MINUTES)
/* We need this many slots to store the load history. */
#define _LOAD_HISTORY (_LOAD_HISTORY_SECONDS/_LOAD_UNIT_SECS)
/* Runnable processes and other load-average information. */
struct loadinfo {
u16_t proc_load_history[_LOAD_HISTORY]; /* history of proc_s_cur */
u16_t proc_last_slot;
clock_t last_clock;
};
struct cpu_info {
u8_t vendor;
u8_t family;
u8_t model;
u8_t stepping;
u32_t freq; /* in MHz */
u32_t flags[2];
};
struct machine {
int pc_at;
int ps_mca;
int processor;
unsigned processors_count; /* how many cpus are available */
unsigned bsp_id; /* id of the bootstrap cpu */
int padding; /* used to be protected */
int vdu_ega;
int vdu_vga;
int apic_enabled; /* does the kernel use APIC or not? */
phys_bytes acpi_rsdp; /* where is the acpi RSDP */
};
struct io_range
{
unsigned ior_base; /* Lowest I/O port in range */
unsigned ior_limit; /* Highest I/O port in range */
};
struct mem_range
{
phys_bytes mr_base; /* Lowest memory address in range */
phys_bytes mr_limit; /* Highest memory address in range */
};
/* For EXEC_NEWMEM */
struct exec_newmem
{
vir_bytes text_addr; /* Starting address of text section */
vir_bytes text_bytes; /* Length of text section (in bytes) */
vir_bytes data_addr; /* Starting address of data section */
vir_bytes data_bytes; /* Length of data section (in bytes) */
vir_bytes tot_bytes; /* Minimum stack region size (in bytes) */
vir_bytes args_bytes; /* Arguments/environ size on stack (in bytes) */
int sep_id; /* Separate I&D? */
int is_elf; /* Is ELF exe? */
dev_t st_dev; /* Device holding executable file */
ino_t st_ino; /* Inode of executable file */
time_t st_ctime; /* Last changed time of executable file */
uid_t new_uid; /* Process UID after exec */
gid_t new_gid; /* Process GID after exec */
char progname[16]; /* Should be at least PROC_NAME_LEN */
};
/* Memory chunks. */
struct memory {
phys_bytes base;
phys_bytes size;
};
#define STATICINIT(v, n) \
if(!(v)) { \
if(!((v) = alloc_contig(sizeof(*(v)) * (n), 0, NULL))) { \
panic("allocating " #v " failed: %d", n); \
} \
}
/* The kernel outputs diagnostic messages in a circular buffer. */
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 */
};
#include <minix/config.h>
#include <machine/interrupt.h>
/* randomness struct: random sources after interrupts: */
#define RANDOM_SOURCES 16
#define RANDOM_ELEMENTS 64
typedef unsigned short rand_t;
struct k_randomness {
int random_elements, random_sources;
struct k_randomness_bin {
int r_next; /* next index to write */
int r_size; /* number of random elements */
rand_t r_buf[RANDOM_ELEMENTS]; /* buffer for random info */
} bin[RANDOM_SOURCES];
};
#endif /* _TYPE_H */

View File

@@ -1,78 +0,0 @@
/* Prototypes and definitions for VM interface. */
#ifndef _MINIX_VM_H
#define _MINIX_VM_H
#include <minix/types.h>
#include <minix/endpoint.h>
_PROTOTYPE( int vm_exit, (endpoint_t ep));
_PROTOTYPE( int vm_fork, (endpoint_t ep, int slotno, endpoint_t *child_ep));
_PROTOTYPE( int vm_brk, (endpoint_t ep, char *newaddr));
_PROTOTYPE( int vm_exec_newmem, (endpoint_t ep, struct exec_newmem *args,
int args_bytes, char **ret_stack_top, int *ret_flags));
_PROTOTYPE( int vm_push_sig, (endpoint_t ep, vir_bytes *old_sp));
_PROTOTYPE( int vm_willexit, (endpoint_t ep));
_PROTOTYPE( int vm_adddma, (endpoint_t req_e, endpoint_t proc_e,
phys_bytes start, phys_bytes size) );
_PROTOTYPE( int vm_deldma, (endpoint_t req_e, endpoint_t proc_e,
phys_bytes start, phys_bytes size) );
_PROTOTYPE( int vm_getdma, (endpoint_t req_e, endpoint_t *procp,
phys_bytes *basep, phys_bytes *sizep) );
_PROTOTYPE( void *vm_map_phys, (endpoint_t who, void *physaddr, size_t len));
_PROTOTYPE( int vm_unmap_phys, (endpoint_t who, void *vaddr, size_t len));
_PROTOTYPE( int vm_notify_sig, (endpoint_t ep, endpoint_t ipc_ep));
_PROTOTYPE( int vm_set_priv, (int procnr, void *buf));
_PROTOTYPE( int vm_update, (endpoint_t src_e, endpoint_t dst_e));
_PROTOTYPE( int vm_memctl, (endpoint_t ep, int req));
_PROTOTYPE( int vm_query_exit, (int *endpt));
_PROTOTYPE( int vm_forgetblock, (u64_t id));
_PROTOTYPE( void vm_forgetblocks, (void));
_PROTOTYPE( int vm_yield_block_get_block, (u64_t yieldid, u64_t getid,
void *mem, vir_bytes len));
/* Invalid ID with special meaning for the vm_yield_block_get_block
* interface.
*/
#define VM_BLOCKID_NONE make64(ULONG_MAX, ULONG_MAX)
/* VM kernel request types. */
#define VMPTYPE_NONE 0
#define VMPTYPE_CHECK 1
#define VMPTYPE_COWMAP 2
#define VMPTYPE_SMAP 3
#define VMPTYPE_SUNMAP 4
struct vm_stats_info {
unsigned int vsi_pagesize; /* page size */
unsigned long vsi_total; /* total number of memory pages */
unsigned long vsi_free; /* number of free pages */
unsigned long vsi_largest; /* largest number of consecutive free pages */
unsigned long vsi_cached; /* number of pages cached for file systems */
};
struct vm_usage_info {
vir_bytes vui_total; /* total amount of process memory */
vir_bytes vui_common; /* part of memory mapped in more than once */
vir_bytes vui_shared; /* shared (non-COW) part of common memory */
};
struct vm_region_info {
int vri_seg; /* segment of virtual region (T or D) */
vir_bytes vri_addr; /* base address of region */
vir_bytes vri_length; /* length of region */
int vri_prot; /* protection flags (PROT_) */
int vri_flags; /* memory flags (subset of MAP_) */
};
#define MAX_VRI_COUNT 64 /* max. number of regions provided at once */
_PROTOTYPE( int vm_info_stats, (struct vm_stats_info *vfi) );
_PROTOTYPE( int vm_info_usage, (endpoint_t who,
struct vm_usage_info *vui) );
_PROTOTYPE( int vm_info_region, (endpoint_t who,
struct vm_region_info *vri, int count, vir_bytes *next) );
#endif /* _MINIX_VM_H */