示例#1
0
文件: main.c 项目: xeioex/kernel-dev
int main(struct multiboot *mboot_ptr)
{
	// All our initialisation calls will go in here.
	init_descriptor_tables();
	monitor_clear();
	initialise_paging();
//	init_timer(3);

	int res = 0;

	monitor_clear();
	monitor_write(str);
	monitor_write("\n\r");
	monitor_write_hex(0xbadacacd);
	monitor_write_hex(0xbada0000);
	monitor_write("\n\r");
	monitor_write_dec(0xadacacd);
	monitor_write("\n\r");
	monitor_write_dec(1234567890);

	//memcpy(0xb8000+80*2*5,0xb8000,80*2*5);
	//memset(0xb8000,76,80*2*5);

	asm volatile ("int $0x3");

	//u32int *ptr = (u32int*)0x0ffffff;
	//u32int do_page_fault = *ptr;
	

	return 0;
}
示例#2
0
void isr_handler(regsiters_t regs)
{
	monitor_write("recv inte");
	monitor_write_dec(regs.int_no);
	monitor_write("err code");
	monitor_write_dec(regs.err_code);
	monitor_put('\n');
}
示例#3
0
void isr_handler(registers_t regs)
{
	monitor_write("recv inte");
	monitor_write_dec(regs.int_no);
	monitor_write("err code");
	monitor_write_dec(regs.err_code);
	monitor_put('\n');
	if(spec_handler[regs.int_no] != NULL){
		spec_handler[regs.int_no](regs);
	}
}
示例#4
0
文件: isr.c 项目: cman-rus/OSrepo2
void isr_handler(registers_t regs)
{
    monitor_write_dec(z);
    monitor_put('-');
    monitor_write("recieved interrupt: ");
    monitor_write_dec(regs.int_no);
    monitor_write(", add: ");
    monitor_write_hex(regs.cs);
    monitor_put(':');
    monitor_write_hex(regs.eip);
    monitor_put('\n');
    ++z;
}
示例#5
0
u32int encode(u32int source,u32int sz)
{
//first layer
    monitor_write("Version:");
    monitor_write_dec(version);
    monitor_put('\n');
    u32int i=0;
    u32int temp=0x1;
    u32int result=0;                                 // detect run by symbol 00
    u8int marker=0x0;
    u8int layer1[32];
    while(i<32)
    {   monitor_write_dec((source>>i)&0X3);

        i++;
    }
    i=0;
    while(i<32)
    {   layer1[i]=0;//  clearing garbage value
        i++;
    };

    i=0;

    while(i<32)
    {
        if(((source>>i)&0X3)==temp)
        {
            monitor_write("X:");
//monitor_put('\n');
            monitor_write_dec(marker);
            layer1[marker]=layer1[marker]+1;
            monitor_write_dec(layer1[marker]);

//monitor_put('\n');
            s("  ");
            i++;
        }

        else {
            temp+=1;
            temp%=4;


            marker++;
        }


    }
示例#6
0
void irq_handler(registers_t regs)
{
	monitor_write("irq");
	monitor_write_dec(regs.int_no);
	monitor_write("err code");//0
	monitor_write_dec(regs.err_code);
	if(spec_handler[regs.int_no] != NULL){
		spec_handler[regs.int_no](regs);
	}
	if(regs.int_no >= 40){
		outb(0xa0, 0x20);
	}
	outb(0x20, 0x20);
	
}
示例#7
0
static void timer_irq_handler(registers_t regs)
{
	static uint32_t tick = 0;
	++tick;
	monitor_write("Timer at:");
	monitor_write_dec(tick);
}
示例#8
0
// C Interrupt dispatcher
void isr_handler(registers_t regs)
{
	// This line is important. When the processor extends the 8-bit interrupt number
   // to a 32bit value, it sign-extends, not zero extends. So if the most significant
   // bit (0x80) is set, regs.int_no will be very large (about 0xffffff80).
   u8int int_no = regs.int_no & 0xFF;
	if (interrupt_handlers[int_no] != 0)
	{
		isr_t handler = interrupt_handlers[int_no];
		handler(regs);
	}
	else
	{

		monitor_set_forecolor(e_color_magenta);
		monitor_write("Unhandled interrupt #");
		monitor_write_dec(int_no);
		monitor_put('\n');
		monitor_write("Message: ");
		if(int_no < 32){
			monitor_write(interrupt_messages[int_no - 1]);
			monitor_put('\n');
		}
		monitor_set_forecolor(e_color_white);

		// ERR!
		PANIC("Unhandled interrupt");
	}
}
示例#9
0
static void timer_callback (registers_t *regs)
{
    tick++;
    monitor_write("Tick: ");
    monitor_write_dec(tick);
    monitor_write("\n");
}
示例#10
0
// This gets called from our ASM interrupt handler stub.
void isr_handler(registers_t* regs)
{
	
    monitor_write("recieved interrupt: ");
    //monitor_write_dec(regs->int_no);
    monitor_write_dec(5);
    monitor_put('\n');
}
示例#11
0
文件: isr.c 项目: gnarlie/bad-os-32
void isr_handler(registers_t regs) {
    if (interrupt_handlers[regs.int_no]) {
        interrupt_handlers[regs.int_no](regs);
    }
    else {
        monitor_write("unhandled interrupt: ");
        monitor_write_dec(regs.int_no);
        monitor_put('\n');
    }
}
示例#12
0
int main(struct multiboot *mboot_ptr)
{
  // All our initialisation calls will go in here.
  monitor_clear();
  monitor_write("Hello world!\n");
  monitor_write_hex(12345678);
  monitor_write("\n");
  monitor_write_dec(12345678);
  monitor_write("\n");
  return 0xDEADBABA;
}
示例#13
0
static void timer_callback(registers_t regs)
{
	 regs = regs;
    tick++;
	 if (tick % 200 == 0)
	 {
    	 monitor_write("Tick: ");
	 	 monitor_write_dec(tick / 200);
	 	 monitor_put('\n');
	 }
}
示例#14
0
文件: isr.c 项目: memnonila/MOS
void isr_handler(registers_t regs){
	u8int int_no = regs.int_no & 0xFF;
	if(interrupt_handlers[int_no] != 0){
		isr_t handler = interrupt_handlers[int_no];
		handler(&regs);
	} else {
		monitor_write("recieved interrupt: ");
		monitor_write_dec(regs.int_no);
		monitor_put('\n');
	}
}
示例#15
0
void idt_handler (registers_t *regs)
{
  if (interrupt_handlers [regs->int_no])
    interrupt_handlers [regs->int_no] (regs);
  else
  {
    monitor_write ("Unhandled interrupt: ");
    monitor_write_dec (regs->int_no);
    monitor_put ('\n');
  }
}
示例#16
0
文件: isr.c 项目: heguangyu5/my-os
void isr_handler(registers_t regs)
{
	if (interrupt_handlers[regs.int_no] != 0) {
		isr_t handler = interrupt_handlers[regs.int_no];
		handler(regs);
	} else {
		monitor_write("received CPU interrupt: ");
		monitor_write_dec(regs.int_no);
		monitor_put('\n');
	}
}
示例#17
0
void isr_handler(registers_t regs){

	monitor_write("recieved interrupt: ");
	monitor_write_dec(regs.int_no);
	monitor_put('\n');

	// screen_print_str("recieved interrupt: \n");
	// screen_print_char(regs.int_no - '0');

   // monitor_write("recieved interrupt: ");
   // monitor_write_dec(regs.int_no);
   // monitor_put('\n');
}
示例#18
0
文件: main.c 项目: Nov11/jamesos
//写个struct mulitboot 省着老有警告 用的时候再改
//grub标准里有这个http://gnu.april.org/software/grub/manual/multiboot/multiboot.html
//struct multiboot{};
int kmain(struct multiboot_info* mboot_ptr)//name is mentioned in boot.s
{
	init_gdt();
	init_idt();
	monitor_write("qhello!!@#$%^&*()[]+= bcdef:wworld! 1234");
	monitor_write("\n");
	monitor_write_hex(256);
	monitor_write("finished");
	monitor_write_dec(256);
	monitor_write("done ss");
	monitor_write_hex(kss);
	monitor_write("done esp");
	monitor_write_hex(kesp);
	
	monitor_put('\n');
	//init_gdt();
	//init_idt();
	asm volatile("int $0x3");
	asm volatile("int $0x4");
	prtf("aa bb %x %u %s 11\t \nbb\n", 10, 10, "str");	
	//asm volatile("sti");
    	//init_timer(500);
	//monitor_write_hex((u32int)&end);
	prtf("1\tend is at addr :%x end itself:%x kend:%x &kend:%x\n", (u32int)&end, end, kend, &kend);

	/*旧的paging实现
	init_paging();
	prtf("paging enabled!\n");
	u32int* ptr = (u32int*)0xa0000000;
	*ptr = 1;
	*/
	//新的paging 
	//换了个管理物理内存的方法 这个没啥大区别
	//分割物理内存管理 虚拟内存管理
	//显式映射虚拟地址
	//pmm里搞的都是物理地址 函数返回的也是物理地址
	init_pmm ((u32int)&end, 1 << 25);//32MB
	init_vmm ();
	/*prtf("mboot_ptr : %x\n", mboot_ptr);//大概0x2d000 没到640k呢
	prtf("mem_upper %x\n", mboot_ptr->mem_upper);*/
	map(0xa0000000, 0x300000, PAGE_WRITE|PAGE_PRESENT);
	prtf("mapped!\n");
	u32int* ptr = (u32int*)0xa0000000;
	*ptr = 1;
	prtf("assigned!\n");
	unmap(0xa0000000);
	prtf("unmapped!\n");
	*ptr = 2;
	prtf("end!\n");
	return 0xdeadbeef;
}
示例#19
0
文件: main.c 项目: dom96/himari
int kmain(void* mbd, unsigned int magic)
{
    // Initialise the screen (by clearing it)
    monitor_clear();
    // Alloc some memory
    u8int mem;
    memset(&mem, 32, 5);
    
    monitor_write("Hello, world!\n");
    monitor_write_bin(mem);
    monitor_write("\n");
    monitor_write_dec(mem);
    
    return 0;
}
示例#20
0
文件: isr.c 项目: heguangyu5/my-os
void irq_handler(registers_t regs)
{
	if (regs.int_no > 40) {
		// slave reset
		outb(0xA0, 0x20);
	}

	// master reset
	outb(0x20, 0x20);

	if (interrupt_handlers[regs.int_no] != 0) {
		isr_t handler = interrupt_handlers[regs.int_no];
		handler(regs);
	} else {
		monitor_write("received IRQ interrupt: ");
		monitor_write_dec(regs.int_no);
		monitor_put('\n');
	}
}
示例#21
0
文件: monitor.c 项目: Nov11/jamesos
void prtf(const char* format, ...)
{
	const char** arg = &format;//存format的地址
	int c;

	//arg是format这个参数的下一个参数的地址,也就是字符串后第一个参数的地址
	arg++;
	while((c = *format++) != 0){
		if(c == '\\'){
			c = *format++;
			switch(c){
				case 'n':
					monitor_put('\n');
					break;
				case 't':
					monitor_put('\t');
					break;
			}
		}else if(c == '%'){
			c = *format++;
			switch(c){
				case 'u':
					monitor_write_dec(*(u32int*)arg);
					break;
				case 'x':
					monitor_write_hex(*(u32int*)arg);
					break;
				case 's':
					monitor_write(*arg);
					break;
				case 'p':
					monitor_write_hex(*(u32int*)arg);
					break;
			}
			arg++;
		}else{
			monitor_put(c);
		}
	}
}
示例#22
0
int main(struct multiboot *mboot_ptr)
{
  // All our initialisation calls will go in here.
  
  //init descriptor tables
  init_descriptor_tables();
  //Testing screen instructions
  monitor_clear();
  monitor_write("Hello World");
  u32int n = 0xDEADBABA;

  monitor_write("\n");
  monitor_write_hex(n);
  
  monitor_write("\n");
  n = 1234567890;
  
  monitor_write_dec(n);

  asm volatile ("int $0x1");
  //asm volatile ("int $0x4");

  return 0xDEADBABA;
}
示例#23
0
文件: cli.c 项目: scaery/tapestry-os
// Time Display Function
void time_disp() {
  
  // display time
  monitor_write_dec(readCMOS(0x0));
  printf(" ");
  monitor_write_dec(readCMOS(0x2));
  printf(" ");
  monitor_write_dec(readCMOS(0x4));
  printf(" ");
  monitor_write_dec(readCMOS(0x7));
  printf(" ");
  monitor_write_dec(readCMOS(0x8));
  printf(" ");
  monitor_write_dec(readCMOS(0x9));
  //printf("\n");
  //monitor_write_dec(mktime(getDatetime()));

  // add blank line
  printf("\n");
  
}
示例#24
0
panic(char* msg, u32int line, char* file)
{
	monitor_write(msg);
	monitor_write_dec(line);
	monitor_write(file);
}