[SqNOS] Idea about changing the way we compile the VM

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[SqNOS] Idea about changing the way we compile the VM

melkyades
Last night I had a really interesting idea about the VM...

For now, we have a special VM platform that is "squeakNOS". This is sometimes a problem, we need a custom makefile, the VM gets old and we are still working with the old interpreter because of this. Supporting the makefile is really boring.

What I'm thinking about, then? We have nativeboost to execute binary code, an assembler and even prototype of smalltalk to binary translator (waterfall), wouldn't it be possible to use all that to make the standard unix VM work with the sq/NOS image?

What work I think that would be required?

- Making the image partly POSIX compliant? This means it should be able to receive syscalls and respond to them, probably doing nothing in most cases.

- Re-coding the support code written in C. But doing it in smalltalk and nativizing it with waterfall or with asmjit. This code is really short, shouldn't be much work.

- Moving some fancy stuff from actual Makefile to Smalltalk. The actual Makefile has to do some special linking of binary code. For example, it takes some binary code from libc and puts it in the VM. We'll have to do this from the image.


What we gain? Important and cool stuff:

- We don't need a special vm any more. This removes a barrier to entering the project.
- We get this support code written in smalltalk so we get closer to the idea of a full-smalltalk OS
- We get POSIX compatibility, this means we might be able to/get closer to execute code compiled for unix.
- We get POSIX documented in smalltalk code... I don't know if somebody is interested in this anyway

Cool, isn't it?

We should look for an M.Sc thesist ;P

Cheers,
Javier.
--
Lic. Javier Pimás
Ciudad de Buenos Aires

_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos
Reply | Threaded
Open this post in threaded view
|

Re: [SqNOS] Idea about changing the way we compile the VM

ccrraaiigg

     Yes, excellent idea. Let's do it!


-C

--
Craig Latta
www.netjam.org/resume
+31   6 2757 7177
+ 1 415  287 3547 (no SMS)
_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos
Reply | Threaded
Open this post in threaded view
|

Re: [SqNOS] Idea about changing the way we compile the VM

Jecel Assumpcao Jr
In reply to this post by melkyades
Javier,

> Last night I had a really interesting idea about the VM...
> For now, we have a special VM platform that is "squeakNOS". This is sometimes
> a problem, we need a custom makefile, the VM gets old and we are still working
> with the old interpreter because of this. Supporting the makefile is really boring.

What are the Vm changes that we need? I thought it was just one plugin
to allow low level i/o and memory access plus a patch to find the image
pre-loaded into memory, right?

> What I'm thinking about, then? We have nativeboost to execute binary code, an
> assembler and even prototype of smalltalk to binary translator (waterfall),

I am not familiar with waterfall, but in the past we had a Smalltalk to
x86 translator in the Exupery project.

> wouldn't it be possible to use all that to make the standard unix VM work with the
> sq/NOS image?

The nativeboost and related parts would indeed be an alternative to the
plugin. But it seems to me that the startup patch to the Unix VM would
still be needed. I am sure it would be relatively easy to write code
that could work either way (in fact, isn't that already the case for the
SqueakNOS VM?).

> What work I think that would be required?
> - Making the image partly POSIX compliant? This means it should be able to receive
> syscalls and respond to them, probably doing nothing in most cases.

The image would be receiving syscalls from where? I think I
misunderstood this part.

> - Re-coding the support code written in C. But doing it in smalltalk and nativizing it
> with waterfall or with asmjit. This code is really short, shouldn't be much work.

And some of this support code isn't really in C anyway, since that
language has no notion of i/o ports. It would be interesting to have
multiple versions of such code in the same image if we want it to be
able to run on ARM computers as well as PCs at some point.

> - Moving some fancy stuff from actual Makefile to Smalltalk. The actual Makefile has
> to do some special linking of binary code. For example, it takes some binary code
> from libc and puts it in the VM. We'll have to do this from the image.

