arm: added some missing arch bits and changed asm section for arm compat.

This commit is contained in:
Jerome Duval
2012-04-01 14:03:36 +02:00
parent 8175a2c342
commit 57c324a753
13 changed files with 286 additions and 1 deletions
+2
View File
@@ -11,6 +11,8 @@ if $(TARGET_ARCH) = x86 {
PPC_ONLY = "" ;
} else if $(TARGET_ARCH) = m68k {
M68K_ONLY = "" ;
} else if $(TARGET_ARCH) = arm {
ARM_ONLY = "" ;
}
local GPL_ONLY = ;
@@ -10,7 +10,12 @@
#warning ARM: fix system_time()
struct arm_real_time_data {
vint64 system_time_offset;
};
struct arch_real_time_data {
struct arm_real_time_data data[2];
vint32 system_time_conversion_factor;
vint32 version;
};
+7
View File
@@ -0,0 +1,7 @@
SubDir HAIKU_TOP src system glue arch arm ;
KernelObjects
crti.S
crtn.S
;
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
/** This file contains the first part of the ".init" and ".fini" sections in
* the ELF executable.
* The functions defined here will be called during initialization/termination
* of the loaded executable/library. The ".init" and ".fini" sections are
* stacked together like this:
*
* crti.S entry point
* call to _init_before/_term_before
* crtbegin.S GCC specific: constructors/destructors are called, ...
* crtend.S
* crtn.S call to _init_after/_term_after
* exit
*/
#define FUNCTION(x) .global x; .type x,%function; x
.section .init
FUNCTION(_init):
bl __haiku_init_before
// crtbegin.o stuff comes here
.section .fini
FUNCTION(_fini):
bl __haiku_term_before
// crtbegin.o stuff comes here
+19
View File
@@ -0,0 +1,19 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
/** This file contains the final part of the ".init" and ".fini" sections in
* the ELF executable. It is tightly connected to crti.S.
* Have a look at crti.S to find a description of what happens here.
*/
.section .init
// the image ID and program args are still on the stack
bl __haiku_init_after
.section .fini
// the image ID and program args are still on the stack
bl __haiku_term_after
+17
View File
@@ -0,0 +1,17 @@
SubDir HAIKU_TOP src system libroot os arch arm ;
UsePrivateKernelHeaders ;
UsePrivateSystemHeaders ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
MergeObject os_arch_$(TARGET_ARCH).o :
atomic.S
byteorder.S
system_time.c
thread.c
time.c
tls.c
generic_system_time_nsecs.cpp
;
@@ -0,0 +1,88 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#define SYSCALL0(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL1(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL2(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL3(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL4(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL5(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL6(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL7(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL8(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL9(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL10(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL11(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL12(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL13(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
+9
View File
@@ -0,0 +1,9 @@
#include <OS.h>
#include "syscalls.h"
thread_id
find_thread(const char *name)
{
return _kern_find_thread(name);
}
+42
View File
@@ -0,0 +1,42 @@
/*
* Copyright 2006, Ingo Weinhold <[email protected]>.
* Distributed under the terms of the MIT License.
*/
#include <OS.h>
#include <arch_cpu.h>
#include <libroot_private.h>
#include <real_time_data.h>
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->data[0].system_time_offset = 0;
sRealTimeData->system_time_conversion_factor = 1000000000LL;
sRealTimeData->version = 0;
}
__arm_setup_system_time(&sRealTimeData->system_time_conversion_factor);
}
bigtime_t
__arch_get_system_time_offset(struct real_time_data *data)
{
int32 version;
bigtime_t offset;
do {
version = sRealTimeData->version;
offset = sRealTimeData->data[version % 2].system_time_offset;
} while (version != sRealTimeData->version);
return offset;
}
+53
View File
@@ -0,0 +1,53 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
// ToDo: this is a dummy implementation - I've not yet gained enough knowledge
// to decide how this should be done, so it's just broken now (okay for single
// threaded apps, though).
// we don't want to have the inline assembly included here
#ifndef _NO_INLINE_ASM
# define _NO_INLINE_ASM 1
#endif
#include "support/TLS.h"
#include "tls.h"
static int32 gNextSlot = TLS_FIRST_FREE_SLOT;
static void *gSlots[TLS_MAX_KEYS];
int32
tls_allocate(void)
{
int32 next = atomic_add(&gNextSlot, 1);
if (next >= TLS_MAX_KEYS)
return B_NO_MEMORY;
return next;
}
void *
tls_get(int32 index)
{
return gSlots[index];
}
void **
tls_address(int32 index)
{
return &gSlots[index];
}
void
tls_set(int32 index, void *value)
{
gSlots[index] = value;
}
+3
View File
@@ -22,6 +22,9 @@
#ifdef ARCH_ppc
# include "arch/ppc/syscalls.inc"
#endif
#ifdef ARCH_arm
# include "arch/arm/syscalls.inc"
#endif
#ifdef ARCH_m68k
# include "arch/m68k/syscalls.inc"
#endif
@@ -247,7 +247,7 @@
__attribute__ ((unused, section (".gnu.warning." #symbol __sec_comment))) \
= msg;
# define libc_freeres_ptr(decl) \
__make_section_unallocated ("__libc_freeres_ptrs, \"aw\", @nobits") \
__make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
# define __libc_freeres_fn_section \
__attribute__ ((section ("__libc_freeres_fn")))
@@ -0,0 +1,10 @@
SubDir HAIKU_TOP src system libroot posix string arch arm ;
UsePrivateSystemHeaders ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
MergeObject posix_string_arch_$(TARGET_ARCH).o :
memcpy.c
memset.c
;