svn commit: r237724 - projects/amd64_xen_pv/sys/amd64/xen
Cherry G. Mathew
cherry at FreeBSD.org
Thu Jun 28 19:27:55 UTC 2012
Author: cherry
Date: Thu Jun 28 19:27:54 2012
New Revision: 237724
URL: http://svn.freebsd.org/changeset/base/237724
Log:
later initialisation code for the bootstrap vcpu, that depends on
uma(9) and malloc(9) initialisation routines having been run.
This happens during mi_startup() after SI_SUB_VM init hooks are run.
Approved by: gibbs (implicit)
Modified:
projects/amd64_xen_pv/sys/amd64/xen/machdep.c
Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/xen/machdep.c Thu Jun 28 19:19:38 2012 (r237723)
+++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Thu Jun 28 19:27:54 2012 (r237724)
@@ -56,10 +56,12 @@
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/cons.h>
#include <sys/cpu.h>
#include <sys/imgact.h>
+#include <sys/kernel.h>
#include <sys/linker.h>
#include <sys/lock.h>
#include <sys/msgbuf.h>
@@ -74,8 +76,13 @@
#include <vm/vm.h>
#include <vm/pmap.h>
+#include <vm/vm_page.h>
+#include <vm/vm_object.h>
+#include <vm/vm_pager.h>
+#include <machine/clock.h>
#include <machine/cpu.h>
+#include <machine/intr_machdep.h>
#include <machine/md_var.h>
#include <machine/pcb.h>
#include <machine/stdarg.h>
@@ -110,6 +117,8 @@ vm_offset_t pa_index = 0;
vm_paddr_t phys_avail[PHYSMAP_SIZE + 2];
vm_paddr_t dump_avail[PHYSMAP_SIZE + 2];
+struct kva_md_info kmi;
+
struct pcpu __pcpu[MAXCPU];
struct user_segment_descriptor gdt[512]
@@ -124,11 +133,14 @@ void failsafe_callback(void);
vm_paddr_t initxen(struct start_info *);
-extern void identify_cpu(void);
+extern void printcpuinfo(void); /* XXX header file */
+extern void identify_cpu(void); /* XXX header file */
+extern void panicifcpuunsupported(void); /* XXX header file */
static void get_fpcontext(struct thread *td, mcontext_t *mcp);
static int set_fpcontext(struct thread *td, const mcontext_t *mcp,
char *xfpustate, size_t xfpustate_len);
+
/* Expects a zero-ed page aligned page */
static void
setup_gdt(struct user_segment_descriptor *thisgdt)
@@ -577,6 +589,73 @@ cpu_idle_wakeup(int cpu)
return (1);
}
+static void
+cpu_startup(void *dummy)
+{
+ uintmax_t memsize;
+
+ /*
+ * Good {morning,afternoon,evening,night}.
+ */
+ startrtclock();
+
+ //printcpuinfo();
+ //panicifcpuunsupported();
+
+#ifdef PERFMON
+ perfmon_init();
+#endif
+ realmem = Maxmem;
+
+ /*
+ * Display physical memory if SMBIOS reports reasonable amount.
+ */
+ memsize = 0;
+ if (memsize < ptoa((uintmax_t)cnt.v_free_count))
+ memsize = ptoa((uintmax_t)Maxmem);
+ printf("real memory = %ju (%ju MB)\n", memsize, memsize >> 20);
+
+ /*
+ * Display any holes after the first chunk of extended memory.
+ */
+ if (bootverbose) {
+ int indx;
+
+ printf("Physical memory chunk(s):\n");
+ for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) {
+ vm_paddr_t size;
+
+ size = phys_avail[indx + 1] - phys_avail[indx];
+ printf(
+ "0x%016jx - 0x%016jx, %ju bytes (%ju pages)\n",
+ (uintmax_t)phys_avail[indx],
+ (uintmax_t)phys_avail[indx + 1] - 1,
+ (uintmax_t)size, (uintmax_t)size / PAGE_SIZE);
+ }
+ }
+
+ vm_ksubmap_init(&kmi);
+
+ printf("avail memory = %ju (%ju MB)\n",
+ ptoa((uintmax_t)cnt.v_free_count),
+ ptoa((uintmax_t)cnt.v_free_count) / 1048576);
+
+ /*
+ * Set up buffers, so they can be used to read disk labels.
+ */
+ bufinit();
+ vm_pager_bufferinit();
+
+ cpu_setregs();
+
+ /*
+ * Add BSP as an interrupt target.
+ */
+ intr_add_cpu(0);
+}
+
+SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
+
/* XXX: Unify with "native" machdep.c */
/*
* Reset registers to default values on exec.
@@ -588,6 +667,12 @@ exec_setregs(struct thread *td, struct i
}
void
+cpu_setregs(void)
+{
+ /* XXX: */
+}
+
+void
cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{
@@ -1427,3 +1512,4 @@ freebsd4_sigreturn(struct thread *td, st
return sys_sigreturn(td, (struct sigreturn_args *)uap);
}
#endif
+
More information about the svn-src-projects
mailing list