Mostly warnings removed by fixing prototypes. More simplification to arch/i86/kernel/irqtab.c and arch/i86/sibo/irqtab.c. More changes in arch/i86/sibo/irqtab.c to be in sync with arch/i86/kernel/irqtab.c, Code size was reduced by 32 bytes, data size increased 4 bytes and bss size reduced by 4 bytes. Juan
diff -Nur elks.orig/arch/i86/drivers/block/doshd.c elks/arch/i86/drivers/block/doshd.c --- elks.orig/arch/i86/drivers/block/doshd.c 2015-04-26 11:39:15.000000000 -0500 +++ elks/arch/i86/drivers/block/doshd.c 2015-05-06 17:01:42.000000000 -0500 @@ -652,7 +652,7 @@ next_block: /* make sure we have a valid request - Done by INIT_REQUEST */ - if (!CURRENT || CURRENT->rq_dev < 0) + if (!CURRENT) return; /* now initialize it */ diff -Nur elks.orig/arch/i86/drivers/char/lp.c elks/arch/i86/drivers/char/lp.c --- elks.orig/arch/i86/drivers/char/lp.c 2015-04-26 11:39:15.000000000 -0500 +++ elks/arch/i86/drivers/char/lp.c 2015-05-06 17:01:42.000000000 -0500 @@ -162,7 +162,7 @@ return 1; } -int lp_write(struct inode *inode, struct file *file, char *buf, int count) +size_t lp_write(struct inode *inode, struct file *file, char *buf, int count) { register char *chrsp; @@ -180,7 +180,7 @@ break; chrsp++; } - return (int) chrsp; + return (size_t)chrsp; } int lp_open(struct inode *inode, struct file *file) diff -Nur elks.orig/arch/i86/drivers/char/mem.c elks/arch/i86/drivers/char/mem.c --- elks.orig/arch/i86/drivers/char/mem.c 2015-05-06 17:01:32.000000000 -0500 +++ elks/arch/i86/drivers/char/mem.c 2015-05-06 17:01:42.000000000 -0500 @@ -79,29 +79,29 @@ return (filp->f_pos = 0); } -int null_read(struct inode *inode, struct file *filp, char *data, int len) +size_t null_read(struct inode *inode, struct file *filp, char *data, int len) { debugmem("null_read()\n"); return 0; } -int null_write(struct inode *inode, struct file *filp, char *data, int len) +size_t null_write(struct inode *inode, struct file *filp, char *data, int len) { debugmem1("null write: ignoring %d bytes!\n", len); - return len; + return (size_t)len; } /* * /dev/full code */ -int full_read(struct inode *inode, struct file *filp, char *data, int len) +size_t full_read(struct inode *inode, struct file *filp, char *data, int len) { debugmem("full_read()\n"); filp->f_pos += len; return len; } -int full_write(struct inode *inode, struct file *filp, char *data, int len) +size_t full_write(struct inode *inode, struct file *filp, char *data, int len) { debugmem1("full_write: objecting to %d bytes!\n", len); return -ENOSPC; @@ -110,12 +110,12 @@ /* * /dev/zero code */ -int zero_read(struct inode *inode, struct file *filp, char *data, int len) +size_t zero_read(struct inode *inode, struct file *filp, char *data, int len) { debugmem("zero_read()\n"); - fmemset((__u16) data, current->mm.dseg, 0, (__u16) len); + fmemset(data, current->mm.dseg, 0, (size_t) len); filp->f_pos += len; - return len; + return (size_t)len; } static void split_seg_off(unsigned short int *segment, @@ -129,7 +129,7 @@ /* * /dev/kmem (and currently also mem) code */ -loff_t kmem_read(struct inode *inode, register struct file *filp, +size_t kmem_read(struct inode *inode, register struct file *filp, char *data, size_t len) { unsigned short int sseg, soff; @@ -139,10 +139,10 @@ debugmem3("Reading %u %p %p.\n", len, sseg, soff); fmemcpy(current->mm.dseg, (__u16) data, sseg, soff, (__u16) len); filp->f_pos += len; - return (loff_t) len; + return (size_t) len; } -int kmem_write(struct inode *inode, register struct file *filp, +size_t kmem_write(struct inode *inode, register struct file *filp, char *data, size_t len) { unsigned short int dseg, doff; @@ -153,7 +153,7 @@ debugmem2("Writing to %d:%d\n", dseg, doff); fmemcpy(dseg, doff, current->mm.dseg, (__u16) data, (__u16) len); filp->f_pos += len; - return (int) len; + return len; } int kmem_ioctl(struct inode *inode, struct file *file, int cmd, char *arg) diff -Nur elks.orig/arch/i86/drivers/char/ntty.c elks/arch/i86/drivers/char/ntty.c --- elks.orig/arch/i86/drivers/char/ntty.c 2015-04-26 11:39:15.000000000 -0500 +++ elks/arch/i86/drivers/char/ntty.c 2015-05-06 17:01:42.000000000 -0500 @@ -117,20 +117,20 @@ return 0; } -int tty_release(struct inode *inode, struct file *file) +void tty_release(struct inode *inode, struct file *file) { register struct tty *rtty; rtty = determine_tty(inode->i_rdev); if (!rtty) - return -ENODEV; + return; if (current->pid == rtty->pgrp) { kill_pg(rtty->pgrp, SIGHUP, 1); - rtty->pgrp = NULL; + rtty->pgrp = 0; } rtty->flags &= ~TTY_OPEN; - return rtty->ops->release(rtty); + rtty->ops->release(rtty); } static void tty_charout_raw(register struct tty *tty, unsigned char ch) @@ -170,7 +170,7 @@ * */ -int tty_write(struct inode *inode, struct file *file, char *data, int len) +size_t tty_write(struct inode *inode, struct file *file, char *data, int len) { register struct tty *tty = determine_tty(inode->i_rdev); register char *pi; @@ -187,7 +187,7 @@ return len; } -int tty_read(struct inode *inode, struct file *file, char *data, int len) +size_t tty_read(struct inode *inode, struct file *file, char *data, int len) { #if 1 register struct tty *tty = determine_tty(inode->i_rdev); @@ -361,7 +361,7 @@ #if defined(CONFIG_CONSOLE_DIRECT) || defined(CONFIG_SIBO_CONSOLE_DIRECT) - chq_init(ttys[0].inq, ttys[0].inq_buf, INQ_SIZE); + chq_init(&ttys[0].inq, ttys[0].inq_buf, INQ_SIZE); ttyp = ttys; for (pi = 0 ; ((int)pi) < NUM_TTYS ; pi++) { ttyp->ops = &dircon_ops; @@ -383,7 +383,7 @@ #ifdef CONFIG_PSEUDO_TTY ttyp = &ttys[8]; - for (pi = 8; ((int)pi) < 8 + NR_PTYS; pi++) { + for (pi = (char *)8; ((int)pi) < 8 + NR_PTYS; pi++) { ttyp->ops = &ttyp_ops; (ttyp++)->minor = (int)pi; } diff -Nur elks.orig/arch/i86/drivers/char/pty.c elks/arch/i86/drivers/char/pty.c --- elks.orig/arch/i86/drivers/char/pty.c 2015-04-26 11:39:15.000000000 -0500 +++ elks/arch/i86/drivers/char/pty.c 2015-05-06 17:01:42.000000000 -0500 @@ -35,13 +35,12 @@ return -ENODEV; } -int pty_release(struct inode *inode, struct file *file) +void pty_release(struct inode *inode, struct file *file) { register struct tty *otty; if ((otty = determine_tty(inode->i_rdev))) kill_pg(otty->pgrp, SIGHUP, 1); - return 0; } int pty_ioctl(struct inode *inode, struct file *file, int cmd, char *arg) @@ -89,7 +88,7 @@ #endif } -int pty_read(struct inode *inode, struct file *file, char *data, int len) +size_t pty_read(struct inode *inode, struct file *file, char *data, int len) { register struct tty *tty = determine_tty(inode->i_rdev); register char *pi; @@ -115,10 +114,10 @@ ++pi; } debug1("{%u}\n", (int)pi); - return (int)pi; + return (size_t)pi; } -int pty_write(struct inode *inode, struct file *file, char *data, int len) +size_t pty_write(struct inode *inode, struct file *file, char *data, int len) { register struct tty *tty = determine_tty(inode->i_rdev); register char *pi; @@ -144,13 +143,14 @@ debug(" wc"); } debug("\n"); - return (int)pi; + return (size_t)pi; } int ttyp_write(register struct tty *tty) { if (tty->outq.len == tty->outq.size) interruptible_sleep_on(&tty->outq.wq); + return 0; } /*@-type@*/ diff -Nur elks.orig/arch/i86/drivers/char/serial.c elks/arch/i86/drivers/char/serial.c --- elks.orig/arch/i86/drivers/char/serial.c 2015-04-26 11:39:15.000000000 -0500 +++ elks/arch/i86/drivers/char/serial.c 2015-05-06 17:01:42.000000000 -0500 @@ -272,7 +272,7 @@ debug1("SERIAL: Interrupt %d recieved.\n", irq); - sp = &ports[irq_port[irq - 2]]; + sp = &ports[(int)irq_port[irq - 2]]; do { statusp = (char *)inb_p(sp->io + UART_LSR); if ((int)statusp & UART_LSR_DR) diff -Nur elks.orig/arch/i86/drivers/char/tcpdev.c elks/arch/i86/drivers/char/tcpdev.c --- elks.orig/arch/i86/drivers/char/tcpdev.c 2015-05-06 17:01:32.000000000 -0500 +++ elks/arch/i86/drivers/char/tcpdev.c 2015-05-06 17:01:42.000000000 -0500 @@ -22,8 +22,6 @@ #ifdef CONFIG_INET -extern inet_process_tcpdev(); - unsigned char tdin_buf[TCPDEV_INBUFFERSIZE]; unsigned char tdout_buf[TCPDEV_OUTBUFFERSIZE]; @@ -35,7 +33,7 @@ char tcpdev_inuse; -static int tcpdev_read(struct inode *inode, struct file *filp, char *data, +static size_t tcpdev_read(struct inode *inode, struct file *filp, char *data, unsigned int len) { debug4("TCPDEV: read( %p, %p, %p, %u )\n",inode,filp,data,len); @@ -86,13 +84,13 @@ panic("bufin_sem tragedy"); } -static int tcpdev_write(struct inode *inode, struct file *filp, +static size_t tcpdev_write(struct inode *inode, struct file *filp, char *data, size_t len) { int ret; debug4("TCPDEV: write( %p, %p, %p, %u )\n",inode,filp,data,len); - if (len <= 0) + if (!len) ret = 0; else { down(&bufin_sem); @@ -106,7 +104,7 @@ ret = (int) len; } debug1("TCPDEV: write() returning %d\n",ret); - return ret; + return (size_t)ret; } int tcpdev_select(struct inode *inode, struct file *filp, int sel_type) @@ -154,11 +152,10 @@ return 0; } -int tcpdev_release(struct inode *inode, struct file *file) +void tcpdev_release(struct inode *inode, struct file *file) { debug2("TCPDEV: release( %p, %p )\n",inode,file); tcpdev_inuse = 0; - return 0; } /*@-type@*/ diff -Nur elks.orig/arch/i86/kernel/bios16.c elks/arch/i86/kernel/bios16.c --- elks.orig/arch/i86/kernel/bios16.c 2015-04-26 11:39:15.000000000 -0500 +++ elks/arch/i86/kernel/bios16.c 2015-05-06 17:01:42.000000000 -0500 @@ -6,32 +6,30 @@ * 9/1999 place the CS-Variable in a seperated RAM-Segment for * ROM version. Christian Mardm"oller (chm@xxxxxx) */ - + +#include <linuxmt/config.h> #include <linuxmt/types.h> -#include <arch/segment.h> #include <linuxmt/biosparm.h> -#include <linuxmt/config.h> static struct biosparms bdt; /* * The external interface is a pointer.. */ - + struct biosparms *bios_data_table=&bdt; /* * Quick drop into assembler for this one. */ - + #ifndef S_SPLINT_S #asm .text /* * stashed_ds lives in the kernel cs or we can never recover it... - */ - -/* In ROM we cant store anything! The space for the extrasegment + * + * In ROM we cant store anything! The space for the extrasegment * is managed in irqtab.c where I've found this mode first * ChM 10/99 */ diff -Nur elks.orig/arch/i86/kernel/irqtab.c elks/arch/i86/kernel/irqtab.c --- elks.orig/arch/i86/kernel/irqtab.c 2015-05-06 17:01:32.000000000 -0500 +++ elks/arch/i86/kernel/irqtab.c 2015-05-06 17:01:42.000000000 -0500 @@ -1,54 +1,45 @@ +#include <linuxmt/config.h> #include <arch/irq.h> #include <arch/asm-offsets.h> -#include <linuxmt/config.h> - -static int bios_call_cnt_l = 5; -static long stashed_irq0_l; -int intr_count = 0; /* * Easy way to store our kernel DS + * + * moving variables from code segment to an extra segment + * CONFIG_ROM_IRQ_DATA for the ROM_CODE-Version + * ELKS 0.76 7/1999 Christian Mard?ller (chm@xxxxxx) */ -/* moving variables from code segment to an extra segment -/ CONFIG_ROM_IRQ_DATA for the ROM_CODE-Version -/ ELKS 0.76 7/1999 Christian Mard?ller (chm@xxxxxx) -/ */ - -#ifdef CONFIG_ROMCODE -/* In ROM-Mode we must generate a physical 3th segment :-) -/ The segmentaddress is given by CONFIG_ROM_IRQ_DATA, -/ the offset is constant per #define -/-------------------------------------------------------*/ - +#ifdef CONFIG_ROMCODE +/* + * In ROM-Mode we must generate a physical 3th segment :-) + * The segmentaddress is given by CONFIG_ROM_IRQ_DATA, + * the offset is constant per #define + */ #define stashed_ds [0] - -#else +#endif #ifndef S_SPLINT_S #asm - .text - .globl stashed_ds - .even -stashed_ds: - .word 0 -#endasm -#endif + .text +#ifndef CONFIG_ROMCODE +/* + Kernel is in RAM. Reserve space in the + code segment to save the kernel DS +*/ + .globl stashed_ds + .even +stashed_ds: + .word 0 #endif -extern void sig_check(void); - /* * Low level IRQ control. */ - -#ifndef S_SPLINT_S -#asm .globl ___save_flags .globl _restore_flags - .text ___save_flags: pushf @@ -131,14 +122,9 @@ ! Other IRQs (see IRQ 0 at the bottom for the ! main code). ! - .text - .extern _do_IRQ - - .data - .extern _cache_A1 - .extern _cache_21 - - .text + .extern _schedule + .extern _sig_check + .extern _do_IRQ _irq1: ;keyboard push ax @@ -479,23 +465,20 @@ ! This path will return directly to user space ! call _schedule ! Task switch - mov bx,_current - mov 8[bx],#1 - call _sig_check ! Check signals + mov bx,_current + mov 8[bx],#1 + call _sig_check ! Check signals ! ! At this point, the kernel stack is empty. Thus, there is no ! need to save the kernel stack pointer. ! - mov bx,_current - mov sp,TASK_USER_SP[bx] -#ifndef CONFIG_ADVANCED_MM - mov ss,TASK_USER_SS[bx] -#else - mov ax, TASK_USER_SS[bx] ! user ds - mov bp, sp - mov ss, ax - mov 12[bp], ax ! change the es in the stack - mov 14[bp], ax ! change the ds in the stack + mov bx,_current + mov sp,TASK_USER_SP[bx] + mov ss,TASK_USER_SS[bx] ! user ds +#ifdef CONFIG_ADVANCED_MM + mov bp,sp + mov 12[bp],ss ! change the es in the stack + mov 14[bp],ss ! change the ds in the stack #endif j noschedpop ! @@ -524,7 +507,17 @@ iret .data - .even + .globl _intr_count + + .even + +_bios_call_cnt_l: + .word 5 +_stashed_irq0_l: + .long 0 +_intr_count: + .word 0 + .zerow 256 ! (was) 128 byte interrupt stack _intstack: diff -Nur elks.orig/arch/i86/sibo/irqtab.c elks/arch/i86/sibo/irqtab.c --- elks.orig/arch/i86/sibo/irqtab.c 2015-05-06 17:01:32.000000000 -0500 +++ elks/arch/i86/sibo/irqtab.c 2015-05-06 17:01:42.000000000 -0500 @@ -1,53 +1,45 @@ +#include <linuxmt/config.h> #include <arch/irq.h> #include <arch/asm-offsets.h> -#include <linuxmt/config.h> /* * Easy way to store our kernel DS + * + * moving variables from code segment to an extra segment + * CONFIG_ROM_IRQ_DATA for the ROM_CODE-Version + * ELKS 0.76 7/1999 Christian Mard?ller (chm@xxxxxx) */ -/* moving variables from code segment to an extra segment -/ CONFIG_ROM_IRQ_DATA for the ROM_CODE-Version -/ ELKS 0.76 7/1999 Christian Mard?ller (chm@xxxxxx) -/ */ - #ifdef CONFIG_ROMCODE -/* In ROM-Mode we must generate a physical 3th segment :-) -/ The segmentaddress is given by CONFIG_ROM_IRQ_DATA, -/ the offset is constant per #define -/-------------------------------------------------------*/ - - #define SEG_IRQ_DATA es +/* + * In ROM-Mode we must generate a physical 3th segment :-) + * The segmentaddress is given by CONFIG_ROM_IRQ_DATA, + * the offset is constant per #define + */ #define stashed_ds [0] - -#else - #define SEG_IRQ_DATA cs +#endif #ifndef S_SPLINT_S #asm - .globl stashed_ds - .even + .text +#ifndef CONFIG_ROMCODE +/* + Kernel is in RAM. Reserve space in the + code segment to save the kernel DS +*/ + .globl stashed_ds + .even stashed_ds: .word 0 - -#endasm -#endif - #endif -extern void sig_check(void); - /* * Low level IRQ control. */ - -#ifndef S_SPLINT_S -#asm .globl ___save_flags .globl _restore_flags - .text ___save_flags: pushf @@ -72,85 +64,57 @@ .globl _irqtab_init _irqtab_init: - mov al, #0x00 ! disable psion hardware interrupt sources out 0x15, al mov al, #0x00 out 0x08, al cli + mov bx,ds #ifdef CONFIG_ROMCODE - mov ax,#CONFIG_ROM_IRQ_DATA - mov es,ax + mov ax,#CONFIG_ROM_IRQ_DATA + mov ds,ax +#else + seg cs #endif - - seg SEG_IRQ_DATA - mov stashed_ds,ds - mov _intr_count,#0 + mov stashed_ds,bx + mov es,bx xor ax,ax - mov es,ax ;intr table + mov ds,ax ;intr table out 0x15, al ! memory protection - mov ax, cs - seg es - mov 0x01e6, ax - mov ax, #_irq0 - seg es - mov 0x01e4, ax + mov [0x01e6],cs + mov [0x01e4],#_irq0 #if 0 mov ax, cs + seg es mov 0x01c2, ax #endif #if 0 - lea ax,_irq0 - seg es - mov [0xe4],ax - mov ax,cs - seg es - mov [0x02],ax + mov [0xe4],#_irq0 + mov [0x02],cs - lea ax,_irq1 - seg es - mov [0x04],ax - mov ax,cs - seg es - mov [0x06],ax - - lea ax,_irq2 - seg es - mov [0x08],ax - mov ax,cs - seg es - mov [0x0A],ax + mov [0x04],#_irq1 + mov [0x06],cs - lea ax,_irq3 - seg es - mov [0x0C],ax - mov ax,cs - seg es - mov [0x0E],ax + mov [0x08],#_irq2 + mov [0x0A],cs + + mov [0x0C],#_irq3 + mov [0x0E],cs + + mov [0x10],#_irq4 + mov [0x12],cs - lea ax,_irq4 - seg es - mov [0x10],ax - mov ax,cs - seg es - mov [0x12],ax - #endif ! Setup INT 0x80 (for syscall) - lea ax,_syscall_int - seg es - mov [512],ax - mov ax,cs - seg es - mov [514],ax + mov [512],#_syscall_int + mov [514],cs ! Tidy up - mov dx,ds ;the original value - mov es,dx ;just here + mov ds,bx ;the original value just here sti ret @@ -161,15 +125,10 @@ ! Other IRQs (see IRQ 0 at the bottom for the ! main code). ! - .text + .extern _schedule + .extern _sig_check .extern _do_IRQ - .data - .extern _cache_A1 - .extern _cache_21 - - .text - _irq1: push ax mov ax,#1 @@ -519,14 +478,16 @@ iret .data - .globl _intr_count -_intr_count: - .word 0 + .globl _intr_count + + .even off_stashed_irq0_l: .word 0 seg_stashed_irq0_l: .word 0 +_intr_count: + .word 0 .zerow 256 ! (was) 128 byte interrupt stack _intstack: diff -Nur elks.orig/fs/block_dev.c elks/fs/block_dev.c --- elks.orig/fs/block_dev.c 2015-04-26 11:39:15.000000000 -0500 +++ elks/fs/block_dev.c 2015-05-06 17:01:42.000000000 -0500 @@ -85,13 +85,13 @@ return written; } -int block_read(struct inode *inode, register struct file *filp, +size_t block_read(struct inode *inode, register struct file *filp, char *buf, size_t count) { return blk_rw(inode, filp, buf, count, BLOCK_READ); } -int block_write(struct inode *inode, register struct file *filp, +size_t block_write(struct inode *inode, register struct file *filp, char *buf, size_t count) { return blk_rw(inode, filp, buf, count, BLOCK_WRITE); diff -Nur elks.orig/include/arch/bitops.h elks/include/arch/bitops.h --- elks.orig/include/arch/bitops.h 2015-04-26 11:39:15.000000000 -0500 +++ elks/include/arch/bitops.h 2015-05-06 17:01:42.000000000 -0500 @@ -5,7 +5,7 @@ extern unsigned char set_bit(unsigned int,void *); extern unsigned char test_bit(unsigned int,void *); -extern unsigned int find_first_non_zero_bit(register void *,unsigned int); -extern unsigned int find_first_zero_bit(register void *,unsigned int); +extern unsigned int find_first_non_zero_bit(register int *,unsigned int); +extern unsigned int find_first_zero_bit(register int *,unsigned int); #endif diff -Nur elks.orig/include/linuxmt/fs.h elks/include/linuxmt/fs.h --- elks.orig/include/linuxmt/fs.h 2015-05-06 17:01:25.000000000 -0500 +++ elks/include/linuxmt/fs.h 2015-05-06 17:01:42.000000000 -0500 @@ -484,8 +484,8 @@ #ifdef CONFIG_BLK_DEV_CHAR -extern int block_read(struct inode *,struct file *,char *,size_t); -extern int block_write(struct inode *,struct file *,char *,size_t); +extern size_t block_read(struct inode *,struct file *,char *,size_t); +extern size_t block_write(struct inode *,struct file *,char *,size_t); #else diff -Nur elks.orig/include/linuxmt/ntty.h elks/include/linuxmt/ntty.h --- elks.orig/include/linuxmt/ntty.h 2015-04-26 11:39:15.000000000 -0500 +++ elks/include/linuxmt/ntty.h 2015-05-06 17:01:42.000000000 -0500 @@ -39,7 +39,7 @@ struct tty_ops { int (*open) (); - int (*release) (); + void (*release) (); int (*write) (); int (*read) (); int (*ioctl) (); diff -Nur elks.orig/include/linuxmt/tcpdev.h elks/include/linuxmt/tcpdev.h --- elks.orig/include/linuxmt/tcpdev.h 2015-05-06 17:01:25.000000000 -0500 +++ elks/include/linuxmt/tcpdev.h 2015-05-06 17:01:42.000000000 -0500 @@ -90,5 +90,6 @@ }; extern void tcpdev_clear_data_avail(void); +extern int inet_process_tcpdev(char *buf, int len); #endif