/****************************************************************************** * common/trace.c * * Xen Trace Buffer * * Copyright (C) 2004 by Intel Research Cambridge * * Authors: Mark Williamson, mark.a.williamson@intel.com * Rob Gardner, rob.gardner@hp.com * Date: October 2005 * * Copyright (C) 2005 Bin Ren * * The trace buffer code is designed to allow debugging traces of Xen to be * generated on UP / SMP machines. Each trace entry is timestamped so that * it's possible to reconstruct a chronological record of trace events. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef CONFIG_COMPAT #include #define xen_t_buf t_buf CHECK_t_buf; #undef xen_t_buf #define TB_COMPAT IS_COMPAT(dom0) #else #define compat_t_rec t_rec #define TB_COMPAT 0 #endif typedef union { struct t_rec *nat; struct compat_t_rec *cmp; } t_rec_u; /* opt_tbuf_size: trace buffer size (in pages) */ static unsigned int opt_tbuf_size = 0; integer_param("tbuf_size", opt_tbuf_size); /* Pointers to the meta-data objects for all system trace buffers */ static DEFINE_PER_CPU(struct t_buf *, t_bufs); static DEFINE_PER_CPU(t_rec_u, t_recs); static int nr_recs; /* High water mark for trace buffers; */ /* Send virtual interrupt when buffer level reaches this point */ static int t_buf_highwater; /* Number of records lost due to per-CPU trace buffer being full. */ static DEFINE_PER_CPU(unsigned long, lost_records); /* a flag recording whether initialization has been done */ /* or more properly, if the tbuf subsystem is enabled right now */ int tb_init_done; /* which CPUs tracing is enabled on */ static cpumask_t tb_cpu_mask = CPU_MASK_ALL; /* which tracing events are enabled */ static u32 tb_event_mask = TRC_ALL; static void trace_notify_guest(void) { send_guest_global_virq(dom0, VIRQ_TBUF); } /** * alloc_trace_bufs - performs initialization of the per-cpu trace buffers. * * This function is called at start of day in order to initialize the per-cpu * trace buffers. The trace buffers are then available for debugging use, via * the %TRACE_xD macros exported in . * * This function may also be called later when enabling trace buffers * via the SET_SIZE hypercall. */ static int alloc_trace_bufs(void) { int i, order; unsigned long nr_pages; char *rawbuf; struct t_buf *buf; if ( opt_tbuf_size == 0 ) return -EINVAL; nr_pages = num_online_cpus() * opt_tbuf_size; order = get_order_from_pages(nr_pages); nr_recs = (opt_tbuf_size * PAGE_SIZE - sizeof(struct t_buf)) / (!TB_COMPAT ? sizeof(struct t_rec) : sizeof(struct compat_t_rec)); if ( (rawbuf = alloc_xenheap_pages(order)) == NULL ) { printk("Xen trace buffers: memory allocation failed\n"); opt_tbuf_size = 0; return -EINVAL; } /* Share pages so that xentrace can map them. */ for ( i = 0; i < nr_pages; i++ ) share_xen_page_with_privileged_guests( virt_to_page(rawbuf) + i, XENSHARE_writable); for_each_online_cpu ( i ) { buf = per_cpu(t_bufs, i) = (struct t_buf *) &rawbuf[i*opt_tbuf_size*PAGE_SIZE]; buf->cons = buf->prod = 0; per_cpu(t_recs, i).nat = (struct t_rec *)(buf + 1); } t_buf_highwater = nr_recs >> 1; /* 50% high water */ open_softirq(TRACE_SOFTIRQ, trace_notify_guest); return 0; } /** * tb_set_size - handle the logic involved with dynamically * allocating and deallocating tbufs * * This function is called when the SET_SIZE hypercall is done. */ static int tb_set_size(int size) { /* * Setting size is a one-shot operation. It can be done either at * boot time or via control tools, but not by
// dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications)
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)

// Implemented features:
//  [X] Platform: Clipboard support (for Win32 this is actually part of core imgui)
//  [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
//  [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE).
// Missing features:
//  [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice).

IMGUI_IMPL_API bool     ImGui_ImplWin32_Init(void* hwnd);
IMGUI_IMPL_API void     ImGui_ImplWin32_Shutdown();
IMGUI_IMPL_API void     ImGui_ImplWin32_NewFrame();

// Handler for Win32 messages, update mouse/keyboard data.
// You may or not need this for your implementation, but it can serve as reference for handling inputs.
// Intentionally commented out to avoid dragging dependencies on <windows.h> types. You can copy the extern declaration in your code.
/*
IMGUI_IMPL_API LRESULT  ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
*/