flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > CLI and STI information or explanation |
Author |
|
Chewy509 24 Oct 2004, 07:51
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. |
|||
24 Oct 2004, 07:51 |
|
vbVeryBeginner 24 Oct 2004, 19:46
thank you,
i guess they should put your statement in book :p |
|||
24 Oct 2004, 19:46 |
|
ASHLEY4 25 Oct 2004, 02:10
Your book sounds like :"IBM PC Assembly Language and Programming by Peter Abel" ?.
\\\\||//// (@@) ASHLEY4. |
|||
25 Oct 2004, 02:10 |
|
vbVeryBeginner 25 Oct 2004, 03:38
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 |
|||
25 Oct 2004, 03:38 |
|
ASHLEY4 25 Oct 2004, 14:24
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. |
|||
25 Oct 2004, 14:24 |
|
Octavio 25 Oct 2004, 19:58
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. |
|||
25 Oct 2004, 19:58 |
|
Chewy509 25 Oct 2004, 23:18
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). |
|||
25 Oct 2004, 23:18 |
|
Gomer73 26 Oct 2004, 17:34
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 |
|||
26 Oct 2004, 17:34 |
|
Tomasz Grysztar 26 Oct 2004, 20:38
You can also use "LSS SP,[pointer_variable]" instruction to load both SS and SP with one instruction.
|
|||
26 Oct 2004, 20:38 |
|
Octavio 26 Oct 2004, 22:07
Gomer73 wrote: The following wouldn't work: but the following will work (+386) mov ss,ax mov sp,0f000h |
|||
26 Oct 2004, 22:07 |
|
Gomer73 27 Oct 2004, 15:51
Makes since, I forget what instructions can be used where.
Thanks, ...Gomer73 |
|||
27 Oct 2004, 15:51 |
|
neonz 06 Nov 2004, 18:02
Actually, CLI/STI on modifying stack is only necessary for 8086/8088 CPUs. All newer Intel CPUs AFAIK do that CLI/STI thing automatically.
|
|||
06 Nov 2004, 18:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.