]> git.corax.cc Git - corax/commitdiff
Remove object files that were added in error; add current state of the source
authorMatthias Kruk <m@m10k.eu>
Tue, 3 Sep 2019 15:12:59 +0000 (00:12 +0900)
committerMatthias Kruk <m@m10k.eu>
Tue, 3 Sep 2019 15:12:59 +0000 (00:12 +0900)
24 files changed:
Makefile
config.h
kernel/arch/apic.o [deleted file]
kernel/arch/arch.o [deleted file]
kernel/arch/boot.S
kernel/arch/boot.o [deleted file]
kernel/arch/cpu.o [deleted file]
kernel/arch/cpu32.o [deleted file]
kernel/arch/debug.o [deleted file]
kernel/arch/defs.h
kernel/arch/entry.o [deleted file]
kernel/arch/i8259.S
kernel/arch/i8259.o [deleted file]
kernel/arch/init.S
kernel/arch/init.o [deleted file]
kernel/arch/interrupt.c
kernel/arch/interrupt.o [deleted file]
kernel/arch/paging.c
kernel/arch/paging.o [deleted file]
kernel/arch/task.S
kernel/arch/task.o [deleted file]
kernel/core/core.o [deleted file]
kernel/core/main.c
kernel/core/main.o [deleted file]

index 7782996e9ff34b1a1998f30056b9b97fa8be705e..f463b6e75d445d103ddd5a89e76360786f119f29 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,15 @@
 DEPS = kernel
 OUTPUT = corax
 PHONY = $(DEPS) clean qemu
-LAYOUT = $(shell setxkbmap -query | sed -nE 's/^layout:.*?([a-z]{2})$/\1/p')
+#LAYOUT = $(shell setxkbmap -query | sed -nE 's/^layout:.*?([a-z]{2})$/\1/p')
 
-foo:
-       $(eval setxkbmap -query | sed -nE 's/^layout:.*?([a-z]{2})$/\1/p')
+#foo:
+#      $(eval setxkbmap -query | sed -nE 's/^layout:.*?([a-z]{2})$/\1/p')
 
 all: $(OUTPUT)
 
 qemu:
-       qemu-system-x86_64 -k ja -kernel $(OUTPUT) -m 512
+       qemu-system-i386 -k ja -kernel $(OUTPUT) -m 128 -display gtk
 
 $(OUTPUT): $(DEPS)
        mv kernel/corax $(OUTPUT)
index d0d930fbac22481ba0a4ff2c41fcbc6dc0628a33..69b7f4f8a1ccea5366ad6fc91bcf336c55778b63 100644 (file)
--- a/config.h
+++ b/config.h
@@ -22,7 +22,7 @@
 #define CONFIG_KERNEL_STACK_SIZE    4096
 #define CONFIG_USER_STACK_SIZE      4096
 
-#define CONFIG_APIC     1
+#define CONFIG_APIC     0
 
 #define CONFIG_SMP      0
 #define CONFIG_SMP_CPUS 1
diff --git a/kernel/arch/apic.o b/kernel/arch/apic.o
deleted file mode 100644 (file)
index 78dd5e0..0000000
Binary files a/kernel/arch/apic.o and /dev/null differ
diff --git a/kernel/arch/arch.o b/kernel/arch/arch.o
deleted file mode 100644 (file)
index b02a94b..0000000
Binary files a/kernel/arch/arch.o and /dev/null differ
index 7e53bf1551c1ffcc5b969a638c3e11be62de1d6b..41b855149e4be26ebe657057311850dcccacfcd7 100644 (file)
@@ -38,6 +38,7 @@ loader:
     cli
     movl    $_cpu, %esp
     addl    $STACK0_TOP, %esp
+       movl    %esp, %ebp
     pushl   %eax
     pushl   %ebx
     call    corax
