mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Page index to address translation script
This commit is contained in:
12
scripts/vmem_translate.py
Executable file
12
scripts/vmem_translate.py
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
def translate(i4 = 0, i3 = 0, i2 = 0, i1 = 0, offset = 0):
|
||||||
|
addr = (i4 << 39) + (i3 << 30) + (i2 << 21) + (i1 << 12) + offset
|
||||||
|
if addr & (1 << 47):
|
||||||
|
addr |= 0xffff000000000000
|
||||||
|
return addr
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import sys
|
||||||
|
print("{:016x}".format(translate(*map(int, sys.argv[1:]))))
|
||||||
|
|
||||||
Reference in New Issue
Block a user