-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-organize and provide .pc file for packaging
- Loading branch information
Showing
6 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(example LANGUAGES CXX) | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(libriscv REQUIRED) | ||
find_package(PkgConfig REQUIRED) | ||
pkg_check_modules(libriscv REQUIRED IMPORTED_TARGET libriscv) | ||
|
||
add_executable(example example.cpp) | ||
target_link_libraries(example riscv) | ||
target_link_libraries(example PkgConfig::libriscv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Name: @CMAKE_PROJECT_NAME@ | ||
Description: @CMAKE_PROJECT_DESCRIPTION@ | ||
URL: https://github.com/fwsGonzo/libriscv | ||
Version: @PROJECT_VERSION@ | ||
Cflags: -I/usr/include | ||
Libs: -L/usr/lib -lriscv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "supervisor.hpp" | ||
|
||
#include "../machine.hpp" | ||
|
||
namespace riscv | ||
{ | ||
template <int W> | ||
bool Supervisor<W>::is_privilege_machine() const noexcept { | ||
return false; | ||
} | ||
template <int W> | ||
bool Supervisor<W>::is_privilege_supervisor() const noexcept { | ||
return false; | ||
} | ||
|
||
template <int W> | ||
void Supervisor<W>::mret() | ||
{ | ||
if (!is_privilege_machine()) | ||
throw MachineException(ILLEGAL_OPERATION, "MRET requires machine privilege level"); | ||
} | ||
|
||
template <int W> | ||
void Supervisor<W>::sret() | ||
{ | ||
if (!is_privilege_supervisor()) | ||
throw MachineException(ILLEGAL_OPERATION, "SRET requires supervisor privilege level"); | ||
|
||
} | ||
|
||
template struct Supervisor<4>; | ||
template struct Supervisor<8>; | ||
} |
7 changes: 5 additions & 2 deletions
7
lib/libriscv/supervisor.hpp → lib/libriscv/supervisor/supervisor.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters