summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-12-05 00:16:42 +0100
committerMichal Idziorek <m.i@gmx.at>2014-12-05 00:16:42 +0100
commit743a4860cce117baec6ef3c40deb0f945529c34f (patch)
treefe9f609521ac66331364d8a9c97ac9dcf5fcd46c
parent41c3e0bc640f570831bd6c18fbfb8c7cec23a43d (diff)
struggling with paging exceptions!
-rw-r--r--asm/asm.h18
-rw-r--r--asm/int_irq.asm155
-rw-r--r--asm/int_irq0.asm9
-rw-r--r--kernel/config.h2
-rw-r--r--kernel/interrupts.c36
-rw-r--r--kernel/syscalls.c5
-rw-r--r--kernel/task.c5
-rw-r--r--userspace/Makefile2
-rw-r--r--userspace/init.c4
9 files changed, 200 insertions, 36 deletions
diff --git a/asm/asm.h b/asm/asm.h
index c9a1fa3..58c3f62 100644
--- a/asm/asm.h
+++ b/asm/asm.h
@@ -4,3 +4,21 @@ void int_default_handler();
void int_clock_handler();
void int_syscall_handler();
void int_irq0();
+void int_irq1();
+void int_irq2();
+void int_irq3();
+void int_irq4();
+void int_irq5();
+void int_irq6();
+void int_irq7();
+void int_irq8();
+void int_irq9();
+void int_irq10();
+void int_irq11();
+void int_irq12();
+void int_irq13();
+void int_irq14();
+void int_irq15();
+void int_irq16();
+void int_irq17();
+void int_irq18();
diff --git a/asm/int_irq.asm b/asm/int_irq.asm
new file mode 100644
index 0000000..8341074
--- /dev/null
+++ b/asm/int_irq.asm
@@ -0,0 +1,155 @@
+global int_irq0
+global int_irq1
+global int_irq2
+global int_irq3
+global int_irq4
+global int_irq5
+global int_irq6
+global int_irq7
+global int_irq8
+global int_irq9
+global int_irq10
+global int_irq11
+global int_irq12
+global int_irq13
+global int_irq14
+global int_irq15
+global int_irq16
+global int_irq17
+global int_irq18
+
+[extern exception_handle]
+[extern exception_handle_0]
+[extern exception_handle_1]
+[extern exception_handle_2]
+[extern exception_handle_3]
+[extern exception_handle_4]
+[extern exception_handle_5]
+[extern exception_handle_6]
+[extern exception_handle_7]
+[extern exception_handle_8]
+[extern exception_handle_9]
+[extern exception_handle_10]
+[extern exception_handle_11]
+[extern exception_handle_12]
+[extern exception_handle_13]
+[extern exception_handle_14]
+[extern exception_handle_15]
+[extern exception_handle_16]
+[extern exception_handle_17]
+[extern exception_handle_18]
+
+[bits 32]
+int_irq0:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq1:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq2:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq3:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq4:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq5:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq6:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq7:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq8:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq9:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq10:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq11:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq12:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq13:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq14:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq15:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq16:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq17:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
+
+int_irq18:
+
+ cli
+ call exception_handle ;this will never return due to panic!
+ jmp $
diff --git a/asm/int_irq0.asm b/asm/int_irq0.asm
deleted file mode 100644
index a713774..0000000
--- a/asm/int_irq0.asm
+++ /dev/null
@@ -1,9 +0,0 @@
-global int_irq0
-[extern exception_handle]
-
-[bits 32]
-int_irq0:
-
- cli
- call exception_handle ;this will never return due to panic!
- jmp $
diff --git a/kernel/config.h b/kernel/config.h
index a741c4a..60c650a 100644
--- a/kernel/config.h
+++ b/kernel/config.h
@@ -8,7 +8,7 @@
#define FOOLOS_CONFIG_H
#define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line
-#define FOOLOS_LOG_OFF // do not log anything
+//#define FOOLOS_LOG_OFF // do not log anything
#define FOOLOS_CONSOLE // otherwise VESA will be used!
#define MEM_PRINT_MEMORYMAP
#define LOG_BUF_SIZE 4069
diff --git a/kernel/interrupts.c b/kernel/interrupts.c
index f82c59c..349b842 100644
--- a/kernel/interrupts.c
+++ b/kernel/interrupts.c
@@ -118,24 +118,24 @@ void int_init(uint16_t sel)
// exceptions
int_install_ir(0, 0b10001110, 0x08,&int_irq0);
- int_install_ir(1, 0b10001110, 0x08,&int_irq0);
- int_install_ir(2, 0b10001110, 0x08,&int_irq0);
- int_install_ir(3, 0b10001110, 0x08,&int_irq0);
- int_install_ir(4, 0b10001110, 0x08,&int_irq0);
- int_install_ir(5, 0b10001110, 0x08,&int_irq0);
- int_install_ir(6, 0b10001110, 0x08,&int_irq0);
- int_install_ir(7, 0b10001110, 0x08,&int_irq0);
- int_install_ir(8, 0b10001110, 0x08,&int_irq0);
- int_install_ir(9, 0b10001110, 0x08,&int_irq0);
- int_install_ir(10, 0b10001110, 0x08,&int_irq0);
- int_install_ir(11, 0b10001110, 0x08,&int_irq0);
- int_install_ir(12, 0b10001110, 0x08,&int_irq0);
- int_install_ir(13, 0b10001110, 0x08,&int_irq0);
- int_install_ir(14, 0b10001110, 0x08,&int_irq0);
- int_install_ir(15, 0b10001110, 0x08,&int_irq0);
- int_install_ir(16, 0b10001110, 0x08,&int_irq0);
- int_install_ir(17, 0b10001110, 0x08,&int_irq0);
- int_install_ir(18, 0b10001110, 0x08,&int_irq0);
+ int_install_ir(1, 0b10001110, 0x08,&int_irq1);
+ int_install_ir(2, 0b10001110, 0x08,&int_irq2);
+ int_install_ir(3, 0b10001110, 0x08,&int_irq3);
+ int_install_ir(4, 0b10001110, 0x08,&int_irq4);
+ int_install_ir(5, 0b10001110, 0x08,&int_irq5);
+ int_install_ir(6, 0b10001110, 0x08,&int_irq6);
+ int_install_ir(7, 0b10001110, 0x08,&int_irq7);
+ int_install_ir(8, 0b10001110, 0x08,&int_irq8);
+ int_install_ir(9, 0b10001110, 0x08,&int_irq9);
+ int_install_ir(10, 0b10001110, 0x08,&int_irq10);
+ int_install_ir(11, 0b10001110, 0x08,&int_irq11);
+ int_install_ir(12, 0b10001110, 0x08,&int_irq12);
+ int_install_ir(13, 0b10001110, 0x08,&int_irq13);
+ int_install_ir(14, 0b10001110, 0x08,&int_irq14);
+ int_install_ir(15, 0b10001110, 0x08,&int_irq15);
+ int_install_ir(16, 0b10001110, 0x08,&int_irq16);
+ int_install_ir(17, 0b10001110, 0x08,&int_irq17);
+ int_install_ir(18, 0b10001110, 0x08,&int_irq18);
diff --git a/kernel/syscalls.c b/kernel/syscalls.c
index 6925b87..62b924f 100644
--- a/kernel/syscalls.c
+++ b/kernel/syscalls.c
@@ -127,11 +127,6 @@ int syscall_execve(char *name, char **argv1, char **env1)
uint32_t *entry=temp;
temp+=4;
- char *force_argv[]={"",NULL};
- char *force_env[]={"PS1=$","PWD=/home/miguel","PATH=/bin",NULL};
- if(argv1==NULL)argv1=force_argv;
- if(env1==NULL)env1=force_env;
-
int env_count=0;
do{env_count++;}while(env1[env_count]!=NULL);
diff --git a/kernel/task.c b/kernel/task.c
index b01975d..1bfc1b2 100644
--- a/kernel/task.c
+++ b/kernel/task.c
@@ -154,7 +154,10 @@ volatile void task_init(pdirectory *dir)
task_list[0].vmem=dir;
task_list[0].esp = 0; // will be set by next task_switch_next() call.
current_task=0;
- syscall_execve("/bin/init",NULL,NULL);
+
+ char *argv[]={"/bin/init",NULL};
+ char *env[]={NULL};
+ syscall_execve("/bin/init",argv,env);
}
diff --git a/userspace/Makefile b/userspace/Makefile
index 8516bc1..2434008 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -22,7 +22,7 @@ ext2.img: $(PROGS)
cp $^ mnt/bin
echo "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++." > mnt/home/miguel/hello.brain
# cp ~/temp/fool-os-stuff/binutils-build-host-foolos/binutils/readelf mnt/bin
- cp ~/temp/fool-os-stuff/ncurses-5.9/progs/clear mnt/bin
+ cp ~/temp/fool-os-stuff/ncurses-5.9/progs/tput mnt/bin
mkdir -p mnt/etc
echo "127.0.0.1 localhost" > mnt/etc/hosts
sync
diff --git a/userspace/init.c b/userspace/init.c
index 6dc6215..d152581 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -12,7 +12,9 @@ int main(int argc, char **argv)
if(pid==0)
{
- execve("/bin/foolshell",0,0); // replace process with our foolshell :)
+ char *argv[]={"/bin/foolshell",0};
+ char *env[]={"PS1=$","PWD=/home/miguel","PATH=/bin",0};
+ execve("/bin/foolshell",argv,env); // replace process with our foolshell :)
puts("FATAL ERROR: Something terrible happened. Unable to Execute SHELL!");
while(1);// hang