should equal 0 before return to R-mode from P-mode,but
in my codes the DPL equal 3 and RPL equal 2 and it run
very well,I want to know:
(1)Is priviledge level of the data segment DPL or RPL? or other?
(2)why does it run well?is the opinoino of book error?
Look:
Code: Select all
;Define a data segment in GDT
dseg segment use16
gdt label byte
dummy descriptor <>
datas descriptor <0ffffh,8000h,0bh,0F2h,0> ;DPL=3
datas_sel =datas-gdt+3
.....
dseg ends
;Code segment
cseg segment use16
assume cs:cseg, ds:dseg
start:
.....
;jump into P-mode
virtual: ;P-Mode
mov ax,datas_sel
mov ds,ax
....
;return to R-mode
....
real: ;R-Mode
....
sti
mov ax,4c00h
int 21h
cseg ends
end start