The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: jam@magic.com (James A. Markevitch)
Subject: [Unix-jun72] Minor bug in sources e09-07
Date: Sat, 3 May 2008 10:35:46 -0700 (PDT)	[thread overview]
Message-ID: <200805031735.KAA01301@mist.magic.com> (raw)

> >There is a bug in the svn sources on page e09-07, near the bottom.
> >The call to sleep should read:
> >
> >       jsr     r0,sleep; 0:..
> >
> >Note that there should be a colon, not a semi-colon after the 0.
> >Presumably, this code was never executed, else it would have
> >resulted in a halt.
> 
> thanks!
> 
> but what *does* that syntax do?  0:..  ?

The two-instruction sequence is:

	movb	tty+3(r1),0f / put clist id in sleep argument
	jsr	r0,sleep; 0:..

The "0:" on the second line is a label and it is referenced by the "0f"
in the first line.  The first line is putting a value into the argument
being passed to the sleep subroutine.  Self-modifying code.

The ".." assembles to a 0.

With the incorrect code, "0" assembled to a 0 and ".." assembled to
a 0, so there was one extra word of zeroes, and the return from the
sleep would have executed it (halt) instead of the "br 1b" on the
next line.

James Markevitch



             reply	other threads:[~2008-05-03 17:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-03 17:35 James A. Markevitch [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-05-03 16:21 James A. Markevitch
2008-05-03 17:26 ` Brad Parker

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=200805031735.KAA01301@mist.magic.com \
    --to=jam@magic.com \
    /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;
as well as URLs for NNTP newsgroup(s).