Page 1 of 1
multicore/multiprocessor [solved]
Posted: Thu Oct 18, 2007 3:09 am
by os64dev
Ok i am looking into multicpu programming and have a question regarding GDT and IDT. Do you share the same GDT and IDT on each processor or do you define new one for each proc.?
Posted: Thu Oct 18, 2007 4:52 am
by AJ
Hi,
Each CPU has its own GDTR and IDTR, but the actual GDT and IDT can be shared. One thing you should do is have a separate TSS for each CPU, though (which kind of makes sense - there could otherwise be quite a mess if both processors are running different threads from the same task).
HTH,
Adam
Posted: Thu Oct 18, 2007 6:09 am
by bluecode
AJ wrote:One thing you should do is have a separate TSS for each CPU, though (which kind of makes sense - there could otherwise be quite a mess if both processors are running different threads from the same task).
Imho you can not even use the same TSS descriptor for different cpus, because one cpu sets the busy bit and the other throw an exception when it accesses that descriptor (because the busy bit is set).
Posted: Thu Oct 18, 2007 6:14 am
by os64dev
bluecode wrote:AJ wrote:One thing you should do is have a separate TSS for each CPU, though (which kind of makes sense - there could otherwise be quite a mess if both processors are running different threads from the same task).
Imho you can not even use the same TSS descriptor for different cpus, because one cpu sets the busy bit and the other throw an exception when it accesses that descriptor (because the busy bit is set).
Yeah that was happening just now. thanks for pointing it out it has saved me a whole lot of debugging. The sharing of the GDT and IDT is what i did already, though it gives an additional requirement: namely reentrant interrupt handlers