diff --git a/kernel/arch/boot.o b/kernel/arch/boot.o
deleted file mode 100644 (file)
index 18094cc..0000000
Binary files a/kernel/arch/boot.o and /dev/null differ
diff --git a/kernel/arch/cpu.o b/kernel/arch/cpu.o
deleted file mode 100644 (file)
index b4a094a..0000000
Binary files a/kernel/arch/cpu.o and /dev/null differ
diff --git a/kernel/arch/cpu32.o b/kernel/arch/cpu32.o
deleted file mode 100644 (file)
index 3562e2d..0000000
Binary files a/kernel/arch/cpu32.o and /dev/null differ
diff --git a/kernel/arch/debug.o b/kernel/arch/debug.o
deleted file mode 100644 (file)
index 2e59868..0000000
Binary files a/kernel/arch/debug.o and /dev/null differ
index bf52790f27bbb5f0b51102e90e8b111f9e27be79..72e9903228b560b28380999bfe2a472bf32ed256 100644 (file)
  * 0x200  = IF
  * 0x400  = DF
  * 0x800  = OF
- * 0x1000 = 
+ * 0x1000 =
  */
 #endif /* __DEFS_H */
diff --git a/kernel/arch/entry.o b/kernel/arch/entry.o
deleted file mode 100644 (file)
index fb3c37a..0000000
Binary files a/kernel/arch/entry.o and /dev/null differ
index dce961a08d948b4557dbc11c0cb75d731e068339..82c4124604ed6f4d10f5d4edb9293078f0aabd49 100644 (file)
@@ -30,13 +30,17 @@ _i8259_init:
     call    dbg_printf
 
     /* TODO: initialise timer */
-/*  call    _i8259_getmask  */
+#if 0
+    call    _i8259_getmask
+#endif
     xorl    %eax, %eax
-    movw    $0xfffd, %ax
+
+       /* 0x0001 = timer, 0x0002 = kbd */
+       /* 0xfffd = mask all but kbd, 0xfffc = all but (timer | kbd) */
+    movw    $0xfffc, %ax
     movl    %eax, (%esp)
     call    _i8259_setmask
     addl    $4, %esp
-    sti
     ret
 
 .global _i8259_getmask
diff --git a/kernel/arch/i8259.o b/kernel/arch/i8259.o
deleted file mode 100644 (file)
index 02d25b6..0000000
Binary files a/kernel/arch/i8259.o and /dev/null differ
index 33ef2bfb1684a5144af2f03d36dc1c814953e911..ada755c6bd700e7b0d4675a1f5b3f534e8bdb882 100644 (file)
@@ -27,6 +27,7 @@
 .extern _kernel_cr3
 .extern pg_init
 .extern dbg_printf
+.extern dbg_panic
 
 .extern _i8259_init
 .extern _apic_init
@@ -136,13 +137,38 @@ _entries:
     .long _int_entry23
 #endif /* CONFIG_APIC */
 
+_dbg_regs_str:
+       .ascii "EAX = %08x EBX = %08x\n"
+       .ascii "ECX = %08x EDX = %08x\n"
+       .ascii "ESI = %08x EDI = %08x\n"
+       .asciz "ESP = %08x EBP = %08x\n"
+
 .section .text
+.globl _print_regs
+
+_print_regs:
+       pushl %ebp
+       pushl %esp
+       pushl %edi
+       pushl %esi
+       pushl %edx
+       pushl %ecx
+       pushl %ebx
+       pushl %eax
+       pushl $_dbg_regs_str
+       call  dbg_printf
+       addl  $36, %esp
+       ret
+
 arch_init:
+       call    _print_regs
+
     subl    $24, %esp
 
     movl    $_mem_start, %eax
     addl    $4, %eax
     movl    %eax, (_mem_start)
+
 /*
     movl    $_cpu, %eax
     addl    $GDT_OFFSET, %eax
@@ -160,7 +186,8 @@ arch_init:
     shll    $3, %eax
     movl    %eax, 8(%esp)
     call    memset
-*/
+       */
+
     movl    $_cpu, %eax
     addl    $GDT_OFFSET, %eax
     movl    $0, (%eax)
@@ -231,19 +258,28 @@ arch_init:
     /* remap i8259 interrupts */
     movb    $0x11, %al
     outb    %al, $PIC1_COMM
-    outb    %al, $PIC2_COMM
-    movb    $PIC1_VECTOR0, %al
+       movb    $PIC1_VECTOR0, %al
     outb    %al, $PIC1_DATA
-    movb    $PIC2_VECTOR0, %al
-    outb    %al, $PIC2_DATA
     movb    $0x04, %al
     outb    %al, $PIC1_DATA
-    movb    $0x02, %al
-    outb    %al, $PIC2_DATA
     movb    $0x01, %al
     outb    %al, $PIC1_DATA
