diff --git a/headers/private/system/arch/sparc/arch_cpu_defs.h b/headers/private/system/arch/sparc/arch_cpu_defs.h index e69de29bb2..3be3d08758 100644 --- a/headers/private/system/arch/sparc/arch_cpu_defs.h +++ b/headers/private/system/arch/sparc/arch_cpu_defs.h @@ -0,0 +1,13 @@ +/* + * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_ARCH_SPARC_DEFS_H +#define _SYSTEM_ARCH_SPARC_DEFS_H + + +#define SPINLOCK_PAUSE() do {} while (false) + + +#endif /* _SYSTEM_ARCH_SPARC_DEFS_H */ + diff --git a/src/system/libroot/os/arch/sparc/stack_frame.c b/src/system/libroot/os/arch/sparc/stack_frame.c new file mode 100644 index 0000000000..d5db3c3f4d --- /dev/null +++ b/src/system/libroot/os/arch/sparc/stack_frame.c @@ -0,0 +1,25 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. +*/ + +#include + +#include + + +void* +get_stack_frame(void) +{ + // TODO: Implement! + return NULL; +} + + +void* +__arch_get_caller(void) +{ + // TODO: Implement! + return NULL; +} + diff --git a/src/system/libroot/os/arch/sparc/system_time.c b/src/system/libroot/os/arch/sparc/system_time.c new file mode 100644 index 0000000000..5f3fffd5e4 --- /dev/null +++ b/src/system/libroot/os/arch/sparc/system_time.c @@ -0,0 +1,33 @@ +/* + * Copyright 2012, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * François Revol + */ + +#include + +#include +#include +#include + +static vint32 *sConversionFactor; + +//XXX: this is a hack +// remove me when platform code works +static int64 +__sparc_get_time_base(void) +{ + static uint64 time_dilation_field = 0; + return time_dilation_field++; +} + +bigtime_t +system_time(void) +{ + uint64 timeBase = __sparc_get_time_base(); + + uint32 cv = sConversionFactor ? *sConversionFactor : 0; + return (timeBase >> 32) * cv + (((timeBase & 0xffffffff) * cv) >> 32); +} diff --git a/src/system/libroot/os/arch/sparc/thread.c b/src/system/libroot/os/arch/sparc/thread.c new file mode 100644 index 0000000000..6e4e258361 --- /dev/null +++ b/src/system/libroot/os/arch/sparc/thread.c @@ -0,0 +1,10 @@ +#include +#include "syscalls.h" + + +thread_id +find_thread(const char *name) +{ + return _kern_find_thread(name); +} + diff --git a/src/system/libroot/os/arch/sparc/time.c b/src/system/libroot/os/arch/sparc/time.c new file mode 100644 index 0000000000..3e20cdd5e9 --- /dev/null +++ b/src/system/libroot/os/arch/sparc/time.c @@ -0,0 +1,32 @@ +/* + * Copyright 2006, Ingo Weinhold . + * Distributed under the terms of the MIT License. + */ + +#include + +#include +#include +#include + + +static struct arch_real_time_data *sRealTimeData; + +void +__arch_init_time(struct real_time_data *data, bool setDefaults) +{ + sRealTimeData = &data->arch_data; + + if (setDefaults) { + sRealTimeData->system_time_conversion_factor = 1000000000LL; + } + + // __sparc_setup_system_time(&sRealTimeData->system_time_conversion_factor); +} + + +bigtime_t +__arch_get_system_time_offset(struct real_time_data *data) +{ + return 0; +} diff --git a/src/system/libroot/posix/glibc/arch/sparc/Jamfile b/src/system/libroot/posix/glibc/arch/sparc/Jamfile new file mode 100644 index 0000000000..a0fb7e6b60 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/sparc/Jamfile @@ -0,0 +1,139 @@ +SubDir HAIKU_TOP src system libroot posix glibc arch sparc ; + +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc arch $(TARGET_ARCH) ; +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch + $(TARGET_ARCH) ; +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch generic ; +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include ; +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc stdlib ; +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc math ; +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc libio ; +SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ; + +SubDirHdrs $(HAIKU_TOP) src system libroot posix glibc arch generic ; + +UsePrivateHeaders libroot ; + +SubDirCcFlags -D_GNU_SOURCE -D_IEEE_LIBM ; + +local genericSources = + branred.c + cmp.c dbl2mpn.c divrem.c + dosincos.c + halfulp.c + memrchr.c + mpa.c mpatan.c mpatan2.c mpexp.c mplog.c mpn2dbl.c + mpn2flt.c mpn2ldbl.c mpsqrt.c mptan.c + mul.c mul_n.c + sincos32.c + slowexp.c + slowpow.c + + e_acosh.c e_acoshf.c # e_acoshl.c + e_atan2.c e_atan2f.c # e_atan2l.c + e_atanh.c e_atanhf.c # e_atanhl.c + e_cosh.c e_coshf.c # e_coshl.c + e_exp.c e_expf.c + e_fmod.c e_fmodf.c # e_fmodl.c + e_gamma_r.c e_gammaf_r.c + e_hypot.c e_hypotf.c # e_hypotl.c + e_j0.c e_j0f.c + e_j1.c e_j1f.c + e_jn.c e_jnf.c + e_lgamma_r.c e_lgammaf_r.c + e_log.c e_logf.c + e_log10.c e_log10f.c + e_pow.c e_powf.c # e_powl.c + e_rem_pio2f.c + e_remainder.c e_remainderf.c # e_remainderl.c + e_scalb.c e_scalbf.c # e_scalbl.c + e_sinh.c e_sinhf.c # e_sinhl.c + k_cos.c k_cosf.c + k_sin.c k_sinf.c + k_rem_pio2.c k_rem_pio2f.c # k_rem_pio2l.c + k_tan.c k_tanf.c + s_asinh.c s_asinhf.c # s_asinhl.c + s_atan.c s_atanf.c # s_atanl.c + s_cbrt.c s_cbrtf.c # s_cbrtl.c + s_ceil.c s_ceilf.c # s_ceill.c + s_copysign.c s_copysignf.c # s_copysignl.c + s_cos.c s_cosf.c + s_erf.c s_erff.c # s_erfl.c + s_expm1f.c s_expm1.c + s_fabs.c s_fabsf.c # s_fabsl.S + s_finite.c s_finitef.c # s_finitel.c + s_floor.c s_floorf.c # s_floorl.c + s_fma.c s_fmaf.c # s_fmal.c + s_fmax.c s_fmaxf.c # s_fmaxl.c + s_fmin.c s_fminf.c # s_fminl.c + s_fpclassify.c s_fpclassifyf.c # s_fpclassifyl.c + s_frexp.c s_frexpf.c # s_frexpl.c + s_ilogb.c s_ilogbf.c + s_isinf.c s_isinff.c # s_isinfl.c + s_ldexp.c s_ldexpf.c # s_ldexpl.c + s_llrint.c s_llrintf.c # s_llrintl.c + s_log1p.c s_log1pf.c + s_logb.c s_logbf.c # s_logbl.c + s_lrint.c s_lrintf.c # s_lrintl.c + s_lround.c s_lroundf.c + s_modf.c s_modff.c # s_modfl.c + s_nan.c s_nanf.c # s_nanl.c + s_nextafter.c s_nextafterf.c # s_nextafterl.c + s_nexttoward.c # s_nexttowardf.c s_nexttowardl.c + s_round.c s_roundf.c # s_roundl.c + s_scalbn.c s_scalbnf.c # s_scalbnl.c + s_signbit.c s_signbitf.c # s_signbitl.c + s_significand.c s_significandf.c + s_signgam.c + s_sin.c s_sinf.c # s_sinl.c + s_sincos.c s_sincosf.c + s_tan.c s_tanf.c + s_tanh.c s_tanhf.c + s_trunc.c s_truncf.c + t_exp.c + w_acos.c w_acosf.c # w_acosl.c + w_acosh.c w_acoshf.c # w_acoshl.c + w_atan2.c w_atan2f.c # w_atan2l.c + w_asin.c w_asinf.c # w_asinl.c + w_atanh.c w_atanhf.c # w_atanhl.c + w_cosh.c w_coshf.c # w_coshl.c + w_drem.c w_dremf.c # w_dreml.c + w_exp.c w_expf.c # w_expl.c + w_fmod.c w_fmodf.c # w_fmodl.c + w_hypot.c w_hypotf.c # w_hypotl.c + w_j0.c w_j0f.c + w_j1.c w_j1f.c + w_jn.c w_jnf.c + w_lgamma.c w_lgammaf.c + w_lgamma_r.c w_lgammaf_r.c + w_log.c w_logf.c # w_logl.c + w_log10.c w_log10f.c # w_log10l.c + w_pow.c w_powf.c # w_powl.c + w_remainder.c w_remainderf.c # w_remainderl.c + w_scalb.c w_scalbf.c # w_scalbl.c + w_sinh.c w_sinhf.c # w_sinhl.c + # no asm for m68k in glibc + w_sqrt.c w_sqrtf.c # w_sqrtl.c + ; + + +MergeObject <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_generic.o : + $(genericSources) +; + + +#MergeObject <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_other.o : +# ; + + +MergeObjectFromObjects <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH).o + : : + <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_generic.o + # <$(TARGET_ARCH)>posix_gnu_arch_$(TARGET_ARCH)_other.o +; + + +SEARCH on [ FGristFiles $(genericSources) ] + = [ FDirName $(HAIKU_TOP) src system libroot posix glibc arch + generic ] ; + diff --git a/src/system/libroot/posix/glibc/include/arch/sparc/bits/fenv.h b/src/system/libroot/posix/glibc/include/arch/sparc/bits/fenv.h new file mode 100644 index 0000000000..90cfa2089f --- /dev/null +++ b/src/system/libroot/posix/glibc/include/arch/sparc/bits/fenv.h @@ -0,0 +1,94 @@ +/* Copyright (C) 1997-2012 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FENV_H +# error "Never use directly; include instead." +#endif + +/* Define bits representing the exception. We use the bit positions + of the appropriate bits in the FPU control word. */ +enum + { + FE_INVALID = 0x01, +#define FE_INVALID FE_INVALID + __FE_DENORM = 0x02, + FE_DIVBYZERO = 0x04, +#define FE_DIVBYZERO FE_DIVBYZERO + FE_OVERFLOW = 0x08, +#define FE_OVERFLOW FE_OVERFLOW + FE_UNDERFLOW = 0x10, +#define FE_UNDERFLOW FE_UNDERFLOW + FE_INEXACT = 0x20 +#define FE_INEXACT FE_INEXACT + }; + +#define FE_ALL_EXCEPT \ + (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID) + +/* The ix87 FPU supports all of the four defined rounding modes. We + use again the bit positions in the FPU control word as the values + for the appropriate macros. */ +enum + { + FE_TONEAREST = 0, +#define FE_TONEAREST FE_TONEAREST + FE_DOWNWARD = 0x400, +#define FE_DOWNWARD FE_DOWNWARD + FE_UPWARD = 0x800, +#define FE_UPWARD FE_UPWARD + FE_TOWARDZERO = 0xc00 +#define FE_TOWARDZERO FE_TOWARDZERO + }; + + +/* Type representing exception flags. */ +typedef unsigned short int fexcept_t; + + +/* Type representing floating-point environment. This structure + corresponds to the layout of the block written by the `fstenv' + instruction and has additional fields for the contents of the MXCSR + register as written by the `stmxcsr' instruction. */ +typedef struct + { + unsigned short int __control_word; + unsigned short int __unused1; + unsigned short int __status_word; + unsigned short int __unused2; + unsigned short int __tags; + unsigned short int __unused3; + unsigned int __eip; + unsigned short int __cs_selector; + unsigned int __opcode:11; + unsigned int __unused4:5; + unsigned int __data_offset; + unsigned short int __data_selector; + unsigned short int __unused5; +#ifdef __x86_64__ + unsigned int __mxcsr; +#endif + } +fenv_t; + +/* If the default argument is used we use this value. */ +#define FE_DFL_ENV ((const fenv_t *) -1) + +#ifdef __USE_GNU +/* Floating-point environment where none of the exception is masked. */ +# define FE_NOMASK_ENV ((const fenv_t *) -2) +#endif + diff --git a/src/system/libroot/posix/glibc/include/arch/sparc/bits/fenvinline.h b/src/system/libroot/posix/glibc/include/arch/sparc/bits/fenvinline.h new file mode 100644 index 0000000000..bd1a30dfa2 --- /dev/null +++ b/src/system/libroot/posix/glibc/include/arch/sparc/bits/fenvinline.h @@ -0,0 +1,9 @@ +/* This file provides inline versions of floating-pint environment + handling functions. If there were any. */ + +#ifndef __NO_MATH_INLINES + +/* Here is where the code would go. */ + +#endif + diff --git a/src/system/libroot/posix/string/arch/sparc/Jamfile b/src/system/libroot/posix/string/arch/sparc/Jamfile new file mode 100644 index 0000000000..e19b60f834 --- /dev/null +++ b/src/system/libroot/posix/string/arch/sparc/Jamfile @@ -0,0 +1,10 @@ +SubDir HAIKU_TOP src system libroot posix string arch sparc ; + +UsePrivateSystemHeaders ; + +SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ; + +MergeObject <$(TARGET_ARCH)>posix_string_arch_$(TARGET_ARCH).o : + memcpy.c + memset.c +;