Exemplo n.º 1
0
extern "C" void irqHandler_4()
{
  kprintfd("IRQ 4 called\n");
  SerialManager::getInstance()->service_irq(4);
  ArchInterrupts::EndOfInterrupt(4);
  kprintfd("IRQ 4 ended\n");
}
Exemplo n.º 2
0
void Bitmap::bmprint(uint8* b, size_t n, size_t num_bits_set)
{
  kprintfd("\n-----Bitmap: size=%zd, num_bits_set=%zd-----\n", n, num_bits_set);
  for (uint32 i = 0; i < n; i++)
  {
    kprintfd("%d", getBit(b, i));
  }
  kprintfd("\n-----Bitmap:end------\n");
}
Exemplo n.º 3
0
void Buffer::print()
{
  kprintfd ( "\n----Buffer:size:%d-offset:%d-----\n",size_,offset_ );
  for ( uint32 i = 0; i<size_;i++ )
  {
    kprintfd ( "%x",buffer_[i] );
  }
  kprintfd ( "\n----Buffer:end------\n" );
}
Exemplo n.º 4
0
void SWEBDebugInfo::printCallInformation(pointer address) const {
    const char *name;
    ssize_t line;
    getCallNameAndLine(address, name, line);
    if (line >= 0) {
        kprintfd("%10zx: %." CALL_FUNC_NAME_LIMIT_STR "s:%zu \n", address, name, line );
    }
    else {
        kprintfd("%10zx: %." CALL_FUNC_NAME_LIMIT_STR "s+%zx\n", address, name, -line);
    }
}
Exemplo n.º 5
0
// testing the registerfilesystem
void testRegFS()
{
  kprintfd ( "***** begin ROOT_Mount()\n" );
  RamFSType *ramfs = new RamFSType();
  vfs.registerFileSystem ( ramfs );
  vfs.root_mount ( "ramfs", 0 );
  kprintfd ( "***** end ROOT_Mount()\n" );

  //testMountUmount();
  //testFile();
  testFinal();

  kprintfd ( "***** begin ROOTUmount()\n\n\n" );
  vfs.rootUmount();
  vfs.unregisterFileSystem ( ramfs );
  kprintfd ( "***** end ROOTUmount()\n" );
}
Exemplo n.º 6
0
void ArchMemory::insertPD(uint32 pdpt_vpn, uint32 physical_page_directory_page)
{
  kprintfd("insertPD: pdpt %p pdpt_vpn %x physical_page_table_page %x\n",page_dir_pointer_table_,pdpt_vpn,physical_page_directory_page);
  memset((void*)getIdentAddressOfPPN(physical_page_directory_page), 0,PAGE_SIZE);
  memset((void*)(page_dir_pointer_table_ + pdpt_vpn), 0, sizeof(PageDirPointerTableEntry));
  page_dir_pointer_table_[pdpt_vpn].page_directory_ppn = physical_page_directory_page;
  page_dir_pointer_table_[pdpt_vpn].present = 1;
}
Exemplo n.º 7
0
void Lock::printWaitersList()
{
  debug(LOCK, "Threads waiting for lock %s (%p), newest thread waiting first:\n", name_, this);
  size_t count = 0;
  for(Thread* thread = waiters_list_; thread != 0; thread = thread->next_thread_in_lock_waiters_list_)
  {
    kprintfd("%zu: %s (%p)\n", ++count, thread->getName(), thread);
  }
}
Exemplo n.º 8
0
void Scheduler::yield()
{
  if ( ! ArchInterrupts::testIFSet() )
  {
    kprintfd ( "Scheduler::yield: WARNING Interrupts disabled, do you really want to yield ? (currentThread %x %s)\n", currentThread, currentThread->name_ );
    kprintf ( "Scheduler::yield: WARNING Interrupts disabled, do you really want to yield ?\n" );
  }
  ArchThreads::yield();
}
Exemplo n.º 9
0
void Lock::printHoldingList(Thread* thread)
{
  debug(LOCK, "Locks held by thread %s (%p):",
        thread->getName(), thread);
  for(Lock* lock = thread->holding_lock_list_; lock != 0; lock = lock->next_lock_on_holding_list_)
  {
    kprintfd(" %s (%p)%s", lock->name_, lock, lock->next_lock_on_holding_list_ ? "," : ".\n");
  }
}
Exemplo n.º 10
0
void ArchMemory::insertPT(PageDirEntry* page_directory, uint32 pde_vpn, uint32 physical_page_table_page)
{
  kprintfd("insertPT: page_directory %p pde_vpn %x physical_page_table_page %x\n",page_directory,pde_vpn,physical_page_table_page);
  memset((void*)getIdentAddressOfPPN(physical_page_table_page), 0, PAGE_SIZE);
  memset((void*)(page_directory + pde_vpn), 0, sizeof(PageDirPointerTableEntry));
  page_directory[pde_vpn].pt.writeable = 1;
  page_directory[pde_vpn].pt.size = 0;
  page_directory[pde_vpn].pt.page_table_ppn = physical_page_table_page;
  page_directory[pde_vpn].pt.user_access = 1;
  page_directory[pde_vpn].pt.present = 1;
}
Exemplo n.º 11
0
void KeyboardManager::kb_wait()
{
  uint32 i;

  for (i = 0; i < 0x10000; i++)
  {
    uint8 stat = inportb(0x64);
    if ((stat & 0x02) == 0)
      break;
  }
  if (i >= 0x10000)
    kprintfd("KeyboardManager::kb_wait: waiting on 0x02 didn't speed up things :-(\n");
}
Exemplo n.º 12
0
void ArchThreads::printThreadRegisters(Thread *thread, uint32 userspace_registers, bool verbose)
{
  ArchThreadRegisters *info = userspace_registers?thread->user_registers_:thread->kernel_registers_;
  if (!info)
  {
    kprintfd("\t%sThread %10p has no %sThread registers. %s\n",
             userspace_registers?"Kernel":"  User",thread,userspace_registers?"User":"******",userspace_registers?"":"This should never(!) occur. How did you do that?");
  }
  else if (verbose)
  {
    kprintfd("\t\t%sThread: %10p, info: %10p\n"\
             "\t\t\t eax: %10x  ebx: %10x  ecx: %10x  edx: %10x\n"\
             "\t\t\t esp: %10x  ebp: %10x  esp0 %10x  eip: %10x\n"\
             "\t\t\teflg: %10x  cr3: %10x\n",
             userspace_registers?"  User":"******",thread,info,info->eax,info->ebx,info->ecx,info->edx,info->esp,info->ebp,info->esp0,info->eip,info->eflags,info->cr3);
  }
  else
  {
    kprintfd("\t%sThread %10p: info %10p eax %10x ebp %10x esp %10x esp0 %10x eip %10x cr3 %10x\n",
             userspace_registers?"  User":"******",thread,info,info->eax,info->ebp,info->esp,info->esp0,info->eip,info->cr3);
  }
}
Exemplo n.º 13
0
 void checkKMMDeadlock()
 {
   if (unlikely (ArchInterrupts::testIFSet() == false || Scheduler::instance()->isSchedulingEnabled() == false))
   {
     if (unlikely (KernelMemoryManager::instance()->KMMLockHeldBy() != 0))
     {
       boot_completed = 0;
       kprintfd("(ERROR) checkKMMDeadlock: Using a not resize-safe ustl container method with IF=%d and SchedulingEnabled=%d ! This will fail!!!\n",
                ArchInterrupts::testIFSet(), Scheduler::instance()->isSchedulingEnabled());
       currentThread->printBacktrace(true);
       prenew_assert(false);
     }
   }
 }
