cpcdos

FRANCE [Lyon], 14.03.2018, 11:32 (edited by cpcdos, 14.03.2018, 13:49) |
Asm IDT "equivalent" for DPMI clients (Developers) |
Hello everyone!
Under FreeDos, i compile programs with GCC, after to have set IDT, remap master & slave ports and blabla... I want load my IDT from lidt asm instruction
For be brief :
idt_pointer.size = 256*sizeof(GateDescriptor) - 1;
idt_pointer.base = (uint32_t)interruptDescriptorTable;
asm volatile("lidt %0" : : "m" (idt_pointer));
From example here by AlgorithMan-de.
My problem.. program crash at the asm inline. I've GDB for be sure (Same problem for lgdt,sgdt,lidt and sidt opcodes) WHY ? I think FreeDos/Dpmi have already loaded GDT and block memory access. I've search DPMI functions for clean previous GDT, and put MY GDT.. I've need of you
I've found docs on http://www.delorie.com/djgpp/doc/libc/
__dpmi_free_ldt_descriptor()
__dpmi_allocate_ldt_descriptors()
but i don't know if it's a good way for me..
Best regards, --- Sébastien FAVIER
ps: Excuse me for my English level, I'm a French student |
RayeR

CZ, 14.03.2018, 20:18
@ cpcdos
|
Asm IDT "equivalent" for DPMI clients |
Maybe one reason is that your DPMI client app runs under ring 3, while DPMI server runs under ring 0 so you cannot change all you want. I think it's not good idea to completly replace IDT. Under DPMI it's complicated because there can happen interrupts in real mode and pmode too so there are 2 ways to handle them. DJGPP provides some DPMI wrappers usefull for hooking your own ISR. I don't remember details...
The __dpmi_allocate_ldt_descriptors() function is good for defining your own segment if you need e.g. some MMIO memory transfer. For IDT stuff there should be similar functions... --- DOS gives me freedom to unlimited HW access. |
cpcdos

FRANCE [Lyon], 17.03.2018, 17:49
@ RayeR
|
Asm IDT "equivalent" for DPMI clients |
Thank you RayeR, DPMI client app runs under ring 3 yes exactly.
I will invertigate with __dpmi_allocate_ldt_descriptors()
If someone have ideas or C example with this __dpmi_allocate_ldt_descriptors() his help will be appreciated  --- Sébastien FAVIER
ps: Excuse me for my English level, I'm a French student |