Updating built-in GDT
When porting a new OS to xen (using 2.0.7) is it possible to use the builtin GDT for all your purposes, or do you have to create a new one if you want to work with anything but the descriptors that are already in the xen provided one.
If you can use the builtin one, how do you access the GDT? Is it in the 64M reserved address space?
Regards
Ivan Kelly
Quoted 6 lines · Ivan Kelly
When porting a new OS to xen (using 2.0.7) is it possible to use the builtin GDT for all your purposes, or do you have to create a new one if you want to work with anything but the descriptors that are already in the xen provided one.
If you can use the builtin one, how do you access the GDT? Is it in the 64M reserved address space?
You can't update the built-in GDT. Instead, create your own and pass the list of MFNs that comprise your GDT to the set_gdt() hypercall. You must ensure you have only read-only mappings of those MFNs before passing them to that hypercall! If you wish to update your GDT, use the update_descriptor() hypercall.
We could emulate write accesses to the guest GDT, but that hasn't so far been implemented.
-- Keir
Quoted 5 lines · Keir Fraser
You can't update the built-in GDT. Instead, create your own and pass the list of MFNs that comprise your GDT to the
set_gdt()hypercall. You must ensure you have only read-only mappings of those MFNs before passing them to that hypercall! If you wish to update your GDT, use theupdate_descriptor()hypercall.
I ended up taking this approach, though i've yet to get it to work. With update_descriptor the first argument is a machine address. Should this be the machine frame number + offset of entry?
Regards
Ivan
Quoted 3 lines · Ivan Kelly
I ended up taking this approach, though i've yet to get it to work. With
update_descriptorthe first argument is a machine address. Should this be the machine frame number + offset of entry?
Nope, it's a u64 machine address.
Precisely, it's (MFN << 12) + offset
-- Keir
Quoted 1 line · Keir Fraser
Nope, it's a u64 machine address.
32bit machine here, so i guess that should be u32
Quoted 2 lines
Precisely, it's (MFN << 12) + offset
ya, thats what i meant :)
Thanks
Ivan
Quoted 2 lines · Ivan Kelly
Quoted 1 line
Nope, it's a u64 machine address.
32bit machine here, so i guess that should be u32
Always u64 (think PAE: it can support >4GB on a 32b system).
-- Keir
Quoted 5 lines
You can't update the built-in GDT. Instead, create your own and pass the list of MFNs that comprise your GDT to the
set_gdt()hypercall. You must ensure you have only read-only mappings of those MFNs before passing them to that hypercall! If you wish to update your GDT, use theupdate_descriptor()hypercall.
does set_gdt add the default descriptors(at 819, 820, 821 etc) or will i have to insert these into my new gdt manually?
Regards
Ivan
Quoted 7 lines · Ivan Kelly
Quoted 5 lines
You can't update the built-in GDT. Instead, create your own and pass the list of MFNs that comprise your GDT to the
set_gdt()hypercall. You must ensure you have only read-only mappings of those MFNs before passing them to that hypercall! If you wish to update your GDT, use theupdate_descriptor()hypercall.does
set_gdtadd the defaultdescriptors(at 819, 820, 821 etc)or will i have to insert these into my new gdt manually?
The default selectors are 0xe000 and above. They are always available, even if you install your own GDT. To achieve this trick, guest GDTs are limited to 14 pages (7168 entries) rather than 16 pages (8192 entries).
-- Keir