+
+       movb    $0x11, %al
+    outb    %al, $PIC2_COMM
+    movb    $PIC2_VECTOR0, %al
+    outb    %al, $PIC2_DATA
+    movb    $0x02, %al
+    outb    %al, $PIC2_DATA
+       movb    $0x01, %al
     outb    %al, $PIC2_DATA
+
+       movl    $128, %esi
+0:     subl    $1, %esi
     xorl    %eax, %eax
+       cmp     %esi, 0
+       jnz     0b
+
     outb    %al, $PIC1_DATA
     outb    %al, $PIC2_DATA
 
@@ -271,7 +307,7 @@ arch_init:
     addl    $8, (%esp)
     addl    $1, %esi
     jmp     0b
-    1:
+1:
 
     /*
     _idt_fill:
@@ -356,7 +392,7 @@ arch_init:
     0:
 #endif /* CONFIG_APIC */
     call    _i8259_init
-    1:
+1:
 
     popl    %ebx
     orl     %eax, %ebx
@@ -381,9 +417,12 @@ arch_init:
 
     movl    12(%esp), %eax
     addl    $16, %esp
-*/
+       */
+
+       sti
+
+       call _print_regs
 
-    sti
     ret
 
 /*
diff --git a/kernel/arch/init.o b/kernel/arch/init.o
deleted file mode 100644 (file)
index fa77260..0000000
Binary files a/kernel/arch/init.o and /dev/null differ
index 49d3768c2cefc2d9fd0f0c389b1b9cf9bf4edbba..05023fdb8895f3b8dfc40e6003d3de7e5118b6f1 100644 (file)
@@ -64,8 +64,8 @@ int _int_handle(stack_frame_t ctx)
     if(ctx.intn == INT_KEYBOARD) {
         extern struct cpu _cpu[CONFIG_SMP_CPUS];
 
-        dbg_printf("Rebooting...\n");
-
+        dbg_printf("Keyboard interrupt\n");
+#if 0
         /* hacky reboot: clear IDT entries for
          * #DF and #GP, then cause a #GP */
         _cpu[CPU_ID].cpu_idt[EXC_DOUBLEFAULT].sd_low = 0;
@@ -76,6 +76,7 @@ int _int_handle(stack_frame_t ctx)
         /* this is such a retarded thing to do, I don't see how this
          * could not cause a triple fault */
         asm volatile("ljmp $0x30, $0xfee00020"); /* LEEROY JENKINS!!! */
+#endif
     } else if(ctx.intn != INT_TIMER) {
                dbg_printf("Interrupt %u occurred\n", ctx.intn);
        }
