I want to fetch data from TSS, first I define TSS in GDT: dseg segment use16 gdt label byte dummy descriptor <> demotss descriptor <104,,,89h,> demotss_sel =demotss-gdt .... dseg ends
then I define the TSS segment: DEMOTSSSEG SEGMENT PARA USE16 DW ?,0 DD ? DW ?,0 DD ? DW ?,0 DD ? DW ?,0 DD 0 ;CR3 DD ? ;EIP DW ?,? ;eflag DD ? ;eax DD ? ;ecx DD ? ;edx DD ? ;ebx DD ? ;esp DD ? ;ebp DD ? ;esi DD ? ;edi DW ?, 0 ;es DW ?, 0 ;cs DW ?, 0 ;ss DW ?, 0 ;ds DW ?, 0 ;fs DW ?, 0 ;gs DW ?, 0 DW 0 DW $ + 2 DB 0FFH DEMOTSSSEG ENDS
and then I initialize it: mov bx,16 mov ax,DEMOTSSSEG mul bx mov demotss.basel,ax mov demotss.basem,dl mov demotss.baseh,dh
at last in p-mode: mov ax,demotss_sel LTR ax mov ax,demotss_sel mov ds,ax ;===error mov ax,[2] but I find when I add the instruction:mov ds,ax the PC always restart,why?How to correct it?
|