コード例 #1
0
ファイル: main.c プロジェクト: stupidhurts/nldd
void kernel_main()
{
    init_process();
    init_dispatcher();
    init_ipc();
    init_interrupts();
    init_null_process();
    init_timer();
    init_com();
    init_keyb();
	init_ne2k();
    init_shell();

    while (1);
}
コード例 #2
0
ファイル: main.c プロジェクト: apuder/tos-sfsu-fall2012
void kernel_main() {
    init_process();
    init_dispatcher();
    init_ipc();
    init_interrupts();
    init_null_process();
    init_timer();
#if VGA_MODE_ENABLED
    init_vga_mode();
#endif
    init_com();
    init_keyb();
    clear_kernel_window();
    init_ne_driver();
    init_em();
    init_shell();
    while (1);
}
コード例 #3
0
static int __init
lasi_ps2_register(struct parisc_device *dev)
{
	unsigned long hpa = dev->hpa;
	char *name;
	int device_found = 0;
	u8 id;

	id = gsc_readb(hpa+LASI_ID) & 0x0f;

	switch (id) {
	case 0:
		name = "keyboard";
		lasikbd_hpa = hpa;	/* save "hpa" for lasikbd_leds() */
		break;
	case 1:
		name = "psaux";
		break;
	default:
		printk(KERN_WARNING "%s: Unknown PS/2 port (id=%d) - ignored.\n",
			__FUNCTION__, id );
		return 0;
	}
	
	/* reset the PS/2 port */
	lasi_ps2_reset(hpa);

	switch (id) {
	case 0:	
	        device_found = init_keyb(hpa);
		if (device_found) register_kbd_ops(&gsc_ps2_kbd_ops);
		break;
	case 1:
#ifdef CONFIG_PSMOUSE
		queue = (struct aux_queue *) kmalloc(sizeof(*queue), GFP_KERNEL);
		if (!queue)
			return -ENOMEM;

		memset(queue, 0, sizeof(*queue));
		queue->head = queue->tail = 0;
		init_waitqueue_head(&queue->proc_list);
		
		misc_register(&psaux_mouse);

		aux_write_ack(AUX_ENABLE_DEV);
		/* try it a second time, this will give status if the device is
		 * available */
		device_found = aux_write_ack(AUX_ENABLE_DEV);
		break;
#else
		/* return without printing any unnecessary and misleading info */
		return 0;	
#endif
	} /* of case */
	
	if (device_found) {
	/* Here we claim only if we have a device attached */   
		/* allocate the irq and memory region for that device */
		if (!dev->irq)
	 	return -ENODEV;
	   
	  	if (request_irq(dev->irq, lasikbd_interrupt, 0, name, (void *)hpa))
	  	return -ENODEV;
	   
	  	if (!request_mem_region(hpa, LASI_STATUS + 4, name))
	  	return -ENODEV;
	}
	
	printk(KERN_INFO "PS/2 %s port at 0x%08lx (irq %d) found, "
			 "%sdevice attached.\n",
			name, hpa, dev->irq, device_found ? "":"no ");

	return 0;
}
コード例 #4
0
ファイル: clib.c プロジェクト: 8l/bcpl
int main(int argc, char *argv[])
{ int i = stackupb;      /* for FOR loops  */
  BCPLWORD res;

  //printf("main: entered\n");

  for(i=0; i<=Rtn_upb; i++) rootnode[i] = 0;

  if ( badimplementation() )
  { printf("This implementation of C is not suitable\n");
    return 20;
  }

  /* Try to reconstruct the command line arguments from argv */
  parms = (char *)(MALLOC(256));

  { int p=0;
    parms[0] = 0;

    for (i=1; i<argc; i++) {
      char *arg = argv[i];
      int len = strlen(arg);
      int j;
      int is_string = 0; /* =1 if arg contains ", space, or newline.white space */
      /*printf("clib: getting command line, len=%d\n", len); */
      for (j=0; j<len; j++)
        if( arg[j]=='"' || arg[j]==' ' || arg[j]=='\n') is_string = 1;
      /*printf("clib: getting command line, is_string=%d\n", is_string); */
      parms[++p] = ' ';
      if(is_string)
      { parms[++p] = '"';
        for (j=0; j<len; j++)
        { int ch = arg[j];
          if(ch=='\n') { parms[p++] = '*'; parms[++p] = 'n'; }
          if(ch=='"')  { parms[p++] = '*'; parms[++p] = '"'; }
	  else parms[++p] = ch;
        }
        parms[++p] = '"';
      } else {
        for (j=0; j<len; j++) parms[++p] = arg[j];
      }
    }
    parms[++p] = '\n';  /* Put a newline at the end of the argument string */
    parms[0] = p; /* Fill in the BCPL string length */
    parmp = 1;    /* Subscript of the first character of the */
                  /* command-line argument */

    /*printf("clib: args: len=%d\n", parms[0]); */
    /*for(i=1; i<=parms[0];i++) printf("parm[%d]=%d\n", i, parms[i]); */
    /*printf("\n"); */
  }

  /*  parms = (BCPLWORD *)(MALLOC(argc+1)); */
  /*parms[0] = argc > 1 ? argc : 0; */
  /*for (i = 0; i < argc; i++) { */
  /*  BCPLWORD v = (BCPLWORD)(MALLOC(1+strlen(argv[i]) >> B2Wsh)) >> B2Wsh; */
  /*  c2b_str(argv[i], v); */
  /*  parms[1+i] = v; */
  /*} */

  old_handler = signal(SIGINT, handler);
  initfpvec();

  // Allocate space for the environment variable names
  // and file prefix string.
  rootvarstr    = ((BCPLWORD)malloc(5*16*4))>>B2Wsh;
  pathvarstr    = rootvarstr+1*16;
  hdrsvarstr    = rootvarstr+2*16;
  scriptsvarstr = rootvarstr+3*16;
  prefixstr     = rootvarstr+4*16;
  prefixbp      = (char *)(prefixstr<<B2Wsh);
  for(i=0; i<=5*16; i++) ((BCPLWORD*)(rootvarstr<<B2Wsh))[i] = 0;
  //printf("rootnode[Rtn_hdrsvar]=%d\n", rootnode[Rtn_hdrsvar]);

  c2b_str(rootvar, rootvarstr);
  c2b_str(pathvar, pathvarstr);
  c2b_str(hdrsvar, hdrsvarstr);
  c2b_str(scriptsvar, scriptsvarstr);

  rootnode[Rtn_rootvar]      = rootvarstr;
  rootnode[Rtn_pathvar]      = pathvarstr;
  rootnode[Rtn_hdrsvar]      = hdrsvarstr;
  rootnode[Rtn_scriptsvar]   = scriptsvarstr;

  //printf("rootnode=%d\n", (BCPLWORD)rootnode/4);
  //printf("rootnode[Rtn_hdrsvar]=%d\n", rootnode[Rtn_hdrsvar]);
  if(filetracing) {
    char *path = getenv(rootvar);
    PRINTFS("Environment variable %s", rootvar);
    PRINTFS(" = %s\n", path);
    path = getenv(pathvar);
    PRINTFS("Environment variable %s", pathvar);
    PRINTFS(" = %s\n", path);
    path = getenv(hdrsvar);
    PRINTFS("Environment variable %s", hdrsvar);
    PRINTFS(" = %s\n", path);
    path = getenv(scriptsvar);
    PRINTFS("Environment variable %s", scriptsvar);
    PRINTFS(" = %s\n", path);
  }

  stackbase = (BCPLWORD *)(calloc((stackupb+1), 1<<B2Wsh));
  if(stackbase==0) 
    { printf("unable to allocate space for stackbase\n");
      exit(20);
    }

  globbase  = (BCPLWORD *)(calloc((gvecupb+1), 1<<B2Wsh));
  if(globbase==0) 
    { printf("unable to allocate space for globbase\n");
      exit(20);
    }

  globbase[0] = gvecupb;

  for (i=1;i<=gvecupb;i++) globbase[i] = Globword + i;
  globbase[Gn_rootnode] = ((BCPLWORD)rootnode)>>B2Wsh;
  //printf("globbase[Gn_rootnode]=%d\n", globbase[Gn_rootnode]);

  for (i=0;i<=stackupb;i++) stackbase[i] = 0;

  //  printf("clib: gvecupb=%d stackupb=%d\n", gvecupb, stackupb);
  /* initsections, gvecupb and stackupb are defined in the file */
  /* (typically) initprog.c created by a call of the command makeinit. */

  //printf("Calling initsections\n");
  initsections(globbase);
  //printf("Calling init_keyb\n");
  ttyinp = init_keyb();

  //printf("globbase[Gn_rootnode]=%d\n", globbase[Gn_rootnode]);
  //printf("clib: calling callstart(%d, %d)\n",
  //	 (BCPLWORD)stackbase, (BCPLWORD)globbase);
  /* Enter BCPL start function: callstart is defined in mlib.s */
  res = callstart(stackbase, globbase);

  close_keyb();

  //for (i=0; i<20; i++) {
  //  if(i % 5 == 0) printf("\nG%3i:", i, globbase[i]);
  //  printf(" %08X", globbase[i]);
  //}
  printf("\n");
  if (res) printf("Execution finished, return code %ld\n", (long)res);

  free(globbase);
  free(stackbase);
  free(parms);

  return res;
}