summaryrefslogtreecommitdiff
path: root/src/dev/arm
diff options
context:
space:
mode:
authorAndreas Sandberg <Andreas.Sandberg@arm.com>2012-11-02 11:32:01 -0500
committerAndreas Sandberg <Andreas.Sandberg@arm.com>2012-11-02 11:32:01 -0500
commitc0ab52799ca4ebd0a51363cfedd0658e6d79b842 (patch)
treeafdf65e4593c64bbc1d5b511aacbaf0fa4b558ad /src/dev/arm
parent044a6525876efc61838dffa89ac52425d510b754 (diff)
downloadgem5-c0ab52799ca4ebd0a51363cfedd0658e6d79b842.tar.xz
sim: Include object header files in SWIG interfaces
When casting objects in the generated SWIG interfaces, SWIG uses classical C-style casts ( (Foo *)bar; ). In some cases, this can degenerate into the equivalent of a reinterpret_cast (mainly if only a forward declaration of the type is available). This usually works for most compilers, but it is known to break if multiple inheritance is used anywhere in the object hierarchy. This patch introduces the cxx_header attribute to Python SimObject definitions, which should be used to specify a header to include in the SWIG interface. The header should include the declaration of the wrapped object. We currently don't enforce header the use of the header attribute, but a warning will be generated for objects that do not use it.
Diffstat (limited to 'src/dev/arm')
-rw-r--r--src/dev/arm/RealView.py14
-rw-r--r--src/dev/arm/pl011.hh2
-rw-r--r--src/dev/arm/realview.hh1
-rw-r--r--src/dev/arm/timer_cpulocal.hh1
4 files changed, 18 insertions, 0 deletions
diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py
index f0b629b38..87d4d9b16 100644
--- a/src/dev/arm/RealView.py
+++ b/src/dev/arm/RealView.py
@@ -54,11 +54,13 @@ from SimpleMemory import SimpleMemory
class AmbaDevice(BasicPioDevice):
type = 'AmbaDevice'
abstract = True
+ cxx_header = "dev/arm/amba_device.hh"
amba_id = Param.UInt32("ID of AMBA device for kernel detection")
class AmbaIntDevice(AmbaDevice):
type = 'AmbaIntDevice'
abstract = True
+ cxx_header = "dev/arm/amba_device.hh"
gic = Param.Gic(Parent.any, "Gic to use for interrupting")
int_num = Param.UInt32("Interrupt number that connects to GIC")
int_delay = Param.Latency("100ns",
@@ -67,6 +69,7 @@ class AmbaIntDevice(AmbaDevice):
class AmbaDmaDevice(DmaDevice):
type = 'AmbaDmaDevice'
abstract = True
+ cxx_header = "dev/arm/amba_device.hh"
pio_addr = Param.Addr("Address for AMBA slave interface")
pio_latency = Param.Latency("10ns", "Time between action and write/read result by AMBA DMA Device")
gic = Param.Gic(Parent.any, "Gic to use for interrupting")
@@ -75,15 +78,18 @@ class AmbaDmaDevice(DmaDevice):
class A9SCU(BasicPioDevice):
type = 'A9SCU'
+ cxx_header = "dev/arm/a9scu.hh"
class RealViewCtrl(BasicPioDevice):
type = 'RealViewCtrl'
+ cxx_header = "dev/arm/rv_ctrl.hh"
proc_id0 = Param.UInt32(0x0C000000, "Processor ID, SYS_PROCID")
proc_id1 = Param.UInt32(0x0C000222, "Processor ID, SYS_PROCID1")
idreg = Param.UInt32(0x00000000, "ID Register, SYS_ID")
class Gic(PioDevice):
type = 'Gic'
+ cxx_header = "dev/arm/gic.hh"
platform = Param.Platform(Parent.any, "Platform this device is part of.")
dist_addr = Param.Addr(0x1f001000, "Address for distributor")
cpu_addr = Param.Addr(0x1f000100, "Address for cpu")
@@ -94,11 +100,13 @@ class Gic(PioDevice):
class AmbaFake(AmbaDevice):
type = 'AmbaFake'
+ cxx_header = "dev/arm/amba_fake.hh"
ignore_access = Param.Bool(False, "Ignore reads/writes to this device, (e.g. IsaFake + AMBA)")
amba_id = 0;
class Pl011(Uart):
type = 'Pl011'
+ cxx_header = "dev/arm/pl011.hh"
gic = Param.Gic(Parent.any, "Gic to use for interrupting")
int_num = Param.UInt32("Interrupt number that connects to GIC")
end_on_eot = Param.Bool(False, "End the simulation when a EOT is received on the UART")
@@ -106,6 +114,7 @@ class Pl011(Uart):
class Sp804(AmbaDevice):
type = 'Sp804'
+ cxx_header = "dev/arm/timer_sp804.hh"
gic = Param.Gic(Parent.any, "Gic to use for interrupting")
int_num0 = Param.UInt32("Interrupt number that connects to GIC")
clock0 = Param.Clock('1MHz', "Clock speed of the input")
@@ -115,6 +124,7 @@ class Sp804(AmbaDevice):
class CpuLocalTimer(BasicPioDevice):
type = 'CpuLocalTimer'
+ cxx_header = "dev/arm/timer_cpulocal.hh"
gic = Param.Gic(Parent.any, "Gic to use for interrupting")
int_num_timer = Param.UInt32("Interrrupt number used per-cpu to GIC")
int_num_watchdog = Param.UInt32("Interrupt number for per-cpu watchdog to GIC")
@@ -123,11 +133,13 @@ class CpuLocalTimer(BasicPioDevice):
class PL031(AmbaIntDevice):
type = 'PL031'
+ cxx_header = "dev/arm/rtc_pl031.hh"
time = Param.Time('01/01/2009', "System time to use ('Now' for actual time)")
amba_id = 0x00341031
class Pl050(AmbaIntDevice):
type = 'Pl050'
+ cxx_header = "dev/arm/kmi.hh"
vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer display")
is_mouse = Param.Bool(False, "Is this interface a mouse, if not a keyboard")
int_delay = '1us'
@@ -135,6 +147,7 @@ class Pl050(AmbaIntDevice):
class Pl111(AmbaDmaDevice):
type = 'Pl111'
+ cxx_header = "dev/arm/pl111.hh"
# Override the default clock
clock = '24MHz'
vnc = Param.VncInput(Parent.any, "Vnc server for remote frame buffer display")
@@ -142,6 +155,7 @@ class Pl111(AmbaDmaDevice):
class RealView(Platform):
type = 'RealView'
+ cxx_header = "dev/arm/realview.hh"
system = Param.System(Parent.any, "system")
pci_cfg_base = Param.Addr(0, "Base address of PCI Configuraiton Space")
mem_start_addr = Param.Addr(0, "Start address of main memory")
diff --git a/src/dev/arm/pl011.hh b/src/dev/arm/pl011.hh
index dbd8bd539..e96d33d83 100644
--- a/src/dev/arm/pl011.hh
+++ b/src/dev/arm/pl011.hh
@@ -48,6 +48,8 @@
#ifndef __DEV_ARM_PL011_H__
#define __DEV_ARM_PL011_H__
+#include "base/bitfield.hh"
+#include "base/bitunion.hh"
#include "dev/io_device.hh"
#include "dev/uart.hh"
#include "params/Pl011.hh"
diff --git a/src/dev/arm/realview.hh b/src/dev/arm/realview.hh
index 70647d47c..f38aa69fc 100644
--- a/src/dev/arm/realview.hh
+++ b/src/dev/arm/realview.hh
@@ -52,6 +52,7 @@
#include "dev/platform.hh"
#include "params/RealView.hh"
+class Gic;
class IdeController;
class System;
diff --git a/src/dev/arm/timer_cpulocal.hh b/src/dev/arm/timer_cpulocal.hh
index cf7e46496..9b60db4ec 100644
--- a/src/dev/arm/timer_cpulocal.hh
+++ b/src/dev/arm/timer_cpulocal.hh
@@ -41,6 +41,7 @@
#ifndef __DEV_ARM_LOCALTIMER_HH__
#define __DEV_ARM_LOCALTIMER_HH__
+#include "base/bitunion.hh"
#include "dev/io_device.hh"
#include "params/CpuLocalTimer.hh"