* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: mpsort.H
* 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 ============================================
// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: mpsort.H
// 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 ============================================
RSTZIP_MAXCPUS = 32 // max cpus supported in trace
unsigned cpu : 1; // max number of cpus = 2
unsigned count : 7; // max rec count = 127; 0 means extended
unsigned cpu : 2; // max number of cpus = 4
unsigned count : 6; // max rec count = 63; 0 means extended
unsigned cpu : 3; // max number of cpus = 32
unsigned count : 5; // max rec count = 31; 0 means extended
unsigned cpu : 4; // max number of cpus = 16
unsigned count : 4; // max rec count = 15; 0 means extended
unsigned cpu : 5; // max number of cpus = 32
unsigned count : 3; // max rec count = 7; 0 means extended
// multirst is a buffer containing nrstrecs records
// unirst[n] is a buffer with space for nrstrecs records
// cpucount is a buffer with space for nrstrecs CpuCount records
// *curcpu is the cpu for the previous RST record
// The total number of CpuCount records is returned.
int sortRstTrace(rstf_unionT* multirst, int nrecs,
RstSplit* unirst, CpuCount* cpucount, int* curcpu) {
int numcpus = 0; // Number of cpu's in this trace.
for (i = 0, j = 0; i < nrecs; i++) {
if (multirst[i].proto.rtype == CPU_T) {
cpucount[j].cpu = *curcpu;
cpucount[j].count = count;
*curcpu = multirst[i].cpu.cpu;
unirst[*curcpu].rst[unirst[*curcpu].nrecs] = multirst[i];
cpucount[j].cpu = *curcpu;
cpucount[j].count = count;