📄 kernel.c,v
字号:
} printf("%s %c(%d)", taskName, keyAscii, keyScan);a637 1d640 6a645 4 static int cnt2 = 0; static long a, temp; static int i;d648 2a649 2 cnt2++; a = temp = cnt2;d652 4a655 3 *((char *) (0xb8000 + 124 + i * 2)) = (char) a = (a >= 10) ? a + 0x37 : a + 0x30; *((char *) (0xb8000 + 124 + i * 2 + 1)) = 0x20;d658 2a659 1 // printf("B");a662 2 // cmosDelay(2); // keyDeal(3, "task2");d670 1d679 8a686 1 memcpy((char *) 0xb8000, scrtime, strlen(scrtime));d707 1a707 1 cmosDelay(1);a711 1d721 2a722 2void newTask(unsigned int taskEntrance, unsigned int stackAddr, char *taskname, int id, int console)d724 1a724 1a725 1 //asm("cli");d727 1d731 1a731 1 taskP->flag = 0x200; // interrupt enabledd734 3a736 11 taskP->sp = stackAddr; taskP->bp = stackAddr; taskP->pid = id; taskP->console = console; if (console == 1) { holdConsole = taskP->pid; keyBuf = (taskP->keyBufs); keyHead = &(taskP->keyHeads); keyTail = &(taskP->keyTails); }a741 2 //asm("sti");d744 2a745 2void initTask() //init a dummy task structure{d748 1a748 1 task->ip = (unsigned int) 0x00; // any integerd750 1a750 1 task->state = 0; // may not set task0's state RUNNABLE!! d752 2a753 2 task->sp = (unsigned int) 0; // dummy spaceholder task->bp = (unsigned int) 0; // dummy spaceholder a760 3 extern char *keyBuf; extern int *keyHead; extern int *keyTail;d784 1a784 10 /* //console switch if (curTask->pid == holdConsole && keyBuf != (curTask->keyBufs)) { keyBuf = (curTask->keyBufs); keyHead = &(curTask->keyHeads); keyTail = &(curTask->keyTails); //holdConsole = curTask->pid; } */d808 1a808 1// return PIT tickcountd811 1a811 1 return tickcount ;d822 1a822 1// insert sortingd830 1a830 1 // produce random data whose value <100d834 1a834 1 printf("%d ", buf[i]);d847 2a848 2 printf("%s%d%s ", k == 0 ? "(" : "", buf[k], k == 0 ? ")" : "");d853 1a853 1 printf("%d ", buf[i]);d859 1a859 1// binary insert sorting, a improvement of the above insort()d862 1a862 1 char buf[SIZE];d864 2a866 1 buf[0] = 0;d868 1a868 1 // produce random data which value <100d872 1a872 1 printf("%d ", buf[i]);d893 1a893 1 printf("[%d] ", pos);d902 2a903 2 printf("%s%d%s ", k == 0 ? "(" : "", buf[k], k == 0 ? ")" : "");d908 1a908 1 printf("%d ", buf[i]);d910 1d936 1a936 1#define WHITE_TXT 0x07 // white on black texta942 1 //static unsigned int vidmem = 0xb8000;d949 1a949 1 vidmem[i] = '>'; //chs;d951 1a951 1 delay2(0x4fffff); // delay();d954 1a954 2 } else if (i >= 160 * (row - 1) && lr == BACKWARD) {d958 1a958 1 vidmem[i] = '<'; //chs;d960 1a960 1 delay2(0x4fffff); // delay();a970 1extern void shreg();d1012 1a1012 1 __asm__("hlt\n""iret\n");d1015 1a1015 1// Exceptionsd1021 1a1021 1// IRQsd1027 1a1027 1/*d1040 2a1041 2#define csHigh 0x00 // code selector MSB#define csLow 0x08 // code selector LSBd1054 3a1056 3void doInitInts() // do init interrupts, be called in initInterrupts(){ char *idtAddr = (char *) 0x1000; // IDT offset in GDT, GDT=0000hd1059 1a1059 1 // Exception & IRQ handler initialization for Intel X86 CPU d1062 1a1062 1 pos = 0x20; // IRQ0~IRQ7 d1065 1a1065 1 pos = 0x30; // IRQ8~IRQ15 d1068 1a1068 1 tmp = tmp & 0x0000ff; // eip b0~b7d1072 1a1072 1 tmp = (tmp >> 8) & 0x0000ff; // eip b8~b15d1075 4a1078 4 *(idtAddr + pos * 8 + 2) = csLow; //cs =0x08 *(idtAddr + pos * 8 + 3) = csHigh; //cs =0x08 *(idtAddr + pos * 8 + 4) = 0; // always reserved as 0 *(idtAddr + pos * 8 + 5) = 0x8e; // signature 0x8Ed1081 1a1081 1 tmp = (tmp >> 16) & 0xff; // eip b16~b23d1085 1a1085 1 tmp = (tmp >> 24) & 0xff; // eip b24~b31d1097 2d1106 3a1108 1 } while ((temp & 0x02) != 0); /* flush the keyboard controller */@1.6log@revise the segment of keyboard handling procedure in ktask in accordance with the change of keyboard interrupt handler in int.asm@text@d11 3a13 3 $Id: kernel.c,v 1.5 2004/02/14 10:39:34 oracle Exp oracle $ built : $Date: 2004/02/14 10:39:34 $ $Revision: 1.5 $d21 4d36 1a36 1static char rcsDate[] = "Built: $Date: 2004/02/14 10:39:34 $";d56 3a58 3extern unsigned int keyTail;extern unsigned int keyHead;extern unsigned int keyBuf;d78 5d157 1a157 1 char *taskname, int id);d172 2d176 2d198 4a201 4 newTask((unsigned) &task1, task1Stackbottom, "task1", 1); newTask((unsigned) &task2, task2Stackbottom, "task2", 2); newTask((unsigned) &ktask, task3Stackbottom, "ktask", 8); newTask((unsigned) &banner, task4Stackbottom, "banner", 4);d203 1a203 1 5);d205 1a205 1 6);d275 1a275 1 while (keyHead % 254 != keyTail) {d278 5a282 2 keyAscii = *((char *) (&keyBuf) + keyHead + 1); keyScan = *((char *) (&keyBuf) + keyHead + 0);d284 3a286 1 keyHead = (keyHead + 2) % 254;d303 1a307 1a364 1d370 1a370 1 && p->pid < 8) {d575 16d594 1d597 1d613 5a617 4// while (i < 0X2FFFFF) {// i++;// } cmosDelay(2);d670 1a670 1 unsigned int stackAddr, char *taskname, int id)d685 8d719 3d745 10a754 1d778 6d800 1a800 1 // produce random data which value <100d983 1d1079 1a1079 1 /* ...and if that didn't work, just hang */@1.5log@add reboot command and function reboot(), useful to reboot computer@text@d11 3a13 3 $Id: kernel.c,v 1.4 2004/02/01 12:14:40 oracle Exp oracle $ built : $Date: 2004/02/01 12:14:40 $ $Revision: 1.4 $d28 3d32 1a32 1static char rcsDate[] = "Built: $Date: 2004/02/01 12:14:40 $";d48 1a48 1extern void setPITFreq(int hz);d51 4a54 5/* keytail keyhead keybuf defined in int.asm for keybd interrupt */extern unsigned int keytail;extern unsigned int keyhead;extern unsigned int keybuf;extern unsigned int keystr;d73 1d90 1d101 1a101 1#define MAXCMDS 4*6d125 1d161 4a164 1d176 1a176 1 printf("type help for available commands\n\n%s", PROMPT);d179 1a179 1 setPITFreq(50 * 1);d189 9a197 1d260 1d262 1a262 1 while ((keyhead + 2) % 254 != keytail) {d264 7a270 2 keyhead = (keyhead + 2) % 254; if (*((char *) (&keybuf) + keyhead + 1) != 0x0a) {d272 4a275 4 //printf("%c(%d)", *((char *) (&keybuf) + keyhead + 1), *((char *) (&keybuf) + keyhead + 0)); printf("%c", *((char *) (&keybuf) + keyhead + 1)); kb[(kp++) % KNLKEYBFLEN] = *((char *) (&keybuf) + keyhead + 1);d278 1a278 3 if (*((char *) (&keybuf) + keyhead + 0) == 69 || *((char *) (&keybuf) + keyhead + 0) == 58 || *((char *) (&keybuf) + keyhead + 0) == 70) {d284 2a285 1 if (*((char *) (&keybuf) + keyhead + 1) == 0x0a) {d293 1d448 7d465 1d578 50a627 3 while (i < 0X2FFFFF) { i++; }a657 2d1012 1a1012 1 } while ((temp & 0x02) != 0); /* flush the keyboard controller */d1014 1a1014 1 outb(0xFE, 0x64); /* pulse the CPU reset line */d1016 2a1017 2 /* ...and if that didn't work, just hang*/ while (1) ;@1.4log@*** empty log message ***@text@d11 3a13 3 $Id: kernel.c,v 1.3 2004/02/01 11:59:05 oracle Exp oracle $ built : $Date: 2004/02/01 11:59:05 $ $Revision: 1.3 $d26 2d29 1a29 1static char rcsDate[]="Built: $Date: 2004/02/01 11:59:05 $" ;a74 1a77 9/*#define BUFLEN 10char shared[BUFLEN];int shidx = 0;int hold = 1;void putd();void getd();*/d86 1a86 1 HANOI, MDP, DIR, WRFILE, RDFILE, TYPE, DEL, COPY, D0,d119 2d155 1d172 1a181 4/* shidx = 0; hold = 1;*/a226 8/* b1=malloc(-1); b1=realloc(b1,1); dump_heap(); free(b1); dump_heap();*/d419 7d443 2a444 1 ("\nSnixos Project version 1.0, 2003.6\n(C) Copyright 2003-2004 Snallie Jockeyson <Snallie@@tom.com> \nAll Rights Reserved.\nDistributed under the terms of the GNU General Public License.\n%s\n",rcsDate);a641 22/*void putd() *//*{ *//* while (1) { *//* while (shidx < BUFLEN - 1 && hold == 1) { *//* shared[shidx++] = 'P'; *//* printf("P:%d ", shidx); *//* } *//* hold = 0; *//* } *//*} *//*void getd() *//*{ *//* while (1) { *//* while (shidx > 0 && hold == 0) { *//* shared[--shidx] = 'C'; *//* printf("C:%d ", shidx); *//* } *//* hold = 1; *//* } *//*} */d771 1a771 1 static int i = 31 * 2; d781 1a781 1 vidmem[i] = '>';//chs;d791 1a791 1 vidmem[i] = '<';//chs;d878 2a879 4 &int0x0, &int0x1, &int0x2, &int0x3, &int0x4, &int0x5, &int0x6, &int0x7, &int0x8, &int0x9, &int0xA, &int0xB, &int0xC, &int0xD, &int0xE, /* &int0xF, reserved */d882 3a884 6 &int0x20, &int0x21, &int0x22, &int0x23, &int0x24, &int0x25, &int0x26, &int0x27, &int0x30, &int0x31, &int0x32, &int0x33, &int0x34, &int0x35, &int0x36, &int0x37d923 20@1.3log@move rcsDate to the first line of copyright information@text@d11 3a13 3 $Id: kernel.c,v 1.2 2004/02/01 11:53:47 oracle Exp oracle $ built : $Date: 2004/02/01 11:53:47 $ $Revision$d27 1a27 1static char rcsDate[]="Built: $Date: 2004/02/01 11:53:47 $" ;d452 1a452 1 ("\nSnixos Project version 1.0, 2003.6, %s\n(C) Copyright 2003-2004 Snallie Jockeyson <Snallie@@tom.com> \nAll Rights Reserved.\nDistributed under the terms of the GNU General Public License.\n\n",rcsDate);@1.2log@add rcs keyword Date to ver()@text@d11 3a13 3 $Id: kernel.c,v 1.1 2004/02/01 11:42:09 oracle Exp oracle $ built : $Date: 2004/02/01 11:42:09 $d27 1a27 1static char rcsDate[]="Built: $Date$" ;d452 1a452 1 ("\nSnixos Project version 1.0, 2003.6\n(C) Copyright 2003-2004 Snallie Jockeyson <Snallie@@tom.com> \n%s\nAll Rights Reserved.\nDistributed under the terms of the GNU General Public License.\n\n",rcsDate);@1.1log@Initial revision@text@d11 2a12 2 $Id$ built : $Date$d26 2d452 1a452 1 ("\nSnixos Project version 1.0, 2003.6\n(C) Copyright 2003-2004 Snallie Jockeyson <Snallie@@tom.com> \nAll Rights Reserved.\nDistributed under the terms of the GNU General Public License.\n\n");@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -