403Webshell
Server IP : 178.105.222.151  /  Your IP : 216.73.216.38
Web Server : nginx/1.28.3
System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.5.4
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/DistUpgrade/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/DistUpgrade/__pycache__/RiscvProfile.cpython-314.pyc
+
�[�iI$��<�Rt^RIt!RR]4t!RR4tR#)aX
riscv_extension_analyzer

This module provides functionality for analyzing and parsing RISC-V extension
strings.

Key Features:
- Validate RISC-V extension strings to ensure they conform to the expected
  format.
- Parse extension strings to extract base ISA information and supported
  extensions.

Author: Heinrich Schuchardt
Version: 0.0.1
Nc�6aa�]tRt^toRtV3RltRtVtV;t#)�RiscvProfileExceptiona
Exception raised for errors related to RISC-V extensions.

This exception is a subclass of RuntimeError and is used to indicate
issues specifically related to the RISC-V instruction set architecture
extensions.

Attributes:
    message (str): A description of the error.
c�&<�\SV`V4R#)N)�super�__init__)�self�message�	__class__s&&��:/usr/lib/python3/dist-packages/DistUpgrade/RiscvProfile.pyr�RiscvProfileException.__init__!s���
����!��)	�__name__�
__module__�__qualname__�__firstlineno__�__doc__r�__static_attributes__�__classdictcell__�
__classcell__)r	�
__classdict__s@@r
rrs����	�"�"rrc�da�]tRt^%toRtRtRtRtRtRt	Rt
]R4tR	t
R
tRtVtR#)
�RiscvProfilez`
RiscvProfile

This class provides functionality to analyze and parse RISC-V extension
strings.
c�H�.RNRNRNRNRNRNRNRNR	NR
NRNRNR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0NR1NR2NR3NR4NR5NR6NR7NR8NR9NR:NR;NR<NR=NR>NR?NR@NRANRBNRCNRDNRENRFNRGNpVPV4V#)Hz�
Gets the extensions published by the Linux kernel

Returns: List of extensions

Raises:
    RiscvExtException: If the provided ISA string is invalid.
�i�m�a�f�d�q�c�v�zicbom�zicboz�ziccrse�zicntr�zicond�zicsr�zifencei�	zihintntl�zihintpause�zihpm�zimop�zabha�zacas�zawrs�zfa�zfh�zfhmin�zca�zcb�zcd�zcf�zcmop�zba�zbb�zbc�zbkb�zbkc�zbkx�zbs�zk�zkn�zknd�zkne�zknh�zkr�zks�zkt�zksed�zksh�ztso�zvbb�zvbc�zve32f�zve32x�zve64d�zve64f�zve64x�zvfh�zvfhmin�zvkb�zvkg�zvkn�zvknc�zvkned�zvkng�zvknha�zvknhb�zvks�zvksc�zvksed�zvksh�zvksg�zvkt��add_implied_extensions)r�
linux_6_14s& r
�linux_supported�RiscvProfile.linux_supported-s���
��
��
��
��
� #�
�%(�
�*-�
�/2�
�4<�
�>F�
��
��
�!)�
�+2�
�4>�
�
�
�'�
�)0�
�29�
�;B�
�DK�
�
�	
��	
�"�	
�$,�	
�.3�	
�5:�	
�<A�	
�CH�	
�

�
�
�
�
"�
�
$)�
�
+1�
�
39�
�
;A�
�
CH�
�
�

��

� �

�"(�

�*0�

�27�

�9>�

�@E�

�
�
��
�$�
�&,�
�.4�
�6>�
�@H�
�
�
��
�!)�
�+1�
�3<�
�>D�
�FL�
�
�
��
�&�
�(/�
�19�
�;C�
�EK�
�
�
��
� '�
�)0�
�28�
�
�	
�#�#�J�/��rc��.RNRNRNRNRNRNRNRNR	NR
NRNRNR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NpVPV4V#)#z�
Gets the mandatory extensions for the RVA23U64 profile

Returns: List of extensions

Raises:
    RiscvExtException: If the provided ISA string is invalid.
rrrrrr �br!�zic64br"�zicbopr#�ziccamoa�ziccif�zicclsmr$r%r&r'r)r*r+r,�za64rsr/r0r2r4r7rJrRr`rF�supmra)r�rva23s& r
�rva23_required�RiscvProfile.rva23_requiredGsW��
��
��
��
��
� #�
�%(�
�*-�
�/2�
�4<�
�>F�
��
��
� *�
�,4�
�6?�
�AJ�
�
�
��
�!(�
�*5�
�7D�
�FM�
�
�	
��	
� '�	
�).�	
�08�	
�:?�	
�AH�	
�

�
�
�
�
 &�
�
(-�
�
/5�
��	
�#�#�E�*��rc��VP4pVP4pVUu.uF
q3V9gKVNK	up#uupi)z�
Gets the required RVA23 extensions published by the Linux kernel

Returns: List of extensions

Raises:
    RiscvExtException: If the provided ISA string is invalid.
)rdrp)r�linux�check�exts&   r
�rva23_to_check�RiscvProfile.rva23_to_check\s>���$�$�&���#�#�%��$�5�u��u����u�5�5��5s�;�;c��R^�R^@R^ /pRpVP4F.wrEVPV4'gKTpV\V4RpM	Vf\R4hVX3#)ad
Checks the base instruction set architecture (ISA) provided by a
RISC-V extension string.

Args:
    isa_string (str): The RISC-V extension string to analyze.

Returns:
    bitness (int): Bitness of base ISA.
    remainder (str): Remaining ISA string.

