mirror of
https://github.com/SerenityOS/serenity
synced 2026-04-25 17:15:42 +02:00
LibC: Implement fegetenv() and fesetenv() on AArch64
These functions simply store/restore the floating-point control and status flags.
This commit is contained in:
@@ -77,8 +77,9 @@ int fegetenv(fenv_t* env)
|
||||
if (!env)
|
||||
return 1;
|
||||
|
||||
(void)env;
|
||||
TODO_AARCH64();
|
||||
asm volatile("mrs %0, fpcr" : "=r"(env->fpcr));
|
||||
asm volatile("mrs %0, fpsr" : "=r"(env->fpsr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -87,8 +88,9 @@ int fesetenv(fenv_t const* env)
|
||||
if (!env)
|
||||
return 1;
|
||||
|
||||
(void)env;
|
||||
TODO_AARCH64();
|
||||
asm volatile("msr fpcr, %0" ::"r"(env->fpcr));
|
||||
asm volatile("msr fpsr, %0" ::"r"(env->fpsr));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef __aarch64__
|
||||
@@ -14,9 +15,9 @@
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
// TODO: Implement this.
|
||||
typedef struct fenv_t {
|
||||
char __dummy; // NOTE: This silences -Wextern-c-compat.
|
||||
uint64_t fpcr;
|
||||
uint64_t fpsr;
|
||||
} fenv_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user