Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

76 lines
2.3 KiB
C

/* Ravenscar RISC-V target support.
Copyright (C) 2019-2024 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "gdbarch.h"
#include "gdbcore.h"
#include "regcache.h"
#include "riscv-tdep.h"
#include "inferior.h"
#include "ravenscar-thread.h"
#include "riscv-ravenscar-thread.h"
#define LAST_REGISTER (RISCV_FIRST_FP_REGNUM + 14)
struct riscv_ravenscar_ops : public ravenscar_arch_ops
{
int reg_offsets[LAST_REGISTER + 1];
riscv_ravenscar_ops (struct gdbarch *arch);
};
riscv_ravenscar_ops::riscv_ravenscar_ops (struct gdbarch *arch)
: ravenscar_arch_ops (gdb::make_array_view (reg_offsets, LAST_REGISTER + 1))
{
int reg_size = riscv_isa_xlen (arch);
for (int regnum = 0; regnum <= LAST_REGISTER; ++regnum)
{
int offset;
if (regnum == RISCV_RA_REGNUM || regnum == RISCV_PC_REGNUM)
offset = 0;
else if (regnum == RISCV_SP_REGNUM)
offset = 1;
else if (regnum == RISCV_ZERO_REGNUM + 8) /* S0 */
offset = 2;
else if (regnum == RISCV_ZERO_REGNUM + 9) /* S1 */
offset = 3;
else if (regnum >= RISCV_ZERO_REGNUM + 19
&& regnum <= RISCV_ZERO_REGNUM + 27) /* S2..S11 */
offset = regnum - (RISCV_ZERO_REGNUM + 19) + 4;
else if (regnum >= RISCV_FIRST_FP_REGNUM
&& regnum <= RISCV_FIRST_FP_REGNUM + 11)
offset = regnum - RISCV_FIRST_FP_REGNUM + 14; /* FS0..FS11 */
else
offset = -1;
if (offset != -1)
offset *= reg_size;
reg_offsets[regnum] = offset;
}
}
/* Register riscv_ravenscar_ops in GDBARCH. */
void
register_riscv_ravenscar_ops (struct gdbarch *gdbarch)
{
set_gdbarch_ravenscar_ops (gdbarch, new riscv_ravenscar_ops (gdbarch));
}