[ox/std] Add missing ARM7TDMI functions, some are just stubs for now
This commit is contained in:
parent
87c65a70b0
commit
11029c93c8
3
deps/ox/src/ox/std/CMakeLists.txt
vendored
3
deps/ox/src/ox/std/CMakeLists.txt
vendored
@ -1,9 +1,11 @@
|
||||
add_library(
|
||||
OxStd
|
||||
arith.cpp
|
||||
assert.cpp
|
||||
buildinfo.cpp
|
||||
byteswap.cpp
|
||||
memops.cpp
|
||||
new.cpp
|
||||
random.cpp
|
||||
stacktrace.cpp
|
||||
strops.cpp
|
||||
@ -25,6 +27,7 @@ install(
|
||||
byteswap.hpp
|
||||
defines.hpp
|
||||
error.hpp
|
||||
hardware.hpp
|
||||
hashmap.hpp
|
||||
math.hpp
|
||||
memops.hpp
|
||||
|
44
deps/ox/src/ox/std/arith.cpp
vendored
Normal file
44
deps/ox/src/ox/std/arith.cpp
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2015 - 2018 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "hardware.hpp"
|
||||
|
||||
// these provide software implementations of arithmetic operators expected by
|
||||
// the compiler on older processors
|
||||
|
||||
#if !OX_HW_DIV
|
||||
|
||||
extern "C" {
|
||||
|
||||
unsigned __aeabi_uldivmod(unsigned, unsigned) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned __aeabi_uidiv(unsigned, unsigned) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned __aeabi_uimod(unsigned, unsigned) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned __aeabi_uidivmod(unsigned, unsigned) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
signed __aeabi_idiv(signed, signed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
signed __aeabi_imod(signed, signed) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
28
deps/ox/src/ox/std/hardware.hpp
vendored
Normal file
28
deps/ox/src/ox/std/hardware.hpp
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2015 - 2018 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(__arm__)
|
||||
|
||||
#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__)
|
||||
#define OX_HW_DIV 1
|
||||
#else
|
||||
#define OX_HW_DIV 0
|
||||
#endif
|
||||
|
||||
#elif defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
|
||||
|
||||
#define OX_HW_DIV 1
|
||||
|
||||
#else
|
||||
|
||||
#warn "Undefined hardware"
|
||||
|
||||
#endif
|
||||
|
17
deps/ox/src/ox/std/memops.cpp
vendored
17
deps/ox/src/ox/std/memops.cpp
vendored
@ -7,6 +7,23 @@
|
||||
*/
|
||||
|
||||
#include "types.hpp"
|
||||
#include "memops.hpp"
|
||||
|
||||
#ifndef OX_USE_STDLIB
|
||||
|
||||
extern "C" {
|
||||
|
||||
void *memcpy(void *dest, const void *src, std::size_t size) {
|
||||
return ox_memcpy(dest, src, size);
|
||||
}
|
||||
|
||||
void *memset(void *ptr, int val, std::size_t size) {
|
||||
return ox_memset(ptr, val, size);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int ox_memcmp(const void *ptr1, const void *ptr2, std::size_t size) noexcept {
|
||||
int retval = 0;
|
||||
|
1
deps/ox/src/ox/std/memops.hpp
vendored
1
deps/ox/src/ox/std/memops.hpp
vendored
@ -5,6 +5,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "types.hpp"
|
||||
|
21
deps/ox/src/ox/std/new.cpp
vendored
Normal file
21
deps/ox/src/ox/std/new.cpp
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2015 - 2018 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef OX_USE_STDLIB
|
||||
|
||||
#include "types.hpp"
|
||||
|
||||
void *operator new(std::size_t, void *addr) {
|
||||
return addr;
|
||||
}
|
||||
|
||||
void *operator new[](std::size_t, void *addr) {
|
||||
return addr;
|
||||
}
|
||||
|
||||
#endif
|
2
deps/ox/src/ox/std/new.hpp
vendored
2
deps/ox/src/ox/std/new.hpp
vendored
@ -22,7 +22,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
void *operator new(std::size_t, void*) noexcept;
|
||||
void *operator new(std::size_t, void*);
|
||||
|
||||
|
||||
/**
|
||||
|
1
deps/ox/src/ox/std/std.hpp
vendored
1
deps/ox/src/ox/std/std.hpp
vendored
@ -12,6 +12,7 @@
|
||||
#include "bitops.hpp"
|
||||
#include "byteswap.hpp"
|
||||
#include "error.hpp"
|
||||
#include "hardware.hpp"
|
||||
#include "hashmap.hpp"
|
||||
#include "math.hpp"
|
||||
#include "memops.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user