Page 1 of 1

About lldt

Posted: Thu Oct 12, 2006 12:27 am
by tresss

Code: Select all

GDT:
....
....

;-----------------------------LDT-------------------------------
GdtLdt:
        dw LDTLen
        dw LDT
        dw 8200
        dw 0000
        
GdtSysTSS:
	dw TSS_Len
	dw TSS_Sys

.....
SelLDT equ GdtLdt-GDT
....
;-------------------------GDT End---------------------------

;-------------------------LDT-------------------------------
align 32
LDT:
        dw TSSCode1_Len
        dw TSSCode1
        dw 0x9800
        dw 0x0040
LDTLen  equ $-LDT-1

SelLdtCode equ 0x4


[bits 32]
align 32
PStart:
  mov ax,SelData
  mov ds,ax
  mov ax,SelSysStack
  mov ss,ax
  mov eax,0x00FF
  mov esp,eax
  mov ax,SelVideo
  mov gs,ax
;---------------------------------------------------------------
  mov ax,SelLDT
  lldt ax		;Error in here;

  jmp SelLdtCode:0
jmp $
I debug the code by Bochs.
It error and stop when running into "lldt ax"

why?

Posted: Thu Oct 12, 2006 6:28 pm
by Mikae
Is it just a part of your code, or you are trying to use 'lldt' insturction in RM?

Anyway, you can't use 'lldt' instruction in RM. Also, note that arument, used by this instruction is just a selector, which points to a segment descriptor in GDT. The segment must have type 'LDT'. In any other case you will get exception.

Thanks

Posted: Thu Oct 12, 2006 7:08 pm
by tresss
OK...Thanks.

I have find this Error.

Code: Select all

GdtLdt:
        dw LDTLen
        dw LDT
        dw 8200
        dw 0000 
It's Should

Code: Select all

GdtLdt:
        dw LDTLen
        dw LDT
        dw 0x8200
        dw 0000 
:)

Posted: Fri Oct 13, 2006 10:31 am
by delroth
I think you should use

Code: Select all

lldt [SelLDT]
instead of your lldt ax.

Posted: Sat Oct 14, 2006 12:26 am
by tresss
yes..........

Thanks....