* * *

Author Topic: Toro Kernel  (Read 3654 times)

Blestan

  • Sr. Member
  • ****
  • Posts: 452
Toro Kernel
« on: January 21, 2017, 09:17:34 pm »
Hi folks!
i mentioned that in the past few months ne toro kernel is again in development. the creator of toro (Matias E. Vara)  is doing a great job to update the kernel !!!
the tcp stack is updated and working ...
i have the "briliant" idea to create a fpc cloud infrastruture for web apps based on toro/fpc.
the main concepts are:
1/ monoblock app running in vm based on toro ( the base idea of toro)
2/ simple single user non concurent but async flie system ( todo - help needed on that)
3/ communication with intranet DB (mysql, postgres etc) and cache servers (redis, memcache  ...) .. native (no dll or .so ) clients implementations of the protocols is to be done - help needed... or maybe a thin tcp/http warpper based on json for communication with the servers?
4/ serving web requests on the extranet with a very fast (bare metal) http server
5/ running apps in vm deployed by platform like openskack
6/ no code injection possible due to the monoblock concept of toro - app is compiled and part of the kernel - one vm is runing a single kernel with the app embeded
7/ no interpreded languages - no risk :)
8/ minimal overhead no additional drivers except for ethernet and disk

waiting for your comments and suggestions!

:))
Speak postscript or die!
Translate to pdf and live!

z0rr0

  • New member
  • *
  • Posts: 31
Re: Toro Kernel
« Reply #1 on: February 18, 2017, 03:31:42 pm »
Hi everyone, I have just moved the toro repo to github: https://github.com/MatiasVara/torokernel. I am also trying to organize the TODO work by using project and issue sections. Fell free to go through!


Regards, Matias.


z0rr0

  • New member
  • *
  • Posts: 31
Re: Toro Kernel
« Reply #2 on: June 17, 2017, 05:13:53 pm »
Hi everyone, I would like to share my last work related with Toro. Toro is now able to run as KVM guest. This is still experimental but I think work is going well. To show this, I deployed ToroHello example in a VM which anyone can see by connecting a VNC client to 51.15.142.20:5900. This is still a very simple example however it shows how easily a freepascal application can be deployed in the cloud. This application is quite fast since there is no OS, only TORO.   

Regards, Matias.
« Last Edit: June 17, 2017, 05:22:58 pm by z0rr0 »

Blestan

  • Sr. Member
  • ****
  • Posts: 452
Re: Toro Kernel
« Reply #3 on: June 17, 2017, 06:11:17 pm »
great new matias!!! on my side im advancing on the rest api backend ... soon we can test to compile the server under toro.. do you have an idea im is possible to deploy toro as a digital ocean droplet... cannot find any info about the vm they use... kvm docker or other... anyway toro is great ;)
Speak postscript or die!
Translate to pdf and live!

Soner A.

  • Full Member
  • ***
  • Posts: 183
    • My Blog
Re: Toro Kernel
« Reply #4 on: June 17, 2017, 09:21:26 pm »
I would integrate PascalScript, then the user can create own applications.
I am using pascalscript in my applications it is very usefull. You don't need LCL for PascalScript.
I use it on Android too.
I use latest Lazarus version with fixes-svn, fpc latest official, Windows 7, All 32Bit

Blestan

  • Sr. Member
  • ****
  • Posts: 452
Re: Toro Kernel
« Reply #5 on: June 17, 2017, 10:51:45 pm »
why to integrate. an interprerer when you can deploy native???? not only speeed degradation but also a security problem...you will have a nodejs server...why???
Speak postscript or die!
Translate to pdf and live!

taazz

  • Hero Member
  • *****
  • Posts: 4260
Re: Toro Kernel
« Reply #6 on: June 17, 2017, 11:11:51 pm »
why to integrate. an interprerer when you can deploy native???? not only speeed degradation but also a security problem...you will have a nodejs server...why???
as a programmable shell like bash but true programmable not a toy language.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

