Skip to content

Commit

Permalink
rename *_to_string() functions just to to_string()
Browse files Browse the repository at this point in the history
  • Loading branch information
wbenny committed Aug 1, 2019
1 parent bc5a342 commit b5a9945
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/ia32/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct exception_error_code_t
};
};

constexpr inline const char* exception_vector_to_string(exception_vector value) noexcept
constexpr inline const char* to_string(exception_vector value) noexcept
{
switch (value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/ia32/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class physical_memory_range
pa_t end_;
};

constexpr inline const char* memory_type_to_string(memory_type type) noexcept
constexpr inline const char* to_string(memory_type type) noexcept
{
switch (type)
{
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/ia32/vmx/exit_reason.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enum class exit_reason : uint16_t
execute_xrstors = 0x00000040,
};

constexpr inline const char* exit_reason_to_string(exit_reason value) noexcept
constexpr inline const char* to_string(exit_reason value) noexcept
{
switch (value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/ia32/vmx/instruction_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum instruction_error : uint32_t
invept_invvpid_invalid_operand = 28,
};

constexpr inline const char* instruction_error_to_string(instruction_error value) noexcept
constexpr inline const char* to_string(instruction_error value) noexcept
{
switch (value)
{
Expand Down
4 changes: 4 additions & 0 deletions src/hvpp/hvpp/ia32/vmx/instruction_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ struct instruction_info_t
};
};

//
// #TODO: It would be nice to rename these functions just to `to_string`.
//

constexpr inline const char* instruction_info_gdtr_idtr_to_string(uint64_t value) noexcept
{
switch (value)
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/ia32/vmx/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct interruptibility_state_t
};
};

constexpr inline const char* interrupt_type_to_string(interrupt_type value) noexcept
constexpr inline const char* to_string(interrupt_type value) noexcept
{
switch (value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/ia32/vmx/vmcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ inline vmcs_t::field& operator-=(vmcs_t::field& vmcs_field, int index) noexcept

static_assert(sizeof(vmcs_t) == page_size);

constexpr inline const char* vmcs_field_to_string(vmcs_t::field value) noexcept
constexpr inline const char* to_string(vmcs_t::field value) noexcept
{
switch (value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/lib/mm/mtrr_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace mm
{
hvpp_info(
" %3i) %s [%016" PRIx64 " - %016" PRIx64 "] (%8u kb)", i,
memory_type_to_string(mtrr.type),
to_string(mtrr.type),
mtrr.range.begin().value(),
mtrr.range.end().value(),
mtrr.range.size() / 1024);
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/vcpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ auto vcpu_t::handle_vmx_launch_error() noexcept -> error_code_t
const auto instruction_error = exit_instruction_error();
hvpp_error("error: %u (%s)\n",
static_cast<uint32_t>(instruction_error),
vmx::instruction_error_to_string(instruction_error));
vmx::to_string(instruction_error));

//
// If debugger is attached, break into it.
Expand Down
16 changes: 8 additions & 8 deletions src/hvpp/hvpp/vcpu.inl
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
#if defined(HVPP_ENABLE_INTERRUPT_TRACE)
# define __trace_interrupt_inject_vectoring() \
hvpp_trace("interrupt_inject (vectoring) - vector: %s, type: %s, nmi_unblocking: %u, valid: %u",\
::ia32::exception_vector_to_string(vectoring.vector()), \
::ia32::vmx::interrupt_type_to_string(vectoring.type()), \
::ia32::to_string(vectoring.vector()), \
::ia32::vmx::to_string(vectoring.type()), \
vectoring.nmi_unblocking(), \
vectoring.valid())

# define __trace_interrupt_inject_push() \
hvpp_trace("interrupt_inject (push-%s) - vector: %s, type: %s, queue_size: %u",\
front ? "front" : "back", \
::ia32::exception_vector_to_string(interrupt.vector()), \
::ia32::vmx::interrupt_type_to_string(interrupt.type()), \
::ia32::to_string(interrupt.vector()), \
::ia32::vmx::to_string(interrupt.type()), \
queue.size() + 1)

# define __trace_interrupt_inject_pop() \
hvpp_trace("interrupt_inject (pop-front) - vector: %s, type: %s, queue_size: %u",\
::ia32::exception_vector_to_string(queue.front().vector()), \
::ia32::vmx::interrupt_type_to_string(queue.front().type()), \
::ia32::to_string(queue.front().vector()), \
::ia32::vmx::to_string(queue.front().type()), \
queue.size() - 1)


# define __trace_interrupt_inject() \
hvpp_trace("interrupt_inject - vector: %s, type: %s", \
::ia32::exception_vector_to_string(interrupt.vector()), \
::ia32::vmx::interrupt_type_to_string(interrupt.type()))
::ia32::to_string(interrupt.vector()), \
::ia32::vmx::to_string(interrupt.type()))


#else
Expand Down
10 changes: 5 additions & 5 deletions src/hvpp/hvpp/vmexit/vmexit_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ void vmexit_stats_handler::handle(vcpu_t& vp) noexcept
case vmx::exit_reason::exception_or_nmi:
stats.exception_vector[static_cast<int>(vp.interrupt_info().vector())] += 1;

hvpp_trace_if_enabled("exit_reason::exception_or_nmi: %s", exception_vector_to_string(vp.interrupt_info().vector()));
hvpp_trace_if_enabled("exit_reason::exception_or_nmi: %s", to_string(vp.interrupt_info().vector()));
break;

case vmx::exit_reason::external_interrupt:
stats.exception_vector[static_cast<int>(vp.interrupt_info().vector())] += 1;

hvpp_trace_if_enabled("exit_reason::external_interrupt: %s", exception_vector_to_string(vp.interrupt_info().vector()));
hvpp_trace_if_enabled("exit_reason::external_interrupt: %s", to_string(vp.interrupt_info().vector()));
break;

case vmx::exit_reason::interrupt_window:
Expand Down Expand Up @@ -337,15 +337,15 @@ void vmexit_stats_handler::storage_dump(const vmexit_stats_storage_t& storage_to
if (stats.vmexit[exit_reason_index] > 0)
{
hvpp_info(" %s: %u",
vmx::exit_reason_to_string(static_cast<vmx::exit_reason>(exit_reason_index)),
vmx::to_string(static_cast<vmx::exit_reason>(exit_reason_index)),
stats.vmexit[exit_reason_index]);

switch (static_cast<vmx::exit_reason>(exit_reason_index))
{
case vmx::exit_reason::exception_or_nmi:
for (uint32_t i = 0; i < std::size(stats.exception_vector); ++i)
{
const char* exception_vector_string = exception_vector_to_string(static_cast<exception_vector>(i));
const char* exception_vector_string = to_string(static_cast<exception_vector>(i));
(void)(exception_vector_string);
if (stats.exception_vector[i] > 0)
{
Expand All @@ -357,7 +357,7 @@ void vmexit_stats_handler::storage_dump(const vmexit_stats_storage_t& storage_to
case vmx::exit_reason::external_interrupt:
for (uint32_t i = 0; i < std::size(stats.exception_vector); ++i)
{
const char* exception_vector_string = exception_vector_to_string(static_cast<exception_vector>(i));
const char* exception_vector_string = to_string(static_cast<exception_vector>(i));
(void)(exception_vector_string);
if (stats.exception_vector[i] > 0)
{
Expand Down

0 comments on commit b5a9945

Please sign in to comment.