[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 15/45] windbg: sized data buffer
From: |
Ladi Prosek |
Subject: |
Re: [Qemu-devel] [PATCH v3 15/45] windbg: sized data buffer |
Date: |
Tue, 28 Nov 2017 15:07:51 +0100 |
On Tue, Nov 21, 2017 at 3:08 PM, Mihail Abakumov
<address@hidden> wrote:
> Defined useful sized data buffer. It contains pointer to data and size of
> this data. Also, defined some macros for init and free.
>
> Signed-off-by: Mihail Abakumov <address@hidden>
> Signed-off-by: Pavel Dovgalyuk <address@hidden>
> Signed-off-by: Dmitriy Koltunov <address@hidden>
> ---
> include/exec/windbgstub-utils.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/include/exec/windbgstub-utils.h b/include/exec/windbgstub-utils.h
> index 6ce870beb1..b729cd604e 100755
> --- a/include/exec/windbgstub-utils.h
> +++ b/include/exec/windbgstub-utils.h
> @@ -67,6 +67,22 @@ typedef struct PacketData {
> uint16_t extra_size;
> } PacketData;
>
> +typedef struct SizedBuf {
> + uint8_t *data;
> + size_t size;
> +} SizedBuf;
> +
> +#define SBUF_INIT(buf, mem_ptr, len) do { \
> + buf.data = mem_ptr; \
> + buf.size = len; \
> +} while (false)
> +#define SBUF_MALLOC(buf, size) SBUF_INIT(buf, g_malloc0(size), size)
> +#define SBUF_FREE(buf) do { \
> + g_free(buf.data); \
> + buf.data = NULL; \
> + buf.size = 0; \
> +} while (false)
> +
I don't think that this is necessary. These macros are used for ~240
byte data structures and the points where they are allocated and freed
are super close together.
I'd just put them on the stack in the callers of kd_gen_exception_sc()
and kd_gen_load_symbols_sc() (only one caller each) and remove this
patch.
> InitedAddr *windbg_get_KPCR(void);
> InitedAddr *windbg_get_version(void);
>
>
- [Qemu-devel] [PATCH v3 07/45] windbg: added chardev, (continued)
- [Qemu-devel] [PATCH v3 07/45] windbg: added chardev, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 10/45] windbg: structures for parsing data stream, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 08/45] windbg: hook to wrmsr operation, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 09/45] windbg: handler of fs/gs register, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 11/45] windbg: parsing data stream, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 12/45] windbg: send data and control packets, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 14/45] windbg: init DBGKD_ANY_WAIT_STATE_CHANGE, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 13/45] windbg: handler of parsing context, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 15/45] windbg: sized data buffer, Mihail Abakumov, 2017/11/21
- Re: [Qemu-devel] [PATCH v3 15/45] windbg: sized data buffer,
Ladi Prosek <=
- [Qemu-devel] [PATCH v3 16/45] windbg: generate ExceptionStateChange, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 17/45] windbg: generate LoadSymbolsStateChange, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 18/45] windbg: windbg_vm_stop, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 19/45] windbg: implemented windbg_process_control_packet, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 20/45] windbg: implemented windbg_process_data_packet, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 22/45] windbg: implemented kd_api_read_virtual_memory and kd_api_write_virtual_memory, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 21/45] windbg: implemented windbg_process_manipulate_packet, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 24/45] windbg: implemented kd_api_get_context and kd_api_set_context, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 23/45] windbg: kernel's structures, Mihail Abakumov, 2017/11/21
- [Qemu-devel] [PATCH v3 26/45] windbg: implemented windbg_read_context, Mihail Abakumov, 2017/11/21