I’m currently attempting to write a simple OS, and I’ve encountered one strange problem. I try to load a value into SS with the following code (running in Ring 0 aka CPL=0):
Code: Select all
mov word [0502h], 0018h
mov dword [0504h], 00010000h
lss esp, [0502h]
mov ebp, 00010000h
- 0008h: Execute/read 32-bit code segment; Base=00000000h; Limit=FFFFF000h; DPL=0; Present (FF FF 00 00 00 9A CF 00). CS points here.
- 0010h: Read/write 32-bit data segment; Base=00000000h; Limit=FFFFF000h; DPL=3; Present (FF FF 00 00 00 F2 CF 00). DS, ES, FS, GS point here.
- 0018h: Read/write 32-bit data segment; Base=00000000h; Limit=FFFFF000h; DPL=0; Present (FF FF 00 00 00 92 CF 00). I'm trying to make SS point here.
- anything pointing outside the segment (because it covers the whole address space);
- wrong segment type (it’s a read-write data segment);
- privilege level problems (its DPL equals the current CPL, as it should be for SS).
So the question is: what could be the reason for this exception?