Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ RUN apt-get update && \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

# penguin-env-cffi-gen.py parses the built libraries' DWARF (needs recent
# pyelftools for DWARF5) and verifies generated layouts with cffi.
RUN pip3 install --no-cache-dir "pyelftools>=0.31" cffi

COPY --exclude=.git \
--exclude=.github \
--exclude=build-system \
Expand Down
10 changes: 8 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ COMMON_CONFIGURE_ARGS=(
--disable-linux-aio
)

PENGUIN_SYSTEM_ARCHES="${PENGUIN_SYSTEM_ARCHES:-armel,aarch64,mipsel,mipseb,mips64el,mips64eb,powerpc,powerpc64,powerpc64le,riscv64,loongarch64,intel64}"
PENGUIN_SYSTEM_ARCHES="${PENGUIN_SYSTEM_ARCHES:-armel,aarch64,mipsel,mipseb,mips64el,mips64eb,powerpc,powerpc64,powerpc64el,powerpc64le,riscv64,loongarch64,intel64}"

configure_build_dir() {
local build_dir="$1"
Expand Down Expand Up @@ -87,7 +87,7 @@ penguin_system_arch_to_qemu_target() {
powerpc|ppc)
printf "ppc-softmmu\n"
;;
powerpc64|powerpc64le|ppc64)
powerpc64|powerpc64le|powerpc64el|ppc64)
printf "ppc64-softmmu\n"
;;
riscv64)
Expand Down Expand Up @@ -180,6 +180,9 @@ python3 scripts/penguin-cffi-gen.py \
--mode system \
--build-dir build-system \
--arches "$PENGUIN_SYSTEM_ARCHES"
python3 scripts/penguin-env-cffi-gen.py \
--build-dir build-system \
--manifest build-system/qemu_cffi_system_manifest.json

if [ -n "${PENGUIN_KVM_TARGETS:-}" ]; then
kvm_targets="$PENGUIN_KVM_TARGETS"
Expand Down Expand Up @@ -209,6 +212,9 @@ if [ -n "$kvm_targets" ]; then
--mode kvm \
--build-dir build-kvm \
--targets "$kvm_targets"
python3 scripts/penguin-env-cffi-gen.py \
--build-dir build-kvm \
--manifest build-kvm/qemu_cffi_kvm_manifest.json
fi

python3 scripts/penguin-qemu-package.py --output penguin-qemu.tar.gz
21 changes: 21 additions & 0 deletions include/system/penguin.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,25 @@ int penguin_qemu_add_mmio_region(uint64_t base, uint64_t size,
penguin_mmio_write_cb_t write_cb,
void *opaque);

/*
* Guest register access by GDB core-feature register number. Reads append
* the register bytes (target byte order) into @buf and return the register
* width; writes consume exactly the register width from @buf. Both return
* a negative value on failure.
*/
int penguin_read_guest_reg(CPUState *cs, int regnum, uint8_t *buf,
int buf_len);
int penguin_write_guest_reg(CPUState *cs, int regnum, const uint8_t *buf,
int len);

/*
* Direct CPUArchState access. penguin_cpu_env returns the env pointer for
* a CPU (the layout contract validated in cpu-target.c); callers decode it
* with the build-generated CPUArchState CFFI header. penguin_sync_cpu_state
* must be called before env reads (and to make env writes stick) under
* hardware accelerators; it is a no-op under TCG.
*/
void *penguin_cpu_env(CPUState *cs);
void penguin_sync_cpu_state(CPUState *cs);

#endif /* QEMU_SYSTEM_PENGUIN_H */
7 changes: 7 additions & 0 deletions scripts/penguin-cffi-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"ppc": "ppc-softmmu",
"powerpc64": "ppc64-softmmu",
"powerpc64le": "ppc64-softmmu",
"powerpc64el": "ppc64-softmmu",
"ppc64": "ppc64-softmmu",
"riscv64": "riscv64-softmmu",
"loongarch64": "loongarch64-softmmu",
Expand Down Expand Up @@ -118,6 +119,12 @@
penguin_mmio_read_cb_t read_cb,
penguin_mmio_write_cb_t write_cb,
void *opaque);
int penguin_read_guest_reg(CPUState *cs, int regnum, uint8_t *buf,
int buf_len);
int penguin_write_guest_reg(CPUState *cs, int regnum, const uint8_t *buf,
int len);
void *penguin_cpu_env(CPUState *cs);
void penguin_sync_cpu_state(CPUState *cs);
"""


Expand Down
Loading
Loading