Beispiel #1
0
        internal static OpenFileCompletion OpenAndGetSizeAsync(Thread current, byte[] filename, int flags, int mode)
        {
            ArchDefinition.Assert(filename[filename.Length - 1] == 0);
            var buf = Globals.AllocateAlignedCompletionBuffer(filename.Length);

            if (!buf.isValid)
            {
                return(null);
            }

            buf.CopyFrom(0, filename);

            var completion = new OpenFileCompletion(current, GenericINode.INodeKind.ArchINodeKind, buf, flags, mode);

            IPCStubs.OpenAndGetSizeAsync(current.Parent.helperPid, current.impl._value.thread._value, new Pointer(completion.buf.Location), flags, mode);
            return(completion);
        }
Beispiel #2
0
        public static Pointer linux_sys_get_user_page(int helper_pid, uint faultType, Pointer shadowAddress)
        {
            SetMR(0, (int)Type.EXPRESSOS_OP_GET_USER_PAGE);
            SetMR(1, helper_pid);
            SetMR(2, faultType & L4FPage.L4_FPAGE_FAULT_WRITE);
            SetMR(3, shadowAddress.ToUInt32());

            var tag = new Msgtag((int)IPCTag.EXPRESSOS_IPC, 4, 0, 0);
            var res = l4_stub_ipc_call(ArchGlobals.LinuxServerTid, tag, Timeout.Never);

            if (l4_stub_ipc_error(res) != 0)
            {
                return(Pointer.Zero);
            }

            var relative_pos = GetMR(1);

            ArchDefinition.Assert(relative_pos < ArchGlobals.LinuxMainMemorySize);
            return(ArchGlobals.LinuxMainMemoryStart + relative_pos);
        }