Re: Hangs after "Loading" but before "Uncompressing"

From: almesber@lrc.di.epfl.ch
Date: Thu Jan 27 2000 - 18:04:17 EST


Richard B. Johnson wrote:
> Well! We went over this two years ago. The problem is that segment
> overrides are specifically excluded for the LODS, LODSB, LODSW, and
> LODSD instructions on the '486. (Page 16-203, Intel Rag called
> Intel 486 Microprocessor Family, Programmer's Reference Manual).

http://developer.intel.com/design/pentium/manuals/24319101.pdf
Intel Architecture Software Developer's Manual, Volume 2: Instruction Set
Reference Manual, page 3-275:

"LODS/LODSB/LODSW/LODSD-Load String [...] Loads a byte, word, or doubleword
 from the source operand into the AL, AX, or EAX register, respectively.
 The source operand is a memory location, the address of which is read from
 the DS:EDI [sic!] or the DS:SI registers (depending on the address-size
 attribute of the instruction, 32 or 16, respectively). The DS segment may
 be overridden with a segment override prefix."

While they're visibly not above typos, I'd be surprised if they mis-stated
anything as crucial as the support of segment overrides.

> The sreg field in the LODxx instruction does not exist! (page E-9).

(Page B-10 in the manual above.) Correct, but a segment override is
a _prefix_ (B-17, B-18), not part of the instruction's opcode per se.

> There is absolutely no reason whatsoever to use segment-overides in
> any of the code.

In 16 bit code ? Well, theoretically not, but I'm not sure turning

        mov ax,es:[si]
        mov bx,ss:[si+2]
        mov cx,[si+4]

into (assuming CS == DS, and that ES, SS are a non-trivial distance
away from each other and from DS)

        mov ds,[extra_segment]
        mov ax,[si]
        push cs ; there's no mov es,cs, and we probably
        pop ds ; don't want to sacrifice a register to
        mov ds,[stack_segment] ; avoid touching the stack
        mov bx,[si+2]
        push cs
        pop ds
        mov cx,[si+4]

makes the code more readable or more correct.

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:19 EST