[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Question regarding user-mode and debugging terminals


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: The Evil Geek <theevilgeek@xxxxxxxxx>
  • Date: Thu, 4 Oct 2007 18:09:13 -0700 (PDT)
  • Delivery-date: Thu, 04 Oct 2007 18:09:53 -0700
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=YyRikqogaAR+HxlD+JEPt71BUrRLW2qClHEi9WxSa/1dKIBbO7GvnSM7ptsOgCVvpZrcCDNDdGFwRlm3GQM41f/jqNj7y/BQpMzwnXIv3XZBqDDKM3iEQWEBYxixjq14F3Jq/R+rZdh0vwpDfK9BlQRX4Gc8cfX/pK7efla/QnE=;
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Dear xen-devel,

My partner and I are working to port an "educational"
UNIX-like operating system from a custom simulator to
the Xen platform for an operating systems class here
at Brown University.

Unfortunately, we're having quite a bit of difficulty
switching the system into user mode. Currently, we're
using borrowed code from an early linux kernel:

89 void context_make_active_user(context_t *c)
 90 {
 91     /* Switch stacks and run the thread */
 92     int res;
 93     res = switch_into_user_as(c);
 94   //move_to_user_mode();
 95   //#define move_to_user_mode()
 96 //  __asm__ __volatile__ ("movl %%esp,%%eax\n\t" \
 97     "pushl %0\n\t" \
 98     "pushl %%eax\n\t" \
 99     "pushfl\n\t" \
100     "pushl %1\n\t" \
101     "pushl $1f\n\t" \
102     "iret\n" \
103     "1:\tmovl %0,%%eax\n\t" \
104     "mov %%ax,%%ds\n\t" \
105     "mov %%ax,%%es\n\t" \
106     "mov %%ax,%%fs\n\t" \
107     "mov %%ax,%%gs" \
108     : /* no outputs */ :"i" (__USER_DS), "i"
(__USER_CS):"ax");
109     KASSERT(!res);
110     __asm__ __volatile__("movl %0,%%ebp\n\t"  /*
update ebp */
111                          "movl %1,%%esp\n\t"  /*
update esp */
112        "push %2\n\t"    /* save eip   */
113        "ret"      /* jump to new eip */
114              : : "m" (c->c_ebp), "m" (c->c_esp),
"m" (c->c_eip));
115 }

The code that has been commented out is our attempt to
alter the segment registers and switch to ring 3.
However, this seems to be very wrong. We are
struggling to find examples as to how this switch to
userland might be achieved while running with xen
(and, in fact, in general). Does anyone have any
advice that might help us implement this switch to
userland? Additionally, will returning from a trap
into the kernel from userland automatically switch
back to userland or is additional effort needed?
--
Second, students interacted with this OS (named
"Weenix") through three terminals which were exposed
to Weenix as character devices /dev/tty0 through
/dev/tty3. Additional, the actual terminal through
which the Weenix system had been started would serve
as a console for printing "meta" debugging output to
(this terminal would not be visible to Weenix itself).

We've made significant ground porting Weenix to Xen
(which we have renamed "Wox"), however, we're a bit
hung up in trying to simulate those original three
terminals without going overboard.

We've toyed with the idea of simply using escape
sequence to "split" a single terminal, but this seems
ugly and is not truly what we'd like. We'd much prefer
a way to attach multiple terminals to a single Weenix
instance such that Weenix can interact with these
terminals as if they were character devices. 

One option seems to be modifying the "back-end" driver
utilized by block I/O devices but this seems as though
it would require us to alter Xen itself. Beyond this,
we're really not sure how to proceed. Any pointers or
general advice would be greatly appreciated.
Unfortunately, Weenix doesn't have a network stack;
it's only three or four times more complex than
mini-os :)

Thank you very much!

Brandon & Dan
Brown University


       
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. 
Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=list&sid=396545433

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.