[PATCH v3 04/20] mcdstub: added header with defines specific to the mcd tcp packet communication

Nicolas Eder posted 20 patches 1 year ago
Maintainers: Nicolas Eder <nicolas.eder@lauterbach.com>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Yanan Wang <wangyanan55@huawei.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Thomas Huth <thuth@redhat.com>, Peter Maydell <peter.maydell@linaro.org>
There is a newer version of this series
[PATCH v3 04/20] mcdstub: added header with defines specific to the mcd tcp packet communication
Posted by Nicolas Eder 1 year ago
---
 include/mcdstub/mcd_shared_defines.h | 108 +++++++++++++++++++++++++++
 1 file changed, 108 insertions(+)
 create mode 100644 include/mcdstub/mcd_shared_defines.h

diff --git a/include/mcdstub/mcd_shared_defines.h b/include/mcdstub/mcd_shared_defines.h
new file mode 100644
index 0000000000..fa1adb5c77
--- /dev/null
+++ b/include/mcdstub/mcd_shared_defines.h
@@ -0,0 +1,108 @@
+/*
+ *this file is shared between the mcd dll and the mcd stub.
+ *it has to be kept exectly the same!
+ */
+
+#ifndef MCD_SHARED_DEFINES
+#define MCD_SHARED_DEFINES
+
+/* default tcp port */
+#define MCD_DEFAULT_TCP_PORT "1235"
+
+/* tcp data characters */
+#define TCP_CHAR_OPEN_SERVER 'I'
+#define TCP_CHAR_OPEN_CORE 'i'
+#define TCP_CHAR_GO 'C'
+#define TCP_CHAR_STEP 'c'
+#define TCP_CHAR_BREAK 'b'
+#define TCP_CHAR_QUERY 'q'
+#define TCP_CHAR_CLOSE_SERVER 'D'
+#define TCP_CHAR_CLOSE_CORE 'd'
+#define TCP_CHAR_KILLQEMU 'k'
+#define TCP_CHAR_RESET 'r'
+#define TCP_CHAR_READ_REGISTER 'p'
+#define TCP_CHAR_WRITE_REGISTER 'P'
+#define TCP_CHAR_READ_MEMORY 'm'
+#define TCP_CHAR_WRITE_MEMORY 'M'
+#define TCP_CHAR_BREAKPOINT_INSERT 't'
+#define TCP_CHAR_BREAKPOINT_REMOVE 'T'
+
+/* tcp protocol chars */
+#define TCP_ACKNOWLEDGED '+'
+#define TCP_NOT_ACKNOWLEDGED '-'
+#define TCP_COMMAND_START '$'
+#define TCP_COMMAND_END '#'
+#define TCP_WAS_LAST '|'
+#define TCP_WAS_NOT_LAST '~'
+#define TCP_HANDSHAKE_SUCCESS "shaking your hand"
+#define TCP_EXECUTION_SUCCESS "success"
+#define TCP_EXECUTION_ERROR "error"
+
+/* tcp query arguments */
+#define QUERY_FIRST "f"
+#define QUERY_CONSEQUTIVE "c"
+#define QUERY_END_INDEX "!"
+
+#define QUERY_ARG_SYSTEM "system"
+#define QUERY_ARG_CORES "cores"
+#define QUERY_ARG_RESET "reset"
+#define QUERY_ARG_TRIGGER "trigger"
+#define QUERY_ARG_MEMORY "memory"
+#define QUERY_ARG_REGGROUP "reggroup"
+#define QUERY_ARG_REG "reg"
+#define QUERY_ARG_STATE "state"
+
+/* tcp query packet argument list */
+#define TCP_ARGUMENT_NAME "name"
+#define TCP_ARGUMENT_DATA "data"
+#define TCP_ARGUMENT_ID "id"
+#define TCP_ARGUMENT_TYPE "type"
+#define TCP_ARGUMENT_BITS_PER_MAU "bpm"
+#define TCP_ARGUMENT_INVARIANCE "i"
+#define TCP_ARGUMENT_ENDIAN "e"
+#define TCP_ARGUMENT_MIN "min"
+#define TCP_ARGUMENT_MAX "max"
+#define TCP_ARGUMENT_SUPPORTED_ACCESS_OPTIONS "sao"
+#define TCP_ARGUMENT_REGGROUPID "reggroupid"
+#define TCP_ARGUMENT_MEMSPACEID "memspaceid"
+#define TCP_ARGUMENT_SIZE "size"
+#define TCP_ARGUMENT_THREAD "thread"
+#define TCP_ARGUMENT_ADDRESS "address"
+#define TCP_ARGUMENT_STOP_STRING "stop_str"
+#define TCP_ARGUMENT_INFO_STRING "info_str"
+#define TCP_ARGUMENT_STATE "state"
+#define TCP_ARGUMENT_EVENT "event"
+#define TCP_ARGUMENT_DEVICE "device"
+#define TCP_ARGUMENT_CORE "core"
+#define TCP_ARGUMENT_AMOUNT_CORE "nr_cores"
+#define TCP_ARGUMENT_AMOUNT_TRIGGER "nr_trigger"
+#define TCP_ARGUMENT_OPTION "option"
+#define TCP_ARGUMENT_ACTION "action"
+#define TCP_ARGUMENT_OPCODE "opcode"
+
+/* for packets sent to qemu */
+#define ARGUMENT_SEPARATOR ';'
+#define NEGATIVE_FLAG 0
+#define POSITIVE_FLAG 1
+
+/* core states */
+#define CORE_STATE_RUNNING "running"
+#define CORE_STATE_HALTED "halted"
+#define CORE_STATE_DEBUG "debug"
+#define CORE_STATE_UNKNOWN "unknown"
+
+/* breakpoint types */
+#define MCD_BREAKPOINT_HW 1
+#define MCD_BREAKPOINT_READ 2
+#define MCD_BREAKPOINT_WRITE 3
+#define MCD_BREAKPOINT_RW 4
+
+/* trigger data */
+#define MCD_TRIG_ACT_BREAK "check_data_value"
+#define MCD_TRIG_OPT_VALUE "break_on_trigger"
+
+/* register mem space key words */
+#define MCD_GRP_KEYWORD "GPR"
+#define MCD_CP_KEYWORD "CP"
+
+#endif
-- 
2.34.1
Re: [PATCH v3 04/20] mcdstub: added header with defines specific to the mcd tcp packet communication
Posted by Alex Bennée 12 months ago
Nicolas Eder <nicolas.eder@lauterbach.com> writes:

