From d8cd5023f6fb0927a6bcf6197342e6137a1a0262 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 12 Aug 2020 13:36:06 +0800 Subject: [PATCH] runtime: expose more libm functions --- artiq/firmware/ksupport/api.rs | 42 ++++++++++++++++++- artiq/firmware/ksupport/glue.c | 2 +- artiq/firmware/ksupport/ksupport.ld | 4 +- artiq/firmware/libproto_artiq/kernel_proto.rs | 2 +- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/artiq/firmware/ksupport/api.rs b/artiq/firmware/ksupport/api.rs index 6d14891a7..c07f9776b 100644 --- a/artiq/firmware/ksupport/api.rs +++ b/artiq/firmware/ksupport/api.rs @@ -67,10 +67,48 @@ static mut API: &'static [(&'static str, *const ())] = &[ api!(memcmp, extern { fn memcmp(a: *const u8, b: *mut u8, size: usize); }), /* libm */ - api!(sqrt), - api!(round), + // commented out functions are not available with the libm used here, but are available in NAR3. + api!(acos), + api!(acosh), + api!(asin), + api!(asinh), + api!(atan), + api!(atan2), + api!(atanh), + api!(cbrt), + api!(ceil), + api!(cos), + api!(cosh), + api!(erf), + api!(erfc), + api!(exp), + //api!(exp2), + //api!(exp10), + api!(expm1), + api!(fabs), api!(floor), + //api!(fma), api!(fmod), + api!(hypot), + api!(j0), + api!(j1), + api!(jn), + api!(lgamma), + api!(log), + //api!(log2), + api!(log10), + api!(pow), + api!(round), + api!(sin), + api!(sinh), + api!(sqrt), + api!(tan), + api!(tanh), + //api!(tgamma), + //api!(trunc), + api!(y0), + api!(y1), + api!(yn), /* exceptions */ api!(_Unwind_Resume = ::unwind::_Unwind_Resume), diff --git a/artiq/firmware/ksupport/glue.c b/artiq/firmware/ksupport/glue.c index c1155b732..7f87d5e3c 100644 --- a/artiq/firmware/ksupport/glue.c +++ b/artiq/firmware/ksupport/glue.c @@ -15,7 +15,7 @@ void send_to_core_log(struct slice str); void send_to_rtio_log(struct slice data); #define KERNELCPU_EXEC_ADDRESS 0x40800000 -#define KERNELCPU_PAYLOAD_ADDRESS 0x40840000 +#define KERNELCPU_PAYLOAD_ADDRESS 0x40860000 #define KERNELCPU_LAST_ADDRESS 0x4fffffff #define KSUPPORT_HEADER_SIZE 0x80 diff --git a/artiq/firmware/ksupport/ksupport.ld b/artiq/firmware/ksupport/ksupport.ld index 48b6978f2..bc6a97ab1 100644 --- a/artiq/firmware/ksupport/ksupport.ld +++ b/artiq/firmware/ksupport/ksupport.ld @@ -6,12 +6,12 @@ ENTRY(_reset_handler) * code/data/heap, then comes kernel memory. * Next 4M of main memory are reserved for * the background RPC queue. - * First 256K of kernel memory are for support code. + * First 384K of kernel memory are for support code. * Support code is loaded at ORIGIN-0x80 so that ELF headers * are also loaded. */ MEMORY { - ksupport (RWX) : ORIGIN = 0x40800000, LENGTH = 0x40000 + ksupport (RWX) : ORIGIN = 0x40800000, LENGTH = 0x60000 } /* Kernel stack is at the end of main RAM. */ diff --git a/artiq/firmware/libproto_artiq/kernel_proto.rs b/artiq/firmware/libproto_artiq/kernel_proto.rs index f7fef6eb0..a64f0f0b7 100644 --- a/artiq/firmware/libproto_artiq/kernel_proto.rs +++ b/artiq/firmware/libproto_artiq/kernel_proto.rs @@ -2,7 +2,7 @@ use core::fmt; use dyld; pub const KERNELCPU_EXEC_ADDRESS: usize = 0x40800000; -pub const KERNELCPU_PAYLOAD_ADDRESS: usize = 0x40840000; +pub const KERNELCPU_PAYLOAD_ADDRESS: usize = 0x40860000; pub const KERNELCPU_LAST_ADDRESS: usize = 0x4fffffff; pub const KSUPPORT_HEADER_SIZE: usize = 0x80;