int VEObj::init_existed() { int rc; vzctl_env_status_t env_status; if (vzctl2_get_env_status(ctid(), &env_status, ENV_STATUS_ALL)) return putErr(MIG_ERR_SYSTEM, MIG_MSG_NOSTATUS); if (!(env_status.mask & ENV_STATUS_EXISTS)) return putErr(MIG_ERR_NOEXIST, MIG_MSG_NOEXIST, ctid()); /* TODO: move to upper level */ if (isOptSet(OPT_COPY) && (env_status.mask & ENV_STATUS_SUSPENDED)) return putErr(MIG_ERR_SUSPEND, MIG_MSG_CLONE_FORBIDDEN_FOR_SUSPENDED); if ((rc = ve_data_load(m_ctid, &ve_data))) return rc; root = ve_data.root; priv = ve_data.priv; /* get VELAYOUT version */ layout = vzctl2_env_layout_version((char *)priv); if (layout >= VZCTL_LAYOUT_5) { init_disks(ve_data); } /* get veformat */ if ((veformat = vzctl2_get_veformat(priv)) == -1) { return putErr(MIG_ERR_VZCTL, "vzctl2_get_veformat(%s): %s", priv, vzctl2_get_last_error()); } return 0; }
int kmain(unsigned int magic,multibootInfo *mb) { construct(); //construct the global objects char ans; cout<<"Nano OS is booting\n"; String::strcpy(boot_dev,(const char *)mb->bootDevice); memend=mb->memoryUpper*1024+0x100000; //memory end upper memory in bytes +1MB // well now show the world we have managed our Memory ;) multiboot *m_boot; m_boot=multiboot::Instance(); m_boot->set_multiboot_info(mb); m_boot->set_multiboot_hdr(); cout<<"===============================\n"; cout<<"Available Memory : "<<(unsigned int)m_boot->get_mem_avail()/1024<<"\n"; cout<<" Used Memory : "<<(unsigned int)m_boot->get_mem_used()/1024<<"\n"; cout<<"===============================\n"; cout.flags(hex|showbase); cout<<"Kernel start "<<(unsigned int)m_boot->get_k_start()<<" Kernel end "<<(unsigned int)m_boot->get_k_end() \ <<" kernel length ="<<(unsigned int)m_boot->get_k_length()<<"\n"; cout.flags(dec); kend = m_boot->get_k_end(); // Before we do any thing we should initialize our Heap based memory allocator( Thanks to Chris Giese ) init_heap(); // Setup our Descriptor tables GDT and IDT cout<<"Setting up GDT "; GDT::setup(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); cout<<"setting up IDT "; IDT::setup(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); // After our IDT is loaded We should install our interrupt cout<<"setting up IRQ subsystem "; IRQ::setup(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); // Now, as our IRQ subsystem is set we should install keyboard sothat, our system will be interractive. cout<<"installing key board \n"; kbd::setup(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); // The operating system and the digital computers are worthless if there is no timer // so install and initialize the timer cout<<"installing timer interrupt "; TIMER *my_timer = TIMER::Instance(); my_timer->setup(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); cout<<"my_timer at "<<(unsigned int)my_timer<<"\n"; cout<<"Mboot at "<<(unsigned int)m_boot<<"\n"; // So all the basic systems are in place now // We should initialize the PCI subsystem cout<<"Scanning PCI...\n"; pci_bus *sys_pci_bus=pci_bus::Instance(); sys_pci_bus->scan(); sys_pci_bus->list_dev(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); // now we can start our interrupt system cout<<"\n\n"<<"Enabling Interrupts "; enable(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); // now check if we have any PCI IDE cout<<"Initilizing storage susbsystem(PCI-IDE) "; init_disks(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); cout<<"Initializing Net device..."; detect_netdev(); cout.SetColour(RED,BLACK,0); cout<<"done\n"; cout.SetColour(WHITE,BLACK,0); //cout<<"\nDone\n"; //here let us try our Network ethernet device setup //sys_nic0->send_arp_request(); //cout<<"net init complete\n"; //cout<<"sending\n"; //for(int i=0;i<10;i++) // test_req_arp(); // show which IRQs are installed not necessary but it comes handy while debugging the ISRs. //cout<<"\n"<<"Dumping IRQ routines \n"; //IRQ::dump_irq_routines(); // Our tasks are thread implemented in kernel and it depends on timer interrupt // so now we can start the tasking subsystem //cout<<"Initializing tasking "; //init_tasks(); // bellow this we should not see anything.. why? because in the tasks we started 2 threads // one idle thread and other is our Shell //cout<<"done\n"; init_syscall(); my_test(); for(;;); cout<<"\nReached End of kernel\n shoud not happen \n\nGOODBYE\n"; disable(); halt(); return 0; }
void XHDIDriver::reset() { close_disks(); init_disks(); }
XHDIDriver::XHDIDriver() { init_disks(); }