Skip to content

Commit

Permalink
Merge pull request #2 from panda-re/dev
Browse files Browse the repository at this point in the history
Prepare for merge
  • Loading branch information
AndrewQuijano authored Dec 5, 2024
2 parents 358e344 + cc88392 commit 763be3f
Show file tree
Hide file tree
Showing 91 changed files with 79,579 additions and 15,753 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_IMAGE="ubuntu:20.04"
ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu"
ARG LIBOSI_VERSION="0.1.3"
ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu"
ARG LIBOSI_VERSION="v0.1.7"

### BASE IMAGE
FROM $BASE_IMAGE as base
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ msg() {
}

# Default targets to build. Change with argument. small = i386-softmmu
TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu"
TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu"
LLVM_CONFIG_BINARY="${LLVM_CONFIG_BINARY:-llvm-config-11}"

pypanda=""
Expand Down
4 changes: 2 additions & 2 deletions default-configs/mips64el-softmmu.mak
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ CONFIG_JAZZ=y
CONFIG_G364FB=y
CONFIG_JAZZ_LED=y
CONFIG_VT82C686=y
CONFIG_MIPS_BOSTON=y
CONFIG_FITLOADER=y
CONFIG_MIPS_BOSTON=n
CONFIG_FITLOADER=n
CONFIG_PCI_XILINX=y
3 changes: 2 additions & 1 deletion hw/avatar/configurable_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,9 @@ static void set_entry_point(QDict *conf, THISCPU *cpuu)
cpuu->env.active_tc.PC = entry;

#elif defined(TARGET_PPC)
cpuu->env.nip = entry;
//Not implemented yet
fprintf(stderr, "Not yet implemented- can't start execution at 0x%x\n", entry);
//fprintf(stderr, "Not yet implemented- can't start execution at 0x%x\n", entry);
#endif

}
Expand Down
4 changes: 2 additions & 2 deletions panda/Makefile.panda.target
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ MIPS64_HELPERS += op_helper.bc2
llvm-$(TARGET_MIPS64) += fpu/softfloat.bc2
llvm-$(TARGET_MIPS64) += $(addprefix target/mips/,$(MIPS64_HELPERS))

# only support mips64, not mipsel64
llvmmorph-$(TARGET_MIPS64) += llvm-helpers-mips64.bc
# support mips64 and mips64el
llvmmorph-$(TARGET_MIPS64) += llvm-helpers-$(TARGET_NAME).bc

