About lldt

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tresss
Posts: 21
Joined: Thu Jul 06, 2006 10:52 pm

About lldt

Post 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?
http://english.writeos.com

My English is not very good
Mikae
Member
Member
Posts: 94
Joined: Sun Jul 30, 2006 1:08 pm

Post 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.
tresss
Posts: 21
Joined: Thu Jul 06, 2006 10:52 pm

Thanks

Post 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 
:)
http://english.writeos.com

My English is not very good
delroth
Posts: 8
Joined: Sun Oct 01, 2006 3:29 am
Location: At my computer
Contact:

Post by delroth »

I think you should use

Code: Select all

lldt [SelLDT]
instead of your lldt ax.
tresss
Posts: 21
Joined: Thu Jul 06, 2006 10:52 pm

Post by tresss »

yes..........

Thanks....
http://english.writeos.com

My English is not very good
Post Reply