dead@root 2
This commit is contained in:
parent
0e5bd43f55
commit
c8fe14b21d
6
Makefile
6
Makefile
@ -6,10 +6,10 @@ AS = i686-elf-as
|
||||
LD = i686-elf-gcc
|
||||
GRUB_FILE = grub-file
|
||||
GRUB_MKRESCUE = grub-mkrescue
|
||||
KERNEL = myos.bin
|
||||
ISO = myos.iso
|
||||
KERNEL = deados.bin
|
||||
ISO = deados.iso
|
||||
|
||||
SOURCES_C = kernel.c tty.c idt.c timer.c io.c vga.c gdt.c sys.c irq.c isr.c keyboard.c shell.c string.c
|
||||
SOURCES_C = kernel.c tty.c idt.c timer.c io.c vga.c gdt.c sys.c irq.c isr.c keyboard.c shell.c string.c user_space.c syscall.c
|
||||
SOURCES_ASM = boot.s idt_load.s gdt_flush.s pit_handler.s irq_e.s isr_e.s
|
||||
OBJECTS = $(SOURCES_ASM:.s=.o) $(SOURCES_C:.c=.o)
|
||||
|
||||
|
4
grub.cfg
4
grub.cfg
@ -1,3 +1,3 @@
|
||||
menuentry "dead" {
|
||||
multiboot /boot/myos.bin
|
||||
menuentry "deadOS" {
|
||||
multiboot /boot/deados.bin
|
||||
}
|
5
kernel.c
5
kernel.c
@ -9,6 +9,8 @@
|
||||
#include "interrupts.h"
|
||||
#include "keyboard.h"
|
||||
#include "shell.h"
|
||||
#include "user_space.h"
|
||||
#include "syscall.h"
|
||||
|
||||
void kernel_main(void)
|
||||
{
|
||||
@ -35,6 +37,9 @@ void kernel_main(void)
|
||||
terminal_printc("\n");
|
||||
delay(500);
|
||||
}
|
||||
// syscall_init();
|
||||
|
||||
// enter_user_space();
|
||||
|
||||
shell_init();
|
||||
}
|
4
shell.c
4
shell.c
@ -13,7 +13,7 @@ void shell_init(void)
|
||||
while (true)
|
||||
{
|
||||
terminal_printc("\n");
|
||||
terminal_printc("&7root@dead: /> ");
|
||||
terminal_printc("&7dead@&croot&7: /> ");
|
||||
|
||||
i = 0;
|
||||
c = 0;
|
||||
@ -106,7 +106,7 @@ void shell_parse_input(char *input)
|
||||
else
|
||||
{
|
||||
terminal_printc("Unknown command: '");
|
||||
terminal_printc(command);
|
||||
terminal_writestring(command);
|
||||
terminal_printc("'\n");
|
||||
terminal_printc("Type 'help' to print out the list of commands.\n");
|
||||
}
|
||||
|
26
syscall.c
Normal file
26
syscall.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdint.h>
|
||||
#include "interrupts.h"
|
||||
#include "syscall.h"
|
||||
#include "tty.h"
|
||||
|
||||
void test_syscall()
|
||||
{
|
||||
terminal_printc("Test syscall called\n");
|
||||
}
|
||||
|
||||
void syscall_handler(Stack *registers)
|
||||
{
|
||||
int sys_index = registers->eax;
|
||||
|
||||
if (sys_index != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
test_syscall();
|
||||
}
|
||||
|
||||
void syscall_init(void)
|
||||
{
|
||||
isr_install_handler(128, syscall_handler);
|
||||
}
|
6
syscall.h
Normal file
6
syscall.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef SYSCALL_H
|
||||
#define SYSCALL_H
|
||||
|
||||
void syscall_init(void);
|
||||
|
||||
#endif
|
23
user_space.c
Normal file
23
user_space.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include "user_space.h"
|
||||
|
||||
void enter_user_space(void)
|
||||
{
|
||||
asm volatile(" cli; \
|
||||
mov $0x23, %ax; \
|
||||
mov %ax, %ds; \
|
||||
mov %ax, %es; \
|
||||
mov %ax, %fs; \
|
||||
mov %ax, %gs; \
|
||||
mov %esp, %eax; \
|
||||
pushl $0x23; \
|
||||
pushl %eax; \
|
||||
pushf; \
|
||||
popl %eax; \
|
||||
orl $0x200, %eax; \
|
||||
pushl %eax; \
|
||||
pushl $0x1B; \
|
||||
push $1f; \
|
||||
iret; \
|
||||
1: \
|
||||
");
|
||||
}
|
6
user_space.h
Normal file
6
user_space.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _USER_SPACE_H
|
||||
#define _USER_SPACE_H
|
||||
|
||||
void enter_user_space(void);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user