flat assembler
Message board for the users of flat assembler.
Index
> Main > Will an interupt affect this? |
Author |
|
l4m2 04 Aug 2015, 12:12
cs:cs:cs:cs:nop
cs:ss:movsb 66 67 66 67 mov ax,[bx] 66 mov al,5 |
|||
04 Aug 2015, 12:12 |
|
revolution 04 Aug 2015, 12:28
IIRC last segment register wins.
|
|||
04 Aug 2015, 12:28 |
|
l4m2 05 Aug 2015, 02:13
revolution wrote: Quote: Which segment register is used? |
|||
05 Aug 2015, 02:13 |
|
shutdownall 05 Aug 2015, 11:03
l4m2 wrote:
Usually interrupts will be handled at the end of an instruction only - otherwise you will have unpredicted results. What should happen if an interrupt occurs when reading the first, second, third, fourth byte of an instruction ? The interrupt interrupts the program not the current instruction. |
|||
05 Aug 2015, 11:03 |
|
l4m2 05 Aug 2015, 18:10
Let's say 66 cs:cs:cs:...cs:mov ax,bx. the 66thrown ?
|
|||
05 Aug 2015, 18:10 |
|
revolution 06 Aug 2015, 01:23
A single instruction consists of all prefixes and the final opcode and operands, Interrupts cannot occur within an instruction. It just won't happen. Interrupts only occur between instruction boundaries.
All of the code below is considered a single instruction and an interrupt cannot occur within those 15 bytes: Code: cs:ds:es:fs:gs:ss:cs:ds:es:fs:gs:ss:cs:ds:nop |
|||
06 Aug 2015, 01:23 |
|
Feryno 06 Aug 2015, 08:54
If I remember correctly, no more than 4 prefixes allowed. Pls consult CPU manuals. Also instruction limit is 15 bytes I think (or maybe 16?). And yes, interrupt cannot be fired inside instruction.
|
|||
06 Aug 2015, 08:54 |
|
revolution 06 Aug 2015, 09:10
It is easy to test:
Code: include 'win32ax.inc' .code start: times 14 ds nop invoke MessageBox,HWND_DESKTOP,'14 prefixes','14 prefixes',MB_OK invoke ExitProcess,0 .end start |
|||
06 Aug 2015, 09:10 |
|
shutdownall 06 Aug 2015, 10:20
By the way - block instructions can be interrupted as they are executed as single instructions in a loop which maybe interrupted. On the Z80 interrupts are accepted during all LDIR/LDDR, CPIR/CPDR, OTIR/OTDR instructions. Think this is quite similar to x86 instructions with REP prefix for example - would be interesting to see if all necessary flags are restored like direction flag - would be nice to test.
|
|||
06 Aug 2015, 10:20 |
|
revolution 06 Aug 2015, 10:41
Logically something like "rep lodsb" is still a single instruction. So it can't be interrupted in the middle of rep and lodsb but it can interrupt at any iteration count. The interrupt function will see the return address pointing to the beginning of rep. Register values for [R|E]SI, [R|E]DI and [R|E]CX are updated before entering the ISR. If the ISR alters DF then [R|E]SI and [R|E]DI will go in the opposite direction from before it was interrupted. If your ISR alters DF then expect bad things to happen. But remember that the ISR can alter all register values anyway so [R|E]SI, [R|E]DI and [R|E]CX could come back with different values also.
|
|||
06 Aug 2015, 10:41 |
|
shutdownall 07 Aug 2015, 00:11
Yes you are right - it is the job of the ISR to save the flag register and all used registers ...
|
|||
07 Aug 2015, 00:11 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.