I have currently enabled paging and can allocate memory dynamically.
No I started implementing hardwarebased multitasking and so there I have a few questions.
- 1.) Do I need more than one instance of my tss structure?
2.) Is the Accessnumber for the gdt 0x09?
3.) What is the base of the tss and what the limit?
Code: Select all
typedef struct tss
{
u16int backlink, __blh;
u32int esp0;
u16int ss0, __ss0h;
u32int esp1;
u16int ss1, __ss1h;
u32int esp2;
u16int ss2, __ss2h;
u32int cr3;
u32int eip;
u32int eflags;
u32int eax, ecx, edx , ebx;
u32int esp, ebp, esi, edi;
u16int es, __esh;
u16int cs, __csh;
u16int ss, __ssh;
u16int ds, __dsh;
u16int fs, __fsh;
u16int gs, __gsh;
u16int ldt, __ldth;
u16int trace, bitmap;
} tss_t;
And this is the way i initialize it:
Code: Select all
tss_t *ptr_tss;
void initialise_multitasking(void)
{
/*
* For Hardware Task switching set up an empty tss Table and
* and set the gdt gate 5
*/
// Allocate the memory for ptr_tss
ptr_tss = (tss_t *)kmalloc(sizeof(tss_t));
// set a new GDT entry for the tss
/*Arguments of 'gdt_set_gate':number,base,limit,access, gran*/
gdt_set_gate(5, /*Is this right?->*/0, sizeof(tss_t), 0x28, 0xCF)
// Flush GDT
gdt_flush(/*gdt pointer here*/);
__asm__ __volatile__("ltr %%ax" :: "a" (0x09));
}
Is this the right way of initialising multitasking or do I have made some failures.
Greetings
Christian
PS: My English is sometimes not very good.




