<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        font-size:10.5pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-AU" link="blue" vlink="purple" style="text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US">This is a known problem, and a side-effect of the way memory is allocated when loading ELF images.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US">As you know, globalmsg is part of the data section. In Barrelfish, another domain (typically spawnd) loads the ELF image for a program, allocating memory and constructing
 its initial page tables. When the new domain starts running, it has page table mappings for its ELF image, but not the metadata or caps backing them which are required by the pmap lookup code. This is why the first lookup fails. The second lookup succeeds
 because the thread&#8217;s stack is allocated dynamically within the context of the new domain, so the metadata is tracked correctly.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US">There is nothing (easy) you can do to fix this &#8211; it&#8217;s just something we haven&#8217;t implemented because nothing really needed it yet, but it has occurred to me that much
 of this would be cleaner if we did most of the ELF loading in the context of the new domain rather than its parent.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US">Perhaps we can help you find a workaround &#8230; what are you trying to achieve at the high level?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US"><br>
Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US">Andrew<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" align="left" style="text-align:left"><b><span lang="EN-US" style="font-size:11.0pt">From:</span></b><span lang="EN-US" style="font-size:11.0pt"> zhanqing Zhan(Qing) [mailto:zhanqing.zhan@huawei.com]
<br>
<b>Sent:</b> Tuesday, 2 April 2013 20:19<br>
<b>To:</b> barrelfish-users@lists.inf.ethz.ch<br>
<b>Subject:</b> [Barrelfish-users] (no subject)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" align="left" style="text-align:left"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">hi, everyone<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp; I have a problem about global string point and local string point in memory
 map.<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">My machine is x86_64 debian and the test code looks like:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">char globalmsg[] = &quot;hello, world&quot;;<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">void func()<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">{<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp; struct pmap *pmap = get_current_pmap();<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp; /* this lookup function can't find global string memory capref&nbsp; */<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp; pmap-&gt;f.lookup(pmap, globalmsg, ..cap.. );<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp; char localmsg[] = &quot;hello, world&quot;;<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp; /* this lookup function can find local string memory capref, it works */<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp; pmap-&gt;f.lookup(pmap, localmsg, ..cap..);<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">}<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp; How do I make the pmap lookup function get capref with globalmsg ?<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">the localmsg Vaddress is 0x511f20, is belong to stack segment;<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">the globalmsg Vaddress is 0x4b9008;<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">and we can see globalmsg in text segment and localmsg in text segment,<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp; [ 1] .text&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROGBITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000000000400120&nbsp; 00000120<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0000000000090922&nbsp; 0000000000000000&nbsp; AX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 16<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp; [ 9] .data&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PROGBITS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00000000004b9000&nbsp; 000b9000<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 000000000000d608&nbsp; 0000000000000000&nbsp; WA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 32<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp; So I think there are maybe two problem:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">1, the data segment not do map;
<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">2, the global string point Vaddress should add segment address;<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">the fs register is 0x17, the IDT context is:<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">ldt[0] 0x2cc40<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">ldt[1] 0x4b9020<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">ldt[2] 0x804f0020<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">&nbsp; I add those idt address to globalmsg then do pmap lookup function, all the
 same not work.<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">Thanks for your any suggestion!<o:p></o:p></span></p>
<p class="MsoNormal" align="left" style="text-align:left;text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:SimSun;color:black;mso-fareast-language:ZH-CN">Best regards!</span><span lang="EN-US" style="mso-fareast-language:ZH-CN"><o:p></o:p></span></p>
</div>
</body>
</html>