Why does this give illegal instruction? 
Author Message
 Why does this give illegal instruction?

Here is a little routine I have that clears a segment. the 'mov'

gives illegal instruction on the second pass through the loop ???

;
; clrseg - Clear any segment.
;       FS = Segment base, ECX = Size in Paragraphs.
;
clrseg  proc     near
        push     eax
        push     ecx
        push     edi
;
        sub      edi,edi           ;clear index
        shl      ecx,2             ;mult by 4 = n'dwords/para

        add      edi,4             ;next...

;
        pop      edi
        pop      ecx
        pop      eax
        ret
clrseg  endp
;



Sat, 23 Oct 1999 03:00:00 GMT  
 Why does this give illegal instruction?

Quote:

>Here is a little routine I have that clears a segment. the 'mov'

>gives illegal instruction on the second pass through the loop ???

>;
>; clrseg - Clear any segment.
>;       FS = Segment base, ECX = Size in Paragraphs.
>;
>        sub      edi,edi           ;clear index
>        shl      ecx,2             ;mult by 4 = n'dwords/para
>        sub      eax,eax           ;clear this

>        add      edi,4             ;next...



Surely it should be

        add     edi,4

With FS set up correctly, it shouldn't go bang.  I think you'll need
to post the code where you set it up.
It could happily write to FS:0, but not FS:4, if the value at FS:0 is
0, and the value as FS:4 isn't.

Jim



Sun, 24 Oct 1999 03:00:00 GMT  
 Why does this give illegal instruction?



Quote:

>>Here is a little routine I have that clears a segment. the 'mov'

>>gives illegal instruction on the second pass through the loop ???

>>;
>>; clrseg - Clear any segment.
>>;       FS = Segment base, ECX = Size in Paragraphs.
>>;

>>        sub      edi,edi           ;clear index
>>        shl      ecx,2             ;mult by 4 = n'dwords/para
>>        sub      eax,eax           ;clear this

>>        add      edi,4             ;next...


>Surely it should be


>    add     edi,4



    Bill Lanam



Mon, 25 Oct 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Illegal Instruction Workaround

2. clipper & nt illegal instruction

3. Debug gives an "illegal operation"

4. Level:Benign gives Illegal Operation Error

5. Windows NT 3.5 Illegal Instruction

6. Any illegal instruction processing interrupts?

7. Illegal instructions

8. Illegal instruction (core dumped)

9. drand : illegal instruction ???

10. Illegal Instruction on Mac OS X Intel

11. Illegal Instruction in Tcl_Eval()

12. 'after' causes illegal instruction errors

 

 
Powered by phpBB® Forum Software