It seems that the current VMMaker tools are using CMake. If the goal is
to merge the SqueakNOS and Unix VMs, doesn't it make sense to use the
same things for both?
 
> What we gain? Important and cool stuff:
> - We don't need a special vm any more. This removes a barrier to entering the
> project.- We get this support code written in smalltalk so we get closer to the
> idea of a full-smalltalk OS- We get POSIX compatibility, this means we might be
> able to/get closer to execute code compiled for unix.- We get POSIX documented
> in smalltalk code... I don't know if somebody is interested in this anyway

Does the "execute code compiled for unix" part mean you want to run
stuff written in C within the image and have SqueakNOS pretend to be
Unix for that code? This seems like a completely different project from
having a single VM binary run on top of Unix and on bare computers. And
it is not something that would be very secure unless that code runs in a
separate address space.

By the way, in 1987 my then partner asked me if "it is possible to write
a Unix in Smalltalk". Though in theory the answer is "yes" (you can
always simulate some computer in Smalltalk and run Unix on that - it
would just be really, really slow) I replied "no", which resulted in a
series of events which killed our company. So I have given this question
a lot of thought in the past few decades....

-- Jecel

_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos
Reply | Threaded
Open this post in threaded view
|

Re: [SqNOS] Idea about changing the way we compile the VM

melkyades
In reply to this post by melkyades
Hi guys, cool to see there's people reading the list these days!

On Wed, Oct 24, 2012 at 9:46 PM, Jecel Assumpcao Jr. <[hidden email]> wrote:
Javier,

> Last night I had a really interesting idea about the VM...
> For now, we have a special VM platform that is "squeakNOS". This is sometimes
> a problem, we need a custom makefile, the VM gets old and we are still working
> with the old interpreter because of this. Supporting the makefile is really boring.

What are the Vm changes that we need? I thought it was just one plugin
to allow low level i/o and memory access plus a patch to find the image
pre-loaded into memory, right?

There are different parts of the VM that were modified to make squeaknos. One of them is this special linking I told. Other part was to add some primitives for accessing special procesor instructions from smalltalk: in and out. As you probably know, they are needed to interact with io devices. There is a plugin which implements a primitive for each of these (there are variants, in byte, in word, in dword, etc). 

