source: mainline/kernel/tools/amd64/decpt.py@ 954c024

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 954c024 was a35b458, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 7 years ago

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

  • Property mode set to 100755
File size: 621 bytes
Line 
1#!/usr/bin/env python
2"""
3Decode 64-bit address into components
4"""
5import sys
6
7def main():
8 if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'):
9 print("%s 0x..." % sys.argv[0])
10 sys.exit(1)
11
12 address = int(sys.argv[1],16)
13 offset = address & 0xfff
14 ptl3 = (address >> 12) & 0x1ff
15 ptl2 = (address >> 21) & 0x1ff
16 ptl1 = (address >> 30) & 0x1ff
17 ptl0 = (address >> 39) & 0x1ff
18 print("Ptl0: %3d" % ptl0)
19 print("Ptl1: %3d" % ptl1)
20 print("Ptl2: %3d" % ptl2)
21 print("Ptl3: %3d" % ptl3)
22 print("Offset: 0x%x" % offset)
23
24if __name__ == '__main__':
25 main()
Note: See TracBrowser for help on using the repository browser.