flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Chewy509
The cli/sti pair are being used because they are modifying the Stack Segment (SS) and Stack Pointer (SP) registers. If an interrupt occurs mid-stack segment/pointer change, it's possible that the system will crash. Any Interrupt Service Routines (ISRs), will use your stack (either in full or just briefly) while servicing the IRQ. So it's really important that a valid stack is accessible while external interrupts are enabled.
The safe bet to just to disable external int's, until you have your stack setup. |
|||
![]() |
|
vbVeryBeginner
thank you,
i guess they should put your statement in book :p |
|||
![]() |
|
ASHLEY4
Your book sounds like :"IBM PC Assembly Language and Programming by Peter Abel" ?.
\\\\||//// (@@) ASHLEY4. |
|||
![]() |
|
vbVeryBeginner
ASHLEY4 wrote:
yup, how you know? you own that book also? i got a Fourth Edition here, it is by Peter Abel Professor Emeritus British Columbia Institute of Technology don't tell me you are Peter Abel?? if it is, nice to met you ![]() i like people who got lot of knowledge ![]() |
|||
![]() |
|
ASHLEY4
No just have the book, have you read this book ?.
http://www.cs.smith.edu/~thiebaut/ArtOfAssembly/artofasm.html you can ask Randall Hyde ? here: http://board.win32asmcommunity.net/forum.php?f=30 \\\\||//// (@@) ASHLEY4. |
|||
![]() |
|
Octavio
this instruction: mov ss,ax
disables interrupts until the end of next instruction to make possible to load ss and sp in two consecutive instructions without disabling interrupts. |
|||
![]() |
|
Chewy509
Octavio wrote: this instruction: mov ss,ax I thought that was implementation specific and couldn't be relied upon in all cases? (Please correct me if am wrong). |
|||
![]() |
|
Gomer73
It should be universally compatible after whichever processor implemented it(386, 486, I forget which one.)
But it is still a pain, because you would have to load another register prior to the move. The following wouldn't work: mov ss,ax mov ax,0xf000 mov sp,ax you would need to do something like: mov bx,0xf000 mov ss,ax mov sp,bx |
|||
![]() |
|
Tomasz Grysztar
You can also use "LSS SP,[pointer_variable]" instruction to load both SS and SP with one instruction.
|
|||
![]() |
|
Octavio
Gomer73 wrote: The following wouldn't work: but the following will work (+386) mov ss,ax mov sp,0f000h |
|||
![]() |
|
Gomer73
Makes since, I forget what instructions can be used where.
Thanks, ...Gomer73 |
|||
![]() |
|
neonz
Actually, CLI/STI on modifying stack is only necessary for 8086/8088 CPUs. All newer Intel CPUs AFAIK do that CLI/STI thing automatically.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.