This plugin can now be easily removed and replaced by AsmJit (igor's assembler) and NativeBoost. The real challenge is to make the unix VM load after grub, we may need an elf loader.

 

> What I'm thinking about, then? We have nativeboost to execute binary code, an
> assembler and even prototype of smalltalk to binary translator (waterfall),

I am not familiar with waterfall, but in the past we had a Smalltalk to
x86 translator in the Exupery project.

Yes, it's similar.
 

> wouldn't it be possible to use all that to make the standard unix VM work with the
> sq/NOS image?

The nativeboost and related parts would indeed be an alternative to the
plugin. But it seems to me that the startup patch to the Unix VM would
still be needed. I am sure it would be relatively easy to write code
that could work either way (in fact, isn't that already the case for the
SqueakNOS VM?).

> What work I think that would be required?
> - Making the image partly POSIX compliant? This means it should be able to receive
> syscalls and respond to them, probably doing nothing in most cases.

The image would be receiving syscalls from where? I think I
misunderstood this part.

From the VM itself (or other programs if we are able to execute them). We would use the Unix VM, and this VM would think it is executing on Unix. So if for example it calls printf, it would end in a syscall to the kernel, like this:

         mov eax,4         ;system call number for output(sys_write)
         mov ebx,1         ;default output device
         mov ecx, msg1      ;message to write
         mov edx, msg1len   ;message length  
         int 0x80  

From smalltalk what we should do is place an interrupt handler that catches syscalls and  manages them through callbacks to the image.
 

> - Re-coding the support code written in C. But doing it in smalltalk and nativizing it
> with waterfall or with asmjit. This code is really short, shouldn't be much work.

And some of this support code isn't really in C anyway, since that
language has no notion of i/o ports. It would be interesting to have
multiple versions of such code in the same image if we want it to be
able to run on ARM computers as well as PCs at some point.

The less statically compiled, the best.
 

> - Moving some fancy stuff from actual Makefile to Smalltalk. The actual Makefile has
> to do some special linking of binary code. For example, it takes some binary code
> from libc and puts it in the VM. We'll have to do this from the image.

It seems that the current VMMaker tools are using CMake. If the goal is
to merge the SqueakNOS and Unix VMs, doesn't it make sense to use the
same things for both?

Yes, but the SqueakNOS makefile was made before CMake came, and now up-to-date VMs are made with CMake, which means we have to update to CMake too if we want to have the latest VM. But it may be even easier not to have a special platform at all, that's what I want.


> What we gain? Important and cool stuff:
> - We don't need a special vm any more. This removes a barrier to entering the
> project.- We get this support code written in smalltalk so we get closer to the
> idea of a full-smalltalk OS- We get POSIX compatibility, this means we might be
> able to/get closer to execute code compiled for unix.- We get POSIX documented
> in smalltalk code... I don't know if somebody is interested in this anyway

Does the "execute code compiled for unix" part mean you want to run
stuff written in C within the image and have SqueakNOS pretend to be
Unix for that code?

Yes! At first, only for the VM, after that who knows.
 
This seems like a completely different project from
having a single VM binary run on top of Unix and on bare computers. And
it is not something that would be very secure unless that code runs in a
separate address space.

SqueakNOS has none security mechanisms implented for now.
 

By the way, in 1987 my then partner asked me if "it is possible to write
a Unix in Smalltalk". Though in theory the answer is "yes" (you can
always simulate some computer in Smalltalk and run Unix on that - it
would just be really, really slow) I replied "no", which resulted in a
series of events which killed our company. So I have given this question
a lot of thought in the past few decades....

But then you didn't have SqueakNOS ;P
 
-- Jecel


Cheers,
Javier
 
_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos



--
Lic. Javier Pimás
Ciudad de Buenos Aires

_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos
Reply | Threaded
Open this post in threaded view
|

Re: [SqNOS] Idea about changing the way we compile the VM

Guido Chari
Hi,

I like very much the idea. I'm willing to collaborate.

However, i think that it would be important first to make the CMake configurations from the VM compatible with SqueakNOS platform sources. It would be simpler if the VM has a uniform building process.

