• R/O
  • HTTP
  • SSH
  • HTTPS

vaneosmain: コミット

VaneOSのメインGitリポジトリです。


コミットメタ情報

リビジョン544e6725feee98ecb61dd3a50e51aa9d22a4a979 (tree)
日時2014-10-26 12:52:05
作者vosystems <doradora.motochan@gmai...>
コミッターvosystems

ログメッセージ

bug fix & add command

変更サマリ

差分

--- a/Kernel/Env.c
+++ b/Kernel/Env.c
@@ -6,16 +6,32 @@
66 #include<string.h>
77
88 struct EnvVarCommon env;
9+struct EnvShellCommon eshell;
910
10-void set_env(void)
11+int admin_flag;
12+
13+inline void set_shell_env()
14+{
15+ strcpy(eshell.SHELL,"Vane Shell");
16+ eshell.major=0;
17+ eshell.minor=2;
18+ eshell.build=100;
19+ eshell.revision=eshell.build;
20+}
21+
22+inline void set_env(void)
1123 {
1224 strcpy(env.OS_NAME,"Vane Operating System");
1325 strcpy(env.PC_NAME,"Vane-Alpha");
1426 strcpy(env.USER_NAME,"Vane");
1527 strcpy(env.LANG,"en-us");
16- strcpy(env.SHELL,"Vane Shell");
1728 env.major=0;
1829 env.minor=4;
1930 env.build=1000;
2031 env.revision=env.build;
32+
33+ set_shell_env();
34+ env.SHELL=&eshell;
35+
36+ admin_flag=0;
2137 }
--- a/Kernel/Graphical.c
+++ b/Kernel/Graphical.c
@@ -0,0 +1,10 @@
1+/*
2+*Graphic mode kernel source.
3+*(C) 2014 VOSystems.
4+*/
5+
6+#include<Graphic.h>
7+#include<stdio.h>
8+#include<string.h>
9+
10+
--- a/Kernel/Makefile
+++ b/Kernel/Makefile
@@ -44,9 +44,11 @@ TASK_C=task.c
4444 TIME_C=time.c
4545 SCAN_C=scan.c
4646 ENV_C=Env.c
47+TOOLS_C=tools.c
48+CMD_C=cmd_shell.c
4749
4850 #オブジェクト
49-BOOT_OBJ=${BOOT_S:.S=.o} ${BOOT_C:.c=.o} ${VANE_S:.S=.o} ${KEYBOARD_C:.c=.o} ${STDIO_C:.c=.o} ${GDT_IDT_C:.c=.o} ${INTERRUPT_C:.c=.o} ${STRING_C:.c=.o} ${ASM_INTERRUPT_S:.S=.o} ${SCANCODE_C:.c=.o} ${MEMMAN_C:.c=.o} ${FAT_C:.c=.o} ${GRAPHIC_C:.c=.o} ${SYSTEM_C:.c=.o} ${MESSAGE_C:.c=.o} ${TIMER_C:.c=.o} ${TASK_C:.c=.o} ${TIME_C:.c=.o} ${SCAN_C:.c=.o} ${ENV_C:.c=.o}
51+BOOT_OBJ=${BOOT_S:.S=.o} ${BOOT_C:.c=.o} ${VANE_S:.S=.o} ${KEYBOARD_C:.c=.o} ${STDIO_C:.c=.o} ${GDT_IDT_C:.c=.o} ${INTERRUPT_C:.c=.o} ${STRING_C:.c=.o} ${ASM_INTERRUPT_S:.S=.o} ${SCANCODE_C:.c=.o} ${MEMMAN_C:.c=.o} ${FAT_C:.c=.o} ${GRAPHIC_C:.c=.o} ${SYSTEM_C:.c=.o} ${MESSAGE_C:.c=.o} ${TIMER_C:.c=.o} ${TASK_C:.c=.o} ${TIME_C:.c=.o} ${SCAN_C:.c=.o} ${ENV_C:.c=.o} ${TOOLS_C:.c=.o} ${CMD_C:.c=.o}
5052
5153 kernel: ${BOOT_OBJ}
5254 ${LD} ${TARGET} ${BOOT_OBJ}
--- a/Kernel/System.c
+++ b/Kernel/System.c
@@ -99,7 +99,14 @@ inline void shift_vga_text(void)
9999
100100 inline void printVersion(void)
101101 {
102- printf("Vane Operating System [Version %d.%d(build %d)]\n",env.major, env.minor, env.build);
103- printf("Vane Shell [Version 0.2(build 100)]\n");
104- printf("Copyright (C) 2013-2014 VaneOS Project. All rights reserved.\n");
102+ printf("%s [Version %d.%d(build %d)]\n",env.OS_NAME, env.major, env.minor, env.build);
103+ printf("%s [Version %d.%d(build %d)]\n",env.SHELL->SHELL, env.SHELL->major, env.SHELL->minor, env.SHELL->build);
104+ printCopyRight();
105+}
106+
107+inline void printCopyRight(void)
108+{
109+ puts("Copyright (C) 2013-2014 VaneOS Project. All rights reserved.\n");
110+ puts("Copyright (C) 2013-2014 VOSystems. All rights reserved.\n");
111+ puts("Copyright (C) 2014 odeeen. All rights reserved.\n");
105112 }
--- a/Kernel/Vane.S
+++ b/Kernel/Vane.S
@@ -117,8 +117,7 @@ VESA_Check:
117117 RET
118118
119119 VESA_640_480_SET:
120-
121- MOV BX,0x4101
120+ MOV BX,0x0101
122121 MOV AX,0x4F02
123122 INT 0x10
124123
--- a/Kernel/boot.c
+++ b/Kernel/boot.c
@@ -26,6 +26,7 @@
2626 #include<timer.h>
2727 #include<System.h>
2828 #include<Env.h>
29+#include<tools.h>
2930
3031 /*PROTOTYPE*/
3132 void outPortByte( unsigned short address, unsigned char value );
@@ -140,10 +141,11 @@ void cstart(unsigned long magic, unsigned long addr)
140141 }
141142 printINFO("Boot Time and Day = ");
142143 printtime();
143- putchar('\n');
144+ cr();cr();
145+
144146 do{
145- puts("\nKernelShell/Root/>");
146- scan_str(cmd);
147+ ShowPrompt();//puts("\nKernelShell/Root/>");
148+ scan_str(cmd,sizeof(cmd)/sizeof(cmd[0]));
147149
148150 if(strcmp("time",cmd)==0){
149151 int in=0;
@@ -154,17 +156,34 @@ void cstart(unsigned long magic, unsigned long addr)
154156 io_hlt();
155157 io_hlt();
156158 io_hlt();
159+ io_hlt();
160+ io_hlt();
157161 }
162+ cr();
158163
159164 }else if(strcmp("vane",cmd)==0){
160165 attr=CH_BLUE;
161166 printVersion();
162167 attr=WHITE;
163-
168+ cr();cr();
169+
170+ }else if(strcmp("copyright",cmd)==0){
171+ attr=CH_GREE;
172+ printCopyRight();
173+ attr=WHITE;
174+ cr();
175+
176+ }else if(strcmp("cls",cmd)==0 || strcmp("clear",cmd)==0){
177+ ClearScreen();
178+
164179 }else{
180+ if(strcmp("exit",cmd)==0)break;
165181 printFAIL("Unknown this command");
182+ cr();
183+
166184 }
167- }while(strcmp(cmd,"exit"));
185+ //init_char_arrey(cmd,100);
186+ }while(strcmp(cmd,"exit")!=0);
168187 while(1)io_hlt();
169188 return;
170189 }
--- /dev/null
+++ b/Kernel/cmd_shell.c
@@ -0,0 +1,17 @@
1+/*
2+*command shell kernel
3+*(C) 2014 VOSystems.
4+*/
5+
6+#include<stdio.h>
7+#include<Env.h>
8+
9+inline void ShowPrompt(void)
10+{
11+ printf("%s@%s: ~",env.USER_NAME, env.PC_NAME);
12+ if(admin_flag==1){
13+ printf("# ");
14+ }else{
15+ printf("$ ");
16+ }
17+}
--- a/Kernel/scan.c
+++ b/Kernel/scan.c
@@ -3,6 +3,8 @@
33 *(C) 2014 VOSystems.
44 */
55 #include<stdio.h>
6+#include<tools.h>
7+#include<VaneOS.h>
68
79 int scan_num(void)
810 {
@@ -92,16 +94,19 @@ char scan_char(void)
9294 return scan;
9395 }
9496
95-char* scan_str(char* in)
97+char* scan_str(char* in,size_t lengh)
9698 {
9799 char* p=in;
98100 char tmp=0;
99101 unsigned int count=0;
100102
103+ init_char_arrey(in,lengh);
104+
101105 while(1){
102106 tmp=getch();
103107 if(tmp==' ' || tmp=='\n'){
104108 putchar('\n');
109+ *p='\0';
105110 break;
106111
107112 }else if(tmp=='\b' && count>0){
--- a/Kernel/scancode.c
+++ b/Kernel/scancode.c
@@ -12,9 +12,11 @@ char Generate_Scancode_To_ASCII_Code(void)
1212 int scode=msg_get(&kernel)-buf_separate_keyboard;//getmsg(MSG_NUM_KEYBOARD);
1313 if(256<=scode && scode<512)return 0;
1414
15+ msg_put(&kernel,0x00+buf_separate_keyboard);
16+
1517 if(scode==SC_LEFT_SHIFT || scode==SC_RIGHT_SHIFT){
1618 shift_flag=1;
17- }else if((shift_flag==1 && scode==BREAK_NORMAL(SC_LEFT_SHIFT)) || (shift_flag==1 && scode==BREAK_NORMAL(SC_LEFT_SHIFT))){
19+ }else if(shift_flag==1 && (scode==BREAK_NORMAL(SC_LEFT_SHIFT) || scode==BREAK_NORMAL(SC_LEFT_SHIFT))){
1820 shift_flag=0;
1921 }
2022
--- a/Kernel/stdio.c
+++ b/Kernel/stdio.c
@@ -413,6 +413,52 @@ char * uint_to_str_small_hex(char *buf, unsigned src, int base) {
413413 return buf;
414414 }
415415
416+void sprintf(char* s,char* fmt, ...)
417+{
418+ char **arg = (char **) &fmt;
419+ char c;
420+ arg++;
421+
422+ while((c = *fmt++) != 0) {
423+ if(c != '%'){
424+ *s++ = c;
425+
426+ }else{
427+ char buf[64];
428+ char *p;
429+ c = *fmt++;
430+
431+ if(c=='d'){
432+ // if value is minus, put '-' in the head
433+ if( 0 > *((int *) arg) ) {
434+ *s++ = '-';
435+ *((int *) arg) *= -1;
436+ }
437+ p = uint_to_str_small_hex(buf, *((unsigned *) arg++), 10);
438+ strcpy(s,p);
439+
440+ }else if(c=='x'){
441+ p = uint_to_str_small_hex(buf, *((unsigned *) arg++), 16);
442+ strcpy(s,p);
443+
444+ }else if(c=='X'){
445+ p = uint_to_str_big_hex(buf, *((unsigned *) arg++), 16);
446+ strcpy(s,p);
447+
448+ }else if(c=='s'){
449+ p = *arg++;
450+ strcpy(s,p);
451+ }else if(c=='c'){
452+ p=*arg++;
453+ char send=*p;
454+ *s++ = send;
455+ }else{
456+ *s++ = c;
457+ }
458+ }
459+ }
460+}
461+
416462 void printf(char* fmt, ...)
417463 {
418464 char **arg = (char **) &fmt;
--- a/Kernel/string.c
+++ b/Kernel/string.c
@@ -34,12 +34,9 @@ int strcmp(const char *s1, const char *s2)
3434 return ((*(unsigned char*)s1<*(unsigned char*)s2) ? -1 : +1);
3535 }
3636
37-void strcpy(char* copy,const char* source)
37+char* strcpy(char* copy,const char* source)
3838 {
39- while(*source!='\0')
40- {
41- *copy++ =*source++;
42- }
43- *copy='\0';
44- return;
39+ char* s=copy;
40+ while((*s++ = *source++)!=0);
41+ return copy;
4542 }
--- /dev/null
+++ b/Kernel/tools.c
@@ -0,0 +1,12 @@
1+/*
2+*useful tools
3+*(C) 2014 VOSystems.
4+*/
5+#include<VaneOS.h>
6+
7+void init_char_arrey(char* arrey,size_t lengh)
8+{
9+ unsigned int i;
10+ for(i=0;i<lengh;i++)*arrey++ =0;
11+ return;
12+}
Binary files a/bin/Kernel.vsb and b/bin/Kernel.vsb differ
--- a/include/Env.h
+++ b/include/Env.h
@@ -6,12 +6,20 @@
66 #ifndef _ENV_H_VANE_
77 #define _ENV_H_VANE_
88
9+struct EnvShellCommon
10+{
11+ char SHELL[32];
12+ unsigned int major, minor, build, revision;
13+};
14+
915 struct EnvVarCommon
1016 {
11- char* OS_NAME, PC_NAME, USER_NAME , LANG, SHELL;
17+ char OS_NAME[32], PC_NAME[32], USER_NAME[32], LANG[6];
1218 unsigned int major, minor, build, revision;
19+ struct EnvShellCommon *SHELL;
1320 };
1421
22+extern int admin_flag;
1523 extern struct EnvVarCommon env;
1624
1725 #endif
--- a/include/Env.h~
+++ b/include/Env.h~
@@ -6,10 +6,17 @@
66 #ifndef _ENV_H_VANE_
77 #define _ENV_H_VANE_
88
9+struct EnvShellCommon
10+{
11+ char SHELL[32];
12+ unsigned int major, minor, build, revision;
13+};
14+
915 struct EnvVarCommon
1016 {
11- char* PC_NAME, OS_NAME, USER_NAME , LANG, SHELL;
17+ char OS_NAME[32], PC_NAME[32], USER_NAME[32], LANG[6];
1218 unsigned int major, minor, build, revision;
19+ struct EnvShellCommon *SHELL;
1320 };
1421
1522 extern struct EnvVarCommon env;
--- a/include/System.h
+++ b/include/System.h
@@ -15,5 +15,6 @@ void set_qemuvga0reg(int reg, int dat);
1515 void init_qemuvga0(int x, int y, int c, int flag);
1616 void readrtc(unsigned char *t);
1717 void printtime(void);
18+void printCopyRight(void);
1819
1920 #endif
--- a/include/System.h~
+++ b/include/System.h~
@@ -0,0 +1,19 @@
1+/*
2+*System Functions
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _SYSTEM_H_VANE_
7+#define _SYSTEM_H_VANE_
8+
9+extern int vram_start_address;
10+extern char vmode;
11+extern short scrnX,scrnY;
12+
13+void init_qemuvga0(int x, int y, int c, int flag);
14+void set_qemuvga0reg(int reg, int dat);
15+void init_qemuvga0(int x, int y, int c, int flag);
16+void readrtc(unsigned char *t);
17+void printtime(void);
18+
19+#endif
--- a/include/VaneOS.h
+++ b/include/VaneOS.h
@@ -33,6 +33,8 @@ void init_all(void);
3333 int getmsg(int msg_num);
3434 void sendmsg(int msg,int msg_num);
3535
36+#define cr() putchar('\n');
37+
3638 #define COL8_000000 0
3739 #define COL8_FF0000 1
3840 #define COL8_00FF00 2
--- a/include/VaneOS.h~
+++ b/include/VaneOS.h~
@@ -33,9 +33,6 @@ void init_all(void);
3333 int getmsg(int msg_num);
3434 void sendmsg(int msg,int msg_num);
3535
36-enum VGA_PORTS;
37-enum CGTC_REGS;
38-
3936 #define COL8_000000 0
4037 #define COL8_FF0000 1
4138 #define COL8_00FF00 2
--- /dev/null
+++ b/include/cmd.h
@@ -0,0 +1,11 @@
1+/*
2+*cmd shell header.
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _CMD_H_VANE_
7+#define _CMD_H_VANE_
8+
9+void ShowPrompt(void);
10+
11+#endif
--- a/include/scancode.h
+++ b/include/scancode.h
@@ -41,7 +41,7 @@ extern int kernelbuf[32];
4141 #define SC_W 0x11
4242 #define SC_X 0x2d
4343 #define SC_Y 0x15
44-#define SC_Z 0x15
44+#define SC_Z 0x2c
4545
4646 #define SC_0 0x0b
4747 #define SC_1 0x02
@@ -54,7 +54,7 @@ extern int kernelbuf[32];
5454 #define SC_8 0x09
5555 #define SC_9 0x0a
5656
57-#define SC_ZEN_HAN_KAKU 0x29
57+#define SC_ZEN_HAN_KAKU 0x29
5858 #define SC_ECOAL 0x0c
5959 #define SC_TILDA 0x0d
6060 #define SC_YEN 0x7d
--- 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
--- a/include/string.h
+++ b/include/string.h
@@ -6,6 +6,6 @@
66 #define _STRING_H_VANE_
77
88 int strcmp(const char*,const char*);
9-void strcpy(char*,const char*);
9+char* strcpy(char*,const char*);
1010
1111 #endif
--- /dev/null
+++ b/include/string.h~
@@ -0,0 +1,11 @@
1+/*
2+
3+*/
4+
5+#ifndef _STRING_H_VANE_
6+#define _STRING_H_VANE_
7+
8+int strcmp(const char*,const char*);
9+void strcpy(char*,const char*);
10+
11+#endif
--- /dev/null
+++ b/include/tools.h
@@ -0,0 +1,13 @@
1+/*
2+*useful tools
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _TOOLS_H_VANE_
7+#define _TOOLS_H_VANE_
8+
9+#include<VaneOS.h>
10+
11+void init_char_arrey(char* arrey,size_t lengh);
12+
13+#endif
--- /dev/null
+++ b/include/tools.h~
@@ -0,0 +1,11 @@
1+/*
2+*useful tools
3+*(C) 2014 VOSystems.
4+*/
5+
6+#ifndef _TOOLS_H_VANE_
7+#define _TOOLS_H_VANE_
8+
9+void init_char_arrey(char* arrey,size_t lengh);
10+
11+#endif
旧リポジトリブラウザで表示