Ejemplo n.º 1
0
  main(void)
{

  set_eflags();

  /* Define the kernel segment registers */
  set_seg_regs(__KERNEL_DS, __KERNEL_DS, INITIAL_ESP);

  printk("Kernel Loaded!    ");

  /* Initialize hardware data */
  setGdt(); /* Definicio de la taula de segments de memoria */
  setIdt(); /* Definicio del vector de interrupcions */
  setTSS(); /* Definicio de la TSS */

  /* Initialize Memory */
  init_mm();

/* Initialize an address space to be used for the monoprocess version of ZeOS */

  /* monoprocess_init_addr_space(); TO BE DELETED WHEN ADDED THE PROCESS MANAGEMENT CODE TO BECOME MULTIPROCESS */

  /* Initialize Scheduling */
  init_sched();

  /* Initialize idle task data */
  init_idle();

  /* Initialize task 1 data */
  init_task1();

  /* Initialize keyboard buffer */
  init_keyboard_buffer();

  /* Move user code/data now (after the page table initialization) */
  copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size);

  /* Adds this call in order to perform test suite provided by lab course */
  zeos_init_auxjp();

  printk("Entering user mode...");

  /*
   * zeos_ticks must be initialized after memory initialization and just before
   * enabling interrupts in order to measure the correct elapsed time
   */
  zeos_ticks = 0;

  enable_int();

  /*
   * We return from a 'theorical' call to a 'call gate' to reduce our privileges
   * and going to execute 'magically' at 'usr_main'...
   */
  return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START);

  /* The execution never arrives to this point */
  return 0;
}
Ejemplo n.º 2
0
main(void)
{
    
    set_eflags();
    
    /* Define the kernel segment registers  and a stack to execute the 'main' code */
    // It is necessary to use a global static array for the stack, because the
    // compiler will know its final memory location. Otherwise it will try to use the
    // 'ds' register to access the address... but we are not ready for that yet
    // (we are still in real mode).
    set_seg_regs(__KERNEL_DS, __KERNEL_DS, (DWord) &protected_tasks[5]);
    
    printk("Kernel Loaded!    ");
    
    /* Initialize hardware data */
    setGdt(); /* Definicio de la taula de segments de memoria */
    setIdt(); /* Definicio del vector de interrupcions */
    setTSS(); /* Definicio de la TSS */
    
    /* Initialize Memory */
    init_mm();
    
    /* Initialize an address space to be used for the monoprocess version of ZeOS */
    
    monoprocess_init_addr_space(); /* TO BE DELETED WHEN ADDED THE PROCESS MANAGEMENT CODE TO BECOME MULTIPROCESS */
    
    /* Initialize Scheduling */
    init_sched();
    
    /* Initialize idle task  data */
    init_idle();
    /* Initialize task 1 data */
    init_task1();

    /* Initialize semaphores */
    init_semaphores();
    
    /* Move user code/data now (after the page table initialization) */
    copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size);
    
    
    printk("Entering user mode...");
    
    enable_int();
    /*
     * We return from a 'theorical' call to a 'call gate' to reduce our privileges
     * and going to execute 'magically' at 'usr_main'...
     */
    return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START);
    
    /* The execution never arrives to this point */
    return 0;
}
Ejemplo n.º 3
0
Archivo: system.c Proyecto: Arau/ZeOS
  main(void) 
{

  set_eflags();

  /* Define the kernel segment registers */
  set_seg_regs(__KERNEL_DS, __KERNEL_DS, KERNEL_ESP);


  printk("Kernel Loaded!    "); 

  /* Initialize hardware data */
  setGdt(); /* Definicio de la taula de segments de memoria */
  setIdt(); /* Definicio del vector de interrupcions */
  setTSS(); /* Definicio de la TSS */

  /* Initialize Memory */
  init_mm();

/* Initialize an address space to be used for the monoprocess version of ZeOS */

//  monoprocess_init_addr_space(); /* TO BE DELETED WHEN ADDED THE PROCESS MANAGEMENT CODE TO BECOME MULTIPROCESS */

  /* Initialize Scheduling */
  init_sched();

  /* Initialize idle task  data */
  init_idle();
  /* Initialize task 1 data */
  init_task1();

  /* Move user code/data now (after the page table initialization) */
  copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size);


  
  printk("Entering user mode..."); 
  
  enable_int();
  /*
   * We return from a 'theorical' call to a 'call gate' to reduce our privileges
   * and going to execute 'magically' at 'usr_main'...
   */
  return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START);

  /* The execution never arrives to this point */
  return 0;
}
Ejemplo n.º 4
0
  main(void) 
{
  set_eflags();

  /* Define the kernel segment registers */
  set_seg_regs(__KERNEL_DS, __KERNEL_DS, KERNEL_ESP);


  printk("Kernel Loaded!    "); 

  /* Initialize hardware data */
  setGdt(); /* Definicio de la taula de segments de memoria */
  setIdt(); /* Definicio del vector de interrupcions */
  setTSS(); /* Definicio de la TSS */

  /* Initialize Memory */
  init_mm();

  /* Initialize task 0 data */
  //init_task0();

  init_sched();
 
  /* Move user code/data now (after the page table initialization) */
  copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size);

  enable_int();
  
  printk("Entering user mode..."); 

  /*
   * We return from a 'theorical' call to a 'call gate' to reduce our privileges
   * and going to execute 'magically' at 'usr_main'...
   */
  return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START);

  /* The execution never arrives to this point */
  return 0;
}