Added <minix/sys_config.h>. 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 _). <minix/config.h> 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.
This commit is contained in:
Ben Gras 2005-08-29 13:52:08 +00:00
parent ed5fa1767a
commit 43ea6a9ce8
8 changed files with 126 additions and 80 deletions

View file

@ -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 <minix/machine.h>.
*/
#include <minix/sys_config.h>
#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 <minix/config.h> please define MACHINE"
#endif
#ifndef CHIP
error "In <minix/config.h> please define MACHINE to have a legal value"
#endif
#if (MACHINE == 0)
error "MACHINE has incorrect value (0)"
#endif
/* _ASKDEV and _FASTLOAD are defined in sys_config.h. */
#define ASKDEV _ASKDEV
#define FASTLOAD _FASTLOAD
#endif /* _CONFIG_H */

View file

@ -9,7 +9,7 @@
#ifndef _DEVIO_H
#define _DEVIO_H
#include <minix/config.h> /* needed to include <minix/type.h> */
#include <minix/sys_config.h> /* needed to include <minix/type.h> */
#include <sys/types.h> /* u8_t, u16_t, u32_t needed */
typedef u16_t port_t;

View file

@ -1,7 +1,7 @@
#ifndef _DMAP_H
#define _DMAP_H
#include <minix/config.h>
#include <minix/sys_config.h>
#include <minix/ipc.h>
/*===========================================================================*

70
include/minix/sys_config.h Executable file
View file

@ -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 <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
#endif /* _MINIX_SYS_CONFIG_H */

View file

@ -1,8 +1,8 @@
#ifndef _TYPE_H
#define _TYPE_H
#ifndef _CONFIG_H
#include <minix/config.h>
#ifndef _MINIX_SYS_CONFIG_H
#include <minix/sys_config.h>
#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

View file

@ -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 <minix/config.h>
#include <minix/sys_config.h>
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 <minix/config.h> is included, let's check */
#if (CHIP == 0)
#include "CHIP macro not set, include <minix/config.h>"
#if (_MINIX_CHIP == 0)
#include "_MINIX_CHIP macro not set, include <minix/config.h>"
#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

View file

@ -13,7 +13,7 @@
#ifndef _MINIX__TYPES_H
#include <sys/types.h>
#endif
#include <minix/config.h>
#include <minix/sys_config.h>
#if (_WORD_SIZE != 2 && _WORD_SIZE != 4) || \
(_PTR_SIZE != _WORD_SIZE && _PTR_SIZE != 2*_WORD_SIZE)

View file

@ -10,11 +10,11 @@
#include <ansi.h>
#endif
#ifndef _CONFIG_H
#include <minix/config.h>
#ifndef _MINIX_SYS_CONFIG_H
#include <minix/sys_config.h>
#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 <minix/jmp_buf.h>. */
#define SC_SIGCONTEXT 2 /* nonzero when signal context is included */