mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mad Hatter <slokus@yahoo.com>
To: "Randy.Dunlap" <rddunlap@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: bootsect.S: 2 questions
Date: Mon, 13 Jan 2003 17:15:33 -0800 (PST)	[thread overview]
Message-ID: <20030114011533.98422.qmail@web13707.mail.yahoo.com> (raw)
In-Reply-To: <Pine.LNX.4.33L2.0301130844050.1675-100000@dragon.pdx.osdl.net>

Thanks for the pointers to Ralf Brown's interrupt page.

--- "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

      reply	other threads:[~2003-01-14  1:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-13 16:28 Mad Hatter
2003-01-13 16:50 ` Richard B. Johnson
2003-01-13 16:59 ` Randy.Dunlap
2003-01-14  1:15   ` Mad Hatter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030114011533.98422.qmail@web13707.mail.yahoo.com \
    --to=slokus@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rddunlap@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®