Hi Stef,
what I want, is NativeBoost for Pharo 5+. Because we could do this:

primInPortByte: portNumber      <primitive: 'primitiveNativeCall'
module: 'NativeBoostPlugin' error: errorCode>        ^ self nbCallout
function: #(uint8 ( uint16 portNumber )) emit: [:gen |                  | asm 
result proxy
|                       asm := gen asm.                 proxy := gen proxy.     
                result := gen reserveTemp.              
asm                             pop: asm EDX;   "EDX = portNumber"    
                        push: asm EDI;
"save EDI"                            mov: result to: asm EDI; 
"EDI = temp address
for result"                                db: 16rEC;              
"IN AL, DX"                           pop: asm EDI. 
"restore EDI"                 gen releaseTemps: 1.            ].

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.
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.
This is how SqueakNOSPlugin can be removed entirelly. But I'm afraid nobody
can play with it in Pharo7 images...




-----
Save The World!
--
View this message in context: 
http://forum.world.st/ANN-PharoNOS-tp4939247p4939313.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply via email to