Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/27240 )

Change subject: util: Use M5OP_FOREACH to build a table of function pointers.
......................................................................

util: Use M5OP_FOREACH to build a table of function pointers.

These function pointers act a little like a vtable in C++ where a table
can be selected which will point to a collection of implementations for
the various functions.

The intention is that instances of these tables will correspond to each
of the backend mechanisms for calling m5 ops for a given variant of the
m5 utility, currently instructions, addresses, or semihosting.

Change-Id: I5953917349ac0fe54b75872e011557dfdece1115
---
A util/m5/src/dispatch_table.h
1 file changed, 41 insertions(+), 0 deletions(-)



diff --git a/util/m5/src/dispatch_table.h b/util/m5/src/dispatch_table.h
new file mode 100644
index 0000000..78ea1a5
--- /dev/null
+++ b/util/m5/src/dispatch_table.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2020 Google Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __DISPATCH_TABLE_H__
+#define __DISPATCH_TABLE_H__
+
+#include <gem5/asm/generic/m5ops.h>
+#include <gem5/m5ops.h>
+
+typedef struct DispatchTable
+{
+#define M5OP(name, func) __typeof__(&name) name;
+M5OP_FOREACH
+#undef M5OP
+} DispatchTable;
+
+#endif // __DISPATCH_TABLE_H__

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/27240
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5953917349ac0fe54b75872e011557dfdece1115
Gerrit-Change-Number: 27240
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to