Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!rice!uupsi!cmcl2!lab!jai From: jai@lab.ultra.nyu.edu (Benchiao Jai) Newsgroups: comp.os.minix Subject: NYUMINIX:MODIFY Message-ID: <1991Feb24.070340.6203@cmcl2.nyu.edu> Date: 24 Feb 91 07:03:40 GMT Sender: notes@cmcl2.nyu.edu (Notes Person) Organization: New York University Ultracomputer Research Lab Lines: 232 Nntp-Posting-Host: lab.ultra.nyu.edu 1. Change all '/' in the include path names to '\'. And TURBO-C checks all directives even not executed, so delete: ***** h\CONST.H #ifndef i8088 #ifndef ATARI_ST #error Either i8088 or ATARI ST must be defined #endif #endif ***** 2. Interrupt controller #2 is used only for WINI, now it's not needed. Delete the following sections. ***** kernel\MAIN.C port_out(INT2_MASK, CMASK2); /* same for second intr controller */ ***** ***** kernel\PROC.C if (pc_at && task == WINCHESTER) /* this re-enables the second controller chip */ port_out(INT2_CTL, ENABLE); ***** 3. Do not initialize the vectors not used by MINIX. Delete the following sections. ***** kernel\MAIN.C #define HIGH_INT 16 /* limit of the interrupt vectors */ extern int int00(), int01(), int02(), int03(), int04(), int05(), int06(), int07(), int08(), int09(), int10(), int11(), int12(), int13(), int14(), int15(); int (*int_vec[HIGH_INT])() = {int00, int01, int02, int03, int04, int05, int06, int07, int08, int09, int10, int11, int12, int13, int14, int15}; ***** ***** kernel\MAIN.C for (t = 0; t < HIGH_INT; t++) set_vec(t, int_vec[t], base_click); for (t = HIGH_INT; t < 256; t++) set_vec(t, trp, base_click); ***** ***** kernel\MAIN.C if (pc_at) { set_vec(AT_WINI_VECTOR, wini_int, base_click); phys_copy(phys_b + 4L*EM_VEC, 4L*EM_VEC, 4L); /* extended mem vec */ } else set_vec(XT_WINI_VECTOR, wini_int, base_click); ***** ***** kernel\MAIN.C /* Put a ptr to proc table in a known place so it can be found in /dev/mem */ set_vec( (BASE - 4)/4, proc, (phys_clicks) 0); ***** And modify this: ***** kernel\CONST.H #define VECTOR_BYTES 284 /* bytes of interrupt vectors to save */ >>>>> #define VECTOR_BYTES 132 /* bytes of interrupt vectors to save */ ***** ***** kernel\MAIN.C extern int wini_int(), lpr_int(), trp(), rs232_int(), secondary_int(); >>>>> extern int lpr_int(), rs232_int(), secondary_int(); ***** 4. NYUMINIX is on top of MS-DOS, so we need to change the address base. ***** kernel\MAIN.C #define VERY_BIG 39328 /* must be bigger than kernel size (clicks) */ #define BASE 1536 /* address where MINIX starts in memory */ >>>>> #define VERY_BIG (unsigned)34816/* must be bigger than kernel size (clicks) */ #define BASE _CS /* address where MINIX starts in memory */ ***** ***** kernel\MAIN.C old_state = lock(); /* we can't handle interrupts yet */ base_click = BASE >> CLICK_SHIFT; size = sizes[0] + sizes[1]; /* kernel text + data size in clicks */ >>>>> lock(); /* we can't handle interrupts yet */ base_click = BASE; size = sizes[0] + sizes[1]; /* kernel text + data size in clicks */ ***** 5. The word 'interrupt' is reserved by TURBO-C, change it to 'interupt'. ***** kernel\CONSOLE.C interrupt(TTY, &keybd_mess); /* send a message to the tty task */ >>>>> interupt(TTY, &keybd_mess); /* send a message to the tty task */ ***** ***** kernel\PRINTER.C interrupt(PRINTER, &int_mess); >>>>> interupt(PRINTER, &int_mess); ***** ***** kernel\PROC.C PUBLIC interrupt(task, m_ptr) >>>>> PUBLIC interupt(task, m_ptr) ***** ***** kernel\RS232.C interrupt(TTY, &rs232_rd_mess); /* send a message to the tty task */ >>>>> interupt(TTY, &rs232_rd_mess); /* send a message to the tty task */ ***** ***** kernel\RS232.C interrupt(TTY, &rs232_wt_mess); /* send the message to the tty task */ >>>>> interupt(TTY, &rs232_wt_mess); /* send the message to the tty task */ ***** 6. Three PRIVATE functions in RS232.C should be PUBLIC. MINIX C compiler didn't catch this. ***** kernel\RS232.C PRIVATE rs_out_char(tp, c) >>>>> PUBLIC rs_out_char(tp, c) ***** ***** kernel\RS232.C PRIVATE init_rs232() >>>>> PUBLIC init_rs232() ***** ***** kernel\RS232.C PRIVATE set_uart(line, mode, speeds) >>>>> PUBLIC set_uart(line, mode, speeds) ***** 7. This is not necessary, but helps if you have a strange printer port which doesn't match your display card. Like my laptop, it has a MONO display but a COLOR printer port (0x378). ***** kernel\PRINTER.C PRIVATE print_init() { /* Color display uses 0x378 for printer; mono display uses 0x3BC. */ int i; extern int color; port_base = (color ? PR_COLOR_BASE : PR_MONO_BASE); >>>>> PRIVATE print_init() { int i; extern char get_byte(); port_base = get_byte(0x40, 8) + (get_byte(0x40, 9) << 8); ***** 8. Some type checking problems: ***** h\const.h #define NO_NUM 0x8000 /* used as numerical argument to panic() */ >>>>> #define NO_NUM (int)0x8000 /* used as numerical argument to panic() */ ***** ***** h\const.h #define I_REGULAR 0100000 /* regular file, not dir or special */ >>>>> #define I_REGULAR (int)0100000 /* regular file, not dir or special */ ***** ***** mm\UTILITY.C extern errno; >>>>> extern int errno; ***** 9. Some operator precedence problems: ***** h\type.h #define MAX(a,b) (a > b ? a : b) #define MIN(a,b) (a < b ? a : b) >>>>> #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define MIN(a,b) (((a) < (b)) ? (a) : (b)) ***** ***** mm\SIGNAL.C if (sig_map == 1 << (STACK_FAULT - 1)) stack_fault(proc_nr); >>>>> if (sig_map == ((unshort)1 << (STACK_FAULT - 1))) stack_fault(proc_nr); ***** ***** mm\UTILITY.C if (mp->mp_effuid == SUPER_USER && mask == X_BIT && (s_buf->st_mode & (X_BIT << 6 | X_BIT << 3 | X_BIT))) return(fd); >>>>> if (mp->mp_effuid == SUPER_USER && mask == X_BIT && (s_buf->st_mode & ((X_BIT << 6) | (X_BIT << 3) | X_BIT))) return(fd); ***** ***** mm\UTILITY.C if (s_buf->st_mode >> shift & mask) /* test the relevant bits */ >>>>> if ((s_buf->st_mode >> shift) & mask) /* test the relevant bits */ ***** ***** fs\PIPE.C fp->fp_fd = fd << 8 | fs_call; >>>>> fp->fp_fd = (fd << 8) | fs_call; ***** 10. Finally, you will want to load the root disk from an MS-DOS file. And since the MS-DOS files, as being MINIX filesystems, are relatively smaller than partitions, you'll want to have more of them and more places to mount them. ***** fs\CONST.H #define NR_SUPERS 5 /* # slots in super block table */ >>>>> #define NR_SUPERS 8 /* # slots in super block table */ ***** ***** fs\MAIN.C #define RAM_IMAGE (dev_nr)0x303 /* major-minor dev where root image is kept */ >>>>> #define RAM_IMAGE (dev_nr)0x300 /* major-minor dev where root image is kept */ ***** ***** fs\MAIN.C root_device = BOOT_DEV; /* try floppy disk first */ bp = get_block(root_device, SUPER_BLOCK, NORMAL); /* get RAM super block */ >>>>> root_device = RAM_IMAGE; bp = get_block(root_device, SUPER_BLOCK, NORMAL); /* get super block */ ***** ***** fs\MAIN.C if (sp->s_magic != SUPER_MAGIC) { put_block(bp, FULL_DATA_BLOCK); root_device = RAM_IMAGE; bp = get_block(root_device, SUPER_BLOCK, NORMAL); /* get RAM super block */ copy(super_block, bp->b_data, sizeof(struct super_block)); sp = &super_block[0]; if (sp->s_magic != SUPER_MAGIC) panic("Invalid root file system", NO_NUM); } >>>>> if (sp->s_magic != SUPER_MAGIC) panic("Invalid root file system", NO_NUM); ***** Benchiao Jai jai@cs.nyu.edu Brought to you by Super Global Mega Corp .com