Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2002 18:58:07 -0700 (PDT)
From:      Jonathan Mini <mini@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 16781 for review
Message-ID:  <200208300158.g7U1w7fE020135@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16781

Change 16781 by mini@mini_stylus on 2002/08/29 18:57:55

	Fix a munged file from the previous integ (change 16780).

Affected files ...

.. //depot/projects/kse/sys/i386/i386/machdep.c#54 edit

Differences ...

==== //depot/projects/kse/sys/i386/i386/machdep.c#54 (text+ko) ====

@@ -125,134 +125,175 @@
 extern void earlysetcpuclass(void);	/* same header file */
 extern void finishidentcpu(void);
 extern void panicifcpuunsupported(void);
-rintf(sb, "%s<type>", indent);
-		sbuf_printf_uuid(sb, uuid);
-		sbuf_printf(sb, "</type>\n");
-	}
+extern void initializecpu(void);
+
+#define	CS_SECURE(cs)		(ISPL(cs) == SEL_UPL)
+#define	EFL_SECURE(ef, oef)	((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
+
+static void cpu_startup(void *);
+static void fpstate_drop(struct thread *td);
+static void get_fpcontext(struct thread *td, mcontext_t *mcp);
+static int  set_fpcontext(struct thread *td, const mcontext_t *mcp);
+#ifdef CPU_ENABLE_SSE
+static void set_fpregs_xmm(struct save87 *, struct savexmm *);
+static void fill_fpregs_xmm(struct savexmm *, struct save87 *);
+#endif /* CPU_ENABLE_SSE */
+SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL)
+
+int	_udatasel, _ucodesel;
+u_int	atdevbase;
+
+#if defined(SWTCH_OPTIM_STATS)
+extern int swtch_optim_stats;
+SYSCTL_INT(_debug, OID_AUTO, swtch_optim_stats,
+	CTLFLAG_RD, &swtch_optim_stats, 0, "");
+SYSCTL_INT(_debug, OID_AUTO, tlb_flush_count,
+	CTLFLAG_RD, &tlb_flush_count, 0, "");
+#endif
+
+int physmem = 0;
+int cold = 1;
+
+#ifdef COMPAT_43
+static void osendsig(sig_t catcher, int sig, sigset_t *mask, u_long code);
+#endif
+
+static int
+sysctl_hw_physmem(SYSCTL_HANDLER_ARGS)
+{
+	int error = sysctl_handle_int(oidp, 0, ctob(physmem), req);
+	return (error);
+}
+
+SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_INT|CTLFLAG_RD,
+	0, 0, sysctl_hw_physmem, "IU", "");
+
+static int
+sysctl_hw_usermem(SYSCTL_HANDLER_ARGS)
+{
+	int error = sysctl_handle_int(oidp, 0,
+		ctob(physmem - cnt.v_wire_count), req);
+	return (error);
 }
 
-static struct g_geom *
-g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist)
+SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_INT|CTLFLAG_RD,
+	0, 0, sysctl_hw_usermem, "IU", "");
+
+static int
+sysctl_hw_availpages(SYSCTL_HANDLER_ARGS)
 {
-	struct g_consumer *cp;
-	struct g_geom *gp;
-	struct g_gpt_softc *gs;
-	struct g_slicer *gsp;
-	u_char *buf, *mbr;
-	struct gpt_ent *ent;
-	struct gpt_hdr *hdr;
-	u_int i, npart, secsz, tblsz;
-	int error, ps;
+	int error = sysctl_handle_int(oidp, 0,
+		i386_btop(avail_end - avail_start), req);
+	return (error);
+}
 
-	g_trace(G_T_TOPOLOGY, "g_gpt_taste(%s,%s)", mp->name, pp->name);
-	g_topology_assert();
+SYSCTL_PROC(_hw, OID_AUTO, availpages, CTLTYPE_INT|CTLFLAG_RD,
+	0, 0, sysctl_hw_availpages, "I", "");
 
-	/*
-	 * XXX: I don't like to hardcode a maximum number of slices, since
-	 * it's wasting space most of the time and insufficient any time.
-	 * It's easier for now...
-	 */
-	gp = g_slice_new(mp, GPT_MAX_SLICES, pp, &cp, &gs, sizeof(*gs),
-	    g_gpt_start);
-	if (gp == NULL)
-		return (NULL);
+int Maxmem = 0;
 
-	gsp = gp->softc;
-	g_topology_unlock();
-	gp->dumpconf = g_gpt_dumpconf;
+vm_offset_t phys_avail[10];
 
-	npart = 0;
-	mbr = NULL;
+/* must be 2 less so 0 0 can signal end of chunks */
+#define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2)
 
-	if (gp->rank != 2 && insist == 0)
-		goto out;
+struct kva_md_info kmi;
 
-	error = g_getattr("GEOM::sectorsize", cp, &secsz);
-	if (error)
-		goto out;
+static struct trapframe proc0_tf;
+#ifndef SMP
+static struct pcpu __pcpu;
+#endif
 
-	/* XXX: we need to get the media size as well. */
+struct mtx icu_lock;
 
