sparc: add defines and minimum set of required files

Gets the stage0 bootstrap to run.
Imlementation is probably nonsense at this point.

Change-Id: I10876efbb54314b864c0ad951152757cdb2fd366
Reviewed-on: https://review.haiku-os.org/c/1061
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Adrien Destugues
2019-02-23 16:30:50 +00:00
committed by waddlesplash
parent be6c334335
commit 5629675a32
36 changed files with 925 additions and 1 deletions
+8
View File
@@ -243,6 +243,14 @@ rule KernelArchitectureSetup architecture
# offset in floppy image (>= sizeof(haiku_loader))
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 384 ; # in kB
case sparc :
HAIKU_KERNEL_PLATFORM ?= openfirmware ;
HAIKU_BOOT_TARGETS += openfirmware ;
HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 1440 ; # in kB
# offset in floppy image (>= sizeof(haiku_loader))
HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 384 ; # in kB
case arm :
HAIKU_KERNEL_PLATFORM ?= u-boot ;
HAIKU_BOOT_TARGETS += u-boot ;
@@ -0,0 +1,72 @@
BootstrapPackageRepository HaikuPortsCross
: sparc
:
# architecture "any" packages
haikuporter-0-1
noto-20170202-7
:
# repository architecture packages (stage 0)
gcc_bootstrap-7.3.0_2018_05_01-1
gcc_bootstrap_syslibs-7.3.0_2018_05_01-1
gcc_bootstrap_syslibs_devel-7.3.0_2018_05_01-1
:
# repository architecture packages (stage 1)
bash_bootstrap-4.4.012-1
binutils_bootstrap-2.28.1_2017_08_05-1
bison_bootstrap-3.0.4-5
coreutils_bootstrap-8.22-1
curl_bootstrap-7.40.0-1
curl_bootstrap_devel-7.40.0-1
expat_bootstrap-2.1.0-1
expat_bootstrap_devel-2.1.0-1
findutils_bootstrap-4.6.0-1
flex_bootstrap-2.5.35-1
freetype_bootstrap-2.6.3-1
freetype_bootstrap_devel-2.6.3-1
gawk_bootstrap-3.1.8-2
grep_bootstrap-2.14-1
icu_bootstrap-57.1-2
icu_bootstrap_devel-57.1-2
less_bootstrap-451-1
m4_bootstrap-1.4.16-1
make_bootstrap-4.1-2
ncurses6_bootstrap-6.0-1
ncurses6_bootstrap_devel-6.0-1
python_bootstrap-2.7.6-1
sed_bootstrap-4.2.1-1
texinfo_bootstrap-4.13a-1
zlib_bootstrap-1.2.11-1
zlib_bootstrap_devel-1.2.11-1
:
# repository architecture packages (stage 2)
libsolv_bootstrap-0.3.0_haiku_2014_12_22-1
libsolv_bootstrap_devel-0.3.0_haiku_2014_12_22-1
:
# source packages
bash_bootstrap
binutils_bootstrap
bison_bootstrap
coreutils_bootstrap
curl_bootstrap
expat_bootstrap
findutils_bootstrap
flex_bootstrap
freetype_bootstrap
gawk_bootstrap
gcc_bootstrap
grep_bootstrap
less_bootstrap
libsolv_bootstrap
m4_bootstrap
make_bootstrap
ncurses6_bootstrap
python_bootstrap
sed_bootstrap
texinfo_bootstrap
zlib_bootstrap
:
# debuginfo packages
;
Vendored
+4 -1
View File
@@ -33,7 +33,7 @@ options:
variables will be set accordingly.
<arch> specifies the target architecture, either
"x86_gcc2", "x86", "x86_64", "ppc", "m68k",
"arm", "arm64", "riscv32", "riscv64"
"arm", "arm64", "riscv32", "riscv64", "sparc"
This option and --cross-tools-prefix can be
specified multiple times. The first cross tools
specify the primary tools, the subsequent ones the
@@ -273,6 +273,7 @@ standard_gcc_settings()
powerpc-*) targetCpu=ppc;;
riscv32-*) targetCpu=riscv32;;
riscv64-*) targetCpu=riscv64;;
sparc64-*) targetCpu=sparc;;
x86_64-*) targetCpu=x86_64;;
*)
echo "Unsupported gcc target machine: $gccMachine" >&2
@@ -682,6 +683,7 @@ while [ $# -gt 0 ] ; do
arm) targetMachine=arm-unknown-haiku;;
riscv32) targetMachine=riscv32-unknown-haiku;;
riscv64) targetMachine=riscv64-unknown-haiku;;
sparc) targetMachine=sparc64-unknown-haiku;;
*)
echo "Unsupported target architecture: $targetArch" >&2
exit 1
@@ -742,6 +744,7 @@ while [ $# -gt 0 ] ; do
arm64) targetMachine=arm64-unknown-haiku;;
riscv32) targetMachine=riscv32-unknown-haiku;;
riscv64) targetMachine=riscv64-unknown-haiku;;
sparc) targetMachine=sparc64-unknown-haiku;;
*)
echo "Unsupported target architecture: $2" >&2
exit 1
+1
View File
@@ -620,6 +620,7 @@ B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE ("package:architecture")
5 B_PACKAGE_ARCHITECTURE_PPC PowerPC
6 B_PACKAGE_ARCHITECTURE_ARM ARM
7 B_PACKAGE_ARCHITECTURE_M68K m68k
8 B_PACKAGE_ARCHITECTURE_SPARC sparc
= =============================== =========================================
:Child Attributes: none
+7
View File
@@ -71,6 +71,13 @@
# define __HAIKU_ARCH_ABI "riscv64"
# define __HAIKU_ARCH_RISCV32 1
# define __HAIKU_ARCH_BITS 64
#elif defined(__sparc64__)
# define __HAIKU_ARCH sparc64
# define __HAIKU_ARCH_ABI "sparc"
# define __HAIKU_ARCH_SPARC 1
# define __HAIKU_ARCH_PHYSICAL_BITS 64
# define __HAIKU_BIG_ENDIAN 1
# define __HAIKU_ARCH_BITS 64
#else
# error Unsupported architecture!
#endif
+15
View File
@@ -0,0 +1,15 @@
/*
* Copyright 2005-2019, Haiku Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _ARCH_SPARC_DEBUGGER_H
#define _ARCH_SPARC_DEBUGGER_H
struct sparc_debug_cpu_state {
uint32 dummy;
} __attribute__((aligned(8)));
#endif // _ARCH_SPARC_DEBUGGER_H
+3
View File
@@ -18,6 +18,7 @@
#include <arch/m68k/arch_debugger.h>
#include <arch/mipsel/arch_debugger.h>
#include <arch/arm/arch_debugger.h>
#include <arch/sparc/arch_debugger.h>
#if defined(__x86_64__)
@@ -32,6 +33,8 @@
typedef struct mipsel_debug_cpu_state debug_cpu_state;
#elif defined(__arm__)
typedef struct arm_debug_cpu_state debug_cpu_state;
#elif defined(__sparc64__)
typedef struct sparc_debug_cpu_state debug_cpu_state;
#else
#error unsupported architecture
#endif
+11
View File
@@ -0,0 +1,11 @@
/*
* Copyright 2019 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ARCH_SETJMP_H_
#define _ARCH_SETJMP_H_
// FIXME determine size
typedef unsigned long __jmp_buf[1];
#endif /* _ARCH_SETJMP_H_ */
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright 2019 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ARCH_SIGNAL_H_
#define _ARCH_SIGNAL_H_
/*
* Architecture-specific structure passed to signal handlers
*/
#if __sparc64__
struct vregs
{
// ulong g0; // always 0, so no need to save
ulong g1;
ulong g2;
ulong g3;
ulong g4;
ulong g5;
ulong g6;
ulong g7;
ulong o0;
ulong o1;
ulong o2;
ulong o3;
ulong o4;
ulong o5;
ulong sp;
ulong o7;
ulong l0;
ulong l1;
ulong l2;
ulong l3;
ulong l4;
ulong l5;
ulong l6;
ulong l7;
ulong i0;
ulong i1;
ulong i2;
ulong i3;
ulong i4;
ulong i5;
ulong fp;
ulong i7;
// TODO: sparc: Fix floats in vregs
};
#endif /* __sparc64__ */
#endif /* _ARCH_SIGNAL_H_ */
@@ -0,0 +1,103 @@
/*
* Copyright 2014, Paweł Dziepak, [email protected].
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck IV <[email protected]>
*/
#ifndef _KERNEL_ARCH_SPARC_ATOMIC_H
#define _KERNEL_ARCH_SPARC_ATOMIC_H
static inline void
memory_read_barrier_inline(void)
{
// TODO
}
static inline void
memory_write_barrier_inline(void)
{
// TODO
}
static inline void
memory_full_barrier_inline(void)
{
// TODO
}
#define memory_read_barrier memory_read_barrier_inline
#define memory_write_barrier memory_write_barrier_inline
#define memory_full_barrier memory_full_barrier_inline
static inline void
atomic_set_inline(int32* value, int32 newValue)
{
memory_write_barrier();
*(volatile int32*)value = newValue;
}
static inline int32
atomic_get_and_set_inline(int32* value, int32 newValue)
{
// BIG TODO: PowerPC Atomic get and set
// asm volatile("xchgl %0, (%1)"
// : "+r" (newValue)
// : "r" (value)
// : "memory");
return newValue;
}
static inline int32
atomic_test_and_set_inline(int32* value, int32 newValue, int32 testAgainst)
{
// BIG TODO: PowerPC Atomic test and set inline
// asm volatile("lock; cmpxchgl %2, (%3)"
// : "=a" (newValue)
// : "0" (testAgainst), "r" (newValue), "r" (value)
// : "memory");
return newValue;
}
static inline int32
atomic_add_inline(int32* value, int32 newValue)
{
// BIG TODO: PowerPC Atomic add inline
// asm volatile("lock; xaddl %0, (%1)"
// : "+r" (newValue)
// : "r" (value)
// : "memory");
return newValue;
}
static inline int32
atomic_get_inline(int32* value)
{
int32 newValue = *(volatile int32*)value;
memory_read_barrier();
return newValue;
}
#define atomic_set atomic_set_inline
#define atomic_get_and_set atomic_get_and_set_inline
#ifndef atomic_test_and_set
# define atomic_test_and_set atomic_test_and_set_inline
#endif
#ifndef atomic_add
# define atomic_add atomic_add_inline
#endif
#define atomic_get atomic_get_inline
#endif // _KERNEL_ARCH_PPC_ATOMIC_H
@@ -0,0 +1,52 @@
/*
* Copyright 2003-2004, Axel Dörfler, [email protected].
* Copyright 2019, Adrien Destugues, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_SPARC_CPU_H
#define _KERNEL_ARCH_SPARC_CPU_H
#include <arch/sparc/arch_thread_types.h>
#include <arch/sparc/cpu.h>
#include <kernel.h>
#define CPU_MAX_CACHE_LEVEL 8
#define CACHE_LINE_SIZE 128
// 128 Byte lines on PPC970
#define set_ac()
#define clear_ac()
typedef struct arch_cpu_info {
int null;
} arch_cpu_info;
#ifdef __cplusplus
extern "C" {
#endif
static inline void
arch_cpu_pause(void)
{
// TODO: CPU pause
}
static inline void
arch_cpu_idle(void)
{
// TODO: CPU idle call
}
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_ARCH_SPARC_CPU_H */
@@ -0,0 +1,18 @@
/*
* Copyright 2005-2019, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler <[email protected]>
* Ingo Weinhold <[email protected]>
* Adrien Destugues <[email protected]>
*/
#ifndef _KERNEL_ARCH_SPARC_INT_H
#define _KERNEL_ARCH_SPARC_INT_H
#include <SupportDefs.h>
#define NUM_IO_VECTORS 256
#endif /* _KERNEL_ARCH_SPARC_INT_H */
@@ -0,0 +1,34 @@
/*
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Copyright 2019, Adrien Destugues, [email protected]
** Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_SPARC_KERNEL_H
#define _KERNEL_ARCH_SPARC_KERNEL_H
#include <arch/cpu.h>
// memory layout
#define KERNEL_BASE 0x80000000
#define KERNEL_SIZE 0x80000000
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
/*
** User space layout is a little special:
** The user space does not completely cover the space not covered by the kernel.
** This is accomplished by starting user space at 1Mb and running to 64kb short of kernel space.
** The lower 1Mb reserved spot makes it easy to find null pointer references and guarantees a
** region wont be placed there. The 64kb region assures a user space thread cannot pass
** a buffer into the kernel as part of a syscall that would cross into kernel space.
*/
#define USER_BASE 0x100000
#define USER_BASE_ANY USER_BASE
#define USER_SIZE (0x80000000 - (0x10000 + 0x100000))
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
#define KERNEL_USER_DATA_BASE 0x60000000
#define USER_STACK_REGION 0x70000000
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
#endif /* _KERNEL_ARCH_SPARC_KERNEL_H */
@@ -0,0 +1,37 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Copyright 2019, Adrien Destugues, [email protected]. All rights reserved.
** Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_ARCH_SPARC_KERNEL_ARGS_H
#define KERNEL_ARCH_SPARC_KERNEL_ARGS_H
#ifndef KERNEL_BOOT_KERNEL_ARGS_H
# error This file is included from <boot/kernel_args.h> only
#endif
#define _PACKED __attribute__((packed))
#define MAX_VIRTUAL_RANGES_TO_KEEP 32
// kernel args
typedef struct {
// architecture specific
uint64 cpu_frequency;
uint64 bus_frequency;
uint64 time_base_frequency;
addr_range framebuffer; // maps where the framebuffer is located, in physical memory
int screen_x, screen_y, screen_depth;
// The virtual ranges we want to keep in the kernel. E.g. those belonging
// to the Open Firmware.
uint32 num_virtual_ranges_to_keep;
addr_range virtual_ranges_to_keep[MAX_VIRTUAL_RANGES_TO_KEEP];
// platform type we booted from
int platform;
} arch_kernel_args;
#endif /* KERNEL_ARCH_SPARC_KERNEL_ARGS_H */
@@ -0,0 +1,13 @@
/*
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_SPARC_SYSTEM_INFO_H
#define _KERNEL_ARCH_SPARC_SYSTEM_INFO_H
/* nothing to be seen here yet */
#endif /* _KRENEL_ARCH_SPARC_SYSTEM_INFO_H */
@@ -0,0 +1,47 @@
/*
* Copyright 2003-2019, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler <[email protected]>
* Ingo Weinhold <[email protected]>
* Adrien Destugues <[email protected]>
*/
#ifndef _KERNEL_ARCH_SPARC_THREAD_H
#define _KERNEL_ARCH_SPARC_THREAD_H
#include <arch/cpu.h>
#ifdef __cplusplus
extern "C" {
#endif
void ppc_push_iframe(struct iframe_stack *stack, struct iframe *frame);
void ppc_pop_iframe(struct iframe_stack *stack);
struct iframe *ppc_get_user_iframe(void);
static inline Thread *
arch_thread_get_current_thread(void)
{
Thread *t;
//asm volatile("mfsprg2 %0" : "=r"(t));
t = NULL;
return t;
}
static inline void
arch_thread_set_current_thread(Thread *t)
{
//asm volatile("mtsprg2 %0" : : "r"(t));
}
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_ARCH_SPARC_THREAD_H */
@@ -0,0 +1,44 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Copyright 2019, Adrien Destugues, [email protected]
** Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_ARCH_SPARC_THREAD_TYPES_H
#define KERNEL_ARCH_SPARC_THREAD_TYPES_H
#include <arch_cpu.h>
#define IFRAME_TRACE_DEPTH 4
struct iframe_stack {
struct iframe *frames[IFRAME_TRACE_DEPTH];
int32 index;
};
// architecture specific thread info
struct arch_thread {
void *sp; // stack pointer
void *interrupt_stack;
// used to track interrupts on this thread
struct iframe_stack iframes;
};
struct arch_team {
// gcc treats empty structures as zero-length in C, but as if they contain
// a char in C++. So we have to put a dummy in to be able to use the struct
// from both in a consistent way.
char dummy;
};
struct arch_fork_arg {
// gcc treats empty structures as zero-length in C, but as if they contain
// a char in C++. So we have to put a dummy in to be able to use the struct
// from both in a consistent way.
char dummy;
};
#endif /* KERNEL_ARCH_SPARC_THREAD_TYPES_H */
@@ -0,0 +1,19 @@
/*
* Copyright 2005, Axel Dörfler, [email protected].
* Copyright 2019, Adrien Destugues, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_SPARC_USER_DEBUGGER_H
#define _KERNEL_ARCH_SPARC_USER_DEBUGGER_H
struct arch_team_debug_info {
uint32 dummy;
};
struct arch_thread_debug_info {
uint32 dummy;
};
#endif // _KERNEL_ARCH_SPARC_USER_DEBUGGER_H
@@ -0,0 +1,17 @@
/*
* Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
* Copyright 2091, Adrien Destugues, [email protected]. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef ARCH_SPARC_VM_H
#define ARCH_SPARC_VM_H
/* This many pages will be read/written on I/O if possible */
#define NUM_IO_PAGES 4
/* 16 kB */
#define PAGE_SHIFT 12
#endif /* ARCH_SPARC_VM_H */
@@ -0,0 +1,21 @@
/*
* Copyright 2018 Haiku Inc. All Rights Reserved.
* Copyright 2006, Ingo Weinhold <[email protected]>.
* Copyright 2019, Adrien Destugues <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_REAL_TIME_DATA_H
#define _KERNEL_ARCH_REAL_TIME_DATA_H
#include <StorageDefs.h>
#include <SupportDefs.h>
struct arch_real_time_data {
bigtime_t system_time_offset;
uint32 system_time_conversion_factor;
uint32 _padding;
};
#endif /* _KERNEL_ARCH_REAL_TIME_DATA_H */
+135
View File
@@ -0,0 +1,135 @@
name haiku
version %HAIKU_VERSION%
architecture sparc
summary "The Haiku base system"
description "The Haiku base system includes all system core software, like
boot loader, kernel, the system libraries, servers, and applications."
packager "The Haiku build system"
vendor "Haiku Project"
copyrights "2001-2019 Haiku, Inc. et al"
licenses {
MIT
"GNU LGPL v2.1"
}
flags system_package
provides {
haiku=%HAIKU_VERSION% compat>=R1~beta1
cmd:arp
cmd:chop
cmd:clear
cmd:compress
cmd:df
cmd:ftp
cmd:ftpd
cmd:hd
cmd:hey
cmd:login
cmd:more
cmd:passwd
cmd:ping
cmd:ping6
cmd:prio
cmd:ps
cmd:renice
cmd:resattr
cmd:su
cmd:telnet
cmd:telnetd
cmd:top
cmd:tput
cmd:traceroute
cmd:trash
cmd:unchop
cmd:useradd
cmd:watch
cmd:xres
}
requires {
coreutils
cmd:sh
#ifdef HAIKU_REGULAR_BUILD
cmd:bunzip2
cmd:gunzip
cmd:tar
cmd:unzip
#endif
lib:libfreetype
#ifdef HAIKU_BUILD_FEATURE_SPARC_FONTCONFIG_ENABLED
lib:libfontconfig
#endif
lib:libgcc_s
lib:libicudata >= 57
lib:libicui18n >= 57
lib:libicuio >= 57
lib:libicule >= 57
lib:libiculx >= 57
lib:libicutest >= 57
lib:libicutu >= 57
lib:libicuuc >= 57
lib:libncurses >= 6.0
#ifdef HAIKU_REGULAR_BUILD
#ifdef HAIKU_BUILD_FEATURE_SPARC_EXPAT_ENABLED
lib:libexpat
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_GUTENPRINT_ENABLED
lib:libgutenprint
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_LIBICNS_ENABLED
lib:libicns
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_JASPER_ENABLED
lib:libjasper
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_JPEG_ENABLED
lib:libjpeg
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_LIBPNG_ENABLED
lib:libpng >= 16.0
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_TIFF_ENABLED
lib:libtiff >= 5.2
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_LIBWEBP_ENABLED
lib:libwebp
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_ILMBASE_ENABLED
lib:libhalf
lib:libiex
lib:libiexmath
lib:libilmthread
lib:libimath
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_OPENEXR_ENABLED
lib:libilmimf
lib:libilmimfutil
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_OPENSSL_ENABLED
lib:libssl >= 1.0.0
lib:libcrypto >= 1.0.0
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_FFMPEG_ENABLED
lib:libavcodec >= 58
lib:libavfilter >= 7
lib:libavformat >= 58
lib:libavutil >= 56
lib:libswresample >= 3
#endif
#ifdef HAIKU_BUILD_FEATURE_SPARC_ZSTD_ENABLED
lib:libzstd >= 1
#endif
#endif
lib:libsolv
lib:libsolvext
lib:libstdc++
lib:libsupc++
lib:libz
noto
#ifdef HAIKU_REGULAR_BUILD
noto_sans_cjk_jp
#endif
}
@@ -0,0 +1,52 @@
/*
* Copyright 2005, Ingo Weinhold, [email protected].
* Copyright 2012, Alex Smith, [email protected].
* Distributed under the terms of the MIT License.
*/
#include <debug_support.h>
#include "arch_debug_support.h"
struct stack_frame {
struct stack_frame *previous;
void *return_address;
};
status_t
arch_debug_get_instruction_pointer(debug_context *context, thread_id thread,
void **ip, void **stackFrameAddress)
{
// get the CPU state
debug_cpu_state cpuState;
status_t error = debug_get_cpu_state(context, thread, NULL, &cpuState);
if (error != B_OK)
return error;
*ip = (void*)cpuState.rip;
*stackFrameAddress = (void*)cpuState.rbp;
return B_OK;
}
status_t
arch_debug_get_stack_frame(debug_context *context, void *stackFrameAddress,
debug_stack_frame_info *stackFrameInfo)
{
stack_frame stackFrame;
ssize_t bytesRead = debug_read_memory(context, stackFrameAddress,
&stackFrame, sizeof(stackFrame));
if (bytesRead < B_OK)
return bytesRead;
if (bytesRead != sizeof(stackFrame))
return B_ERROR;
stackFrameInfo->frame = stackFrameAddress;
stackFrameInfo->parent_frame = stackFrame.previous;
stackFrameInfo->return_address = stackFrame.return_address;
return B_OK;
}
@@ -0,0 +1,15 @@
SubDir HAIKU_TOP src system boot platform openfirmware arch sparc ;
SubDirHdrs $(HAIKU_TOP) src system boot platform $(TARGET_BOOT_PLATFORM) ;
UsePrivateSystemHeaders ;
UsePrivateHeaders kernel [ FDirName kernel arch $(TARGET_KERNEL_ARCH) ]
[ FDirName kernel boot platform $(HAIKU_KERNEL_PLATFORM) ]
[ FDirName kernel boot platform $(HAIKU_BOOT_PLATFORM) ] ;
SubDirC++Flags -fno-rtti ;
BootStaticLibrary boot_platform_openfirmware_sparc :
;
SEARCH on [ FGristFiles arch_cpu_asm.S arch_mmu.cpp ]
= [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_KERNEL_ARCH) ] ;
+21
View File
@@ -0,0 +1,21 @@
SubDir HAIKU_TOP src system glue arch sparc ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup sparc ] {
on $(architectureObject) {
local architecture = $(TARGET_PACKAGING_ARCH) ;
UsePrivateSystemHeaders ;
local sources =
crti.S
crtn.S
;
MergeObject <$(architecture)>glue_arch_$(TARGET_ARCH).o : $(sources) ;
if $(HAIKU_BUILD_TYPE) = bootstrap {
# build a version for stage0 of the bootstrap process
BootstrapStage0PlatformObjects [ FGristFiles $(sources) ] : true ;
}
}
}
+29
View File
@@ -0,0 +1,29 @@
/*
Copyright 2019, Adrien Destugues <pulkomandy@pulkomandy.tk>
* 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
* crtbegin.S GCC specific: constructors/destructors are called, ...
* crtend.S
* crtn.S call to _init_after/_term_after
* exit
*/
.section .init
.global _init
.type _init, #function
// crtbegin.o stuff comes here
.section .fini
.global _fini
.type _fini, #function
// crtend.o stuff comes here
+15
View File
@@ -0,0 +1,15 @@
/*
* Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk
* 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
.section .fini
+22
View File
@@ -0,0 +1,22 @@
SubDir HAIKU_TOP src system libroot os arch sparc ;
SubDirC++Flags -std=gnu++11 ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup sparc ] {
on $(architectureObject) {
local architecture = $(TARGET_PACKAGING_ARCH) ;
UsePrivateKernelHeaders ;
UsePrivateSystemHeaders ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
MergeObject <$(architecture)>os_arch_$(TARGET_ARCH).o :
tls.c
generic_atomic.cpp
generic_system_time_nsecs.cpp
;
}
}
+53
View File
@@ -0,0 +1,53 @@
/*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the MIT 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;
}
@@ -0,0 +1,2 @@
#define SYSCALL_RETURN_TYPE_ALIGNMENT_TYPE long
#define SYSCALL_PARAMETER_ALIGNMENT_TYPE long