Compare commits
3 Commits
359484b2e4
...
d1364f5c1f
| Author | SHA1 | Date | |
|---|---|---|---|
| d1364f5c1f | |||
| 4bc9dfa589 | |||
| d12371d4a2 |
@ -4,6 +4,8 @@
|
||||
#include "apic.h"
|
||||
#include "gdt.h"
|
||||
#include "idt.h"
|
||||
#include "interrupts.h"
|
||||
#include "sys/io.h"
|
||||
#include "kprintf.h"
|
||||
|
||||
#define PIC1 0x20 /* IO base address for master PIC */
|
||||
@ -44,5 +46,5 @@ void init_idt(void)
|
||||
for (uint8_t j = 0; j < 16; j++)
|
||||
idt_set_descriptor(i + j, irq_stub_table[j], 0x8E);
|
||||
load_idt(&idtr);
|
||||
__asm__ volatile("sti");
|
||||
// toris();
|
||||
}
|
||||
|
||||
@ -48,4 +48,5 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
||||
create_process(1);
|
||||
create_thread(current_pcb, shell_init);
|
||||
toris();
|
||||
while (true);
|
||||
}
|
||||
|
||||
@ -46,13 +46,19 @@ struct pcb *create_process(uint8_t uid)
|
||||
return NULL;
|
||||
}
|
||||
memcpy(new_pcb->heap, current_pcb->heap, 4096);
|
||||
|
||||
if (current_pcb) {
|
||||
new_pcb->next = current_pcb->next;
|
||||
new_pcb->prev = current_pcb;
|
||||
current_pcb->next = new_pcb;
|
||||
if (current_pcb->prev == current_pcb)
|
||||
current_pcb->prev = new_pcb;
|
||||
|
||||
}
|
||||
else {
|
||||
current_pcb = new_pcb;
|
||||
}
|
||||
new_pcb->signals.pending = SIG_IGN;
|
||||
new_pcb->thread_list = NULL;
|
||||
|
||||
return new_pcb;
|
||||
}
|
||||
|
||||
@ -28,9 +28,14 @@ struct tcb *create_thread(struct pcb *process, void (*routine)(void))
|
||||
new_tcb->state = NEW;
|
||||
|
||||
struct tcb *it = process->thread_list;
|
||||
if (it) {
|
||||
while (it)
|
||||
it = it->next;
|
||||
it = new_tcb;
|
||||
}
|
||||
else {
|
||||
process->thread_list = new_tcb;
|
||||
}
|
||||
|
||||
return new_tcb;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user