Compare commits
No commits in common. "540226fb0fa9dc2a62f2c08100b0a233c3e42123" and "494a0f425c9609a30f1f404744d27a70c9582ed6" have entirely different histories.
540226fb0f
...
494a0f425c
6
Makefile
6
Makefile
@ -3,7 +3,7 @@ NAME := bozOS
|
|||||||
AS := i386-elf-as
|
AS := i386-elf-as
|
||||||
ASFLAGS := -g
|
ASFLAGS := -g
|
||||||
CC := i386-elf-gcc
|
CC := i386-elf-gcc
|
||||||
CFLAGS := -std=gnu99 -ffreestanding -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -MMD -fno-omit-frame-pointer -fstack-protector-all -g3
|
CFLAGS := -std=gnu99 -ffreestanding -Wall -Wextra -iquotelibbozo/headers -iquoteheaders -MMD -fno-omit-frame-pointer -fstack-protector-all -g
|
||||||
LD := $(CC)
|
LD := $(CC)
|
||||||
LDFLAGS := -T boot/linker.ld -ffreestanding -nostdlib
|
LDFLAGS := -T boot/linker.ld -ffreestanding -nostdlib
|
||||||
LIBS := -L libbozo/build/ -lbozo -lgcc
|
LIBS := -L libbozo/build/ -lbozo -lgcc
|
||||||
@ -33,7 +33,9 @@ $(NAME): $(OBJ)
|
|||||||
run: $(NAME)
|
run: $(NAME)
|
||||||
qemu-system-i386 -kernel build/$(NAME).bin -vga std
|
qemu-system-i386 -kernel build/$(NAME).bin -vga std
|
||||||
|
|
||||||
iso: $(NAME) mkdir -p isodir/boot/grub cp build/$(NAME).bin isodir/boot/$(NAME).bin
|
iso: $(NAME)
|
||||||
|
mkdir -p isodir/boot/grub
|
||||||
|
cp build/$(NAME).bin isodir/boot/$(NAME).bin
|
||||||
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
cp config/grub.cfg isodir/boot/grub/grub.cfg
|
||||||
grub-mkrescue -o build/$(NAME).iso --compress=xz --locales=en@quot --themes= isodir
|
grub-mkrescue -o build/$(NAME).iso --compress=xz --locales=en@quot --themes= isodir
|
||||||
rm -rf isodir
|
rm -rf isodir
|
||||||
|
@ -38,10 +38,8 @@ void clock_init(struct registers *regs)
|
|||||||
static void clock_handler(struct registers *regs)
|
static void clock_handler(struct registers *regs)
|
||||||
{
|
{
|
||||||
(void)regs;
|
(void)regs;
|
||||||
if (scheduler_counter % 10 == 0) {
|
if (scheduler_counter % 10)
|
||||||
cli();
|
|
||||||
scheduler();
|
scheduler();
|
||||||
}
|
|
||||||
scheduler_counter++;
|
scheduler_counter++;
|
||||||
sleep_counter--;
|
sleep_counter--;
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,7 @@ void kernel_main(multiboot_info_t *mbd, uint32_t magic)
|
|||||||
*/
|
*/
|
||||||
/* "Martin 03:50, 22 March 2009 (UTC)\n"); */
|
/* "Martin 03:50, 22 March 2009 (UTC)\n"); */
|
||||||
create_kernel_task();
|
create_kernel_task();
|
||||||
exec_fn(awa);
|
exec_fn(owo);
|
||||||
|
// exec_fn(owo);
|
||||||
shell_init();
|
shell_init();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ void scheduler(void)
|
|||||||
if (!current_task)
|
if (!current_task)
|
||||||
return;
|
return;
|
||||||
struct task *it = current_task->next;
|
struct task *it = current_task->next;
|
||||||
while (it && it->status != RUN)
|
while (it->status != RUN)
|
||||||
it = it->next;
|
it = it->next;
|
||||||
switch_to_task(it);
|
switch_to_task(it);
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,6 @@ switch_to_task:
|
|||||||
mov esp, [current_task] // esp
|
mov esp, [current_task] // esp
|
||||||
mov eax, [current_task+4] // esp0
|
mov eax, [current_task+4] // esp0
|
||||||
mov ebx, [current_task+8] // cr3
|
mov ebx, [current_task+8] // cr3
|
||||||
mov edi, [current_task+12] // page_directory
|
|
||||||
mov [page_directory], edi
|
|
||||||
mov [TSS+4], eax // tss.esp0
|
mov [TSS+4], eax // tss.esp0
|
||||||
mov ecx, cr3
|
mov ecx, cr3
|
||||||
|
|
||||||
@ -43,6 +41,4 @@ switch_to_task:
|
|||||||
pop ebp
|
pop ebp
|
||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
sti
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -15,9 +15,6 @@ static struct task *create_task(uint8_t owner_id)
|
|||||||
struct task *new_task = vmalloc(sizeof(struct task));
|
struct task *new_task = vmalloc(sizeof(struct task));
|
||||||
if (!new_task)
|
if (!new_task)
|
||||||
return NULL;
|
return NULL;
|
||||||
new_task->next = current_task->next;
|
|
||||||
new_task->prev = current_task;
|
|
||||||
current_task->next = new_task;
|
|
||||||
new_task->owner_id = owner_id;
|
new_task->owner_id = owner_id;
|
||||||
new_task->pid = pid++;
|
new_task->pid = pid++;
|
||||||
new_task->heap = alloc_pages(4096, (void **)&new_task->cr3);
|
new_task->heap = alloc_pages(4096, (void **)&new_task->cr3);
|
||||||
@ -32,7 +29,7 @@ int create_kernel_task(void)
|
|||||||
{
|
{
|
||||||
struct task *new_task = vmalloc(sizeof(struct task));
|
struct task *new_task = vmalloc(sizeof(struct task));
|
||||||
if (!new_task)
|
if (!new_task)
|
||||||
return -1;
|
return 1;
|
||||||
new_task->owner_id = 0;
|
new_task->owner_id = 0;
|
||||||
new_task->pid = 0;
|
new_task->pid = 0;
|
||||||
new_task->heap = page_directory;
|
new_task->heap = page_directory;
|
||||||
@ -49,6 +46,9 @@ void exec_fn(void (*fn)(void))
|
|||||||
kpanic("failed to create new task");
|
kpanic("failed to create new task");
|
||||||
new_task->status = RUN;
|
new_task->status = RUN;
|
||||||
new_task->eip = (uint32_t *)fn;
|
new_task->eip = (uint32_t *)fn;
|
||||||
|
new_task->prev = current_task;
|
||||||
|
new_task->next = current_task->next;
|
||||||
|
current_task->next = new_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user