Skip to content

Commit

Permalink
i#3544 RISC-V, part 9: Add arch files (#5605)
Browse files Browse the repository at this point in the history
Add files with arch-specific symbols and definitions required to compile
for RISC-V.
Those definitions are used in multiple DynamoRIO modules but splitting
them across multiple commits would likely involve merge dependencies.
Therefore it seemed more straightforward to keep all of the files under
core/arch/riscv64 in a single commit.

NOTE:
  This code is not validated and mostly contains stubs as the main point
  was to achieve compilation and estimate the effort required for the
  port. Some of the trivial logic has been implemented though.

Issue: #3544

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
  • Loading branch information
semihalf-kardach-stanislaw committed Aug 18, 2022
1 parent 097cb37 commit 91f3aa0
Show file tree
Hide file tree
Showing 10 changed files with 1,353 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/arch/aarchxx/mangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ insert_out_of_line_context_switch(dcontext_t *dcontext, instrlist_t *ilist,
/*###########################################################################
*###########################################################################
*
* M A N G L I N G R O U T I N E S
* MANGLING ROUTINES
*/

/* forward declaration */
Expand Down
2 changes: 1 addition & 1 deletion core/arch/mangle_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ insert_meta_call_vargs(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr,
/*###########################################################################
*###########################################################################
*
* M A N G L I N G R O U T I N E S
* MANGLING ROUTINES
*/

/* This routine is not shared with drdecode, so it's here instead of mangle_utils.c. */
Expand Down
103 changes: 103 additions & 0 deletions core/arch/riscv64/clean_call_opt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* **********************************************************
* Copyright (c) 2022 Rivos, Inc. All rights reserved.
* **********************************************************/

/*
* 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 Rivos, Inc. 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 RIVOS, INC. 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.
*/

#include "../globals.h"
#include "arch.h"

void
analyze_callee_regs_usage(dcontext_t *dcontext, callee_info_t *ci)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
}

void
analyze_callee_save_reg(dcontext_t *dcontext, callee_info_t *ci)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
}

void
analyze_callee_tls(dcontext_t *dcontext, callee_info_t *ci)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
}

app_pc
check_callee_instr_level2(dcontext_t *dcontext, callee_info_t *ci, app_pc next_pc,
app_pc cur_pc, app_pc tgt_pc)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
return NULL;
}

bool
check_callee_ilist_inline(dcontext_t *dcontext, callee_info_t *ci)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
return false;
}

void
analyze_clean_call_aflags(dcontext_t *dcontext, clean_call_info_t *cci, instr_t *where)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
}

void
insert_inline_reg_save(dcontext_t *dcontext, clean_call_info_t *cci, instrlist_t *ilist,
instr_t *where, opnd_t *args)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
}

void
insert_inline_reg_restore(dcontext_t *dcontext, clean_call_info_t *cci,
instrlist_t *ilist, instr_t *where)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
}

void
insert_inline_arg_setup(dcontext_t *dcontext, clean_call_info_t *cci, instrlist_t *ilist,
instr_t *where, opnd_t *args)
{
/* FIXME i#3544: Not implemented */
ASSERT_NOT_IMPLEMENTED(false);
}
Loading

0 comments on commit 91f3aa0

Please sign in to comment.