Exemple #1
0
/* Initialize APIC by probing */
struct APICData *core_APIC_Probe(void)
{
    struct APICData *data;
    APTR ssp;

#ifdef __i386__
    /* Only i386 needs detection. On x86-64 APIC is always present. */
    ULONG arg = 1;
    ULONG res;

    asm volatile("cpuid":"+a"(arg),"=d"(res)::"%ebx", "%ecx");
    
    if (!(res & (1 << 9)))
    	return NULL;

    D(bug("[APIC] Detected by CPUID instruction\n"));
#endif

    /* Assuming uniprocessor IBM PC compatible */
    data = AllocMem(sizeof(struct APICData) + sizeof(struct CPUData), MEMF_CLEAR);
    if (!data)
	return NULL;

    D(bug("[APIC] APIC Data @ 0x%p\n", data));

    if ((ssp = SuperState()) != NULL)
    {
        data->lapicBase	   = core_APIC_GetBase();
        
        D(bug("[APIC] APIC Base = 0x%p\n", data->lapicBase));

        data->apic_count		   = 1;
        data->flags		   = APF_8259;
        data->cores[0].cpu_LocalID = core_APIC_GetID(data->lapicBase);

        UserState(ssp);

        D(bug("[APIC] ID #%d\n", data->cores[0].cpu_LocalID));

        data->cores[0].cpu_GDT = __KernBootPrivate->BOOTGDT;
        data->cores[0].cpu_TLS = __KernBootPrivate->BOOTTLS;
        data->cores[0].cpu_IDT = __KernBootPrivate->BOOTIDT;
        data->cores[0].cpu_MMU = &__KernBootPrivate->MMU;

        /* Just initialize to default state */
        core_APIC_Init(data, 0);
    }
    else
    {
        FreeMem(data, sizeof(struct APICData) + sizeof(struct CPUData));
        data = NULL;
    }
    return data;
}
Exemple #2
0
static void PrintUserInfo(char **info)
{
  char name[BUFSIZ], buf[BUFSIZ], sponsor[BUFSIZ];
  int status;

  sprintf(name, "%s, %s %s", info[U_LAST], info[U_FIRST], info[U_MIDDLE]);
  sprintf(buf, "Login name: %-20s Full name: %s", info[U_NAME], name);
  Put_message(buf);
  sprintf(buf, "Account is %-20s", UserState(atoi(info[U_STATE])));
  Put_message(buf);
  sprintf(buf, "User id: %-23s MIT ID number: %s",
	  info[U_UID], info[U_MITID]);
  Put_message(buf);
  sprintf(buf, "Class: %-25s Affiliation: %s (%s)",
	  info[U_CLASS], info[U_AFF_DETAILED], info[U_AFF_BASIC]);
  Put_message(buf);
  sprintf(sponsor, "%s %s", info[U_SPONSOR_TYPE], info[U_SPONSOR_NAME]);
  sprintf(buf, "Sponsor: %-23s Expiration date: %s", sponsor,  info[U_EXPIRATION]);
  Put_message(buf);
  sprintf(buf, "Alternate Email: %s", info[U_ALT_EMAIL]);
  Put_message(buf);
  sprintf(buf, "Alternate Phone: %s", info[U_ALT_PHONE]);
  Put_message(buf);
  sprintf(buf, "Login shell: %-19s Windows Console shell: %s", info[U_SHELL],
         info[U_WINCONSOLESHELL]);
  Put_message(buf);
  sprintf(buf, "Windows Home Directory: %-08s Windows Profile Directory: %s",
         info[U_WINHOMEDIR], info[U_WINPROFILEDIR]);
  Put_message(buf);
  status = atoi(info[U_STATE]);
  if (status == 0 || status == 2)
    {
      sprintf(buf, "User %s secure Account Coupon to register",
	      atoi(info[U_SECURE]) ? "needs" : "does not need");
      Put_message(buf);
    }
  sprintf(buf, "Comments: %s", info[U_COMMENT]);
  Put_message(buf);
  sprintf(buf, "Created  by %s on %s.", info[U_CREATOR], info[U_CREATED]);
  Put_message(buf);
  sprintf(buf, MOD_FORMAT, info[U_MODBY], info[U_MODTIME], info[U_MODWITH]);
  Put_message(buf);
}