So, my vision (i've started working on this)...Anybody should be able to download the squeaknos git repository inside the platform sources of the CogVM. Then go to an image with CMakeVMMaker, have a SqueakNosConfig class, and follow the same rules for generating the makefiles as from a standard vm: generateSources;generate. Then cmake ., make, and install.

Then we can think of improving the image with new stuff. All new stuff from the image for interfacing with networking and with filesystems should be very interesting. 

So in my opinion, first we need a modern image running with a CogVM and with a simple building process. This way, with a simpler and uniform building process, i'm sure we will attain the attention and time of more people willing to colaborate.

Happy to see movement on this list,
My 2 cents,
Cheers,
Guido.


2012/10/25 Javier Pimás <[hidden email]>
Hi guys, cool to see there's people reading the list these days!

On Wed, Oct 24, 2012 at 9:46 PM, Jecel Assumpcao Jr. <[hidden email]> wrote:
Javier,


> Last night I had a really interesting idea about the VM...
> For now, we have a special VM platform that is "squeakNOS". This is sometimes
> a problem, we need a custom makefile, the VM gets old and we are still working
> with the old interpreter because of this. Supporting the makefile is really boring.

What are the Vm changes that we need? I thought it was just one plugin
to allow low level i/o and memory access plus a patch to find the image
pre-loaded into memory, right?

There are different parts of the VM that were modified to make squeaknos. One of them is this special linking I told. Other part was to add some primitives for accessing special procesor instructions from smalltalk: in and out. As you probably know, they are needed to interact with io devices. There is a plugin which implements a primitive for each of these (there are variants, in byte, in word, in dword, etc). 

This plugin can now be easily removed and replaced by AsmJit (igor's assembler) and NativeBoost. The real challenge is to make the unix VM load after grub, we may need an elf loader.

 

> What I'm thinking about, then? We have nativeboost to execute binary code, an
> assembler and even prototype of smalltalk to binary translator (waterfall),

I am not familiar with waterfall, but in the past we had a Smalltalk to
x86 translator in the Exupery project.

Yes, it's similar.
 

> wouldn't it be possible to use all that to make the standard unix VM work with the
> sq/NOS image?

The nativeboost and related parts would indeed be an alternative to the
plugin. But it seems to me that the startup patch to the Unix VM would
still be needed. I am sure it would be relatively easy to write code
that could work either way (in fact, isn't that already the case for the
SqueakNOS VM?).

> What work I think that would be required?
> - Making the image partly POSIX compliant? This means it should be able to receive
> syscalls and respond to them, probably doing nothing in most cases.

The image would be receiving syscalls from where? I think I
misunderstood this part.

From the VM itself (or other programs if we are able to execute them). We would use the Unix VM, and this VM would think it is executing on Unix. So if for example it calls printf, it would end in a syscall to the kernel, like this:

         mov eax,4         ;system call number for output(sys_write)
         mov ebx,1         ;default output device
         mov ecx, msg1      ;message to write
         mov edx, msg1len   ;message length  
         int 0x80  

From smalltalk what we should do is place an interrupt handler that catches syscalls and  manages them through callbacks to the image.
 

> - Re-coding the support code written in C. But doing it in smalltalk and nativizing it
> with waterfall or with asmjit. This code is really short, shouldn't be much work.

And some of this support code isn't really in C anyway, since that
language has no notion of i/o ports. It would be interesting to have
multiple versions of such code in the same image if we want it to be
able to run on ARM computers as well as PCs at some point.

The less statically compiled, the best.
 

> - Moving some fancy stuff from actual Makefile to Smalltalk. The actual Makefile has
> to do some special linking of binary code. For example, it takes some binary code
> from libc and puts it in the VM. We'll have to do this from the image.

It seems that the current VMMaker tools are using CMake. If the goal is
to merge the SqueakNOS and Unix VMs, doesn't it make sense to use the
same things for both?

Yes, but the SqueakNOS makefile was made before CMake came, and now up-to-date VMs are made with CMake, which means we have to update to CMake too if we want to have the latest VM. But it may be even easier not to have a special platform at all, that's what I want.


> What we gain? Important and cool stuff:
> - We don't need a special vm any more. This removes a barrier to entering the
> project.- We get this support code written in smalltalk so we get closer to the
> idea of a full-smalltalk OS- We get POSIX compatibility, this means we might be
> able to/get closer to execute code compiled for unix.- We get POSIX documented

> in smalltalk code... I don't know if somebody is interested in this anyway

Does the "execute code compiled for unix" part mean you want to run
stuff written in C within the image and have SqueakNOS pretend to be
Unix for that code?

Yes! At first, only for the VM, after that who knows.
 
This seems like a completely different project from
having a single VM binary run on top of Unix and on bare computers. And
it is not something that would be very secure unless that code runs in a
separate address space.

SqueakNOS has none security mechanisms implented for now.
 

By the way, in 1987 my then partner asked me if "it is possible to write
a Unix in Smalltalk". Though in theory the answer is "yes" (you can
always simulate some computer in Smalltalk and run Unix on that - it
would just be really, really slow) I replied "no", which resulted in a
series of events which killed our company. So I have given this question
a lot of thought in the past few decades....

But then you didn't have SqueakNOS ;P
 
-- Jecel


Cheers,
Javier
 
_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos



--
Lic. Javier Pimás
Ciudad de Buenos Aires

_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos



_______________________________________________
SqueakNOS mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/squeaknos