diff --git a/kernel/arch/interrupt.o b/kernel/arch/interrupt.o
deleted file mode 100644 (file)
index c3b4f2b..0000000
Binary files a/kernel/arch/interrupt.o and /dev/null differ
index e3c9712a2483b91f21fbb536c00b198a875fc398..91b3ee60af3d77638767c94805659472506b77f8 100644 (file)
@@ -131,9 +131,10 @@ void* pg_init(struct multiboot_info *info) {
     while((u32_t)mmap < (info->mmap_addr + info->mmap_length)) {
         u32_t attrs;
         u64_t addr;
-/*
-        dbg_printf("Region: 0x%016llx - 0x%016llx [%u]\n", mmap->addr, mmap->addr + mmap->len, mmap->type);
-*/
+#if 1
+        dbg_printf("Region: 0x%016llx - 0x%016llx [%u]\n",
+                                  mmap->addr, mmap->addr + mmap->len, mmap->type);
+#endif
         attrs = PAGE_ATTR_SIZE | PAGE_ATTR_WRITABLE | PAGE_ATTR_PRESENT;
 
         /* disable caching on reserved memory areas */
@@ -152,7 +153,9 @@ void* pg_init(struct multiboot_info *info) {
 
                 pd = (page_table_t*)cr3;
 
-                for(addr = mmap->addr & ~(PAGE_SIZE_LARGE - 1); addr < (mmap->addr + mmap->len); addr += PAGE_SIZE_LARGE) {
+                for(addr = mmap->addr & ~(PAGE_SIZE_LARGE - 1);
+                                       addr < (mmap->addr + mmap->len);
+                                       addr += PAGE_SIZE_LARGE) {
                     pd->pt_entries[addr >> 22] = (u32_t)addr | attrs;
                 }
 
@@ -271,7 +274,7 @@ void* pg_init(struct multiboot_info *info) {
     */
     _kernel_cr3 = (u32_t)cr3;
 
-    dbg_printf("Enabling %s paging\n", _str_pg_mode[_pg_flags & 0x3]);
+    dbg_printf("Enabling %s paging\n", _str_pg_mode[_pg_flags & PG_MODE_MASK]);
 
     return((void*)(cr3 | _pg_flags));
 }
diff --git a/kernel/arch/paging.o b/kernel/arch/paging.o
deleted file mode 100644 (file)
index 7e5594c..0000000
Binary files a/kernel/arch/paging.o and /dev/null differ
index caf5d12351f2411cfd87d952d91d596a919ad143..6a0360e19fa2e66330d0a7f769d081ded37b66b7 100644 (file)
  */
 
 #define __ASSEMBLY_SOURCE
-       
+
 #include <config.h>
 #include "defs.h"
 
+#define CPU_SIZE (TSS_OFFSET + TSS_SIZE + 4)
+#define CUR_TASK (TSS_OFFSET + TSS_SIZE)
 .extern _cpu
 
 .global _task_prepare
diff --git a/kernel/arch/task.o b/kernel/arch/task.o
deleted file mode 100644 (file)
index 9e4cd05..0000000
Binary files a/kernel/arch/task.o and /dev/null differ
diff --git a/kernel/core/core.o b/kernel/core/core.o
deleted file mode 100644 (file)
index 3fb2790..0000000
Binary files a/kernel/core/core.o and /dev/null differ
index 85e86412efb65af6fe4fb22b208cd088bb6f4b60..1667edad57c78e31bb2a13961bf962551c1a1182 100644 (file)
@@ -91,7 +91,6 @@ int corax(void *mb_info, u32_t magic) {
 
        u32_t p;
 /*
-    volatile register u64_t sysenter, sysexit;
        void *ptr;
 
        for(ptr = (void*)0xd0000; ptr < (void*)0xffffd; ptr++) {
@@ -115,6 +114,9 @@ int corax(void *mb_info, u32_t magic) {
 /*     void *ptr;*/
 
     arch_init(mb_info);
+
+       dbg_panic("fooooo", "baaaaar", __LINE__, "foobar");
+
 /*
     u64_t capabilities = cpu_get_capabilities();
     dbg_printf("CPUID.01h = 0x%016llx\n", capabilities);
@@ -123,15 +125,17 @@ int corax(void *mb_info, u32_t magic) {
         dbg_printf("This is cpu%u\n", cpu_get_id());
     }
 */
+#if 0
+       {
+               volatile register u64_t sysenter, sysexit;
 
-/*
-    sysenter = cpu_timestamp();
-    asm volatile("int $0xCC");
-    sysexit = cpu_timestamp();
-
-    dbg_printf("Syscall took %llu cycles\n", sysexit - sysenter);
-*/
+               sysenter = cpu_timestamp();
+               asm volatile("int $0xCC");
+               sysexit = cpu_timestamp();
 
+               dbg_printf("Syscall took %llu cycles\n", sysexit - sysenter);
+       }
+#endif
 /*
     cpu_debug();
 */
@@ -158,18 +162,21 @@ int corax(void *mb_info, u32_t magic) {
                }
        }
 */
-
        dbg_printf("Switching pstate\n");
+
+       asm volatile("int $0xcc");
+       asm volatile("int $0xcc");
+       /*
        p = cpu_set_pstate(1);
        dbg_printf("Entered P-state %u. (0x%x)\n", p & 0xffff, p);
-       dbg_printf("Initialisation complete. Nothing to do.\n");
-
+       dbg_printf("Initialisation complete. Nothing to do.\n"); */
+/*
        struct task tsk;
 
        _task_prepare(&tsk, (u32_t)_idle, (u32_t)&_stack + sizeof(_stack));
 
        _task_switch(&tsk);
-
+*/
     while(1) {
         asm volatile("hlt");
     }
diff --git a/kernel/core/main.o b/kernel/core/main.o
deleted file mode 100644 (file)
index af67b10..0000000
Binary files a/kernel/core/main.o and /dev/null differ