// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: gen_test1.C
// 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 ============================================
* generate an rst record of each type - verify that trconv displays it correctly
const char usage[] = "gen_test1.C > output.rst";
void zeroit(rstf_unionT * pr)
memset(pr, 0, sizeof(rstf_unionT));
void dumpit(rstf_unionT * pr)
if (fwrite(pr, sizeof(rstf_unionT), 1, stdout) != 1) {
perror("gen_test1: error writing to stdout");
int main(int argc, char *argv[])
assert(sizeof(ru) == 24);
ru.header.rtype = RSTHEADER_T;
ru.header.majorVer = RSTF_MAJOR_VERSION;
ru.header.minorVer = RSTF_MINOR_VERSION;
sprintf(ru.header.header_str, "RST Header v%s", RSTF_VERSION_STR);
const char desc_string[] = "hex digits F-0: FEDCBA9876543210";
ru.string.rtype = STRCONT_T;
memcpy(ru.string.string, desc_string, 23);
ru.string.rtype = STRDESC_T;
strcpy(ru.string.string, desc_string+23);
ru.tlb.tlb_type = 0; // instr
rstf_tlbT_set_cpuid(&ru.tlb, 593);
ru.tlb.tte_tag = 0x00000000ffd00000ull;
ru.tlb.tte_data = 0xc000000000e00064ull;
ru.tlb.tlb_type = 1; // instr
rstf_tlbT_set_cpuid(&ru.tlb, 0);
ru.tlb.tte_tag = 0x0000030016054000ull;
ru.tlb.tte_data = 0x8000000066cd4036ull;
rstf_pregT_set_cpuid(&ru.preg, 1023);
ru.preg.primA = ru.preg.primD = 1432;
ru.pavadiff.rtype = PAVADIFF_T;
ru.pavadiff.ea_valid = 1;
rstf_pavadiffT_set_cpuid(&ru.pavadiff, 347);
ru.pavadiff.icontext = ru.pavadiff.dcontext = 1432;
ru.pavadiff.pc_pa_va = 0x1300000;
ru.pavadiff.ea_pa_va = 0xff00768000;
ru.instr.rtype = INSTR_T;
rstf_instrT_set_cpuid(&ru.instr, 347);
ru.instr.instr = 0xde0fbfe8; // ldub
ru.instr.pc_va = 0xdcba4fcc;
ru.instr.ea_va = 0x1047e8;
ru.trapping_instr.rtype = TRAPPING_INSTR_T;
rstf_trapping_instrT_set_cpuid(&ru.trapping_instr, 347);
ru.trapping_instr.hpriv=1;
ru.trapping_instr.priv=0;
ru.trapping_instr.iftrap = 0;
ru.trapping_instr.pc_va = 0x4350fc00;
ru.trapping_instr.instr = 0xde0fbfe8;
ru.trapping_instr.ea_va_valid = 1;
ru.trapping_instr.ea_va = 0x3141590;
ru.trapping_instr.ea_pa_valid = 0;
rstf_trapT_set_cpuid(&ru.trap, 2);