-	/* Read both the MBR sector and the GPT sector. */
-	mbr = g_read_data(cp, 0, 2 * secsz, &error);
-	if (mbr == NULL || error != 0)
-		goto out;
-#if 0
+static void
+cpu_startup(dummy)
+	void *dummy;
+{
 	/*
-	 * XXX: we should ignore the GPT if there's a MBR and the MBR is
-	 * not a PMBR (Protective MBR). I believe this is what the EFI
-	 * spec is going to say eventually (this is hearsay :-)
-	 * Currently EFI (version 1.02) accepts and uses the GPT even
-	 * though there's a valid MBR. We do this too, because it allows
-	 * us to test this code without first nuking the only partitioning
-	 * scheme we grok until this is working.
+	 * Good {morning,afternoon,evening,night}.
 	 */
-	if (!is_pmbr((void*)mbr))
-		goto out;
+	earlysetcpuclass();
+	startrtclock();
+	printcpuinfo();
+	panicifcpuunsupported();
+#ifdef PERFMON
+	perfmon_init();
 #endif
-
-	hdr = (void*)(mbr + secsz);
-
+	printf("real memory  = %u (%uK bytes)\n", ptoa(Maxmem),
+	    ptoa(Maxmem) / 1024);
 	/*
-	 * XXX: if we don't have a GPT header at LBA 1, we should check if
-	 * there's a backup GPT at the end of the medium. If we have a valid
-	 * backup GPT, we should restore the primary GPT and claim this lunch.
+	 * Display any holes after the first chunk of extended memory.
 	 */
-	if (!is_gpt_hdr(hdr))
-		goto out;
+	if (bootverbose) {
+		int indx;
 
-	tblsz = (hdr->hdr_entries * hdr->hdr_entsz + secsz - 1) & ~(secsz - 1);
-	buf = g_read_data(cp, hdr->hdr_lba_table * secsz, tblsz, &error);
+		printf("Physical memory chunk(s):\n");
+		for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
+			unsigned int size1;
 
-	gsp->frontstuff = hdr->hdr_lba_start * secsz;
-
-	for (i = 0; i < hdr->hdr_entries; i++) {
-		struct uuid unused = GPT_ENT_TYPE_UNUSED;
-		struct uuid freebsd = GPT_ENT_TYPE_FREEBSD;
-		if (i >= GPT_MAX_SLICES)
-			break;
-		ent = (void*)(buf + i * hdr->hdr_entsz);
-		if (!memcmp(&ent->ent_type, &unused, sizeof(unused)))
-			continue;
-		gs->part[i] = g_malloc(hdr->hdr_entsz, M_WAITOK);
-		if (gs->part[i] == NULL)
-			break;
-		bcopy(ent, gs->part[i], hdr->hdr_entsz);
-		ps = (!memcmp(&ent->ent_type, &freebsd, sizeof(freebsd)))
-		    ? 's' : 'p';
-		(void)g_slice_addslice(gp, i, ent->ent_lba_start * secsz,
-		    (ent->ent_lba_end - ent->ent_lba_start + 1ULL) * secsz,
-		    "%s%c%d", gp->name, ps, i + 1);
-		npart++;
+			size1 = phys_avail[indx + 1] - phys_avail[indx];
+			printf("0x%08x - 0x%08x, %u bytes (%u pages)\n",
+			    phys_avail[indx], phys_avail[indx + 1] - 1, size1,
+			    size1 / PAGE_SIZE);
+		}
 	}
 
-	g_free(buf);
+	vm_ksubmap_init(&kmi);
 
- out:
-	if (mbr != NULL)
-		g_free(mbr);
+	printf("avail memory = %u (%uK bytes)\n", ptoa(cnt.v_free_count),
+	    ptoa(cnt.v_free_count) / 1024);
 
-	g_topology_lock();
-	error = g_access_rel(cp, -1, 0, 0);
+	/*
+	 * Set up buffers, so they can be used to read disk labels.
+	 */
+	bufinit();
+	vm_pager_bufferinit();
 
-	if (npart > 0) {
-		LIST_FOREACH(pp, &gp->provider, provider)
-			g_error_provider(pp, 0);
-		return (gp);
-	}
-	g_std_spoiled(cp);
-	return (NULL);
+#ifndef SMP
+	/* For SMP, we delay the cpu_setregs() until after SMP startup. */
+	cpu_setregs();
+#endif
 }
 
-static struct g_class g_gpt_class = {
-	"GPT",
-	g_gpt_taste,
-	NULL,
-	G_CLASS_INITIALIZER
-};
+/*
+ * Send an interrupt to process.
+ *
+ * Stack is set up to allow sigcode stored
+ * at top to call routine, followed by kcall
+ * to sigreturn routine below.  After sigreturn
+ * resets the signal mask, the stack, and the
+ * frame pointer, it returns to the user
+ * specified pc, psl.
+ */
+#ifdef COMPAT_43
+static void
+osendsig(catcher, sig, mask, code)
+	sig_t catcher;
+	int sig;
+	sigset_t *mask;
+	u_long code;
+{
+	struct osigframe sf;
+	struct osigframe *fp;
+	struct proc *p;
+	struct thread *td;
+	struct sigacts *psp;
+	struct trapframe *regs;
+	int oonstack;
+
+	td = curthread;
+	p = td->td_proc;
+	PROC_LOCK_ASSERT(p, MA_OWNED);
+	psp = p->p_sigacts;
+	regs = td->td_frame;
+	oonstack = sigonstack(regs->tf_esp);
 
-DECLARE_GEOM_CLASS(g_gpt_class, g_gpt);
-
+	/* Allocate space for the signal handler context. */
+	if ((p->p_flag & P_ALTSTACK) && !oonstack &&
+	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
+		fp = (struct osigframe *)(p->p_sigstk.ss_sp +
+		    p->p_sigstk.ss_size - sizeof(struct osigframe));
 #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
 		p->p_sigstk.ss_flags |= SS_ONSTACK;
 #endif

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208300158.g7U1w7fE020135>