z0rr0

  • New member
  • *
  • Posts: 31
Re: Toro Kernel
« Reply #7 on: June 18, 2017, 01:07:59 pm »
Toro has very particular architecture in which certain applications are improved but other gets no too much benefices. Toro is good when an application can be split in pipelines. In that case, you can run every pipeline in a different core and then dedicate all the resources needed by core. This reduces a lot the overhead due to shared resources. In addition, switch context are very light.   

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: Toro Kernel
« Reply #8 on: June 18, 2017, 04:17:44 pm »
Hi everyone, I would like to share my last work related with Toro. Toro is now able to run as KVM guest. This is still experimental but I think work is going well. To show this, I deployed ToroHello example in a VM which anyone can see by connecting a VNC client to 51.15.142.20:5900. This is still a very simple example however it shows how easily a freepascal application can be deployed in the cloud. This application is quite fast since there is no OS, only TORO.   

Regards, Matias.
If you like I Worked a little In ToroKernel I tried to put the KernelModuled in a Package, but I didn't without success (maybe you Could help)
But I managed to get My Writepascal-demo running.
Code: Pascal  [Select]
  1. // Toro Write Pascal Example.
  2. // Example using a minimal kernel to print "Pascal" in 3D
  3.  
  4. // Changes :
  5.  
  6. // 19/06/2017 First Version by Joe Care.
  7.  
  8. // Copyright (c) 2017 Joe Care
  9. // All Rights Reserved      
  10.  
  11. // This program is free software: you can redistribute it and/or modify
  12. // it under the terms of the GNU General Public License as published by
  13. // the Free Software Foundation, either version 3 of the License, or
  14. // (at your option) any later version.
  15.  
  16. // This program is distributed in the hope that it will be useful,
  17. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. // GNU General Public License for more details.
  20.  
  21. // You should have received a copy of the GNU General Public License
  22. // along with this program.  If not, see <http://www.gnu.org/licenses/>.
  23.  
  24.  
  25. program WritePacal;
  26.  
  27. {$IFDEF FPC}
  28.  {$mode delphi}
  29. {$ENDIF}
  30.  
  31. {$IMAGEBASE 4194304}
  32.  
  33. // Configuring the RUN for Lazarus
  34. {$IFDEF WIN64}
  35.           {%RunCommand qemu-system-x86_64.exe -m 512 -smp 2 -drive format=raw,file=ToroHello.img}
  36. {$ELSE}
  37. {%RunCommand qemu-system-x86_64 -m 512 -smp 2 -drive format=raw,file=ToroHello.img}
  38. {$ENDIF}
  39. {%RunFlags BUILD-}
  40.  
  41. // They are declared just the necessary units
  42. // The needed units depend on the hardware where you are running the application
  43. uses
  44.     Kernel in '..\rtl\Kernel.pas',
  45.     Process in '..\rtl\Process.pas',
  46.     Memory in '..\rtl\Memory.pas',
  47.     Debug in '..\rtl\Debug.pas',
  48.     Arch in '..\rtl\Arch.pas',
  49.     Filesystem in '..\rtl\Filesystem.pas',
  50.     Pci in '..\rtl\Drivers\Pci.pas',
  51.     Console in '..\rtl\Drivers\Console.pas';
  52.  
  53. const
  54.     i64: int64 = 1055120232691680095; (* This defines "Pascal" *)
  55.     cc: array[-3..3] of ShortString = (* Here are all string-constants *)
  56.         ('\ '#8' \  ',
  57.         #8'__    ',
  58.         #8'__/\  ',
  59.         '  '#8'    ',
  60.         #8'__/\  ',
  61.         '  '#8'    ',
  62.         #8'__/\  ');
  63.  
  64. var
  65.     x, y, c: integer;
  66.  
  67. begin
  68.     PrintStringLn(StringOfChar(cc[1][1], 78));
  69.     for y := 0 to 11 do
  70.       begin
  71.         PrintString(StringOfChar(cc[0][1], 13 - y));
  72.         for x := 0 to 16 do
  73.             for c := 1 to 5 + (x mod 3) and 2 do
  74.                 if c <= length(cc[(x - 5) mod 4]) then
  75.                     PutC(cc[(((i64 shr ((x and 15) * 4 + y div 3)) and (3 -
  76.                         (y div 9) shl 1)) - 4 + (2 - y mod 3) shl 2) mod 4][c]);
  77.         PrintStringln();
  78.       end;
  79.     while True do
  80.         SysThreadSwitch;
  81. end.
  82.  
Put all together in the patch, even a defaultToro.xml (default-Project settings)
Patch attached .
« Last Edit: June 18, 2017, 04:28:24 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

z0rr0

  • New member
  • *
  • Posts: 31
Re: Toro Kernel
« Reply #9 on: June 18, 2017, 04:56:19 pm »
Thanks jc99! I have to replace the methods used to access the console. In Toro the console is written by using WriteConsole() method. I will do it and deploy it soon. 

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: Toro Kernel
« Reply #10 on: June 18, 2017, 05:40:52 pm »
There is a problem with WriteConsole.
My original code was:
Code: Pascal  [Select]
  1. WriteConsole(Copy(CC[],1,5+2),[0]);
that crashed of cause with the formating option Then i Tried:
Code: Pascal  [Select]
  1. WriteConsole('%s',[Copy(CC[],1,5+2)]);
that crashed because Copy() is no PtrUint
So i exported the PrintString Procedure and enabled PutC to handle the backspace-Character
First test looked promising, But then the next drawback:
When you write something like 'abc'+s (:ansistring) you get an error (Wrong parameter in Concat)
When you do copy(s {:ansistring = '123456'} ,1,7) The output went nuts (lot of stupid characters).
When you do copy('123456' ,1,7) get an error (Wrong parameter ) Shortstring to ansistring
.
.
That went on ...
Before final version I tied
Code: Pascal  [Select]
  1. PrintString(CC[][c]);
Error Char to ansistring wrong parameter.
the final version With PutC exportet worked at last.

Please rename the procedure (or overload it If you like) WriteConsole has no indication that it needs Format-Parameters a name like WriteConsoleFmt would indicate that, like the MessageFmt Function, Even in C printf means print formatted on the contrary to write that prints unformatted.
« Last Edit: June 18, 2017, 05:54:01 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: Toro Kernel
« Reply #11 on: June 18, 2017, 05:58:15 pm »
Quote from: z0rr0
I have to replace the methods used to access the console.

No, You don't.
The trick to get the Write, Writeln, readln... working, is to handle/open the Input and Output- files. Demontration in the Wiki.

BTW: attachts an image (preview)
« Last Edit: June 18, 2017, 06:08:22 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: Toro Kernel
« Reply #12 on: June 18, 2017, 06:15:35 pm »
A Mouse support/driver is missing, and i could contribute a graph unit that handles Vesa-Graphics (without the BGI-nonsens of cause)
Mouse is needed/would be good when porting FV
« Last Edit: June 18, 2017, 06:17:35 pm by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

z0rr0

  • New member
  • *
  • Posts: 31
Re: Toro Kernel
« Reply #13 on: June 18, 2017, 07:18:53 pm »
Quote from: z0rr0
I have to replace the methods used to access the console.

No, You don't.
The trick to get the Write, Writeln, readln... working, is to handle/open the Input and Output- files. Demontration in the Wiki.

BTW: attachts an image (preview)


Sorry I misunderstood the previous messages. Thanks for the patch I will review it and implement it.
 

jc99

  • Hero Member
  • *****
  • Posts: 516
    • My private Site
Re: Toro Kernel
« Reply #14 on: June 19, 2017, 12:49:45 am »
No problem, that happens
Apart from those drawbacks I really like it, and very much appreciate your Work (Wow! WTG!) 
« Last Edit: June 19, 2017, 12:55:29 am by jc99 »
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.2 - 1.6.4, 1.8rc3
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus