internal WaterboxMemoryDomainFunc(MemoryArea m, WaterboxHost monitor)
     : base(m, monitor)
 {
     if (!m.Flags.HasFlag(MemoryDomainFlags.FunctionHook))
     {
         throw new InvalidOperationException();
     }
     _access = MemoryDomainAccessStub.Create(m.Data, monitor);
 }
Exemplo n.º 2
0
 protected T PreInit <T>(WaterboxOptions options)
     where T : LibWaterboxCore
 {
     options.Path ??= CoreComm.CoreFileProvider.DllPath();
     _exe = new WaterboxHost(options);
     using (_exe.EnterExit())
     {
         var ret = BizInvoker.GetInvoker <T>(_exe, _exe, CallingConventionAdapters.Waterbox);
         _core = ret;
         return(ret);
     }
 }
Exemplo n.º 3
0
        protected T PreInit <T>(WaterboxOptions options, IEnumerable <Delegate> allExtraDelegates = null)
            where T : LibWaterboxCore
        {
            options.Path ??= CoreComm.CoreFileProvider.DllPath();
            _exe = new WaterboxHost(options);
            var delegates = new Delegate[] { _inputCallback }.AsEnumerable();

            if (allExtraDelegates != null)
            {
                delegates = delegates.Concat(allExtraDelegates);
            }
            using (_exe.EnterExit())
            {
                var ret = BizInvoker.GetInvoker <T>(_exe, _exe, CallingConventionAdapters.MakeWaterbox(delegates, _exe));
                _core = ret;
                return(ret);
            }
        }
Exemplo n.º 4
0
        public Syscalls(WaterboxHost parent)
        {
            _parent = parent;
            var stdin  = new SpecialFile(Stream.Null, "___stdin");
            var stdout = new SpecialFile(Console.OpenStandardOutput(), "___stdout");
            var stderr = new SpecialFile(Console.OpenStandardError(), "___stderr");

            _openFiles = new List <IFileObject>
            {
                stdin,
                stdout,
                stderr
            };
            _availableFiles = new Dictionary <string, IFileObject>
            {
                [stdin.Name]  = stdin,
                [stdout.Name] = stdout,
                [stderr.Name] = stderr
            };
        }
 public static WaterboxMemoryDomain Create(MemoryArea m, WaterboxHost monitor)
 {
     return(m.Flags.HasFlag(MemoryDomainFlags.FunctionHook)
                         ? (WaterboxMemoryDomain) new WaterboxMemoryDomainFunc(m, monitor)
                         : new WaterboxMemoryDomainPointer(m, monitor));
 }
 public static MemoryDomainAccessStub Create(IntPtr p, WaterboxHost host)
 {
     return(BizInvoker.GetInvoker <MemoryDomainAccessStub>(
                new StubResolver(p), host, CallingConventionAdapters.MakeWaterboxDepartureOnly(host)));
 }