summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rw-r--r--kern/freebsd/freebsd_system.cc51
-rw-r--r--kern/freebsd/freebsd_system.hh16
2 files changed, 64 insertions, 3 deletions
diff --git a/kern/freebsd/freebsd_system.cc b/kern/freebsd/freebsd_system.cc
index a22fda9dc..08d1af824 100644
--- a/kern/freebsd/freebsd_system.cc
+++ b/kern/freebsd/freebsd_system.cc
@@ -29,7 +29,7 @@
/**
* @file
* Modifications for the FreeBSD kernel. Based off of kern/linux/linux_system.cc.
- * Currently only used to skip DELAY function. -Ben
+ * Currently only used to skip DELAY function.
*
*/
@@ -64,11 +64,60 @@ FreebsdSystem::FreebsdSystem(Params *p)
skipDelayEvent = new SkipFuncEvent(&pcEventQueue, "DELAY");
if (kernelSymtab->findAddress("DELAY", addr))
skipDelayEvent->schedule(addr+sizeof(MachInst));
+
+ skipOROMEvent = new SkipFuncEvent(&pcEventQueue, "orm_identify");
+ if (kernelSymtab->findAddress("orm_identify", addr))
+ skipOROMEvent->schedule(addr+sizeof(MachInst));
+
+ skipAicEvent = new SkipFuncEvent(&pcEventQueue, "ahc_isa_identify");
+ if (kernelSymtab->findAddress("ahc_isa_identify", addr))
+ skipAicEvent->schedule(addr+sizeof(MachInst));
+
+ skipPNPEvent = new SkipFuncEvent(&pcEventQueue, "pnp_identify");
+ if (kernelSymtab->findAddress("pnp_identify", addr))
+ skipPNPEvent->schedule(addr+sizeof(MachInst));
+
+ skipATAEvent = new SkipFuncEvent(&pcEventQueue, "ata_attach");
+ if (kernelSymtab->findAddress("ata_attach", addr))
+ skipATAEvent->schedule(addr+sizeof(MachInst));
+
+ skipCalibrateClocks = new FreebsdSkipCalibrateClocksEvent(&pcEventQueue, "calibrate_clocks");
+ if (kernelSymtab->findAddress("calibrate_clocks", addr))
+ skipCalibrateClocks->schedule(addr + sizeof(MachInst) * 2);
+
}
+
FreebsdSystem::~FreebsdSystem()
{
delete skipDelayEvent;
+ delete skipOROMEvent;
+ delete skipAicEvent;
+ delete skipATAEvent;
+ delete skipPNPEvent;
+ delete skipCalibrateClocks;
+}
+
+
+void
+FreebsdSystem::doCalibrateClocks(ExecContext *xc)
+{
+ Addr ppc_vaddr = 0;
+ Addr timer_vaddr = 0;
+ Addr ppc_paddr = 0;
+ Addr timer_paddr = 0;
+
+ ppc_vaddr = (Addr)xc->regs.intRegFile[ArgumentReg1];
+ timer_vaddr = (Addr)xc->regs.intRegFile[ArgumentReg2];
+
+ ppc_paddr = vtophys(physmem, ppc_vaddr);
+ timer_paddr = vtophys(physmem, timer_vaddr);
+
+ uint8_t *ppc = physmem->dma_addr(ppc_paddr, sizeof(uint32_t));
+ uint8_t *timer = physmem->dma_addr(timer_paddr, sizeof(uint32_t));
+
+ *(uint32_t *)ppc = 2000000000;
+ *(uint32_t *)timer = 1193180;
}
diff --git a/kern/freebsd/freebsd_system.hh b/kern/freebsd/freebsd_system.hh
index 8caa81cbc..3e9867733 100644
--- a/kern/freebsd/freebsd_system.hh
+++ b/kern/freebsd/freebsd_system.hh
@@ -32,10 +32,11 @@
#include "sim/host.hh"
#include "sim/system.hh"
#include "targetarch/isa_traits.hh"
+#include "kern/freebsd/freebsd_events.hh"
/**
- * This class skips a lengthy function in the FreeBSD kernel.
+ * This class skips lengthy functions in the FreeBSD kernel.
*/
class FreebsdSystem : public System
{
@@ -44,10 +45,21 @@ class FreebsdSystem : public System
/** PC based event to skip the DELAY call */
SkipFuncEvent *skipDelayEvent;
+ SkipFuncEvent *skipOROMEvent;
+
+ SkipFuncEvent *skipAicEvent;
+
+ SkipFuncEvent *skipPNPEvent;
+
+ SkipFuncEvent *skipATAEvent;
+
+ FreebsdSkipCalibrateClocksEvent *skipCalibrateClocks;
+
public:
FreebsdSystem(Params *p);
~FreebsdSystem();
+ void doCalibrateClocks(ExecContext *xc);
};
-#endif // __KERN_LINUX_LINUX_SYSTEM_HH__
+#endif // __KERN_FREEBSD_FREEBSD_SYSTEM_HH__