Reverted the removal of configure_gdt_entry()

Commit 227cc19890
"add alpha version of x64 support"
removed configure_gdt_entry(), but this is used within the
lguest branch.
This commit is contained in:
Jacek Galowicz 2012-06-13 09:36:28 +02:00
parent 531556f53c
commit 49eb099b80
2 changed files with 25 additions and 13 deletions

View file

@ -122,6 +122,16 @@ typedef struct {
*/
void gdt_install(void);
/** @brief Configures and returns a GDT descriptor with chosen attributes
*
* Just feed this function with address, limit and the flags
* you have seen in idt.h
*
* @return a preconfigured gdt descriptor
*/
void configure_gdt_entry(gdt_entry_t *dest_entry, unsigned long base, unsigned long limit,
unsigned char access, unsigned char gran);
#ifdef __cplusplus
}
#endif

View file

@ -188,26 +188,28 @@ int create_default_frame(task_t* task, entry_point_t ep, void* arg)
return 0;
}
/** @brief Configures GDT descriptor with chosen attributes
*
* Just feed this function with address, limit and the flags
* you have seen in gdt.h
*/
/* Setup a descriptor in the Global Descriptor Table */
static void gdt_set_gate(int num, unsigned long base, unsigned long limit,
unsigned char access, unsigned char gran)
unsigned char access, unsigned char gran)
{
configure_gdt_entry(&gdt[num], base, limit, access, gran);
}
void configure_gdt_entry(gdt_entry_t *dest_entry, unsigned long base, unsigned long limit,
unsigned char access, unsigned char gran)
{
/* Setup the descriptor base address */
gdt[num].base_low = (base & 0xFFFF);
gdt[num].base_middle = (base >> 16) & 0xFF;
gdt[num].base_high = (base >> 24) & 0xFF;
dest_entry->base_low = (base & 0xFFFF);
dest_entry->base_middle = (base >> 16) & 0xFF;
dest_entry->base_high = (base >> 24) & 0xFF;
/* Setup the descriptor limits */
gdt[num].limit_low = (limit & 0xFFFF);
gdt[num].granularity = ((limit >> 16) & 0x0F);
dest_entry->limit_low = (limit & 0xFFFF);
dest_entry->granularity = ((limit >> 16) & 0x0F);
/* Finally, set up the granularity and access flags */
gdt[num].granularity |= (gran & 0xF0);
gdt[num].access = access;
dest_entry->granularity |= (gran & 0xF0);
dest_entry->access = access;
}
/*