2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * Authors: Nathan Binkert
32 #include "arch/alpha/tru64/system.hh"
33 #include "arch/isa_traits.hh"
34 #include "arch/vtophys.hh"
35 #include "base/loader/symtab.hh"
36 #include "base/trace.hh"
37 #include "cpu/base.hh"
38 #include "cpu/thread_context.hh"
39 #include "kern/tru64/tru64_events.hh"
40 #include "kern/system_events.hh"
41 #include "mem/physical.hh"
42 #include "mem/port.hh"
43 #include "sim/builder.hh"
47 Tru64AlphaSystem::Tru64AlphaSystem(Tru64AlphaSystem::Params
*p
)
51 if (kernelSymtab
->findAddress("enable_async_printf", addr
)) {
52 virtPort
.write(addr
, (uint32_t)0);
56 kernelPanicEvent
= addKernelFuncEvent
<BreakPCEvent
>("panic");
57 if (!kernelPanicEvent
)
58 panic("could not find kernel symbol \'panic\'");
61 badaddrEvent
= addKernelFuncEvent
<BadAddrEvent
>("badaddr");
63 panic("could not find kernel symbol \'badaddr\'");
66 addKernelFuncEvent
<SkipFuncEvent
>("tl_v48_capture_power_state");
67 skipScavengeBootEvent
=
68 addKernelFuncEvent
<SkipFuncEvent
>("pmap_scavenge_boot");
71 printfEvent
= addKernelFuncEvent
<PrintfEvent
>("printf");
72 debugPrintfEvent
= addKernelFuncEvent
<DebugPrintfEvent
>("m5printf");
73 debugPrintfrEvent
= addKernelFuncEvent
<DebugPrintfrEvent
>("m5printfr");
74 dumpMbufEvent
= addKernelFuncEvent
<DumpMbufEvent
>("m5_dump_mbuf");
78 Tru64AlphaSystem::~Tru64AlphaSystem()
81 delete kernelPanicEvent
;
84 delete skipPowerStateEvent
;
85 delete skipScavengeBootEvent
;
88 delete debugPrintfEvent
;
89 delete debugPrintfrEvent
;
94 BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem
)
96 Param
<Tick
> boot_cpu_frequency
;
97 SimObjectParam
<PhysicalMemory
*> physmem
;
100 Param
<string
> console
;
103 Param
<string
> boot_osflags
;
104 Param
<string
> readfile
;
105 Param
<unsigned int> init_param
;
107 Param
<uint64_t> system_type
;
108 Param
<uint64_t> system_rev
;
110 END_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem
)
112 BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem
)
114 INIT_PARAM(boot_cpu_frequency
, "frequency of the boot cpu"),
115 INIT_PARAM(physmem
, "phsyical memory"),
116 INIT_PARAM(kernel
, "file that contains the kernel code"),
117 INIT_PARAM(console
, "file that contains the console code"),
118 INIT_PARAM(pal
, "file that contains palcode"),
119 INIT_PARAM_DFLT(boot_osflags
, "flags to pass to the kernel during boot",
121 INIT_PARAM_DFLT(readfile
, "file to read startup script from", ""),
122 INIT_PARAM_DFLT(init_param
, "numerical value to pass into simulator", 0),
123 INIT_PARAM_DFLT(system_type
, "Type of system we are emulating", 12),
124 INIT_PARAM_DFLT(system_rev
, "Revision of system we are emulating", 2<<1)
126 END_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem
)
128 CREATE_SIM_OBJECT(Tru64AlphaSystem
)
130 AlphaSystem::Params
*p
= new AlphaSystem::Params
;
131 p
->name
= getInstanceName();
132 p
->boot_cpu_frequency
= boot_cpu_frequency
;
133 p
->physmem
= physmem
;
134 p
->kernel_path
= kernel
;
135 p
->console_path
= console
;
137 p
->boot_osflags
= boot_osflags
;
138 p
->init_param
= init_param
;
139 p
->readfile
= readfile
;
140 p
->system_type
= system_type
;
141 p
->system_rev
= system_rev
;
143 return new Tru64AlphaSystem(p
);
146 REGISTER_SIM_OBJECT("Tru64AlphaSystem", Tru64AlphaSystem
)