#endif
else if (ADDA(off))
off = ADDA_CNT(ptrace(T_GETINS, curpid, pc + 2, 0L)) + bp;
-#if (CHIP == INTEL)
+#if defined(__i386__)
else if (INCSP2(off))
off = bp + 2*INTSIZE;
else if (POPBX2(off))
#undef printf /* defined as printk in <minix/const.h> */
-#if (_MINIX_CHIP == _CHIP_INTEL)
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
#define MINIX_PC
#else
-#error "only the MINIX_PC 1.5.x and later versions works on *86's"
-#endif
+#error "Unsupported arch"
#endif
#ifdef MINIX_ST
#define CSEG 0x2E /* 8088 through 80386 */
#define DSEG 0x3E
-#if (_MINIX_CHIP == _CHIP_INTEL )
-#ifdef __i86
-#define N_REG16 2
-#endif
-#ifdef __i386
+#if defined(__i386__)
#define N_REG16 4 /* 16 bit registers at start of stackframe */
#endif
-#ifndef N_REG16
-#error "N_REG16 not defined"
-#endif
-#endif
-#if (_MINIX_CHIP == _CHIP_INTEL )
+#if defined(__i386__)
#define ADDA(l) ((u16_t) (l) == 0xC481)
#ifdef __i386
}
/* Check CPU */
-#if (CHIP == INTEL)
+#if defined(__i386__)
#if (_WORD_SIZE == 4)
if (hdr->a_cpu != A_I80386)
#else
if (hdr->a_cpu != A_I8086)
#endif
-#endif
-#if (CHIP == M68000)
- if (hdr->a_cpu != A_M68K)
#endif
{
Printf("mdb: invalid cpu in exec header - %04x\n",
#define STD_OUT 1 /* File descriptor for terminal */
-#if (CHIP == INTEL)
+#if defined(__i386__)
#define MEMORY_SIZE (50 * 1024) /* Size of data space to malloc */
#endif
void (*escfunc(c))()
int c;
{
-#if (CHIP == M68000)
-#ifndef COMPAT
- int ch;
-#endif
-#endif
if (c == '[') {
/* Start of ASCII escape sequence. */
c = getchar();
-#if (CHIP == M68000)
-#ifndef COMPAT
- if ((c >= '0') && (c <= '9')) ch = getchar();
- /* ch is either a tilde or a second digit */
-#endif
-#endif
switch (c) {
case 'H': return(HO);
case 'A': return(UP);
case 'B': return(DN);
case 'C': return(RT);
case 'D': return(LF);
-#if (CHIP == M68000)
-#ifndef COMPAT
- /* F1 = ESC [ 1 ~ */
- /* F2 = ESC [ 2 ~ */
- /* F3 = ESC [ 3 ~ */
- /* F4 = ESC [ 4 ~ */
- /* F5 = ESC [ 5 ~ */
- /* F6 = ESC [ 6 ~ */
- /* F7 = ESC [ 17 ~ */
- /* F8 = ESC [ 18 ~ */
- case '1':
- switch (ch) {
- case '~': return(SF);
- case '7': (void) getchar(); return(MA);
- case '8': (void) getchar(); return(CTL);
- }
- case '2': return(SR);
- case '3': return(PD);
- case '4': return(PU);
- case '5': return(FS);
- case '6': return(EF);
-#endif
-#endif
-#if (CHIP == INTEL)
+#if defined(__i386__)
case 'G': return(FS);
case 'S': return(SR);
case 'T': return(SF);
}
return(I);
}
-#if (CHIP == M68000)
-#ifdef COMPAT
- if (c == 'O') {
- /* Start of ASCII function key escape sequence. */
- switch (getchar()) {
- case 'P': return(SF);
- case 'Q': return(SR);
- case 'R': return(PD);
- case 'S': return(PU);
- case 'T': return(FS);
- case 'U': return(EF);
- case 'V': return(MA);
- case 'W': return(CTL);
- }
- }
-#endif
-#endif
return(I);
}
char *ohead; /* next free spot in output buffer */
char *otail; /* next char to output */
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
port_t xmit_port; /* i/o ports */
port_t recv_port;
port_t div_low_port;
static rs232_t rs_lines[NR_RS_LINES];
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
/* 8250 base addresses. */
static port_t addr_8250[] = {
0x3F8, /* COM1 */
speed_t speed;
int divisor;
} s2d[] = {
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
{ B50, UART_FREQ / 50 },
#endif
{ B75, UART_FREQ / 75 },
{ B300, UART_FREQ / 300 },
{ B600, UART_FREQ / 600 },
{ B1200, UART_FREQ / 1200 },
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
{ B1800, UART_FREQ / 1800 },
#endif
{ B2400, UART_FREQ / 2400 },
{ B4800, UART_FREQ / 4800 },
{ B9600, UART_FREQ / 9600 },
{ B19200, UART_FREQ / 19200 },
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
{ B38400, UART_FREQ / 38400 },
{ B57600, UART_FREQ / 57600 },
{ B115200, UART_FREQ / 115200L },
size = sizeof(struct winsize);
break;
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
case KIOCSMAP: /* load keymap (Minix extension) */
size = sizeof(keymap_t);
break;
sigchar(tp, SIGWINCH, 0);
break;
-#if (MACHINE == IBM_PC)
+#if defined(__i386__)
case KIOCSMAP:
/* Load a new keymap (only /dev/console). */
if (isconsole(tp)) r = kbd_loadmap(m_ptr);
void rs_init(struct tty *tp);
void rs_interrupt(message *m);
-#if (CHIP == INTEL)
+#if defined(__i386__)
/* console.c */
void kputc(int c);
void cons_stop(void);
void select_retry_pty(struct tty *tp);
int pty_status(message *m_ptr);
-#endif /* (CHIP == INTEL) */
+#endif /* defined(__i386__) */
#ifndef _INTERRUPT_H
#define _INTERRUPT_H
-#if (CHIP == INTEL)
+#if defined(__i386__)
/* 8259A interrupt controller ports. */
#define INT_CTL 0x20 /* I/O port for interrupt controller */
#ifndef _PORTS_H
#define _PORTS_H
-#if (CHIP == INTEL)
+#if defined(__i386__)
/* Miscellaneous ports. */
#define PCR 0x65 /* Planar Control Register */
#define TIMER2 0x42 /* I/O port for timer channel 2 */
#define TIMER_MODE 0x43 /* I/O port for timer mode control */
-#endif /* (CHIP == INTEL) */
+#endif /* defined(__i386__) */
#endif /* _PORTS_H */
*
*/
-/* 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.
#ifndef _MINIX_CONST_H
#define _MINIX_CONST_H
-#ifndef _MINIX_CHIP
-#error _MINIX_CHIP is not defined
-#endif
-
/* The UNUSED annotation tells the compiler or lint not to complain
* about an unused variable or function parameter.
*
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
/* Memory is allocated in clicks. */
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
#define CLICK_SIZE 4096 /* unit in which memory is allocated */
#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
#else
-#error No reasonable CHIP setting.
+#error Unsupported arch
#endif
/* Click alignment macros. */
/*===========================================================================*
* 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 _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. */
map(SYS_PROFBUF, do_profbuf); /* announce locations to kernel */
/* i386-specific. */
-#if _MINIX_CHIP == _CHIP_INTEL
+#if defined(__i386__)
map(SYS_READBIOS, do_readbios); /* read from BIOS locations */
map(SYS_IOPENABLE, do_iopenable); /* Enable I/O */
map(SYS_SDEVIO, do_sdevio); /* phys_insb, _insw, _outsb, _outsw */
int do_fork(struct proc * caller, message * m_ptr)
{
/* Handle sys_fork(). PR_ENDPT has forked. The child is PR_SLOT. */
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
char *old_fpu_save_area_p;
#endif
register struct proc *rpc; /* child process pointer */
save_fpu(rpp);
/* Copy parent 'proc' struct to child. And reinitialize some fields. */
gen = _ENDPOINT_G(rpc->p_endpoint);
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
old_fpu_save_area_p = rpc->p_seg.fpu_state;
#endif
*rpc = *rpp; /* copy 'proc' struct */
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
rpc->p_seg.fpu_state = old_fpu_save_area_p;
if(proc_used_fpu(rpp))
memcpy(rpc->p_seg.fpu_state, rpp->p_seg.fpu_state, FPU_XFP_SIZE);
if (iskerneln(proc_nr)) return(EPERM);
rp = proc_addr(proc_nr);
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
if (!proc_used_fpu(rp))
return(OK); /* No state to copy */
#endif
(vir_bytes) &mc, (phys_bytes) sizeof(struct __mcontext))) != OK)
return(r);
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
/* Copy FPU state */
mc.mc_fpu_flags = 0;
if (proc_used_fpu(rp)) {
(vir_bytes) &mc, (phys_bytes) sizeof(struct __mcontext))) != OK)
return(r);
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
/* Copy FPU state */
if (mc.mc_fpu_flags & MF_FPU_INITIALIZED) {
rp->p_misc_flags |= MF_FPU_INITIALIZED;
sc.sc_psw = (sc.sc_psw & X86_FLAGS_USER) |
(rp->p_reg.psw & ~X86_FLAGS_USER);
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
/* Don't panic kernel if user gave bad selectors. */
sc.sc_cs = rp->p_reg.cs;
sc.sc_ds = rp->p_reg.ds;
/* Restore the registers. */
memcpy(&rp->p_reg, &sc.sc_regs, sizeof(sigregs));
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
if(sc.sc_flags & MF_FPU_INITIALIZED)
{
memcpy(rp->p_seg.fpu_state, &sc.sc_fpu_state, FPU_XFP_SIZE);
/* Copy the registers to the sigcontext structure. */
memcpy(&sc.sc_regs, (char *) &rp->p_reg, sizeof(sigregs));
- #if (_MINIX_CHIP == _CHIP_INTEL)
+ #if defined(__i386__)
if(proc_used_fpu(rp)) {
/* save the FPU context before saving it to the sig context */
save_fpu(rp);
tr_addr > sizeof(struct stackframe_s) - sizeof(reg_t))
return(EFAULT);
i = (int) tr_addr;
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
/* Altering segment registers might crash the kernel when it
* tries to load them prior to restarting a process, so do
* not allow it.
static int init_buffers(sub_dev_t *sub_dev_ptr)
{
-#if (CHIP == INTEL)
+#if defined(__i386__)
char *base;
size_t size;
unsigned left;
sub_dev_ptr->DmaSize, sub_dev_ptr->Nr);
return OK;
-#else /* CHIP != INTEL */
+#else /* !defined(__i386__) */
printf("%s: init_buffers() failed, CHIP != INTEL", drv.DriverName);
return EIO;
-#endif /* CHIP == INTEL */
+#endif /* defined(__i386__) */
}
}
if (ucp->uc_mcontext.mc_magic == MCF_MAGIC) {
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
/* The caller provides a pointer to a stack that we can use to run our
context on. When the context starts, control is given to a wrapped
start routine, which calls a function and cleans up the stack
/* Check magic number, cpu type, and flags. */
if (BADMAG(*hdr)) return(ENOEXEC);
-#if (CHIP == INTEL && _WORD_SIZE == 2)
+#if (defined(__i386__) && _WORD_SIZE == 2)
if (hdr->a_cpu != A_I8086) return(ENOEXEC);
#endif
-#if (CHIP == INTEL && _WORD_SIZE == 4)
+#if (defined(__i386__) && _WORD_SIZE == 4)
if (hdr->a_cpu != A_I80386) return(ENOEXEC);
#endif
if ((hdr->a_flags & ~(A_NSYM | A_EXEC | A_SEP)) != 0) return(ENOEXEC);
if (stackaddr == MAP_FAILED)
mthread_panic("Failed to allocate stack to thread");
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
guard_start = stackaddr;
guard_end = stackaddr + MTHREAD_GUARDSIZE;
guarded_stacksize = stackaddr + stacksize - guard_end;
/*===========================================================================*
* proctab_dmp *
*===========================================================================*/
-#if (CHIP == INTEL)
+#if defined(__i386__)
void proctab_dmp()
{
/* Proc table dump */
printf("\n");
}
}
-#endif /* (CHIP == INTEL) */
+#endif /* defined(__i386__) */
/*===========================================================================*
* procstack_dmp *
if (sendrec(VFS_PROC_NR, &mess) != OK || mess.m_type != OK)
panic("can't sync up with VFS");
-#if (CHIP == INTEL)
+#if defined(__i386__)
uts_val.machine[0] = 'i';
strcpy(uts_val.machine + 1, itoa(getprocessor()));
#endif
/* Verify stack hypothesis; we assume a stack is used from the top and grows
* downwards.
*/
-#if (_MINIX_CHIP == _CHIP_INTEL)
+#if defined(__i386__)
if (stackp[0] != MAGIC) err(11, 66); /* End of the stack */
for (i = no_ints - 1 - 16; i < no_ints; i++)
if (stackp[i] != MAGIC) stack_untouched = 0;
#include "const.h"
#include "type.h"
#include "mfsdir.h"
-#if (defined(__minix) && MACHINE == IBM_PC)
+#if (defined(__minix) && defined(__i386__))
#include <minix/partition.h>
#include <minix/u64.h>
#include <sys/ioctl.h>