Skip to content

Commit

Permalink
Merge branch 'master' into dts_parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
abejgonzalez authored Jul 29, 2024
2 parents a09ac9d + 4703ad9 commit ca174f6
Show file tree
Hide file tree
Showing 26 changed files with 358 additions and 138 deletions.
9 changes: 9 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,15 @@ install-hdrs : $(install_hdrs)
$(INSTALL_HDR) $(src_dir)/$$file $(install_hdrs_dir)/`dirname $$file`; \
done

install-hdrs-list.h: $(install_hdrs)
rm -f $@.tmp
for file in $(subst $(src_dir)/,,$^); \
do \
$(MKINSTALLDIRS) $(install_hdrs_dir)/`dirname $$file`; \
echo "#include <$(src_dir)/$$file>" >> $@.tmp; \
done
mv $@.tmp $@

install-libs : $(install_libs)
$(MKINSTALLDIRS) $(install_libs_dir)
for file in $^; \
Expand Down
2 changes: 1 addition & 1 deletion ci-tests/build-spike
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mkdir install
CXXFLAGS="-Wnon-virtual-dtor" CFLAGS="-Werror -Wignored-qualifiers -Wunused-function -Wunused-parameter -Wunused-variable" $DIR/../configure --prefix=`pwd`/install
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
make check
make install
make install install-hdrs-list.h

# check that help message prints without error
install/bin/spike -h
7 changes: 5 additions & 2 deletions ci-tests/test-spike
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ tar xf spike-ci.tar
time ../install/bin/spike --isa=rv64gc pk hello | grep "Hello, world! Pi is approximately 3.141588."

# check that including sim.h in an external project works
g++ -std=c++17 -I../install/include -L../install/lib $DIR/testlib.c -lriscv -o test-libriscv
g++ -std=c++17 -I../install/include -L../install/lib $DIR/test-customext.cc -lriscv -o test-customext
g++ -std=c++2a -I../install/include -L../install/lib $DIR/testlib.cc -lriscv -o test-libriscv
g++ -std=c++2a -I../install/include -L../install/lib $DIR/test-customext.cc -lriscv -o test-customext

# check that all installed headers are functional
g++ -std=c++2a -I../install/include -L../install/lib $DIR/testlib.cc -lriscv -o /dev/null -include ../install-hdrs-list.h

LD_LIBRARY_PATH=../install/lib ./test-libriscv pk hello| grep "Hello, world! Pi is approximately 3.141588."
LD_LIBRARY_PATH=../install/lib ./test-customext pk dummy-slliuw | grep "Executed successfully"
File renamed without changes.
8 changes: 8 additions & 0 deletions disasm/isa_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv)
extension_table[EXT_ZICFILP] = true;
} else if (ext_str == "zicfiss") {
extension_table[EXT_ZICFISS] = true;
} else if (ext_str == "smmpm") {
extension_table[EXT_SMMPM] = true;
} else if (ext_str == "smnpm") {
extension_table[EXT_SMNPM] = true;
} else if (ext_str == "ssnpm") {
extension_table[EXT_SSNPM] = true;
} else if (ext_str.substr(0, 3) == "zvl") {
reg_t new_vlen;
try {
Expand Down Expand Up @@ -347,6 +353,8 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv)
if (new_elen != 32 && new_elen != 64)
bad_isa_string(str, ("Invalid Zve string: " + ext_str).c_str());
elen = std::max(elen, new_elen);
} else if (ext_str == "ssdbltrp") {
extension_table[EXT_SSDBLTRP] = true;
} else if (ext_str[0] == 'x') {
extension_table['X'] = true;
if (ext_str.size() == 1) {
Expand Down
4 changes: 2 additions & 2 deletions fdt/libfdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* Copyright (C) 2006 David Gibson, IBM Corporation.
*/

#include <libfdt_env.h>
#include <fdt.h>
#include "libfdt_env.h"
#include "fdt.h"

#define FDT_FIRST_SUPPORTED_VERSION 0x02
#define FDT_LAST_SUPPORTED_VERSION 0x11
Expand Down
18 changes: 6 additions & 12 deletions fesvr/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#ifndef _RISCV_BYTEORDER_H
#define _RISCV_BYTEORDER_H

#include "config.h"
#include <stdint.h>
#include <arpa/inet.h>

static inline uint8_t swap(uint8_t n) { return n; }
static inline uint16_t swap(uint16_t n) { return (n >> 8) | (n << 8); }
Expand All @@ -22,17 +22,11 @@ static inline uint128_t swap(uint128_t n) { return (uint128_t(swap(uint64_t(n)))
static inline int128_t swap(int128_t n) { return int128_t(swap(uint128_t(n))); }
#endif

#ifdef WORDS_BIGENDIAN
template<typename T> static inline T from_be(T n) { return n; }
template<typename T> static inline T to_be(T n) { return n; }
template<typename T> static inline T from_le(T n) { return swap(n); }
template<typename T> static inline T to_le(T n) { return swap(n); }
#else
template<typename T> static inline T from_le(T n) { return n; }
template<typename T> static inline T to_le(T n) { return n; }
template<typename T> static inline T from_be(T n) { return swap(n); }
template<typename T> static inline T to_be(T n) { return swap(n); }
#endif
static inline bool is_be() { return htonl(1) == 1; }
template<typename T> static inline T from_be(T n) { return is_be() ? n : swap(n); }
template<typename T> static inline T to_be(T n) { return from_be(n); }
template<typename T> static inline T from_le(T n) { return is_be() ? swap(n) : n; }
template<typename T> static inline T to_le(T n) { return from_le(n); }

// Wrapper to mark a value as target endian, to guide conversion code

Expand Down
1 change: 1 addition & 0 deletions fesvr/elfloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define _ELFLOADER_H

#include "elf.h"
#include "memif.h"
#include <map>
#include <string>

Expand Down
1 change: 1 addition & 0 deletions riscv/cfg.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// See LICENSE for license details.

#include "config.h"
#include "cfg.h"
#include "mmu.h"
#include "decode.h"
Expand Down
Loading

0 comments on commit ca174f6

Please sign in to comment.