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:
committed by
waddlesplash
parent
be6c334335
commit
5629675a32
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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_ */
|
||||
@@ -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, pdziepak@quarnos.org.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Alexander von Gluck IV <kallisti5@unixzen.com>
|
||||
*/
|
||||
#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, axeld@pinc-software.de.
|
||||
* Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk.
|
||||
* 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 <axeld@pinc-software.de>
|
||||
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
|
||||
* Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
*/
|
||||
#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, pulkomandy@pulkomandy.tk
|
||||
** 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, axeld@pinc-software.de. All rights reserved.
|
||||
** Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk. 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, axeld@pinc-software.de. 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 <axeld@pinc-software.de>
|
||||
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
|
||||
* Adrien Destugues <pulkomandy@pulkomandy.tk>
|
||||
*/
|
||||
#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, pulkomandy@pulkomandy.tk
|
||||
** 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, axeld@pinc-software.de.
|
||||
* Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk.
|
||||
* 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, axeld@pinc-software.de. All rights reserved.
|
||||
* Copyright 2091, Adrien Destugues, pulkomandy@pulkomandy.tk. 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 <bonefish@cs.tu-berlin.de>.
|
||||
* Copyright 2019, Adrien Destugues <pulkomandy@pulkomandy.tk>.
|
||||
* 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 */
|
||||
|
||||
Reference in New Issue
Block a user