GDT flush vc++

Programming, for all ages and all languages.
Post Reply
hojjatrakhshani
Posts: 21
Joined: Sun Feb 19, 2012 7:25 am

GDT flush vc++

Post 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
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: GDT flush vc++

Post by bluemoon »

Lack of information in the question, hence the lack of description in my answer:

Code: Select all

IRET
hojjatrakhshani
Posts: 21
Joined: Sun Feb 19, 2012 7:25 am

Re: GDT flush vc++

Post 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      
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: GDT flush vc++

Post by Combuster »

but i get error from visual stdio
Then you probably need to learn to read it.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply