<div dir="ltr">Hi Jan,<div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 19, 2017 at 1:46 PM, jan.struz <span dir="ltr"><<a href="mailto:public+pharo@struz.cz" target="_blank">public+pharo@struz.cz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Stef,<br>
what I want, is NativeBoost for Pharo 5+. Because we could do this:<br><br><div style="background:#ffffff;overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em"><pre style="margin:0;line-height:125%"><span style="color:#0066bb;font-weight:bold">primInPortByte:</span> <span style="color:#996633">portNumber</span> 
        <<span style="color:#008800;font-weight:bold">primitive:</span> 'primitiveNativeCall' <span style="color:#008800;font-weight:bold">module:</span> 'NativeBoostPlugin' <span style="color:#008800;font-weight:bold">error:</span> errorCode>

        <span style="color:#333333">^</span> <span style="color:#007020">self</span> <span style="color:#0066bb;font-weight:bold">nbCallout</span> <span style="color:#0066bb;font-weight:bold">function:</span> <span style="color:#aa6600">#(uint8</span> <span style="color:#aa6600">(</span> <span style="color:#aa6600">uint16</span> <span style="color:#aa6600">portNumber</span> <span style="color:#aa6600">))</span> <span style="color:#0066bb;font-weight:bold">emit:</span> [<span style="color:#333333">:</span><span style="color:#996633">gen</span> <span style="color:#333333">|</span> 
                        <span style="color:#333333">|</span><span style="color:#996633"> asm result proxy </span><span style="color:#333333">|</span> 
                        <span style="color:#996633">asm</span> <span style="color:#333333">:=</span> <span style="color:#996633">gen</span> <span style="color:#0066bb;font-weight:bold">asm</span>.
                        <span style="color:#996633">proxy</span> <span style="color:#333333">:=</span> <span style="color:#996633">gen</span> <span style="color:#0066bb;font-weight:bold">proxy</span>.
                        <span style="color:#996633">result</span> <span style="color:#333333">:=</span> <span style="color:#996633">gen</span> <span style="color:#0066bb;font-weight:bold">reserveTemp</span>.
                        <span style="color:#996633">asm</span>
                                <span style="color:#0066bb;font-weight:bold">pop:</span> <span style="color:#996633">asm</span> <span style="color:#0066bb;font-weight:bold">EDX</span>;      <span style="color:#888888">"EDX = portNumber"</span>
                                <span style="color:#0066bb;font-weight:bold">push:</span> <span style="color:#996633">asm</span> <span style="color:#0066bb;font-weight:bold">EDI</span>;     <span style="color:#888888">"save EDI"</span>
                                <span style="color:#0066bb;font-weight:bold">mov:</span> <span style="color:#996633">result</span> <span style="color:#0066bb;font-weight:bold">to:</span> <span style="color:#996633">asm</span> <span style="color:#0066bb;font-weight:bold">EDI</span>; <span style="color:#888888">"EDI = temp address for result"</span>
                                <span style="color:#0066bb;font-weight:bold">db:</span> <span style="color:#6600ee;font-weight:bold">16</span><span style="color:#0066bb;font-weight:bold">rEC</span>;                <span style="color:#888888">"IN AL, DX"</span>
                                <span style="color:#0066bb;font-weight:bold">pop:</span> <span style="color:#996633">asm</span> <span style="color:#0066bb;font-weight:bold">EDI</span>.  <span style="color:#888888">"restore EDI"</span>
                        <span style="color:#996633">gen</span> <span style="color:#0066bb;font-weight:bold">releaseTemps:</span> <span style="color:#6600ee;font-weight:bold">1</span>.
                ].
</pre></div>
<br>
This is a rewrite of one method from C source(calling asm) in internal SqueakNOSPlugin into NativeBoost Smalltalk code. It calls privileged (kernel mode only) instruction to directly access HW I/O - disk access.<br>
I have tried to run it, and it worked fine. However there is one little problem. NativeBoost needs method source, which is stored where? On the disk it wants to access... Solution - the source code can be embedded into compiled method trailer - this is only way to make it work. The first run will generate native code, and replaces the embedded source, so you can't touch the method anymore (at runtime)... so it is not perfect.<br>This is how SqueakNOSPlugin can be removed entirelly. But I'm afraid nobody can play with it in Pharo7 images...<br></blockquote><div><br></div><div>Can you not use the new UnifiedFFI which uses the ThreadedFFIPlugin at the bottom level?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




        
        
        <div class="m_3652621351197013797signature" style="margin-top:1em;color:#666666;font-size:11px">
                                Save The World!
                        </div>
<br><hr align="left" width="300">
View this message in context: <a href="http://forum.world.st/ANN-PharoNOS-tp4939247p4939313.html" target="_blank">Re: [ANN] PharoNOS</a><div class="HOEnZb"><div class="h5"><br>
Sent from the <a href="http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html" target="_blank">Pharo Smalltalk Developers mailing list archive</a> at Nabble.com.<br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>