Raises:
    RiscvProfileException:
    If the string does not start with a valid base ISA identifier.
�rv128�rv64�rv32NzInvalid base ISA)�items�
startswith�lenr)r�
isa_string�	base_isas�bitness�key�value�	remainders&&     r
�check_base_isa�RiscvProfile.check_base_isaks{��$
�S��B��B��	�
��#�/�/�+�J�C��$�$�S�)�)���&�s�3�x�y�1�	��	,��?�'�(:�;�;��	�!�!rc���RR.RR.RR.RR.RR.R	R.R
R./pR.ROR
.ROR.ROR.ROR.R OR.R!ORRR.RRR.R.R"ORRR.RRR./pRpV'dRRpVFGpWS9gKW5,FpWa9gKVPV4K	VPV4RpKU	KYRpV'dIRpVF>pWR9d+W%,FpWa9gKVPV4RpK 	V'gK=KL	KPR#)#zG
Adds implied extensions

Args:
    extensions: iterable of extensions
r�zmmulr�zaamorr'rrr!r1r2rg�gr?r@rErUrVrKrXrTr[r\r_TFN)r8r9r>)rrrrrr'r()r@rDrF)r;r<r=rBrArC)r;r<r=rGrH)rWrZrSr`)r]r^rSr`)�append�remove)r�
extensions�implies�	shorthand�update�	extension�implieds&&     r
rb�#RiscvProfile.add_implied_extensions�sI��
�'���'���'���#���#���#���H�:�
��
�&��?��'��C��<��8��f�f�%��f�f�%��7��f�f�%��f�f�%�
�	�����F�'�	��)�#,�#7�#7��"�4�&�-�-�g�6�$8��%�%�i�0�!�F��(�����F�'�	��'�#*�#5�#5��"�4�&�-�-�g�6�%)�F�$6��6��(�rc���Rp.p\V4^8�EdCVPR4'dVR,pV'g\R4hMV'd\R4hV^,R9dRpV'd\P!RV4pM\P!R	V4pV'g\R
4hVP4pWP
4RpVR9dR\P!RV4pV'g\P!R
V4pV'dVRVP4pV'g\R4hVPV4EKSVPV4V#)z�
Parse RISC-V ISA string

args:
    isa_string: ISA string without base ISA (e.g. rv64)

Raises:
    RiscvExtException: If the provided ISA string is invalid.
F�_:�NNzMissing extensionzExpecting underscore�sxzTz^[^_]+z^\D\d+p\d+|\D\d+|\DzExpecting extensionNz\d+p\d+$z\d+$zZero length extension>�sv32�sv39�sv48�sv59)r~r}r�re�match�group�end�search�startr�rb)rr�multi_characterr�r�r�s&&    r
�parse_isa_string�RiscvProfile.parse_isa_string�s(�� ���
��*�o��!��$�$�S�)�)�'��^�
�!�/�0C�D�D�"� �+�,B�C�C��!�}��%�"&�������J�7�����!7��D���+�,A�B�B����
�I�#�I�I�K�L�1�J�� @�@��	�	�+�y�9����I�I�g�y�9�E�� )�.�5�;�;�=� 9�I��+�,C�D�D����i�(��#�#�J�/��rc��\RR4;_uu_4pVP4pRRR4XP	RRR7P4pTF?p\P!RT4pT'gK$\YEP4R4u#	\R	4h +'giL�;i \dp\R4ThRp?ii;i)
z�
Gets the extensions listed in /proc/cpuinfo as common for all harts

Returns: List of extensions

Raises:
    RiscvExtException: If the ISA string is invalid or cannot be found
z
/proc/cpuinfo�rbNzCan't read /proc/cpuinfozutf-8�ignore)�errorsz
isa\s*:\s*zNo ISA information)
�open�read�OSErrorr�decode�
splitlinesr�r�rr�)�file�binary_content�ex�lines�liner�s      r
�read_cpuinfo�RiscvProfile.read_cpuinfo�s���	M��o�t�,�,��!%�����-�
�%�%�g�h�%�?�J�J�L���D��H�H�]�D�1�E��u�#�D�����$6�7�7��
$�$8�9�9�-�,���	M�'�(C�D�"�L��	M�s3�B3�B �B3� B0	�+B3�0B3�3C�>C
�
Cc�t�VP4pVF!pW P9gK\RV24h	R#)ze
Check if the system is RVA23 ready

Raises:
    RiscvExtException: If the system is not RVA23 ready
zMissing extension N)rvr�r)r�expectedrus&  r
�assert_rva23_ready�RiscvProfile.assert_rva23_readys9���&�&�(���C��/�/�)�+�.@���,F�G�G�rc��VP4pVPV4wVnpVPV4VnR#)z�
Initializes a RiscvProfile object with a given RISC-V ISA
string.

Args:
    isa_string (str): The RISC-V ISA string to analyze.

Raises:
    RiscvExtException: If the provided ISA string is invalid.
N)�lowerr�r�r�r�)rrr�s&& r
r�RiscvProfile.__init__s;�� �%�%�'�
�"&�"5�"5�j�"A����i��/�/�	�:��r)r�r�N)rrrrrrdrprvr�rbr��staticmethodr�r�rrr)rs@r
rr%sO������4�*
6� "�D8�t/�b�:��:�0H�;�;rr)rr��RuntimeErrorrrr
rr
�<module>r�s'��� 
�
"�L�
"� G;�G;r

Youez - 2016 - github.com/yon3zu
LinuXploit