Exemplo n.º 14
0
void KeyboardManager::kb_wait()
{
  //basically implemented like x86, but with wait for TX data reg empty flag
  //this function waits for the command buffer to be empty...
  uint32 i;

  for (i = 0; i < 0x10000; i++)
  {
    uint8 stat = kmi->stat;
    if ((stat & (1<<6)))
      break;
  }
  if (i >= 0x10000)
    kprintfd("KeyboardManager::kb_wait: waiting on TX data reg empty did not work :-( kmi->stat=%zx\n", kmi->stat);
}
Exemplo n.º 15
0
extern "C" void dummyHandler()
{
  uint32 saved_switch_to_userspace = currentThread->switch_to_userspace_;
  currentThread->switch_to_userspace_ = 0;
  currentThreadRegisters = currentThread->kernel_registers_;
  ArchInterrupts::enableInterrupts();
  kprintfd("DUMMY_HANDLER: Spurious INT\n");
  ArchInterrupts::disableInterrupts();
  currentThread->switch_to_userspace_ = saved_switch_to_userspace;
  if (currentThread->switch_to_userspace_)
  {
    currentThreadRegisters = currentThread->user_registers_;
    arch_contextSwitch();
  }
}
Exemplo n.º 16
0
void testReadWriteInode()
{
  FileSystemInfo *fs_info = currentThread->getFSInfo();
  Dentry *dentry = fs_info->getRoot();
  Inode *inode = dentry->getInode();
  Superblock *sb = inode->getSuperblock();

  Inode *test_inode = ( Inode* ) ( new RamFSInode ( sb, I_FILE ) );
  test_inode->writeData ( 0, 13, "do write data" );

  char test_array[20];
  test_inode->readData ( 0, 13, test_array );
  test_array[13] = '\0';

  kprintfd ( "test_array = %s\n", test_array );
}
Exemplo n.º 17
0
extern "C" void irqHandler_65()
{
  uint32 ret = Scheduler::instance()->schedule();
  switch (ret)
  {
    case 0:
      // kprintfd("irq65: Going to leave int Handler 65 to kernel\n");
      arch_switchThreadKernelToKernelPageDirChange();
    case 1:
      // kprintfd("irq65: Going to leave int Handler 65 to user\n");
      arch_switchThreadToUserPageDirChange();

    default:
      kprintfd("irq65: Panic in int 65 handler\n");
      for( ; ; ) ;
  }
}
Exemplo n.º 18
0
extern "C" void irqHandler_0()
{
  static uint32 heart_beat_value = 0;
  // static uint32 leds = 0;
  // static uint32 ctr = 0;
  char* fb = (char*)0xC00B8000;
  switch (heart_beat_value)
  {
    default:
    case 0:
    fb[0] = '/';
    fb[1] = 0x9f;
    break;
    case 1:
    fb[0] = '-';
    fb[1] = 0x9f;
    break;
    case 2:
    fb[0] = '\\';
    fb[1] = 0x9f;
    break;
    case 3:
    fb[0] = '|';
    fb[1] = 0x9f;
    break;
  }
  heart_beat_value = (heart_beat_value + 1) % 4;

  Scheduler::instance()->incTicks();

  uint32 ret = Scheduler::instance()->schedule();
  switch (ret)
  {
    case 0:
      // kprintfd("irq0: Going to leave irq Handler 0 to kernel\n");
      ArchInterrupts::EndOfInterrupt(0);
      arch_switchThreadKernelToKernelPageDirChange();
    case 1:
      // kprintfd("irq0: Going to leave irq Handler 0 to user\n");
      ArchInterrupts::EndOfInterrupt(0);
      arch_switchThreadToUserPageDirChange();
    default:
      kprintfd("irq0: Panic in int 0 handler\n");
      for( ; ; ) ;
  }
}
Exemplo n.º 19
0
Inode* DeviceFSSuperBlock::createInode(Dentry* dentry, uint32 type)
{
  Inode *inode = (Inode*) (new RamFSInode(this, type));
  assert(inode);
  if (type == I_DIR)
  {
    //kprintfd ( "createInode: I_DIR\n" );
    int32 inode_init = inode->mknod(dentry);
    assert(inode_init == 0);
  }
  else if (type == I_FILE)
  {
    kprintfd("createInode: I_FILE\n");
    int32 inode_init = inode->mkfile(dentry);
    assert(inode_init == 0);
  }

  all_inodes_.push_back(inode);
  return inode;
}
Exemplo n.º 20
0
void Bitmap::bmprint(uint8* b, size_t n, size_t num_bits_set)
{
  kprintfd("\n---------------------Bitmap: size=%zd, num_bits_set=%zd---------------------\n"
      "       0x0      0x8      0x10     0x18     0x20     0x28     0x30     0x38\n", n, num_bits_set);
  for (size_t i = 0; i < n; i++)
  {
    if (i % 64 == 0)
      kprintfd("%05zx| ",i);
    kprintfd("%d", getBit(b, i));
    if (i % 8 == 7)
      kprintfd(" ");
    if (i % 64 == 63)
      kprintfd("\n");
  }
  kprintfd("\n----------------------------------Bitmap:end----------------------------------\n");
}
Exemplo n.º 21
0
//----------------------------------------------------------------------
void testFinal()
{
  kprintfd ( "\n> mkdir dev\n" );
  vfs_syscall.mkdir ( "dev",0 );

  kprintfd ( "\n> open ../dev/hda0.txt\n" );
  int32 hda0_fd = vfs_syscall.open ( "../dev/hda0.txt", 2 );

  kprintfd ( "\n> write hallo world! to hda0.txt" );
  vfs_syscall.write ( hda0_fd, "hallo world!", 12 );

  kprintfd ( "\n> rmdir dev\n" );
  vfs_syscall.rmdir ( "dev" );

  kprintfd ( "\n> mkdir boot\n" );
  vfs_syscall.mkdir ( "/../../dev/../../boot", 0 );

  kprintfd ( "\n> mkdir usr\n" );
  vfs_syscall.mkdir ( "usr", 0 );

  kprintfd ( "\n> rmdir /dev/hda0.txt\n" );
  vfs_syscall.rmdir ( "/dev/hda0.txt" );

  kprintfd ( "\n> rm /dev/hda0.txt\n" );
  vfs_syscall.rm ( "dev/hda0.txt" );

  kprintfd ( "\n> write hallo world! to hda0.txt" );
  char cbuffer[20];
  int32 size = vfs_syscall.read ( hda0_fd, cbuffer, 12 );
  cbuffer[size] = '\0';
  kprintfd ( "cbuffer = %s\n", cbuffer );

  kprintfd ( "\n> close /dev/hda0.txt\n" );
  vfs_syscall.close ( hda0_fd );

  kprintfd ( "\n> rmdir /dev/hda0.txt\n" );
  vfs_syscall.rmdir ( "/dev/hda0.txt" );

  kprintfd ( "\n> rm /dev/hda0.txt\n" );
  vfs_syscall.rm ( "dev/hda0.txt" );

  kprintfd ( "\n> rm /dev\n" );
  vfs_syscall.rm ( "/dev" );

}
Exemplo n.º 22
0
void ArchBoardSpecific::uart0_irq_handler()
{
  kprintfd("arch_uart0_irq_handler\n");
  while(1);
}
Exemplo n.º 23
0
Arquivo: main.cpp Projeto: IAIK/sweb
extern "C" void startup()
{
#ifdef DEBUG
  //software breakpoint for debugging
  writeLine2Bochs("Wait for GDB!\n");
  bool cont = false;
  while(!cont);
#endif

  writeLine2Bochs("Removing Boot Time Ident Mapping...\n");
  removeBootTimeIdentMapping();
  system_state = BOOTING;

  PageManager::instance();
  writeLine2Bochs("PageManager and KernelMemoryManager created \n");

  main_console = ArchCommon::createConsole(1);
  writeLine2Bochs("Console created \n");

  Terminal *term_0 = main_console->getTerminal(0); // add more if you need more...
  term_0->initTerminalColors(Console::GREEN, Console::BLACK);
  kprintfd("Init debug printf\n");
  term_0->writeString("This is on term 0, you should see me now\n");

  main_console->setActiveTerminal(0);

  kprintf("Kernel end address is %p\n", &kernel_end_address);

  Scheduler::instance();

  //needs to be done after scheduler and terminal, but prior to enableInterrupts
  kprintf_init();

  debug(MAIN, "Threads init\n");
  ArchThreads::initialise();
  debug(MAIN, "Interupts init\n");
  ArchInterrupts::initialise();

  ArchInterrupts::setTimerFrequency(IRQ0_TIMER_FREQUENCY);

  ArchCommon::initDebug();

  vfs.initialize();
  debug(MAIN, "Mounting DeviceFS under /dev/\n");
  DeviceFSType *devfs = new DeviceFSType();
  vfs.registerFileSystem(devfs);
  default_working_dir = vfs.root_mount("devicefs", 0);

  debug(MAIN, "Block Device creation\n");
  BDManager::getInstance()->doDeviceDetection();
  debug(MAIN, "Block Device done\n");

  for (BDVirtualDevice* bdvd : BDManager::getInstance()->device_list_)
  {
    debug(MAIN, "Detected Device: %s :: %d\n", bdvd->getName(), bdvd->getDeviceNumber());
  }

  // initialise global and static objects
  extern ustl::list<FileDescriptor*> global_fd;
  new (&global_fd) ustl::list<FileDescriptor*>();
  extern Mutex global_fd_lock;
  new (&global_fd_lock) Mutex("global_fd_lock");

  debug(MAIN, "make a deep copy of FsWorkingDir\n");
  main_console->setWorkingDirInfo(new FileSystemInfo(*default_working_dir));
  debug(MAIN, "main_console->setWorkingDirInfo done\n");

  ustl::coutclass::init();
  debug(MAIN, "default_working_dir root name: %s\t pwd name: %s\n", default_working_dir->getRoot()->getName(),
        default_working_dir->getPwd()->getName());
  if (main_console->getWorkingDirInfo())
  {
    delete main_console->getWorkingDirInfo();
  }
  main_console->setWorkingDirInfo(default_working_dir);

  debug(MAIN, "Timer enable\n");
  ArchInterrupts::enableTimer();

  KeyboardManager::instance();
  ArchInterrupts::enableKBD();

  debug(MAIN, "Adding Kernel threads\n");
  Scheduler::instance()->addNewThread(main_console);
  Scheduler::instance()->addNewThread(new ProcessRegistry(new FileSystemInfo(*default_working_dir), user_progs /*see user_progs.h*/));
  Scheduler::instance()->printThreadList();

  kprintf("Now enabling Interrupts...\n");
  system_state = RUNNING;

  ArchInterrupts::enableInterrupts();

  Scheduler::instance()->yield();
  //not reached
  assert(false);
}
Exemplo n.º 24
0
extern "C" void irqHandler_11()
{
  kprintfd("IRQ 11 called\n");
  BDManager::getInstance()->serviceIRQ(11);
  ArchInterrupts::EndOfInterrupt(11);
}
Exemplo n.º 25
0
extern "C" void irqHandler_6()
{
  kprintfd("IRQ 6 called\n");
  kprintfd("IRQ 6 ended\n");
}
Exemplo n.º 26
0
//----------------------------------------------------------------------
void testSyscallChdir()
{
  kprintfd ( "!!!!! begin syscall chdir(/chen)\n" );
  vfs_syscall.chdir ( "/chen" );
  vfs_syscall.readdir ( "." );
  kprintfd ( "!!!!! end syscall chdir(/chen)\n" );

  kprintfd ( "!!!!! begin syscall chdir(chen)\n" );
  vfs_syscall.chdir ( "chen" );
  vfs_syscall.readdir ( "." );
  kprintfd ( "!!!!! end syscall chdir(chen)\n" );

  kprintfd ( "!!!!! begin syscall chdir(../../../chen/../chen/./chen)\n" );
  vfs_syscall.chdir ( "../../../chen/../chen/./chen" );
  vfs_syscall.readdir ( "." );
  kprintfd ( "!!!!! end syscall chdir(../../../chen/../chen/./chen)\n" );

  kprintfd ( "!!!!! begin syscall chdir(./chen/chen/chen)\n" );
  vfs_syscall.chdir ( "./chen/chen/chen" );
  vfs_syscall.readdir ( "." );
  kprintfd ( "!!!!! end syscall chdir(./chen/chen/chen)\n" );

  kprintfd ( "!!!!! begin syscall chdir(./chen/chen/./chen)\n" );
  vfs_syscall.chdir ( "./chen/chen/chen/./chen" );
  vfs_syscall.readdir ( "." );
  kprintfd ( "!!!!! end syscall chdir(./chen/chen/./chen)\n" );

  kprintfd ( "!!!!! begin syscall chdir(./chen/chen/chen/chen/chen)\n" );
  vfs_syscall.chdir ( "./chen/chen/chen/chen/chen" );
  vfs_syscall.readdir ( "." );
  kprintfd ( "!!!!! end syscall chdir(./chen/chen/chen/chen/chen)\n" );

  kprintfd ( "!!!!! begin syscall chdir(/chen/chen/qiang)\n" );
  vfs_syscall.chdir ( "/chen/chen/qiang" );
  vfs_syscall.readdir ( "." );
  kprintfd ( "!!!!! end syscall chdir(/chen/chen/qiang)\n" );
}
Exemplo n.º 27
0
//----------------------------------------------------------------------
void testSyscallRmdir()
{
  kprintfd ( "***** begin syscall rmdir(chen)\n" );
  vfs_syscall.rmdir ( "chen" );
  kprintfd ( "***** end syscall rmdir(chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen)\n" );
  vfs_syscall.rmdir ( "/chen/qiang" );
  kprintfd ( "***** end syscall rmdir(chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen)\n" );
  vfs_syscall.rmdir ( "/chen/2006" );
  kprintfd ( "***** end syscall rmdir(chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen)\n" );
  vfs_syscall.rmdir ( "/chen/2005" );
  kprintfd ( "***** end syscall rmdir(chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen)\n" );
  vfs_syscall.rmdir ( "/chen/2007" );
  kprintfd ( "***** end syscall rmdir(chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen/chen)\n" );
  vfs_syscall.rmdir ( "chen/chen" );
  kprintfd ( "***** end syscall rmdir(chen/chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen/chen)\n" );
  vfs_syscall.rmdir ( "chen/chen/chen" );
  kprintfd ( "***** end syscall rmdir(chen/chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen/chen)\n" );
  vfs_syscall.rmdir ( "./.././chen/chen/chen/chen" );
  kprintfd ( "***** end syscall rmdir(chen/chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen/chen)\n" );
  vfs_syscall.rmdir ( "chen/chen/.././chen/chen/chen/.././chen/chen" );
  kprintfd ( "***** end syscall rmdir(chen/chen)\n" );

  kprintfd ( "***** begin syscall rmdir(chen/chen)\n" );
  vfs_syscall.rmdir ( "chen/chen/chen/chen/chen" );
  kprintfd ( "***** end syscall rmdir(chen/chen)\n" );
}
Exemplo n.º 28
0
//----------------------------------------------------------------------
void testPathWalker()
{
  kprintfd ( "***** start of mdkir(/chen)\n" );
  vfs_syscall.mkdir ( "/chen", 0 );
  kprintfd ( "***** end of mkdir(/chen)\n" );

  kprintfd ( "***** start of mkdir(test)\n" );
  vfs_syscall.mkdir ( "test", 0 );
  kprintfd ( "***** end of mkdir(test)\n" );

  kprintfd ( "***** start of chdir(chen)\n" );
  vfs_syscall.chdir ( "chen" );
  kprintfd ( "***** end of chdir(chen)\n" );

  kprintfd ( "***** start of mkdir(./hugo)\n" );
  vfs_syscall.mkdir ( "./hugo", 0 );
  kprintfd ( "***** end of mkdir(./hugo)\n" );

  kprintfd ( "***** start of mkdir(test)\n" );
  vfs_syscall.mkdir ( "./../chen/.././SSS", 0 );
  kprintfd ( "***** end of mkdir(test)\n" );

  kprintfd ( "***** start of mkdir(../hugo)\n" );
  vfs_syscall.mkdir ( "../hugo", 0 );
  kprintfd ( "***** end of mkdir(../hugo)\n" );


  kprintfd ( "***** start of readdir(/)\n" );
  vfs_syscall.readdir ( "/" );
  kprintfd ( "***** end of readdir(/)\n" );

  kprintfd ( "***** start of readdir(/)\n" );
  vfs_syscall.readdir ( "/chen" );
  kprintfd ( "***** end of readdir(/)\n" );
}
Exemplo n.º 29
0
//----------------------------------------------------------------------
void testVfsSyscall()
{
  kprintfd ( "***** start of mdkir(/chen)\n" );
  vfs_syscall.mkdir ( "/chen", 0 );
  kprintfd ( "***** end of mkdir(/chen)\n" );

  kprintfd ( "***** start of mkdir(/chen/qiang)\n" );
  vfs_syscall.mkdir ( "/chen/qiang", 0 );
  kprintfd ( "***** end of mkdir(/chen/qiang)\n" );

  kprintfd ( "***** start of mkdir(/chen/qiang/always)\n" );
  vfs_syscall.mkdir ( "/chen/qiang/always", 0 );
  kprintfd ( "***** end of mkdir(/chen/qiang/always)\n" );

  kprintfd ( "***** start of mkdir(/chen/2005)\n" );
  vfs_syscall.mkdir ( "/chen/2005", 0 );
  kprintfd ( "***** end of mkdir(/chen/2005)\n" );

  kprintfd ( "***** start of readdir(/chen)\n" );
  vfs_syscall.readdir ( "/chen/" );
  kprintfd ( "***** end of readdir(/chen)\n" );

  kprintfd ( "***** start of chdir(/chen/qiang)\n" );
  vfs_syscall.chdir ( "/chen/qiang/" );
  kprintfd ( "***** end of chdir(/chen/qiang)\n" );

  kprintfd ( "***** start of mkdir(/chen/qiang/always/dead)\n" );
  vfs_syscall.mkdir ( "/chen/qiang/always/dead", 0 );
  kprintfd ( "***** end of mkdir(/chen/qiang/always/dead)\n" );

  kprintfd ( "***** start of rmdir(/chen/qiang/always/dead)\n" );
  vfs_syscall.rmdir ( "/chen/qiang/always/dead" );
  kprintfd ( "***** end of rmdir(/chen/qiang/always/dead)\n" );
}
Exemplo n.º 30
0
//----------------------------------------------------------------------
void testFile()
{
  kprintfd ( "\n> open test01.txt\n" );
  int32 test01_fd = vfs_syscall.open ( "test01.txt", 0 );

  kprintfd ( "\n> open test02.hugo\n" );
  int32 test02_fd = vfs_syscall.open ( "test02.hugo", 2 );

  kprintfd ( "\n> close test01.txt\n" );
  vfs_syscall.close ( test01_fd );

  kprintfd ( "\n> write hallo world! to test02.hugo\n" );
  vfs_syscall.write ( test02_fd, "hallo world!", 12 );

  kprintfd ( "\n> read 12 byte from the test02.hugo\n" );
  char test_array[20];
  int32 size = vfs_syscall.read ( test02_fd, test_array, 12 );
  test_array[size] = '\0';
  kprintfd ( "size = %d\n", size );
  kprintfd ( "after read-syscall test_array = %s\n", test_array );

  kprintfd ( "\n> close test02.hugo\n" );
  vfs_syscall.close ( test02_fd );

  kprintfd ( "\n> open test02.hugo READ_ONLY\n" );
  test02_fd = vfs_syscall.open ( "test02.hugo", 0 );

  kprintfd ( "\n> open test02.hugo\n" );
  vfs_syscall.open ( "test02.hugo", 0 );

  kprintfd ( "\n> open test02.hugo\n" );
  vfs_syscall.open ( "test02.hugo", 0 );

  kprintfd ( "\n> open test02.hugo\n" );
  vfs_syscall.open ( "test02.hugo", 0 );

  kprintfd ( "\n> read 12 byte from the test02.hugo\n" );
  char test2_array[20];
  int32 size2 = vfs_syscall.read ( test02_fd, test2_array, 12 );
  test2_array[size2] = '\0';
  kprintfd ( "size = %d\n", size2 );
  kprintfd ( "after read-syscall test2_array = %s\n", test2_array );
}