package Midas
::MMU
::Niagara2
;
use TRELoad
'BitFieldTie';
##############################################################################
my $this = fields
::new
($class);
foreach my $key (keys %args) {
$this->{$key} = $args{$key};
$this->{mapattr_type
} = 'Midas::MMU::Niagara2::SectionAttrs';
$this->{tsb_type
} = 'Midas::MMU::Niagara2::TSB';
##############################################################################
$this->{vasize
} = 64 unless defined $this->{vasize
};
$this->{pasize
} = 40 unless defined $this->{pasize
};
$this->{rasize
} = 40 unless defined $this->{rasize
};
$this->{type
} = 'niagara2' unless defined $this->{type
};
$this->SUPER::set_defaults
();
##############################################################################
my $list = ['-DNIAGARA2'];
push @
$list, '-DALLOW_TSB_COL' if $CONFIG{allow_tsb_conflicts
};
##############################################################################
##############################################################################
##############################################################################
package Midas
::MMU
::Niagara2
::SectionAttrs
;
use Midas
::MMU
::SunSectionAttrs
;
use Midas
::MMU
::TTEFormat
;
use base
qw(Midas::MMU::SunHyperAttrs);
# Hard-code MMU type because 'use fields' directive needs
# to happen at compile-time
keys %{ get_union_tte_field_hash
('niagara2') }
our %Settable = map { $_ => 1} Midas
::MMU
::Niagara2
::SectionAttrs
->settable();
############################################################################
$this = fields
::new
($this);
$this->{settable
} = \
%Settable;
foreach my $key (keys %args) {
$this->{$key} = $args{$key};
############################################################################
$this->SUPER::set_defaults
();
foreach my $field (keys %FieldSizes) {
$this->{$field} = 0 unless defined $this->{$field};
#############################################################################
my @settable = $this->SUPER::settable
();
push @settable, @Settable;
#############################################################################
sub get_field_size_hash
{
my $sizes = $this->SUPER::get_field_size_hash
();
foreach my $field (keys %FieldSizes) {
$sizes->{$field} = $FieldSizes{$field};
############################################################################
###########################################################################
##############################################################################
##############################################################################
package Midas
::MMU
::Niagara2
::TSB
;
############################################################################
$this = fields
::new
($this);
$this->{force_ctx_zero
} = undef;
$this->{page_size
} = undef;
foreach my $key (keys %args) {
$this->{$key} = $args{$key};
############################################################################
sub config_from_register
{
my $config = BitFieldTie
->new(64, $this->{config_register
});
my $base = BitFieldTie
->new($PASIZE, 0);
tie
my %config, 'BitFieldTie', $config;
tie
my %base, 'BitFieldTie', $base;
$base{'39:13'} = $config{'39:13'};
$this->{page_size
} = $config{'6:4'};
$this->{ttefmt
} = $config{7} ?
'sun4v' : 'sun4u';
$this->{sizebits
} = $config{'3:0'};
$this->{numentries
} = 512 * (1 << $this->{sizebits
});
my $base_lo = 13 + $this->{sizebits
};
my $overlap = $base->extract($base_lo, 13);
if($CONFIG{allow_misaligned_tsb_base
}) {
$base->store($base_lo, 13, 0);
fatal
"TSB '$this->{name}' has base $base, which\n".
" is misaligned for size=$this->{sizebits}\n" .
" Illegal unless -allow_misalgined_tsb_base is defined.\n" .
" line=$this->{srcline}, file=$this->{srcfile}\n",
############################################################################
##############################################################################
##############################################################################