source: mainline/kernel/tools/ia32/decpt.py@ f1380b7

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since f1380b7 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: 491 bytes
Line 
1#!/usr/bin/env python
2"""
3Decode 32-bit address into PTE 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 ptl1 = (address >> 12) & 0x3ff
15 ptl0 = (address >> 22) & 0x3ff
16 print("Ptl0: %3d" % ptl0)
17 print("Ptl1: %3d" % ptl1)
18 print("Offset: 0x%x" % offset)
19
20if __name__ == '__main__':
21 main()
Note: See TracBrowser for help on using the repository browser.