For anyone who has ever been interested in taking total control of their computer from Cincom Smalltalk VisualWorks or ObjectStudio - here's how you can bypass all the wonderful technology that makes up the VM, JIT etc and just ran whatever assembly code you want:
(Example for x86 platform only)
| assembly assembler address procedure |
assembly := ByteArray new writeStream.
assembly nextPut: 16rB8. "mov eax, 1"
assembly nextPutAll: #[ 1 0 0 0 ].
assembly nextPut: 16rC3. "retf"
assembler := assembly contents gcCopyToHeap.
address := assembler referentAddress.
procedure := ExternalProcedure new.
procedure owner: ExternalInterface.
procedure referentAddress: address.
procedure type: (CProcedureType resultType: CIntegerType unsignedInt argumentTypes: #() argumentNames: #()).
procedure call