Page 1 of 1

GDT flush vc++

Posted: Fri Aug 31, 2012 7:56 am
by hojjatrakhshani
hi guys :)
is there any way to flush GDT in vc++?
i use jmp 0x8:offset but its not work:cry: & also this

Code: Select all

push selector 
push offset 
retf
thank you

Re: GDT flush vc++

Posted: Fri Aug 31, 2012 9:21 am
by bluemoon
Lack of information in the question, hence the lack of description in my answer:

Code: Select all

IRET

Re: GDT flush vc++

Posted: Fri Aug 31, 2012 9:55 am
by hojjatrakhshani
hi excuse me bluemoon & guys?
i want install rabinson gdt trick in my kernel and early i use
jmp cs:higherkernel but i understand its not true and decide to have far jmp like 0x8:address
but i get error from visual stdio.

Code: Select all

	    align 4
	   dd(MULTIBOOT_HEADER_MAGIC)     
                dd(MULTIBOOT_HEADER_FLAGS)     
                dd(CHECKSUM)             
                dd(HEADER_ADRESS)          
                dd(LOADBASE)              
                dd(00)                    
                dd(00)                   
                dd(HEADER_ADRESS+0x30)                  
                dd(0x0)
	   dd(0x0)
	   dd(0x0)
	   dd(0x0)
               call Initialize_Fake_GDT
	  mov ax,Date_Selector		
	  mov ds, ax
	  mov es, ax
	  mov fs, ax
	  mov gs, ax
     	  mov ss, ax
	  jmp cs:higherhalf

higherhalf:     
                mov     esp,Stack
                push    0                 
                popf
                push    ebx                  
                push    eax               
                call      Entry_Point  
thank bluemoon for his help i use code like this for far jmp

Code: Select all

	push ss
	push esp
             pushfd
	push 0x8
	lea eax,[higherhalf]
             push eax
	iretd
higherhalf:     
                mov     esp,Stack
                push    0                 
                popf
                push    ebx                  
                push    eax      

Re: GDT flush vc++

Posted: Fri Aug 31, 2012 4:20 pm
by Combuster
but i get error from visual stdio
Then you probably need to learn to read it.