> ---
>  include/mcdstub/mcd_shared_defines.h | 108 +++++++++++++++++++++++++++
>  1 file changed, 108 insertions(+)
>  create mode 100644 include/mcdstub/mcd_shared_defines.h
>
> diff --git a/include/mcdstub/mcd_shared_defines.h b/include/mcdstub/mcd_shared_defines.h
> new file mode 100644
> index 0000000000..fa1adb5c77
> --- /dev/null
> +++ b/include/mcdstub/mcd_shared_defines.h
> @@ -0,0 +1,108 @@
> +/*
> + *this file is shared between the mcd dll and the mcd stub.
> + *it has to be kept exectly the same!
> + */

If this comes from the published API headers it needs clear attribution
and a license header. I assume it won't update anything like as
frequently as our linux and Xen headers so I don't think we need special
tooling to handle updates.

> +
> +#ifndef MCD_SHARED_DEFINES
> +#define MCD_SHARED_DEFINES
> +
> +/* default tcp port */
> +#define MCD_DEFAULT_TCP_PORT "1235"
> +
> +/* tcp data characters */
> +#define TCP_CHAR_OPEN_SERVER 'I'
> +#define TCP_CHAR_OPEN_CORE 'i'
> +#define TCP_CHAR_GO 'C'
> +#define TCP_CHAR_STEP 'c'
> +#define TCP_CHAR_BREAK 'b'
> +#define TCP_CHAR_QUERY 'q'
> +#define TCP_CHAR_CLOSE_SERVER 'D'
> +#define TCP_CHAR_CLOSE_CORE 'd'
> +#define TCP_CHAR_KILLQEMU 'k'
> +#define TCP_CHAR_RESET 'r'
> +#define TCP_CHAR_READ_REGISTER 'p'
> +#define TCP_CHAR_WRITE_REGISTER 'P'
> +#define TCP_CHAR_READ_MEMORY 'm'
> +#define TCP_CHAR_WRITE_MEMORY 'M'
> +#define TCP_CHAR_BREAKPOINT_INSERT 't'
> +#define TCP_CHAR_BREAKPOINT_REMOVE 'T'
> +
> +/* tcp protocol chars */
> +#define TCP_ACKNOWLEDGED '+'
> +#define TCP_NOT_ACKNOWLEDGED '-'
> +#define TCP_COMMAND_START '$'
> +#define TCP_COMMAND_END '#'
> +#define TCP_WAS_LAST '|'
> +#define TCP_WAS_NOT_LAST '~'
> +#define TCP_HANDSHAKE_SUCCESS "shaking your hand"
> +#define TCP_EXECUTION_SUCCESS "success"
> +#define TCP_EXECUTION_ERROR "error"
> +
> +/* tcp query arguments */
> +#define QUERY_FIRST "f"
> +#define QUERY_CONSEQUTIVE "c"
> +#define QUERY_END_INDEX "!"
> +
> +#define QUERY_ARG_SYSTEM "system"
> +#define QUERY_ARG_CORES "cores"
> +#define QUERY_ARG_RESET "reset"
> +#define QUERY_ARG_TRIGGER "trigger"
> +#define QUERY_ARG_MEMORY "memory"
> +#define QUERY_ARG_REGGROUP "reggroup"
> +#define QUERY_ARG_REG "reg"
> +#define QUERY_ARG_STATE "state"
> +
> +/* tcp query packet argument list */
> +#define TCP_ARGUMENT_NAME "name"
> +#define TCP_ARGUMENT_DATA "data"
> +#define TCP_ARGUMENT_ID "id"
> +#define TCP_ARGUMENT_TYPE "type"
> +#define TCP_ARGUMENT_BITS_PER_MAU "bpm"
> +#define TCP_ARGUMENT_INVARIANCE "i"
> +#define TCP_ARGUMENT_ENDIAN "e"
> +#define TCP_ARGUMENT_MIN "min"
> +#define TCP_ARGUMENT_MAX "max"
> +#define TCP_ARGUMENT_SUPPORTED_ACCESS_OPTIONS "sao"
> +#define TCP_ARGUMENT_REGGROUPID "reggroupid"
> +#define TCP_ARGUMENT_MEMSPACEID "memspaceid"
> +#define TCP_ARGUMENT_SIZE "size"
> +#define TCP_ARGUMENT_THREAD "thread"
> +#define TCP_ARGUMENT_ADDRESS "address"
> +#define TCP_ARGUMENT_STOP_STRING "stop_str"
> +#define TCP_ARGUMENT_INFO_STRING "info_str"
> +#define TCP_ARGUMENT_STATE "state"
> +#define TCP_ARGUMENT_EVENT "event"
> +#define TCP_ARGUMENT_DEVICE "device"
> +#define TCP_ARGUMENT_CORE "core"
> +#define TCP_ARGUMENT_AMOUNT_CORE "nr_cores"
> +#define TCP_ARGUMENT_AMOUNT_TRIGGER "nr_trigger"
> +#define TCP_ARGUMENT_OPTION "option"
> +#define TCP_ARGUMENT_ACTION "action"
> +#define TCP_ARGUMENT_OPCODE "opcode"
> +
> +/* for packets sent to qemu */
> +#define ARGUMENT_SEPARATOR ';'
> +#define NEGATIVE_FLAG 0
> +#define POSITIVE_FLAG 1
> +
> +/* core states */
> +#define CORE_STATE_RUNNING "running"
> +#define CORE_STATE_HALTED "halted"
> +#define CORE_STATE_DEBUG "debug"
> +#define CORE_STATE_UNKNOWN "unknown"
> +
> +/* breakpoint types */
> +#define MCD_BREAKPOINT_HW 1
> +#define MCD_BREAKPOINT_READ 2
> +#define MCD_BREAKPOINT_WRITE 3
> +#define MCD_BREAKPOINT_RW 4
> +
> +/* trigger data */
> +#define MCD_TRIG_ACT_BREAK "check_data_value"
> +#define MCD_TRIG_OPT_VALUE "break_on_trigger"
> +
> +/* register mem space key words */
> +#define MCD_GRP_KEYWORD "GPR"
> +#define MCD_CP_KEYWORD "CP"
> +
> +#endif

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro