📄 main.c
字号:
#include "hos.h"void start_kernel(void){ int a,i; float b=3.0; long esp; short ss; unsigned long buf[128]; char bint; init_screen(); printk("hos8:start kernel starts\n"); __asm__ ("lss swapper_stack_start, %%esp\n\t" "jmp L1\n\t" "swapper_stack_start:\n\t" ".long (init_task_union + 8192)\n\t" ".long 0x10\n\t" "L1:\n"::); printk("init_task_union is at:%x \n", init_task_union); __asm__ ("movl %%esp, %0\n\t" "movl %%ss, %1\n\t" :"=m"(esp),"=m"(ss):); printk("esp is %x and ss is %x\n", esp, ss); //init_screen(); tss_init(); // be ready for int make_init_task(); current=init_task; init_interrupt(); bint=inbyte(0x21); printk("after init interr. blocked ints:%x\n",bint); init_timer(); bint=inbyte(0x21); printk("after init timer. blocked ints:%x\n",bint); init_kbd(); bint=inbyte(0x21); printk("after init kbd. blocked ints:%x\n",bint); // unmask all irqs // first read what ints are served //a=inbyte(0x21); //printk("21h is %x\n",a); //for(a=0;a<16;a++) unmask_irq(a); //a=inbyte(0x21); //printk("and now 21h is %x\n",a); init_floppy(); bint=inbyte(0x21); printk("after init floppy. blocked ints:%x\n",bint); // check currently serviced interrupts //outbyte(0x20, 0x9); //a=inbyte(0x20); //printk("int served at %x\n",a); //ReadSector(0,0,1, buf, buf); ReadRelativeSector(3, buf, buf); printk("original sect 3 is\n"); for(a=0;a<8;a++) printk("%x ", buf[a]); ReadRelativeSector(0, buf, buf); printk("sect 0 is\n"); for(a=0;a<8;a++) printk("%x ", buf[a]); WriteRelativeSector(3, buf, buf); ReadRelativeSector(3, buf, buf); printk("now. after write. sect 3 is\n"); for(a=0;a<8;a++) printk("%x ", buf[a]); printk("Hello from hos8\n"); printk("systick = [%d]\n", systick); for(a = 0; a < 10000000; a++) ; printk("systick = [%d]\n", systick); //for(;;); init_fs(); // init fs //make_init_task(); //current=init_task; test_fs(); // test fs //now test exec kernel_thread(init); //for(;;); // now move between p1 and p2 // below thread experiment will be recovered later kernel_thread(p1_body); kernel_thread(p2_body); for(;;){ printk("p0"); for(i=0;i<10000000;i++) b=b+1.0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -