本文整理汇总了C#中Pointer.ToUInt32方法的典型用法代码示例。如果您正苦于以下问题:C# Pointer.ToUInt32方法的具体用法?C# Pointer.ToUInt32怎么用?C# Pointer.ToUInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pointer
的用法示例。
在下文中一共展示了Pointer.ToUInt32方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReturnFromPageFault
public static void ReturnFromPageFault(L4Handle target, out Msgtag tag, ref MessageRegisters mr, uint pfa, Pointer physicalPage, uint permssion)
{
var virt_page_addr = ArchDefinition.PageIndex(physicalPage.ToUInt32());
var fpage = new L4FPage(virt_page_addr, ArchDefinition.PageShift, (int)permssion);
tag = new Msgtag(0, 0, 1, 0);
mr.mr0 = (int)(ArchDefinition.PageIndex(pfa) | Msgtag.L4_ITEM_MAP);
mr.mr1 = (int)fpage.raw;
NativeMethods.l4api_ipc_send(target, NativeMethods.l4api_utcb(), tag, Timeout.Never);
}
示例2: CompressFragment
private static int CompressFragment(byte[] source, int length, HashTable hashTable, byte[] scratchOutput)
{
const int inputMarginBytes = 15;
int shift = 32 - Log2Floor(hashTable.Size);
var op = new Pointer(scratchOutput);
var ip = new Pointer(source);
var nextEmit = new Pointer(source);
var baseIp = new Pointer(ip);
Func<Pointer, int, uint> hashPtr = (value, offset) => (value.ToUInt32(offset)*0x1e35a7bd) >> shift;
if(length >= inputMarginBytes)
{
var ipLimit = length - inputMarginBytes;
ip = ip + 1;
var nextHash = hashPtr(ip, 0);
while(true)
{
uint skip = 32;
var nextIp = new Pointer(ip);
Pointer candidate;
do
{
ip = nextIp;
uint hash = nextHash;
Debug.Assert(hash == hashPtr(ip, 0));
uint bytesBetweenHashLookups = skip++ >> 5;
nextIp = ip + bytesBetweenHashLookups;
if(nextIp > ipLimit)
goto emit_remainder;
nextHash = hashPtr(nextIp, 0);
candidate = baseIp + hashTable[hash];
Debug.Assert(candidate >= baseIp);
Debug.Assert(candidate < ip);
hashTable[hash] = ip - baseIp;
} while(ip.ToUInt32() != candidate.ToUInt32());
Debug.Assert(nextEmit + 16 <= length);
op = EmitLiteral(op, nextEmit, ip - nextEmit, true);
Pointer inputBytes;
uint candidateBytes;
do
{
Pointer b = ip;
int matched = 4 + FindMatchLength(candidate + 4, ip + 4, length);
ip += matched;
var offset = b - candidate;
op = EmitCopy(op, offset, matched);
Pointer insertTail = ip - 1;
nextEmit = ip;
if(ip >= ipLimit)
goto emit_remainder;
inputBytes = insertTail;
var prevHash = hashPtr(inputBytes, 0);
hashTable[prevHash] = ip - baseIp - 1;
var curHash = hashPtr(inputBytes, 1);
candidate = baseIp + hashTable[curHash];
candidateBytes = candidate.ToUInt32();
hashTable[curHash] = ip - baseIp;
} while(inputBytes.ToUInt32(1) == candidateBytes);
nextHash = hashPtr(inputBytes, 2);
ip = ip + 1;
}
}
emit_remainder:
if(nextEmit < length)
op = EmitLiteral(op, nextEmit, length - nextEmit, false);
return op;
}
示例3: FindMatchLength
private static int FindMatchLength(Pointer p1, Pointer p2, int length)
{
int matched = 0;
while(p2 <= length - 4 && p2.ToUInt32() == (p1 + matched).ToUInt32())
{
p2 += 4;
matched += 4;
}
if(p2 <= length - 4)
{
var x = p2.ToUInt32() ^ (p1 + matched).ToUInt32();
var matchingBits = FindLSBSetNonZero(x);
matched += matchingBits >> 3;
}
else
{
while((p2 < length) && (p1[matched] == p2[0]))
{
p2 += 1;
++matched;
}
}
return matched;
}
示例4: linux_sys_get_user_page
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;
}
示例5: linux_sys_futex_wake
public static int linux_sys_futex_wake(int helper_pid, uint handle, int op, Pointer shadowAddr, uint bitset)
{
SetMR(0, (int)Type.EXPRESSOS_OP_FUTEX_WAKE);
SetMR(1, helper_pid);
SetMR(2, handle);
SetMR(3, op);
SetMR(4, shadowAddr.ToUInt32());
SetMR(5, bitset);
var tag = new Msgtag((int)IPCTag.EXPRESSOS_IPC, 6, 0, 0);
var res = l4_ipc_send(ArchGlobals.LinuxServerTid, tag, Timeout.Never);
return l4_stub_ipc_error(res) != 0 ? -1 : 0;
}
示例6: linux_sys_alien_mmap2
public static uint linux_sys_alien_mmap2(int helper_pid, Pointer addr, int length, int prot, int flags, int fd, int pgoffset)
{
SetMR(0, (int)Type.EXPRESSOS_OP_ALIEN_MMAP2);
SetMR(1, helper_pid);
SetMR(2, addr.ToUInt32());
SetMR(3, length);
SetMR(4, prot);
SetMR(5, flags);
SetMR(6, fd);
SetMR(7, pgoffset);
var tag = new Msgtag((int)IPCTag.EXPRESSOS_IPC, 8, 0, 0);
var res = l4_stub_ipc_call(ArchGlobals.LinuxServerTid, tag, Timeout.Never);
return l4_stub_ipc_error(res) != 0 ? 0xffffffffU : (uint)GetMR(1);
}