[idt problem]start a user space process
Posted: Sun Jan 21, 2007 12:32 pm
Hello,
I want to start a user space process. Actually I have:This works fine.
My problem is that I'm not sure about how to handle interrupts. If I press any key, the system reboots, because even though the process can read the IDT, it cannot use it.
I think I have to use task gates, but: If I do so, I need a tss for each isr I want to use, right ? Is there a better way ? I don't want as much entries in my gdt ...
I want to start a user space process. Actually I have:
Code: Select all
/* Creating the executable image */
unsigned int imagePhysPage = __get_phys_block(0); // requesting 1<<0 physical pages
unsigned short* vimage = (unsigned short*)accessPhysBlock(imagePhysPage);
*vimage = 0xfeeb; // eb fe: jmp short -2 ; very simple process
releasePhysBlock(vimage); // no more access needed for executable image
/* Creating user space */
CAddressSpace userspace = new CAddressSpace();
userspace->create(); // setting up a page directory
userspace->makeSystemBlockReadable(); // readonly-access for gdt / idt
userspace->map( 0x00400 , imagePhysPage ); // text section at 0x00400000
/* Start */
CTask* task = new CTask(
0x00400000, // eip
0, // no stack needed
userspace->cr3 // task uses userspace
);
task->go();
My problem is that I'm not sure about how to handle interrupts. If I press any key, the system reboots, because even though the process can read the IDT, it cannot use it.
I think I have to use task gates, but: If I do so, I need a tss for each isr I want to use, right ? Is there a better way ? I don't want as much entries in my gdt ...