• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

マイクロカーネル、プリエンプティブマルチタスクを目指しているOSです。


Commit MetaInfo

Révision5c46f3e79c4ee5ea076ac0fbe059730e3a9e045f (tree)
l'heure2014-10-15 22:32:11
Auteurvosystems <doradora.motochan@gmai...>
Commitervosystems

Message de Log

タイマー機能実装開始

Change Summary

Modification

--- a/Kernel/Interrupt.c
+++ b/Kernel/Interrupt.c
@@ -9,24 +9,36 @@
99 #include<Interrupt.h>
1010 #include<scancode.h>
1111 #include<Message.h>
12+#include<timer.h>
1213
13-static volatile int timer_tick;
14+#define UINT_MAX 0x100000000
15+
16+static volatile unsigned int timer_tick;
1417 int system_key_code_flag,break_flag;
1518 unsigned long long input;
1619
17-struct msg_data keyboard;
18-int keybuf[32];
20+struct msg_data kernel;
21+int kernelbuf[32];
22+
23+struct timer timer;
1924
2025 void timer_interrupt( void )
2126 {
2227 /*count tick*/
2328 timer_tick++;
29+ if(timer->timeout>0)
30+ {
31+ timer->timeout--;
32+ if(timer->timeout==0)
33+ {
34+ msg_put(timer->msg,timer->data);
35+ }
36+ }
2437 }
2538
2639 void keyboard_interrupt( void )
2740 {
28- msg_put(&keyboard,readKbdEncBuffer()+buf_separate_keyboard);
29- //sendmsg((int)readKbdEncBuffer(),MSG_NUM_KEYBOARD);
41+ msg_put(&kernel,readKbdEncBuffer()+buf_separate_keyboard);
3042 }
3143
3244 inline void enable()
--- a/Kernel/Vane.S
+++ b/Kernel/Vane.S
@@ -3,84 +3,91 @@
33 .text
44 .intel_syntax noprefix
55
6-.global clear_state,asm_move_cursol,hlt,vane_io_cli,vane_io_sti,write_mem8,VESA_640_480_SET,VESA_Check,VESA_Check,scrn320
7-.global io_hlt,io_cli,io_sti,io_stihlt,io_in8,io_in16,io_in32,io_out8,io_out16,io_out32,io_load_eflags,io_store_eflags,load_cr0,store_cr0,load_tr
6+.global clear_state,asm_move_cursol,write_mem8,VESA_640_480_SET,VESA_Check,VESA_Check,scrn320
7+.global io_hlt,io_cli,io_sti,io_stihlt
8+.global io_in8,io_in16,io_in32,io_out8,io_out16,io_out32
9+.global io_load_eflags,io_store_eflags,load_cr0,store_cr0,load_tr
10+.global farjmp
11+
12+farjmp:
13+ JMP FAR [ESP+4]
14+ RET
815
916 io_hlt:
10- HLT
11- RET
17+ HLT
18+ RET
1219
1320 io_cli:
14- CLI
15- RET
21+ CLI
22+ RET
1623
1724 io_sti:
18- STI
19- RET
25+ STI
26+ RET
2027
2128 io_stihlt:
22- STI
23- HLT
24- RET
29+ STI
30+ HLT
31+ RET
2532
2633 io_in8:
27- MOV EDX,[ESP+4]
28- MOV EAX,0
29- IN AL,DX
30- RET
34+ MOV EDX,[ESP+4]
35+ MOV EAX,0
36+ IN AL,DX
37+ RET
3138
3239 io_in16:
33- MOV EDX,[ESP+4]
34- MOV EAX,0
35- IN AX,DX
36- RET
40+ MOV EDX,[ESP+4]
41+ MOV EAX,0
42+ IN AX,DX
43+ RET
3744
3845 io_in32:
39- MOV EDX,[ESP+4]
40- IN EAX,DX
41- RET
46+ MOV EDX,[ESP+4]
47+ IN EAX,DX
48+ RET
4249
4350 io_out8:
44- MOV EDX,[ESP+4]
45- MOV AL,[ESP+8]
46- OUT DX,AL
47- RET
51+ MOV EDX,[ESP+4]
52+ MOV AL,[ESP+8]
53+ OUT DX,AL
54+ RET
4855
4956 io_out16:
50- MOV EDX,[ESP+4]
51- MOV EAX,[ESP+8]
52- OUT DX,AX
53- RET
57+ MOV EDX,[ESP+4]
58+ MOV EAX,[ESP+8]
59+ OUT DX,AX
60+ RET
5461
5562 io_out32:
56- MOV EDX,[ESP+4]
57- MOV EAX,[ESP+8]
58- OUT DX,EAX
59- RET
63+ MOV EDX,[ESP+4]
64+ MOV EAX,[ESP+8]
65+ OUT DX,EAX
66+ RET
6067
6168 io_load_eflags:
62- PUSHFD
63- POP EAX
64- RET
69+ PUSHFD
70+ POP EAX
71+ RET
6572
6673 io_store_eflags:
67- MOV EAX,[ESP+4]
68- PUSH EAX
69- POPFD
70- RET
74+ MOV EAX,[ESP+4]
75+ PUSH EAX
76+ POPFD
77+ RET
7178
7279 load_cr0:
73- MOV EAX,CR0
74- RET
80+ MOV EAX,CR0
81+ RET
7582
7683 store_cr0:
77- MOV EAX,[ESP+4]
78- MOV CR0,EAX
79- RET
84+ MOV EAX,[ESP+4]
85+ MOV CR0,EAX
86+ RET
8087
8188 load_tr:
82- LTR [ESP+4]
83- RET
89+ LTR [ESP+4]
90+ RET
8491
8592
8693 write_mem8:
@@ -117,10 +124,6 @@ VESA_640_480_SET:
117124
118125 RET
119126
120-hlt:
121- HLT
122- RET
123-
124127 clear_state:
125128 jmp 0x08:_flush_seg
126129 RET
@@ -149,10 +152,3 @@ asm_move_cursol:
149152
150153 RET
151154
152-vane_io_cli:
153- CLI
154- RET
155-
156-vane_io_sti:
157- STI
158- RET
--- a/Kernel/boot.c
+++ b/Kernel/boot.c
@@ -103,7 +103,7 @@ void cstart(unsigned long magic, unsigned long addr)
103103 keyboardEnableKBD();
104104 printOK("Init Keyboard.....");
105105
106- msg_init(&keyboard,32,keybuf);
106+ msg_init(&kernel,32,kernelbuf);
107107 printOK("Init Messaging Buffer.....");
108108
109109 setPitCounter(100,DEF_PIT_COM_COUNTER0,DEF_PIT_COM_MODE_SQUAREWAVE);
@@ -127,14 +127,12 @@ void cstart(unsigned long magic, unsigned long addr)
127127
128128
129129 printf("Free Memory = %d MiB\n\n",memman_total(memman)/(1024*1024));
130-
130+
131131 puts("KernelShell/Root/>");
132- int num;
133- char aaa[100]={"ASD"};
134132 scanf("%s",&cmd);
135133 printf("%s",cmd);
136134
137- while(1)hlt();
135+ while(1);
138136 return;
139137 }
140138
--- a/Kernel/scancode.c
+++ b/Kernel/scancode.c
@@ -7,8 +7,10 @@ int shift_flag;
77
88 char Generate_Scancode_To_ASCII_Code(void)
99 {
10- if(msg_status(&keyboard)==0)return 0;
11- int scode=msg_get(&keyboard)-buf_separate_keyboard;//getmsg(MSG_NUM_KEYBOARD);
10+ if(msg_status(&kernel)==0)return 0;
11+
12+ int scode=msg_get(&kernel)-buf_separate_keyboard;//getmsg(MSG_NUM_KEYBOARD);
13+ if(256<=scode && scode<512)return 0;
1214
1315 if(scode==SC_LEFT_SHIFT || scode==SC_RIGHT_SHIFT){
1416 shift_flag=1;
--- a/include/Interrupt.h~
+++ b/include/Interrupt.h~
@@ -5,9 +5,18 @@ extern int timer_tick;
55 #ifndef INTERRUPT_H
66 #define INTERRUPT_H
77
8+struct timer
9+{
10+ unsigned int count,timeout;
11+ struct msg *msg;
12+ unsigned int data;
13+};
14+
815 void Timer_Interrupt_asm(void);
916 void KeyBoard_Interrupt_asm(void);
1017 void INTERRUPT_NOTHING(void);
18+void out_virtual86mode_interrupt(void);
19+void in_virtual86mode_interrupt(void);
1120
1221 void enter_interrupt(void);
1322 void interrupt_done(void);
--- a/include/VaneOS.h
+++ b/include/VaneOS.h
@@ -10,9 +10,8 @@
1010
1111 #define local static
1212 #define DEBUG while(getchar()!='\n')
13-void vane_io_cli(void);
14-void vane_io_sti(void);
1513 void write_mem_8(int,int);
14+void farjmp(int eip,int cs);
1615
1716 void io_hlt(void);
1817 void io_cli(void);
--- a/include/VaneOS.h~
+++ b/include/VaneOS.h~
@@ -9,7 +9,7 @@
99 #define VANEOS_H
1010
1111 #define local static
12-
12+#define DEBUG while(getchar()!='\n')
1313 void vane_io_cli(void);
1414 void vane_io_sti(void);
1515 void write_mem_8(int,int);
--- a/include/scancode.h
+++ b/include/scancode.h
@@ -7,8 +7,8 @@
77
88 char Generate_Scancode_To_ASCII_Code(void);
99
10-extern struct msg_data keyboard;
11-extern int keybuf[32];
10+extern struct msg_data kernel;
11+extern int kernelbuf[32];
1212
1313 /*Flag Code*/
1414 #define BREAK_FLAG 0xf0