// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: SS_Tlb.cc
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
// The above named program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License version 2 as published by the Free Software Foundation.
// The above named program is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// You should have received a copy of the GNU General Public
// License along with this work; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
// ========== Copyright Header End ============================================
uint_t
SS_Tlb::tlb_id_no
= 0;
SS_Tlb::SS_Tlb( Type type
, uint_t size
)/*{{{*/
ptr_table
= (SS_Tte
**)ss_malloc(sizeof(SS_Tte
*) * tlb_size
);
for (uint_t i
= 0; i
< tlb_size
; i
++)
ptr_table
[i
] = alloc_tte(i
);
SS_Tlb::SS_Tlb( SS_Tlb
& tlb
)/*{{{*/
not_a_clone(false), // only the original not a clone tlb shoud destruct the strands list
strand_list(tlb
.strand_list
), // the structure can be shared ... not_a_clone controls destructing
no_strands(tlb
.no_strands
),
ptr_table
= (SS_Tte
**)ss_malloc(sizeof(SS_Tte
*) * tlb_size
);
memcpy(ptr_table
,tlb
.ptr_table
,sizeof(SS_Tte
*) * tlb_size
);
tlb
.tte_list
= 0; // Avoid having the free list at two places
SS_Tlb
* SS_Tlb::ss_clone( SS_Tlb
* tlb
)/*{{{*/
void SS_Tlb::add_strand( SS_Strand
* strand
)/*{{{*/
strand_list
= new Node(strand
,strand_list
);
void SS_Tlb::rem_strand( SS_Strand
* strand
)/*{{{*/
Node
* head
= strand_list
;
if (head
->strand
== strand
)
strand_list
= head
->next
;
for (Node
* next
= head
->next
; strand
&& next
; head
= next
, next
= next
->next
)
assert (++i
<= no_strands
);
if (next
->strand
== strand
)
SS_Tte
* SS_Tlb::alloc_tte_block()/*{{{*/
SS_Tte
* block
= (SS_Tte
*)ss_malloc(sizeof(SS_Tte
) * SIZE
);
for (uint_t i
= 1; i
< SIZE
; i
++)
void SS_Tlb::dump(FILE *fp
)/*{{{*/
for (int i
=0; i
< size(); i
++)
if (ptr_table
[i
]->valid())