CLANG_FILTER = -Wold-style-declaration -fstack-protector-strong -Wno-error=cpp -g -O0 -O1 -O2 -O3 -mcx16 -Wno-shift-negative-value -fprofile-arcs -ftest-coverage
QEMU_BC2FLAGS:=$(filter-out $(CLANG_FILTER),$(QEMU_CFLAGS) $(CFLAGS)) -O1 -I../target/$(TARGET_BASE_ARCH)
Expand Down
5 changes: 3 additions & 2 deletions panda/include/panda/tcg-llvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class TCGLLVMTranslator {
llvm::Value* getEnvOffsetPtr(int64_t offset, TCGTemp &temp);

/* Function pass manager (used for optimizing the code) */
llvm::legacy::FunctionPassManager *m_functionPassManager;
std::unique_ptr<llvm::legacy::FunctionPassManager> m_functionPassManager =
nullptr;

/* Count of generated translation blocks */
int m_tbCount;
Expand Down Expand Up @@ -300,7 +301,7 @@ class TCGLLVMTranslator {
}

llvm::legacy::FunctionPassManager* getFunctionPassManager() const {
return m_functionPassManager;
return m_functionPassManager.get();
}

/* Code generation */
Expand Down
6 changes: 3 additions & 3 deletions panda/llvm/helper_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ namespace llvm {
***/

char PandaCallMorphFunctionPass::ID = 0;
static FunctionPass *cmfp;
static RegisterPass<PandaCallMorphFunctionPass>
Y("PandaCallMorph", "Change helper function calls to the the LLVM version");

Expand Down Expand Up @@ -138,6 +137,7 @@ void PandaHelperCallVisitor::visitCallInst(CallInst &I) {

static void llvmCallMorphNewModuleCallback(Module *module,
legacy::FunctionPassManager *functionPassManager) {
auto cmfp = new llvm::PandaCallMorphFunctionPass();
functionPassManager->add(cmfp);
}

Expand Down Expand Up @@ -196,8 +196,8 @@ void init_llvm_helpers() {
tcg_llvm_translator->writeModule(mod_file.str().c_str());*/

// Create call morph pass and add to function pass manager
llvm::cmfp = new llvm::PandaCallMorphFunctionPass();
fpm->add(llvm::cmfp);
auto cmfp = new llvm::PandaCallMorphFunctionPass();
fpm->add(cmfp);
tcg_llvm_translator->addNewModuleCallback(
&llvm::llvmCallMorphNewModuleCallback);
helpers_initialized = true;
Expand Down
13 changes: 6 additions & 7 deletions panda/llvm/tcg-llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ TCGLLVMTranslator::TCGLLVMTranslator()
m_eip = NULL;
m_ccop = NULL;

m_functionPassManager = new legacy::FunctionPassManager(m_module.get());
m_functionPassManager = std::make_unique<legacy::FunctionPassManager>(
m_module.get());

/*
Note: if we want to use any of these, they also need to get added to the
Expand Down Expand Up @@ -1310,9 +1311,10 @@ void TCGLLVMTranslator::jitPendingModule()

m_module = std::make_unique<Module>(("tcg-llvm" +
std::to_string(m_tbCount)).c_str(), *m_context);
m_functionPassManager = new legacy::FunctionPassManager(m_module.get());
m_functionPassManager = std::make_unique<legacy::FunctionPassManager>(
m_module.get());
for(auto cb : newModuleCallbacks) {
cb(m_module.get(), m_functionPassManager);
cb(m_module.get(), m_functionPassManager.get());
}
}

Expand Down Expand Up @@ -1511,10 +1513,7 @@ void TCGLLVMTranslator::generateCode(TCGContext *s, TranslationBlock *tb)
*/
TCGLLVMTranslator::~TCGLLVMTranslator()
{
if (m_functionPassManager) {
delete m_functionPassManager;
m_functionPassManager = nullptr;
}
m_functionPassManager = nullptr;

/*if (llvm::llvm_is_multithreaded()) {
LLVMStopMultithreaded();
Expand Down
84 changes: 13 additions & 71 deletions panda/plugins/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions panda/plugins/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"gdb",
"rust_skeleton",
Expand Down
3 changes: 2 additions & 1 deletion panda/plugins/cosi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ crate-type = ["cdylib"]

[dependencies]
once_cell = "1.8.0"
panda-re = { version = "0.46.0", default-features = false }
panda-re = { version = "0.48.0", default-features = false }
regex = "1.5.4"
curl = "0.4.44"
volatility_profile = { path = "./volatility_profile" }
Expand All @@ -24,4 +24,5 @@ ppc = ["panda-re/ppc"]
mips = ["panda-re/mips"]
mipsel = ["panda-re/mipsel"]
mips64 = ["panda-re/mips64"]
mips64el = ["panda-re/mips64el"]
aarch64 = ["panda-re/aarch64"]
3 changes: 2 additions & 1 deletion panda/plugins/cosi_strace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"
crate-type = ["cdylib"]

[dependencies]
panda-re = { version = "0.45.0", default-features = false }
panda-re = { version = "0.48.0", default-features = false }
chumsky = "0.8"
log = "0.4"
once_cell = "1"
Expand All @@ -23,4 +23,5 @@ ppc = ["panda-re/ppc"]
mips = ["panda-re/mips"]
mipsel = ["panda-re/mipsel"]
mips64 = ["panda-re/mips64"]
mips64el = ["panda-re/mips64el"]
aarch64 = ["panda-re/aarch64"]
3 changes: 2 additions & 1 deletion panda/plugins/gdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"
crate-type = ["cdylib"]

[dependencies]
panda-re = { version = "0.14.0", default-features = false }
panda-re = { version = "0.48.0", default-features = false }
gdbstub = "0.5"
lazy_static = "1.4.0"
gdbstub_arch = "0.1.0"
Expand All @@ -25,4 +25,5 @@ ppc = ["panda-re/ppc"]
mips = ["panda-re/mips"]
mipsel = ["panda-re/mipsel"]
mips64 = ["panda-re/mips64"]
mips64el = ["panda-re/mips64el"]
aarch64 = ["panda-re/aarch64"]
8 changes: 4 additions & 4 deletions panda/plugins/gdb/src/memory_map.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use panda::prelude::*;
use panda::plugins::osi::OSI;
use panda::prelude::*;

use std::ffi::CStr;
use gdbstub::outputln;
use std::ffi::CStr;

pub(crate) fn print(cpu: &mut CPUState) {
let mut proc = OSI.get_current_process(cpu);
let mut proc = OSI.get_current_process(cpu).unwrap();
let mappings = OSI.get_mappings(cpu, &mut *proc);

println!("Memory map:");
Expand Down Expand Up @@ -33,7 +33,7 @@ pub(crate) fn print(cpu: &mut CPUState) {
}

pub(crate) fn print_to_gdb(cpu: &mut CPUState, mut out: impl std::fmt::Write) {
let mut proc = OSI.get_current_process(cpu);
let mut proc = OSI.get_current_process(cpu).unwrap();
let mappings = OSI.get_mappings(cpu, &mut *proc);

outputln!(out);
Expand Down
Loading

0 comments on commit 763be3f

Please sign in to comment.