From f4e5776df4bf20836fb917b7ba0a859c674600a5 Mon Sep 17 00:00:00 2001 From: Benjamin Nash Date: Fri, 17 Jun 2005 18:08:05 -0400 Subject: I/O changes and SkipFuncEvents to increase FreeBSD compatibility. SConscript: Added kern/freebsd/freebsd_events.cc. arch/alpha/isa_traits.hh: Added Argument to support replacement of calibrate_clocks function in FreeBSD. dev/ns_gige.hh: Fixed NIC model number typo. dev/tsunami_io.cc: Added support for RTC writes and PIC 2 mask reads. Made RTC static member. dev/tsunami_io.hh: Made RTC static member. kern/freebsd/freebsd_system.cc: Added events to skip functions in FreeBSD. kern/freebsd/freebsd_system.hh: Added events to skip certain functions. --HG-- extra : convert_revision : 8aaca51d3f9b1bb601722a5bae240aae77b445db --- kern/freebsd/freebsd_system.cc | 51 +++++++++++++++++++++++++++++++++++++++++- kern/freebsd/freebsd_system.hh | 16 +++++++++++-- 2 files changed, 64 insertions(+), 3 deletions(-) (limited to 'kern') 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__ -- cgit v1.2.3