Not on really old processors. This won't be relevant for the OP anyway because the OP loaded the stack pointer two instructions before the stack segment.gerryg400 wrote:It's not necessary to disable interrupts if the SS is loaded first. The processor does it for you automatically.You should clear interrupt before changing the stack pointer and segment then restore them afterwards.
Nasm syntax problem
-
- Member
- Posts: 100
- Joined: Wed Mar 13, 2013 2:27 am
Re: Nasm syntax problem
TachyonOS - Violates causality on 95% of attempts. Runs at approximately 1.5c.
Re: Nasm syntax problem
You're correct of course. Some 8088 processors have this bug.
However, it doesn't change the fact that the correct way to modify the SS, (E)SP pair is to modify the SS first and then the (E)SP. That's the way Intel recommends it, presumably because CLI by itself doesn't prevent an NMI or a debug trap.
However, it doesn't change the fact that the correct way to modify the SS, (E)SP pair is to modify the SS first and then the (E)SP. That's the way Intel recommends it, presumably because CLI by itself doesn't prevent an NMI or a debug trap.
If a trainstation is where trains stop, what is a workstation ?
Re: Nasm syntax problem
If possible, LSS is even more recommended:
The [url=http://pdos.csail.mit.edu/6.828/2010/readings/i386.pdf]Intel 80386 Programmer's Reference Manual[/url] wrote:To prevent this situation, the 80386, after both a MOV to SS and a POP to SS instruction, inhibits NMI, INTR, debug exceptions, and single-step traps at the instruction boundary following the instruction that changes SS. Some exceptions may still occur; namely, page fault and general protection fault. Always use the 80386 LSS instruction, and the problem will not occur.
- Griwes
- Member
- Posts: 374
- Joined: Sat Jul 30, 2011 10:07 am
- Libera.chat IRC: Griwes
- Location: Wrocław/Racibórz, Poland
- Contact:
Re: Nasm syntax problem
That's the exact same quote as in post #15...
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Re: Nasm syntax problem
Is this a true uninterruptible loop? Except an SMM...
EDIT: It seems that IP does not wrap around...
Code: Select all
; Uninterruptible Busy Loop Program (loop.asm)
; Written by Antti
; Compile: nasm -f bin -o loop.img loop.asm
[BITS 16]
start:
cli
xor ax, ax
mov ss, ax
mov sp, ax
mov ax, 0x1000
mov es, ax
cld
mov ax, 0xD08E ; Opcodes: "mov ss, ax"
mov cx, 0x8000
xor di, di
rep stosw ; Fill 0x10000-0x1FFFF with "mov ss, ax"
xor ax, ax
jmp 0x1000:0x0000
times 510 - ($ - $$) db 0
dw 0xAA55
times 1474560 - ($ - $$) db 0 ; "Standard floppy size"