???Hey, all,
I am writing a tiny kernel,
and I set GDT in bootloader and switch to
prot mode.
Can I change GDT base address
at runtime?
thanks a lot!
Could I change GDT in protected mode?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Could I change GDT in protected mode?
yep. just prepare another one and lgdt just as you would do before entering pmode.
Just make sure you also refresh segment registers if the new GDT has been modified for those descriptorz. (mov ax,ds ; mov ds,ax ...)
Just make sure you also refresh segment registers if the new GDT has been modified for those descriptorz. (mov ax,ds ; mov ds,ax ...)
Re:Could I change GDT in protected mode?
I mean, if I can do this in protected-mode
or If I must return to real mode?
or If I must return to real mode?
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Could I change GDT in protected mode?
You can change GDT in protected mode.
You do not need to switch back to real mode.
You just need to build your new gdt, a proper GDTR-structure and a pointer to this structore.
You pass the pointer to GDTR to your sub routine which executes the lgdt [gdtrptr] - command.
stay safe
You do not need to switch back to real mode.
You just need to build your new gdt, a proper GDTR-structure and a pointer to this structore.
You pass the pointer to GDTR to your sub routine which executes the lgdt [gdtrptr] - command.
stay safe
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image