So with this code:
mul ecx add eax, 4, since ADD is faster, would it get done before the MUL instruction completes? But then things won't be right, if that's the case. However, the processor still gets things done right, even with all this out-of-order weird stuff; I know that because I have written programs before, and they worked.
The processor does some sort of checking on dependent operands, before saying that an instruction is ready to be executed, but then it has to access memory to do that. Wouldn't it make sense for it to just do things in order, then?
And what about the instruction pointer (program counter)? Like for this code:
mov eax, [var1] div ecx mov ebx, [var2] mov [var3], eax, what if there's an interrupt right when it's done executing the third instruction, but not quite done executing the second? Or, even worse, what if ECX is 0, and it's already done executing the third instruction? Would it undo the third instruction and report, to the operating system exception handler for division by 0, the address of the second instruction?
What do you guys think about all this weird and confusing stuff?


Sign In
Create Account


Back to top









