Trivial Patches

Matthew Kirkwood (matthew.kirkwood@lmh.ox.ac.uk)
Tue, 7 Oct 1997 19:40:54 +0100 (BST)


Reeeeeeet!

Having lost my net access for the summer, I was reduced to
reading through various bits of kernel source, and I found
the following two little opportunities to shrink the kernel
(though not by very much at all ;-):

drivers/char/mem.c has some dead code in memory_lseek():
--- mem.c.orig Sun Sep 28 22:49:10 1997
+++ mem.c Sun Sep 28 22:49:37 1997
@@ -383,9 +383,6 @@
default:
return -EINVAL;
}
- if (file->f_pos < 0)
- return 0;
- return file->f_pos;
}

#define mmap_kmem mmap_mem

and arch/i386/boot/setup.S can be shrunk by _one_whole_instruction_!.
Yes indeed, ladies and gentlemen, there _is_ some sub-optimal assembler
in the Linux kernel:
--- setup.S.orig Sun Sep 28 22:51:09 1997
+++ setup.S Sun Sep 28 22:51:57 1997
@@ -147,11 +147,10 @@

! Routine to print asciiz-string at DS:SI

+ptrs_1: call prtchr
prtstr: lodsb
and al,al
- jz fin
- call prtchr
- jmp prtstr
+ jnz prts_1
fin: ret

! Space printing

So, there you have it. Enjoy.

Matthew.

--
Matthew Kirkwood  |  Mail:  matthew.kirkwood@lmh.ox.ac.uk
LMH JCR,          |  Web:   http://www-jcr.lmh.ox.ac.uk/~weejock/
Oxford OX2 6QA,   |  PGP:   finger weejock@ferret.lmh.ox.ac.uk
England.          |