--- "Richard B. Johnson" <root@chaos.analogic.com> wrote:
>FYI, the startup functions are used once-per-boot. Any "improvements"
>other than those necessary to "fix" something are useless in the
>overall scheme of things.
Sure. I'm a novice at both the x86 instruction set and the GNU assembler
and I'm just trying to understand the reason the code is written the way
it is.
--- "Randy.Dunlap" <rddunlap@osdl.org> wrote:
> If you change those to bytes to save 3 bytes of space, and then you
> change all of the instructions that load or store those values to 16-bit
> registers, do you have a net saving of space?
> Or you load/store them to 8-bit registers and rewrite the code, what
> happens?
I looked at one place where these words are used: the read_track routine.
Part of that code looks like this:
-------------------------------
movw 4(%si), %dx # 4(%si) = track
movw (%si), %cx # (%si) = sread
incw %cx
movb %dl, %ch
movw 2(%si), %dx # 2(%si) = head
movb %dl, %dh
andw $0x0100, %dx
movb $2, %ah
---------------------------------
If this code is rewritten to use byte instructions (and sread, head, track
are changed to .byte instead of .word) like so (the last two instructions
are unchanged):
-----------------------------------------------
movb (%si), %cl # (%si) = sread
incb %cl
movb 2(%si), %ch # 2(%si) = track
movb 1(%si), %dh # 1(%si) = head
andw $0x0100, %dx
movb $2, %ah
------------------------------------------------
there is a net saving of 6 bytes. (I compiled this with "gcc -c", linked
with "ld --oformat binary -Ttext 0x0" and compared the size of the results).
I'm not proposing this as a fix BTW; just an academic exercise, really.
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/