<commit_before>#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/build/debug/Hostboot/Attr.pm $
#
# OpenPOWER HostBoot Project
#
# COPYRIGHT International Business Machines Corp. 2012,2014
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG

#
# This perl module can be used in a standalone Hostboot environment
# (Simics or VBU) or with a L3 dump file to dump a specified target's
# attribute(s).
#
# Authors:  <NAME>
#           <NAME>
#

use strict;
package Hostboot::Attr;
use Hostboot::_DebugFrameworkVMM;
use Exporter;
our @EXPORT_OK = ('main');

use POSIX;
use File::Basename;
use Data::Dumper;
$Data::Dumper::Sortkeys  = 1;


#------------------------------------------------------------------------------
# Constants
#------------------------------------------------------------------------------

use constant PAGESIZE           => 4096;     # 4KB

##  each target object takes up space for:
##      uint32_t iv_attrs + void *iv_pAttrNames + void *iv_pAttrValues
use constant TARGETSIZE             =>  20;
##  Attribute id's are uint32_t enums
use constant    ATTRID_SIZE         =>  4;
##  pointers to attribute values should be 8 bytes
use constant    ATTRVALUESPTR_SIZE  =>  8 ;

##  size of the TargetsHdr struct at the beginning of PNOR
use constant    TARGETS_HDR_SIZE    =>  0x100;

#------------------------------------------------------------------------------
# Globals
#------------------------------------------------------------------------------

my %pages = ();
my  %sections   =   (
                     'PNOR_RO'           => {   'vaddr'     =>  0x100000000,
                                                'physaddr'  =>  0x0,
                                            },
                     'PNOR_RW'           => {   'vaddr'     =>  0x108000000,
                                                'physaddr'  =>  0x0,
                                            },
                     'HEAP_ZERO_INIT'    => {   'vaddr'     =>  0x110000000,
                                                'physaddr'  =>  0x0,
                                            },
                     'HB_HEAP_ZERO_INIT' => {   'vaddr'     =>  0x118000000,
                                                'physaddr'  =>  0x0,
                                            },
                     );<commit_msg>Fix Target size in Attr.pm debug tool<commit_after>#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/build/debug/Hostboot/Attr.pm $
#
# OpenPOWER HostBoot Project
#
# COPYRIGHT International Business Machines Corp. 2012,2014
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG

#
# This perl module can be used in a standalone Hostboot environment
# (Simics or VBU) or with a L3 dump file to dump a specified target's
# attribute(s).
#
# Authors:  <NAME>
#           Mark Wenning
#

use strict;
package Hostboot::Attr;
use Hostboot::_DebugFrameworkVMM;
use Exporter;
our @EXPORT_OK = ('main');

use POSIX;
use File::Basename;
use Data::Dumper;
$Data::Dumper::Sortkeys  = 1;


#------------------------------------------------------------------------------
# Constants
#------------------------------------------------------------------------------

use constant PAGESIZE           => 4096;     # 4KB

##  each target object takes up space for:
##      uint32_t iv_attrs + void *iv_pAttrNames + void *iv_pAttrValues
##      + void* iv_ppAssociations[4]
use constant TARGETSIZE             =>  52;
##  Attribute id's are uint32_t enums
use constant    ATTRID_SIZE         =>  4;
##  pointers to attribute values should be 8 bytes
use constant    ATTRVALUESPTR_SIZE  =>  8 ;

##  size of the TargetsHdr struct at the beginning of PNOR
use constant    TARGETS_HDR_SIZE    =>  0x100;

#------------------------------------------------------------------------------
# Globals
#------------------------------------------------------------------------------

my %pages = ();
my  %sections   =   (
                     'PNOR_RO'           => {   'vaddr'     =>  0x100000000,
                                                'physaddr'  =>  0x0,
                                            },
                     'PNOR_RW'           => {   'vaddr'     =>  0x108000000,
                                                'physaddr'  =>  0x0,
                                            },
                     'HEAP_ZERO_INIT'    => {   'vaddr'     =>  0x110000000,
                                                'physaddr'  =>  0x0,
                                            },
                     'HB_HEAP_ZERO_INIT' => {   'vaddr'     =>  0x118000000,
                                                'physaddr'  =>  0x0,
                                            },
                     );
{'fraction_non_alphanumeric': 0.18622580092513277, 'fraction_numerical': 0.027582662326537603, 'mean_word_length': 1.2930086410054988, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4206554', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1447, 'n_words': 467}