Skip to contentSkip to conversation

approx 2k reduction in kernel code size -- 300 bytes in data (patch)

DISCUSSION Manuel Novoa III 1 participant 1 message Jun 18, 2002

lore
Share & tools
lore
#0 lore raw

Hello all,

Sunday afternoon I felt like taking I break so I started looking at the elks kernel. After doing lots of repetitive bcc-specific optimizations, as well as reworking a few things (arch/i86/lib/memmove.c and kernel/sys.c in particular -- I'd appreciate a second pair of eyes on those), this is what I have for the config file below.

cvs source (with fs/minix/bitmap.c fix):
Root device is (0, 0)
Boot sector 512 bytes.
Setup is 1772 bytes.
System is 120672 B (61456 B code, 7940 B data and 51276d B bss) System is 69428

cvs source with attached patch:
Root device is (0, 0)
Boot sector 512 bytes.
Setup is 1772 bytes.
System is 118380 B (59472 B code, 7640 B data and 51268d B bss) System is 67144

So, a savings of just under 2k in code and 300 bytes in data.

bcc optimizations used mainly fell under the following categories:

1) Reworked codeflow for better bcc code generation.
2) Use of "register char *"s as counters, as bcc can't seem to place ints in registers. (yes, this is ugly, but it is effective)
3) Allocation of different register variables in different blocks in on subroutine, as bcc seems to limit you to two register variables active at a time (di/si).
4) Collection of common work.

Hopefully in a couple of weeks I'll have some time to look at the driver files as well.

Enjoy.

Manuel

Modified files:

	arch/i86/lib/
		bitops.c	memmove.c

	arch/i86/mm/
		init.c		malloc.c

	fs/
		block_dev.c	devices.c	exec.c		fcntl.c
		file_table.c	inode.c		ioctl.c		namei.c
		open.c		pipe.c		read_write.c	readdir.c
		select.c	stat.c		super.c

	fs/minix/
		bitmap.c	file.c		inode.c		namei.c
		symlink.c

	kernel/
		exit.c		fork.c		printk.c	sched.c
		signal.c	sleepwake.c	sys.c		time.c

	lib/
		chqueue.c	string.c

Config file - activated options:

CONFIG_ARCH_AUTO=y
CONFIG_PC_AUTO=y
CONFIG_CONSOLE_DIRECT=y
CONFIG_DCON_VT52=y
CONFIG_DCON_ANSI=y
CONFIG_KEYMAP_US=y
CONFIG_CHAR_DEV_RS=y
CONFIG_CHAR_DEV_LP=y
CONFIG_CHAR_DEV_MEM=y
CONFIG_PSEUDO_TTY=y
CONFIG_BLK_DEV_BIOS=y
CONFIG_BLK_DEV_BFD=y
CONFIG_BLK_DEV_BHD=y
CONFIG_GENDISK=y
CONFIG_BLK_DEV_CHAR=y
CONFIG_MINIX_FS=y
CONFIG_FS_EXTERNAL_BUFFER=y
CONFIG_PIPE=y
CONFIG_EXEC_MINIX=y
CONFIG_SOCKET=y
CONFIG_INET=y
CONFIG_INET_STATUS=y
CONFIG_SYS_VERSION=y
CONFIG_ROOTDEV_FD0=y