runtime: expose more libm functions

This commit is contained in:
Sebastien Bourdeauducq 2020-08-12 13:36:06 +08:00
parent c6f0c4dca4
commit d8cd5023f6
4 changed files with 44 additions and 6 deletions

View File

@ -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),

View File

@ -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

View File

@ -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. */

View File

@ -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;