sparc: more platform headers

Previous commit adding these was merged very quickly, so here's one
more...

Change-Id: I23c424db7631db1f0ec48e2d0ae47c8409ae6af2
Reviewed-on: https://review.haiku-os.org/c/1088
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
PulkoMandy
2019-03-03 20:56:20 +00:00
committed by waddlesplash
parent c5769c4f6b
commit c1566b1555
15 changed files with 172 additions and 19 deletions
@@ -0,0 +1,18 @@
/*
* Copyright 2010, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_SPARC_DEBUG_H
#define _KERNEL_ARCH_SPARC_DEBUG_H
#include <SupportDefs.h>
struct arch_debug_registers {
// TODO
addr_t r1;
};
#endif // _KERNEL_ARCH_SPARC_DEBUG_H
+21 -19
View File
@@ -8,27 +8,29 @@
#include <arch/cpu.h>
// memory layout
#define KERNEL_BASE 0x80000000
#define KERNEL_SIZE 0x80000000
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
// Base of the kernel address space.
// KERNEL_BASE is the base of the kernel address space. This differs from the
// address where the kernel is loaded to: the kernel is loaded in the top 2GB
// of the virtual address space as required by GCC's kernel code model. The
// whole kernel address space is the top 512GB of the address space.
#define KERNEL_BASE 0xffffff0000000000
#define KERNEL_SIZE 0x10000000000
#define KERNEL_TOP (KERNEL_BASE + (KERNEL_SIZE - 1))
#define KERNEL_LOAD_BASE 0xffffffff80000000
/*
** 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)
// Userspace address space layout.
// There is a 2MB hole just before the end of the bottom half of the address
// space. This means that if userland passes in a buffer that crosses into the
// uncanonical address region, it will be caught through a page fault.
#define USER_BASE 0x100000
#define USER_BASE_ANY USER_BASE
#define USER_SIZE (0x800000000000 - (0x200000 + 0x100000))
#define USER_TOP (USER_BASE + (USER_SIZE - 1))
#define KERNEL_USER_DATA_BASE 0x7f0000000000
#define USER_STACK_REGION 0x7f0000000000
#define USER_STACK_REGION_SIZE ((USER_TOP - USER_STACK_REGION) + 1)
#endif /* _KERNEL_ARCH_SPARC_KERNEL_H */
@@ -0,0 +1,12 @@
/*
* Copyright 2019 Adrien Destugues, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_SPARC_CONFIG_H
#define _KERNEL_ARCH_SPARC_CONFIG_H
#define STACK_GROWS_DOWNWARDS
#endif /* _KERNEL_ARCH_SPARC_CONFIG_H */
+2
View File
@@ -1125,6 +1125,8 @@ private:
header.e_machine = EM_MIPS;
#elif defined(__HAIKU_ARCH_ARM)
header.e_machine = EM_ARM;
#elif defined(__HAIKU_ARCH_SPARC)
header.e_machine = EM_SPARCV9;
#else
# error Unsupported architecture!
#endif
@@ -0,0 +1,33 @@
/*
** Copyright 2001-2007, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the MIT License.
*/
/* TODO actuall syscalls? */
#define _SYSCALL(name, n) \
.globl name; \
.type name,%function; \
.align 4; \
name:
#define SYSCALL0(name, n) _SYSCALL(name, n)
#define SYSCALL1(name, n) _SYSCALL(name, n)
#define SYSCALL2(name, n) _SYSCALL(name, n)
#define SYSCALL3(name, n) _SYSCALL(name, n)
#define SYSCALL4(name, n) _SYSCALL(name, n)
#define SYSCALL5(name, n) _SYSCALL(name, n)
#define SYSCALL6(name, n) _SYSCALL(name, n)
#define SYSCALL7(name, n) _SYSCALL(name, n)
#define SYSCALL8(name, n) _SYSCALL(name, n)
#define SYSCALL9(name, n) _SYSCALL(name, n)
#define SYSCALL10(name, n) _SYSCALL(name, n)
#define SYSCALL11(name, n) _SYSCALL(name, n)
#define SYSCALL12(name, n) _SYSCALL(name, n)
#define SYSCALL13(name, n) _SYSCALL(name, n)
#define SYSCALL14(name, n) _SYSCALL(name, n)
#define SYSCALL15(name, n) _SYSCALL(name, n)
#define SYSCALL16(name, n) _SYSCALL(name, n)
#define SYSCALL17(name, n) _SYSCALL(name, n)
#define SYSCALL18(name, n) _SYSCALL(name, n)
#define SYSCALL19(name, n) _SYSCALL(name, n)
#define SYSCALL20(name, n) _SYSCALL(name, n)
@@ -0,0 +1,7 @@
/* sparc is big-endian. */
#ifndef _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
#define __BYTE_ORDER __BIG_ENDIAN
@@ -0,0 +1,8 @@
#ifndef _MATH_H
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
#endif
# define HUGE_VAL (__builtin_huge_val())
# define HUGE_VALF (__builtin_huge_valf())
# define HUGE_VALL (__builtin_huge_vall())
@@ -0,0 +1,31 @@
#if !defined _MATH_H && !defined _COMPLEX_H
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
#endif
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
typedef float float_t;
typedef double double_t;
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN (2147483647)
# define INFINITY (__builtin_inff())
/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
builtins are supported. */
# if __FP_FAST_FMA
# define FP_FAST_FMA 1
# endif
# if __FP_FAST_FMAF
# define FP_FAST_FMAF 1
# endif
# if __FP_FAST_FMAL
# define FP_FAST_FMAL 1
# endif
#endif /* ISO C99 */
@@ -0,0 +1,22 @@
#ifndef _MATH_H
# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
#endif
#define __NTH(fct) __attribute__ ((__nothrow__)) fct
#ifndef __extern_always_inline
# define __MATH_INLINE __inline
#else
# define __MATH_INLINE __extern_always_inline
#endif
#if defined __USE_ISOC99
# define isgreater(x, y) __builtin_isgreater (x, y)
# define isgreaterequal(x, y) __builtin_isgreaterequal (x, y)
# define isless(x, y) __builtin_isless (x, y)
# define islessequal(x, y) __builtin_islessequal (x, y)
# define islessgreater(x, y) __builtin_islessgreater (x, y)
# define isunordered(x, y) __builtin_isunordered (x, y)
#endif
@@ -0,0 +1,5 @@
#ifndef _MATH_H
# error "Never use <bits/nan.h> directly; include <math.h> instead."
#endif
# define NAN (__builtin_nanf (""))
@@ -0,0 +1 @@
# define __WORDSIZE 64
@@ -0,0 +1,4 @@
#ifndef _MATH_PRIVATE_H_
#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
#endif
@@ -0,0 +1,8 @@
#ifndef _STACKINFO_H
#define _STACKINFO_H 1
/* On sparc the stack grows down. */
#define _STACK_GROWS_DOWN 1
#endif /* stackinfo.h */