OSDev http://osdev.su/ |
|
Перестают работать прерывания http://osdev.su/viewtopic.php?f=6&t=643 |
Страница 1 из 1 |
Автор: | Ilyaaa [ 25 окт 2012, 17:05 ] |
Заголовок сообщения: | Перестают работать прерывания |
Здраствуйте, на днях столкнулся с проблеммой: Сначала вроде все работает, задачи переключаются, удаляются итд... Но после определенного количества созданний удаленний задач, при попытке создания новой задачи перестают работать прерывания! Не могу понять в чем дело... Когда создаю ту задачу которая все вешает - форк возвращает id новой задачи в старую, но в новую задачу как показывают тесты даже не заходит (не возвращает 0)... Вот так выглядит функция fork: Код: int fork() { // We are modifying kernel structures, and so cannot be interrupted. asm volatile("cli"); // Take a pointer to this process' task struct for later reference. task_t *parent_task = (task_t*)current_task; // Clone the address space. page_directory_t * directory = clone_directory(current_directory); // Create a new process. task_t *new_task = CreateTaskStruct ("NULL",GetFreeID(), directory, KERNEL_STACK_SIZE,1,1, last_repaint); // Add it to the end of the ready queue. // Find the end of the ready queue... LinkTask (new_task); // This will be the entry point for the new process. u32int eip = read_eip(); // We could be the parent or the child here - check. if (current_task == parent_task) { // This is parent, so set up the esp/ebp/eip for our child. u32int esp; asm volatile("mov %%esp, %0" : "=r"(esp)); u32int ebp; asm volatile("mov %%ebp, %0" : "=r"(ebp)); new_task->Address.esp = esp; new_task->Address.ebp = ebp; new_task->Address.eip = eip; // All finished: Reenable interrupts. asm volatile("sti"); SaveReturnTaskID (new_task->id); // And by convention return the PID of the child. return new_task->id; } else { // We are the child - by convention return 0. return 0; } } Функция read_eip Код: [GLOBAL read_eip] read_eip: pop eax jmp eax Структура задачи такая: Код: typedef struct task { struct { page_directory_t *page_directory; // Page directory. }System; struct { int dynamic; int nice; }Priority; struct { repaint_type_t repaint; }Functions; struct { u32int esp, ebp; // Stack and base pointers. u32int eip; // Instruction pointer. u32int kernel_stack; // Kernel stack location. }Address; struct { struct task *parent; // Parent struct task *brother; // The next task in a linked list. struct task *child; // The back task in a linked list. }Link; char name[256]; //Name process enum status_t status; //Status process int id; // Process ID. } task_t; Есть какие-нибудь мысли, почему такое может происходить? А то я уже голову сломал |
Страница 1 из 1 | Часовой пояс: UTC + 3 часа |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |