svn commit: r243103 - projects/amd64_xen_pv/sys/amd64/xen
Cherry G. Mathew
cherry at FreeBSD.org
Thu Nov 15 20:51:57 UTC 2012
Author: cherry
Date: Thu Nov 15 20:51:57 2012
New Revision: 243103
URL: http://svnweb.freebsd.org/changeset/base/243103
Log:
Setup and load initial thread0 VA context (stack frame, paging, segments)
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 Nov 15 20:50:18 2012 (r243102)
+++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Thu Nov 15 20:51:57 2012 (r243103)
@@ -120,6 +120,8 @@ vm_paddr_t dump_avail[PHYSMAP_SIZE + 2];
struct kva_md_info kmi;
+static struct trapframe proc0_tf;
+
struct pcpu __pcpu[MAXCPU];
struct user_segment_descriptor gdt[512]
@@ -358,6 +360,7 @@ vm_paddr_t
initxen(struct start_info *si)
{
+ char *env;
caddr_t kmdp;
size_t kstack0_sz;
struct pcpu *pc;
@@ -520,6 +523,7 @@ initxen(struct start_info *si)
init_param2(physmem);
+ bzero(msgbufp, msgbufsize);
msgbufinit(msgbufp, msgbufsize);
//fpuinit(); XXX: TODO
@@ -543,6 +547,20 @@ initxen(struct start_info *si)
_ufssel = GSEL(GUFS32_SEL, SEL_UPL);
_ugssel = GSEL(GUGS32_SEL, SEL_UPL);
+ /* Load thread0 context */
+ load_ds(_udatasel);
+ load_es(_udatasel);
+ load_fs(_ufssel);
+
+ /* setup proc 0's pcb */
+ thread0.td_pcb->pcb_flags = 0;
+ thread0.td_pcb->pcb_cr3 = KPML4phys;
+ thread0.td_frame = &proc0_tf;
+
+ env = getenv("kernelname");
+ if (env != NULL)
+ strlcpy(kernelname, env, sizeof(kernelname));
+
return (u_int64_t) thread0.td_pcb & ~0xFul /* 16 byte aligned */;
}
More information about the svn-src-projects
mailing list