tests/fpu_sharing: ported to SPARC
Added the bits and pieces required to run the test on SPARC. Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
This commit is contained in:
parent
6265e2b42a
commit
5fc94948a8
5 changed files with 89 additions and 1 deletions
|
@ -123,6 +123,18 @@ struct fp_non_volatile_register_set {
|
|||
#define SIZEOF_FP_VOLATILE_REGISTER_SET sizeof(struct fp_volatile_register_set)
|
||||
#define SIZEOF_FP_NON_VOLATILE_REGISTER_SET 0
|
||||
|
||||
#elif defined(CONFIG_SPARC)
|
||||
|
||||
struct fp_volatile_register_set {
|
||||
double d[16];
|
||||
};
|
||||
|
||||
struct fp_non_volatile_register_set {
|
||||
};
|
||||
|
||||
#define SIZEOF_FP_VOLATILE_REGISTER_SET sizeof(struct fp_volatile_register_set)
|
||||
#define SIZEOF_FP_NON_VOLATILE_REGISTER_SET 0
|
||||
|
||||
#else
|
||||
|
||||
#error "Architecture must provide the following definitions:\n"
|
||||
|
|
68
tests/kernel/fpu_sharing/generic/src/float_regs_sparc.h
Normal file
68
tests/kernel/fpu_sharing/generic/src/float_regs_sparc.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Cobham Gaisler AB
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _FLOAT_REGS_SPARC_H
|
||||
#define _FLOAT_REGS_SPARC_H
|
||||
|
||||
#include <toolchain.h>
|
||||
#include "float_context.h"
|
||||
|
||||
static inline void _load_all_float_registers(struct fp_register_set *regs)
|
||||
{
|
||||
__asm__ volatile (
|
||||
"ldd [%0 + 0x00], %%f0\n"
|
||||
"ldd [%0 + 0x08], %%f2\n"
|
||||
"ldd [%0 + 0x10], %%f4\n"
|
||||
"ldd [%0 + 0x18], %%f6\n"
|
||||
"ldd [%0 + 0x20], %%f8\n"
|
||||
"ldd [%0 + 0x28], %%f10\n"
|
||||
"ldd [%0 + 0x30], %%f12\n"
|
||||
"ldd [%0 + 0x38], %%f14\n"
|
||||
"ldd [%0 + 0x40], %%f16\n"
|
||||
"ldd [%0 + 0x48], %%f18\n"
|
||||
"ldd [%0 + 0x50], %%f20\n"
|
||||
"ldd [%0 + 0x58], %%f22\n"
|
||||
"ldd [%0 + 0x60], %%f24\n"
|
||||
"ldd [%0 + 0x68], %%f26\n"
|
||||
"ldd [%0 + 0x70], %%f28\n"
|
||||
"ldd [%0 + 0x78], %%f30\n"
|
||||
:
|
||||
: "r" (®s->fp_volatile)
|
||||
);
|
||||
}
|
||||
|
||||
static inline void _store_all_float_registers(struct fp_register_set *regs)
|
||||
{
|
||||
__asm__ volatile (
|
||||
"std %%f0, [%0 + 0x00]\n"
|
||||
"std %%f2, [%0 + 0x08]\n"
|
||||
"std %%f4, [%0 + 0x10]\n"
|
||||
"std %%f6, [%0 + 0x18]\n"
|
||||
"std %%f8, [%0 + 0x20]\n"
|
||||
"std %%f10, [%0 + 0x28]\n"
|
||||
"std %%f12, [%0 + 0x30]\n"
|
||||
"std %%f14, [%0 + 0x38]\n"
|
||||
"std %%f16, [%0 + 0x40]\n"
|
||||
"std %%f18, [%0 + 0x48]\n"
|
||||
"std %%f20, [%0 + 0x50]\n"
|
||||
"std %%f22, [%0 + 0x58]\n"
|
||||
"std %%f24, [%0 + 0x60]\n"
|
||||
"std %%f26, [%0 + 0x68]\n"
|
||||
"std %%f28, [%0 + 0x70]\n"
|
||||
"std %%f30, [%0 + 0x78]\n"
|
||||
:
|
||||
: "r" (®s->fp_volatile)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
||||
static inline void _load_then_store_all_float_registers(struct fp_register_set
|
||||
*regs)
|
||||
{
|
||||
_load_all_float_registers(regs);
|
||||
_store_all_float_registers(regs);
|
||||
}
|
||||
#endif /* _FLOAT_REGS_SPARC_H */
|
|
@ -62,6 +62,8 @@
|
|||
#else
|
||||
#include "float_regs_riscv_other.h"
|
||||
#endif /* __GNUC__ */
|
||||
#elif defined(CONFIG_SPARC)
|
||||
#include "float_regs_sparc.h"
|
||||
#endif
|
||||
|
||||
#include "float_context.h"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
/*
|
||||
* Test Thread Parameters
|
||||
*/
|
||||
#define THREAD_STACK_SIZE 1024
|
||||
#define THREAD_STACK_SIZE (1024 + CONFIG_TEST_EXTRA_STACKSIZE)
|
||||
|
||||
#define THREAD_HIGH_PRIORITY 5
|
||||
#define THREAD_LOW_PRIORITY 10
|
||||
|
|
|
@ -30,6 +30,12 @@ tests:
|
|||
tags: kernel
|
||||
timeout: 600
|
||||
min_ram: 16
|
||||
kernel.fpu_sharing.generic.sparc:
|
||||
extra_args: PI_NUM_ITERATIONS=70000
|
||||
filter: CONFIG_CPU_HAS_FPU
|
||||
arch_allow: sparc
|
||||
tags: kernel
|
||||
timeout: 600
|
||||
kernel.fpu_sharing.generic.x86:
|
||||
extra_args: CONF_FILE=prj_x86.conf
|
||||
platform_allow: qemu_x86
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue