From 43ea6a9ce8b8a02053ce020f02bf64c703223189 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 29 Aug 2005 13:52:08 +0000 Subject: [PATCH] Added . This file is intended to be included from other, user-includable config files. It only defines names that don't pollute the users namespace (start with _). still works like always; it includes sys_config.h now and defines the 'messy' names (such as CHIP) as the 'cleaner' names (such as _MINIX_CHIP). Changed some of the other include files to use sys_config.h and the 'cleaner' names. This solves some (past and future) compilation problems. --- include/minix/config.h | 88 ++++++++++++++------------------------ include/minix/devio.h | 2 +- include/minix/dmap.h | 2 +- include/minix/sys_config.h | 70 ++++++++++++++++++++++++++++++ include/minix/type.h | 10 ++--- include/net/hton.h | 10 ++--- include/stdint.h | 2 +- include/sys/sigcontext.h | 22 +++++----- 8 files changed, 126 insertions(+), 80 deletions(-) create mode 100755 include/minix/sys_config.h diff --git a/include/minix/config.h b/include/minix/config.h index a6cfcbdd8..62eddf0e8 100755 --- a/include/minix/config.h +++ b/include/minix/config.h @@ -9,31 +9,35 @@ * 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. + * */ -/*===========================================================================* - * This section contains user-settable parameters * - *===========================================================================*/ -#define MACHINE IBM_PC /* Must be one of the names listed below */ +/* The MACHINE (called _MINIX_MACHINE) setting can be done + * in . + */ +#include -#define IBM_PC 1 /* any 8088 or 80x86-based system */ -#define SUN_4 40 /* any Sun SPARC-based system */ -#define SUN_4_60 40 /* Sun-4/60 (aka SparcStation 1 or Campus) */ -#define ATARI 60 /* ATARI ST/STe/TT (68000/68030) */ -#define MACINTOSH 62 /* Apple Macintosh (68000) */ +#define MACHINE _MINIX_MACHINE -/* Word size in bytes (a constant equal to sizeof(int)). */ -#if __ACK__ -#define _WORD_SIZE _EM_WSIZE -#define _PTR_SIZE _EM_WSIZE -#endif +#define IBM_PC _MACHINE_IBM_PC +#define SUN_4 _MACHINE_SUN_4 +#define SUN_4_60 _MACHINE_SUN_4_60 +#define ATARI _MACHINE_ATARI +#define MACINTOSH _MACHINE_MACINTOSH /* 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 64 -#define NR_SYS_PROCS 32 +#define NR_PROCS _NR_PROCS +#define NR_SYS_PROCS _NR_SYS_PROCS /* The buffer cache should be made as large as you can afford. */ #if (MACHINE == IBM_PC && _WORD_SIZE == 2) @@ -92,50 +96,22 @@ * indicative of more than just the CPU. For example, machines for which * CHIP == INTEL are expected to have 8259A interrrupt controllers and the * other properties of IBM PC/XT/AT/386 types machines in general. */ -#define INTEL 1 /* CHIP type for PC, XT, AT, 386 and clones */ -#define M68000 2 /* CHIP type for Atari, Amiga, Macintosh */ -#define SPARC 3 /* CHIP type for SUN-4 (e.g. SPARCstation) */ +#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 0 /* no floating point support */ -#define FP_IEEE 1 /* conform IEEE floating point standard */ +#define FP_NONE _FP_NONE /* no floating point support */ +#define FP_IEEE _FP_IEEE /* conform IEEE floating point standard */ -#if (MACHINE == IBM_PC) -#define CHIP INTEL -#endif +/* _MINIX_CHIP is defined in sys_config.h. */ +#define CHIP _MINIX_CHIP -#if (MACHINE == ATARI) || (MACHINE == MACINTOSH) -#define CHIP M68000 -#endif +/* _MINIX_FP_FORMAT is defined in sys_config.h. */ +#define FP_FORMAT _MINIX_FP_FORMAT -#if (MACHINE == SUN_4) || (MACHINE == SUN_4_60) -#define CHIP SPARC -#define FP_FORMAT FP_IEEE -#endif - -#if (MACHINE == ATARI) || (MACHINE == SUN_4) -#define ASKDEV 1 /* ask for boot device */ -#define FASTLOAD 1 /* use multiple block transfers to init ram */ -#endif - -#if (ATARI_TYPE == TT) /* and all other 68030's */ -#define FPP -#endif - -#ifndef FP_FORMAT -#define FP_FORMAT FP_NONE -#endif - -#ifndef MACHINE -error "In please define MACHINE" -#endif - -#ifndef CHIP -error "In please define MACHINE to have a legal value" -#endif - -#if (MACHINE == 0) -error "MACHINE has incorrect value (0)" -#endif +/* _ASKDEV and _FASTLOAD are defined in sys_config.h. */ +#define ASKDEV _ASKDEV +#define FASTLOAD _FASTLOAD #endif /* _CONFIG_H */ diff --git a/include/minix/devio.h b/include/minix/devio.h index cb8902951..ae8918c32 100644 --- a/include/minix/devio.h +++ b/include/minix/devio.h @@ -9,7 +9,7 @@ #ifndef _DEVIO_H #define _DEVIO_H -#include /* needed to include */ +#include /* needed to include */ #include /* u8_t, u16_t, u32_t needed */ typedef u16_t port_t; diff --git a/include/minix/dmap.h b/include/minix/dmap.h index 520797856..1c4f9df39 100644 --- a/include/minix/dmap.h +++ b/include/minix/dmap.h @@ -1,7 +1,7 @@ #ifndef _DMAP_H #define _DMAP_H -#include +#include #include /*===========================================================================* diff --git a/include/minix/sys_config.h b/include/minix/sys_config.h new file mode 100755 index 000000000..cf6cec161 --- /dev/null +++ b/include/minix/sys_config.h @@ -0,0 +1,70 @@ +#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 */ +#define _MACHINE_SUN_4 40 /* any Sun SPARC-based system */ +#define _MACHINE_SUN_4_60 40 /* Sun-4/60 (aka SparcStation 1 or Campus) */ +#define _MACHINE_ATARI 60 /* ATARI ST/STe/TT (68000/68030) */ +#define _MACHINE_MACINTOSH 62 /* Apple Macintosh (68000) */ + +/* Word size in bytes (a constant equal to sizeof(int)). */ +#if __ACK__ +#define _WORD_SIZE _EM_WSIZE +#define _PTR_SIZE _EM_WSIZE +#endif + +#define _NR_PROCS 64 +#define _NR_SYS_PROCS 32 + +/* 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 + +#if (_MINIX_MACHINE == _MACHINE_ATARI) || (_MINIX_MACHINE == _MACHINE_MACINTOSH) +#define _MINIX_CHIP _CHIP_M68000 +#endif + +#if (_MINIX_MACHINE == _MACHINE_SUN_4) || (_MINIX_MACHINE == _MACHINE_SUN_4_60) +#define _MINIX_CHIP _CHIP_SPARC +#define _MINIX_FP_FORMAT _FP_IEEE +#endif + +#if (_MINIX_MACHINE == _MACHINE_ATARI) || (_MINIX_MACHINE == _MACHINE_SUN_4) +#define _ASKDEV 1 /* ask for boot device */ +#define _FASTLOAD 1 /* use multiple block transfers to init ram */ +#endif + +#ifndef _MINIX_FP_FORMAT +#define _MINIX_FP_FORMAT _FP_NONE +#endif + +#ifndef _MINIX_MACHINE +error "In please define _MINIX_MACHINE" +#endif + +#ifndef _MINIX_CHIP +error "In please define _MINIX_MACHINE to have a legal value" +#endif + +#if (_MINIX_MACHINE == 0) +error "_MINIX_MACHINE has incorrect value (0)" +#endif + +#endif /* _MINIX_SYS_CONFIG_H */ diff --git a/include/minix/type.h b/include/minix/type.h index 5f6128983..dcc7e1d80 100755 --- a/include/minix/type.h +++ b/include/minix/type.h @@ -1,8 +1,8 @@ #ifndef _TYPE_H #define _TYPE_H -#ifndef _CONFIG_H -#include +#ifndef _MINIX_SYS_CONFIG_H +#include #endif #ifndef _TYPES_H @@ -14,15 +14,15 @@ 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 */ -#if (CHIP == INTEL) +#if (_MINIX_CHIP == _CHIP_INTEL) typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */ #endif -#if (CHIP == M68000) +#if (_MINIX_CHIP == _CHIP_M68000) typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */ #endif -#if (CHIP == SPARC) +#if (_MINIX_CHIP == _CHIP_SPARC) typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */ #endif diff --git a/include/net/hton.h b/include/net/hton.h index 6b83030b0..64faead63 100755 --- a/include/net/hton.h +++ b/include/net/hton.h @@ -8,7 +8,7 @@ htons means convert a (unsigned) short in host byte order to network byte order. #ifndef _NET__HTON_H #define _NET__HTON_H -#include +#include extern u16_t _tmp; extern u32_t _tmp_l; @@ -16,15 +16,15 @@ extern u32_t _tmp_l; /* Find out about the byte order. */ /* assume is included, let's check */ -#if (CHIP == 0) -#include "CHIP macro not set, include " +#if (_MINIX_CHIP == 0) +#include "_MINIX_CHIP macro not set, include " #endif -#if (CHIP == INTEL) +#if (_MINIX_CHIP == _CHIP_INTEL) #define LITTLE_ENDIAN 1 #endif -#if (CHIP == M68000 || CHIP == SPARC) +#if (_MINIX_CHIP == _CHIP_M68000 || _MINIX_CHIP == _CHIP_SPARC) #define BIG_ENDIAN 1 #endif diff --git a/include/stdint.h b/include/stdint.h index e9b27807f..7eb0afd2e 100644 --- a/include/stdint.h +++ b/include/stdint.h @@ -13,7 +13,7 @@ #ifndef _MINIX__TYPES_H #include #endif -#include +#include #if (_WORD_SIZE != 2 && _WORD_SIZE != 4) || \ (_PTR_SIZE != _WORD_SIZE && _PTR_SIZE != 2*_WORD_SIZE) diff --git a/include/sys/sigcontext.h b/include/sys/sigcontext.h index e6b238700..288ff8221 100755 --- a/include/sys/sigcontext.h +++ b/include/sys/sigcontext.h @@ -10,11 +10,11 @@ #include #endif -#ifndef _CONFIG_H -#include +#ifndef _MINIX_SYS_CONFIG_H +#include #endif -#if !defined(CHIP) +#if !defined(_MINIX_CHIP) #include "error, configuration is not known" #endif @@ -22,7 +22,7 @@ * by the kernel's context switching code. Floating point registers should * be added in a different struct. */ -#if (CHIP == INTEL) +#if (_MINIX_CHIP == _CHIP_INTEL) struct sigregs { #if _WORD_SIZE == 4 short sr_gs; @@ -58,7 +58,7 @@ struct sigframe { /* stack frame created for signalled process */ }; #else -#if (CHIP == M68000) +#if (_MINIX_CHIP == _CHIP_M68000) struct sigregs { long sr_retreg; /* d0 */ long sr_d1; @@ -81,9 +81,9 @@ struct sigregs { short sr_dummy; /* make size multiple of 4 for system.c */ }; #else -#include "error, CHIP is not supported" +#include "error, _MINIX_CHIP is not supported" #endif -#endif /* CHIP == INTEL */ +#endif /* _MINIX_CHIP == _CHIP_INTEL */ struct sigcontext { int sc_flags; /* sigstack state to restore */ @@ -91,7 +91,7 @@ struct sigcontext { struct sigregs sc_regs; /* register set to restore */ }; -#if (CHIP == INTEL) +#if (_MINIX_CHIP == _CHIP_INTEL) #if _WORD_SIZE == 4 #define sc_gs sc_regs.sr_gs #define sc_fs sc_regs.sr_fs @@ -113,9 +113,9 @@ struct sigcontext { #define sc_psw sc_regs.sr_psw #define sc_sp sc_regs.sr_sp #define sc_ss sc_regs.sr_ss -#endif /* CHIP == INTEL */ +#endif /* _MINIX_CHIP == _CHIP_INTEL */ -#if (CHIP == M68000) +#if (_MINIX_CHIP == M68000) #define sc_retreg sc_regs.sr_retreg #define sc_d1 sc_regs.sr_d1 #define sc_d2 sc_regs.sr_d2 @@ -134,7 +134,7 @@ struct sigcontext { #define sc_sp sc_regs.sr_sp #define sc_pc sc_regs.sr_pc #define sc_psw sc_regs.sr_psw -#endif /* CHIP == M68000 */ +#endif /* _MINIX_CHIP == M68000 */ /* Values for sc_flags. Must agree with . */ #define SC_SIGCONTEXT 2 /* nonzero when signal context is included */