Subject: Re: questions about various .S files in i386/boot
To: None <perry@piermont.com>
From: Robert Kennedy <robert@Theory.Stanford.EDU>
List: port-i386
Date: 03/20/1996 22:10:59
> For instance, take the enclosed snippet of code, from start.S. All
> through the code, we find these data32 macros. Could someone please
> explain to me what they mean and why they are there?
> #define	addr32	.byte 0x67
> #define	data32	.byte 0x66
> [...]
> 	.text	
> 	.globl	start
> 
> ENTRY(boot1)
> start:
> 	# start (aka boot1) is loaded at 0x0:0x7c00 but we want 0x7c0:0
> 	# ljmp to the next instruction to adjust %cs
> 	data32
> 	ljmp $0x7c0, $start1
> [...]
> 	# set up %ss and %esp
> 	data32
> 	movl	$BOOTSEG, %eax
> 	movl	%ax, %ss
> 	data32
> 	movl	$BOOTSTACK, %esp

They look like instruction prefixes to me. Intel is fond of
instruction prefixes. From my 8086 programming days, I remember such
things as REP (repeat the next "string-related" instruction,
decrementing some fixed register [BL? CL?] each time until the
register contains zero), and segment prefixes (e.g., The offset in the
following instruction is relative to the ES register). There were
others, too, I think. This looks like just one more. Probably your
16/32 bit guess isn't far off the mark, but I'm too long gone from
programming Intel chips to know for sure.

	-- Robert Kennedy