Page 2 of 2
Re: Nasm syntax problem
Posted: Mon Jun 24, 2013 1:40 am
by Prochamber
gerryg400 wrote:You should clear interrupt before changing the stack pointer and segment then restore them afterwards.
It's not necessary to disable interrupts if the SS is loaded first. The processor does it for you automatically.
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.
Re: Nasm syntax problem
Posted: Mon Jun 24, 2013 5:25 am
by gerryg400
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.
Re: Nasm syntax problem
Posted: Mon Jun 24, 2013 6:37 am
by qw
If possible, LSS is even more recommended:
Re: Nasm syntax problem
Posted: Mon Jun 24, 2013 10:53 am
by Griwes
That's the exact same quote as in post #15...
Re: Nasm syntax problem
Posted: Mon Jun 24, 2013 11:41 am
by Antti
Is this a
true uninterruptible loop? Except an SMM...
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"
EDIT: It seems that IP does not wrap around...