[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v1 2/3] target-microblaze: Allow the stack protect
From: |
Peter Crosthwaite |
Subject: |
Re: [Qemu-devel] [RFC v1 2/3] target-microblaze: Allow the stack protection to be disabled |
Date: |
Thu, 14 May 2015 22:26:47 -0700 |
On Wed, May 13, 2015 at 11:08 PM, Alistair Francis
<address@hidden> wrote:
> Microblaze stack protection is configurable and isn't always enabled.
> This patch allows the stack protection to be disabled from the CPU
> properties.
>
> Signed-off-by: Alistair Francis <address@hidden>
> ---
>
> target-microblaze/cpu-qom.h | 5 +++++
> target-microblaze/cpu.c | 2 ++
> target-microblaze/op_helper.c | 4 +++-
> 3 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/target-microblaze/cpu-qom.h b/target-microblaze/cpu-qom.h
> index e3e0701..7bc5b81 100644
> --- a/target-microblaze/cpu-qom.h
> +++ b/target-microblaze/cpu-qom.h
> @@ -59,6 +59,11 @@ typedef struct MicroBlazeCPU {
> uint32_t base_vectors;
> /*< public >*/
>
> + /* Microblaze Configuration Settings */
> + struct {
> + bool stackproc;
> + } cfg;
> +
> CPUMBState env;
> } MicroBlazeCPU;
>
> diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c
> index 67e3182..c08da19 100644
> --- a/target-microblaze/cpu.c
> +++ b/target-microblaze/cpu.c
> @@ -152,6 +152,8 @@ static const VMStateDescription vmstate_mb_cpu = {
>
> static Property mb_properties[] = {
> DEFINE_PROP_UINT32("xlnx.base-vectors", MicroBlazeCPU, base_vectors, 0),
> + DEFINE_PROP_BOOL("xlnx.use-stack-protection", MicroBlazeCPU,
> cfg.stackproc,
> + true),
This should deposit (at realize time) into pvr[0].SPROT bit.
Regards,
Peter
> DEFINE_PROP_END_OF_LIST(),
> };
>
> diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c
> index d2b3624..24df538 100644
> --- a/target-microblaze/op_helper.c
> +++ b/target-microblaze/op_helper.c
> @@ -467,7 +467,9 @@ void helper_memalign(CPUMBState *env, uint32_t addr,
> uint32_t dr, uint32_t wr,
>
> void helper_stackprot(CPUMBState *env, uint32_t addr)
> {
> - if (addr < env->slr || addr > env->shr) {
> + MicroBlazeCPU *cpu = mb_env_get_cpu(env);
> +
> + if (cpu->cfg.stackproc && (addr < env->slr || addr > env->shr)) {
> qemu_log("Stack protector violation at %x %x %x\n",
> addr, env->slr, env->shr);
> env->sregs[SR_EAR] = addr;
> --
> 1.7.1
>
>
- [Qemu-devel] [RFC v1 0/3] Add Microblaze configuration options, Alistair Francis, 2015/05/14
- [Qemu-devel] [RFC v1 1/3] target-microblaze: Fix up indentation, Alistair Francis, 2015/05/14
- [Qemu-devel] [RFC v1 2/3] target-microblaze: Allow the stack protection to be disabled, Alistair Francis, 2015/05/14
- [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Alistair Francis, 2015/05/14
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Peter Crosthwaite, 2015/05/15
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Alistair Francis, 2015/05/15
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Peter Crosthwaite, 2015/05/15
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Alistair Francis, 2015/05/15
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Peter Crosthwaite, 2015/05/15
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Alistair Francis, 2015/05/15
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Peter Crosthwaite, 2015/05/15
- Re: [Qemu-devel] [RFC v1 3/3] target-microblaze: Convert use-fpu to a CPU property, Andreas Färber, 2015/05/15