Esempio n. 1
0
        public static unsafe void Main()
        {
            ApplicationRuntime.Init();

            var targetProcessId = SysCalls.GetProcessIDForCommand(SysCallTarget.OpenFile);
            var buf             = SysCalls.RequestMessageBuffer(4096, targetProcessId);
            var conHandle       = SysCalls.OpenFile(buf, "/dev/console");

            var con = new ConsoleServer();

            con.Write("ConsoleServer Started");

            // TODO: Create dev /dev/console, other processes can check their existence
            SysCalls.SetServiceStatus(ServiceStatus.Ready);

            while (true)
            {
                SysCalls.ThreadSleep(0); // TODO: Signal

                var gotBytes = SysCalls.ReadFile(conHandle, buf);
                if (gotBytes > 0)
                {
                    for (var byteIdx = 0; byteIdx < gotBytes; byteIdx++)
                    {
                        var bufPtr = (byte *)buf.Start;
                        var key    = bufPtr[byteIdx];
                        con.Write(key);
                    }
                }
            }
        }
Esempio n. 2
0
 public unsafe SSize Read(byte *buf, USize count)
 {
     return(SysCalls.ReadFile(Handle, new MemoryRegion(buf, count)));
 }
Esempio n. 3
0
        public static unsafe void Main()
        {
            ApplicationRuntime.Init();

            //var result = MessageManager.Send(SysCallTarget.ServiceFunc1, 55);

            SysCalls.WriteDebugChar('=');
            SysCalls.WriteDebugChar('/');
            SysCalls.WriteDebugChar('*');

            var targetProcessId = SysCalls.GetProcessIDForCommand(SysCallTarget.OpenFile);
            var buf             = SysCalls.RequestMessageBuffer(4096, targetProcessId);
            var kb = SysCalls.OpenFile(buf, "/dev/keyboard");

            var con = new ConsoleClient();

            con.Init();
            //con.Write("\x001B[37;42m\x001B[8]");
            //con.Write("abc\x001B[2Jgh\x001B[37;42mjk");

            con.Reset();
            con.SetForegroundColor(7);
            con.SetBackgroundColor(0);
            con.ApplyDefaultColor();
            con.Clear();
            con.SetCursor(0, 0);
            con.Write("kl\n");

            for (uint i = 0; i < ApplicationRuntime.ElfSections.SectionHeaderCount; i++)
            {
                var section = ApplicationRuntime.ElfSections.GetSectionHeader(i);
                var name    = ApplicationRuntime.ElfSections.GeSectionName(section);
                con.WriteLine(name);
            }

            while (true)
            {
                SysCalls.ThreadSleep(0);

                //SysCalls.WriteDebugChar('~');
                var gotBytes = SysCalls.ReadFile(kb, buf);
                if (gotBytes > 0)
                {
                    for (var byteIdx = 0; byteIdx < gotBytes; byteIdx++)
                    {
                        var bufPtr = (byte *)buf.Start;
                        var key    = bufPtr[byteIdx];
                        var s      = key.ToString("x");
                        //for (var i = 0; i < s.Length; i++)
                        //    SysCalls.WriteDebugChar(s[i]);
                        //SysCalls.WriteDebugChar(' ');
                        for (var i = 0; i < s.Length; i++)
                        {
                            con.Write(s[i]);
                        }
                        con.Write(' ');
                    }
                }
                //SysCalls.WriteDebugChar('?');
            }
        }