Added and modified kernel stubs and headers for arch mipsel. Correctness not included.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32621 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2009-08-23 02:52:09 +00:00
parent 080f08465b
commit 893988af82
35 changed files with 1172 additions and 32 deletions
@@ -0,0 +1,90 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_CPU_H
#define _KERNEL_ARCH_MIPSEL_CPU_H
#warning IMPLEMENT arch_cpu.h
#include <arch/mipsel/arch_thread_types.h>
#include <kernel.h>
struct iframe {
#warning struct iframe
uint32 r31;
uint32 r30;
uint32 r29;
uint32 r28;
uint32 r27;
uint32 r26;
uint32 r25;
uint32 r24;
uint32 r23;
uint32 r22;
uint32 r21;
uint32 r20;
uint32 r19;
uint32 r18;
uint32 r17;
uint32 r16;
uint32 r15;
uint32 r14;
uint32 r13;
uint32 r12;
uint32 r11;
uint32 r10;
uint32 r9;
uint32 r8;
uint32 r7;
uint32 r6;
uint32 r5;
uint32 r4;
uint32 r3;
uint32 r2;
uint32 r1;
uint32 r0;
};
typedef struct arch_cpu_info {
int null;
} arch_cpu_info;
#ifdef __cplusplus
extern "C" {
#endif
extern long long get_time_base(void);
void __mipsel_setup_system_time(vint32 *cvFactor);
// defined in libroot: os/arch/system_time.c
int64 __mipsel_get_time_base(void);
// defined in libroot: os/arch/system_time_asm.S
extern void mipsel_context_switch(void **_oldStackPointer,
void *newStackPointer);
extern bool mipsel_set_fault_handler(addr_t *handlerLocation, addr_t handler)
__attribute__((noinline));
#ifdef __cplusplus
}
#endif
/* TODO */
enum mipsel_processor_version {
FAKE1 = 0x0001,
FAKE2 = 0x0002,
FAKE3 = 0x0003,
};
#endif /* _KERNEL_ARCH_MIPSEL_CPU_H */
@@ -0,0 +1,48 @@
/*
* Copyright 2005-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler <[email protected]>
* Ingo Weinhold <[email protected]>
*/
#ifndef _KERNEL_ARCH_MIPSEL_INT_H
#define _KERNEL_ARCH_MIPSEL_INT_H
#include <SupportDefs.h>
#warning IMPLEMENT arch_int.h
#define NUM_IO_VECTORS 256
struct mipsel_cpu_exception_context {
void *kernel_handle_exception; // exception handler routine in the
// kernel
void *exception_context; // the virtual address of this
// structure
void *kernel_stack; // kernel stack for the current thread
uint32 scratch[8]; // scratch memory for free use in the
// early exception handling code
};
#ifdef __cplusplus
extern "C" {
#endif
struct mipsel_cpu_exception_context* mipsel_get_cpu_exception_context(int cpu);
void mipsel_set_current_cpu_exception_context(
struct mipsel_cpu_exception_context *context);
// only called once per CPU
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_ARCH_MIPSEL_INT_H */
@@ -0,0 +1,36 @@
/*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_KERNEL_H
#define _KERNEL_ARCH_MIPSEL_KERNEL_H
#include <arch/cpu.h>
#warning IMPLEMENT arch_kernel.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)
#define KERNEL_USER_DATA_BASE 0x6fff0000
#define USER_STACK_REGION 0x70000000
#define USER_STACK_REGION_SIZE (USER_TOP - USER_STACK_REGION)
#endif /* _KERNEL_ARCH_MIPSEL_KERNEL_H */
@@ -0,0 +1,31 @@
/*
* Copyright 2009, Axel Dörfler, [email protected].
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_KERNEL_ARGS_H
#define _KERNEL_ARCH_MIPSEL_KERNEL_ARGS_H
#ifndef KERNEL_BOOT_KERNEL_ARGS_H
# error This file is included from <boot/kernel_args.h> only
#endif
#warning IMPLEMENT arch_kernel_args.h
#define _PACKED __attribute__((packed))
// kernel args
typedef struct {
int cpu_type;
int fpu_type;
int mmu_type;
int platform;
int machine;
// architecture specific
uint64 cpu_frequency;
uint64 bus_frequency;
uint64 time_base_frequency;
} arch_kernel_args;
#endif /* _KERNEL_ARCH_MIPSEL_KERNEL_ARGS_H */
@@ -0,0 +1,14 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_MMU_H
#define _KERNEL_ARCH_MIPSEL_MMU_H
#include <arch_cpu.h>
#warning IMPLEMENT arch_mmu.h
#endif /* _KERNEL_ARCH_MIPSEL_MMU_H */
@@ -0,0 +1,53 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_PLATFORM_H
#define _KERNEL_ARCH_MIPSEL_PLATFORM_H
#include <arch/platform.h>
#warning IMPLEMENT arch_platform.h
struct real_time_data;
enum mipsel_platform_type {
MIPSEL_PLATFORM_ROUTERBOARD = 0,
};
namespace BPrivate {
class MipselPlatform {
public:
MipselPlatform(mipsel_platform_type platformType);
virtual ~MipselPlatform();
static MipselPlatform* Default();
inline mipsel_platform_type PlatformType() const { return fPlatformType; }
virtual status_t Init(struct kernel_args* kernelArgs) = 0;
virtual status_t InitSerialDebug(struct kernel_args* kernelArgs) = 0;
virtual status_t InitPostVM(struct kernel_args* kernelArgs) = 0;
virtual status_t InitRTC(struct kernel_args* kernelArgs,
struct real_time_data* data) = 0;
virtual char SerialDebugGetChar() = 0;
virtual void SerialDebugPutChar(char c) = 0;
virtual void SetHardwareRTC(uint32 seconds) = 0;
virtual uint32 GetHardwareRTC() = 0;
virtual void ShutDown(bool reboot) = 0;
private:
mipsel_platform_type fPlatformType;
};
} // namespace BPrivate
using BPrivate::MipselPlatform;
#endif /* _KERNEL_ARCH_MIPSEL_PLATFORM_H */
@@ -0,0 +1,14 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_SYSTEM_INFO_H
#define _KERNEL_ARCH_MIPSEL_SYSTEM_INFO_H
#warning IMPLEMENT arch_system_info.h
/* nothing to be seen here yet */
#endif /* _KERNEL_ARCH_MIPSEL_SYSTEM_INFO_H */
@@ -0,0 +1,47 @@
/*
* Copyright 2003-2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold <[email protected]>
* Jonas Sundström <[email protected]>
*/
#ifndef _KERNEL_ARCH_MIPSEL_THREAD_H
#define _KERNEL_ARCH_MIPSEL_THREAD_H
#include <arch/cpu.h>
#warning IMPLEMENT arch_thread.h
#ifdef __cplusplus
extern "C" {
#endif
void mipsel_push_iframe(struct iframe_stack* stack, struct iframe* frame);
void mipsel_pop_iframe(struct iframe_stack* stack);
struct iframe* mipsel_get_user_iframe(void);
static inline struct thread*
arch_thread_get_current_thread(void)
{
#warning IMPLEMENT arch_thread_get_current_thread
struct thread* t;
return t;
}
static inline void
arch_thread_set_current_thread(struct thread* t)
{
#warning IMPLEMENT arch_thread_set_current_thread
}
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_ARCH_MIPSEL_THREAD_H */
@@ -0,0 +1,41 @@
/*
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_THREAD_TYPES_H
#define _KERNEL_ARCH_MIPSEL_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_MIPSEL_THREAD_TYPES_H */
@@ -0,0 +1,17 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_USER_DEBUGGER_H
#define _KERNEL_ARCH_MIPSEL_USER_DEBUGGER_H
struct arch_team_debug_info {
uint32 dummy;
};
struct arch_thread_debug_info {
uint32 dummy;
};
#endif /* _KERNEL_ARCH_MIPSEL_USER_DEBUGGER_H */
@@ -0,0 +1,16 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_VM_H
#define _KERNEL_ARCH_MIPSEL_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 /* _KERNEL_ARCH_MIPSEL_VM_H */
@@ -0,0 +1,27 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_VM_TRANSLATION_MAP_H
#define _KERNEL_ARCH_MIPSEL_VM_TRANSLATION_MAP_H
#include <arch/vm_translation_map.h>
#ifdef __cplusplus
extern "C" {
#endif
status_t mipsel_map_address_range(addr_t virtualAddress, addr_t physicalAddress,
size_t size);
void mipsel_unmap_address_range(addr_t virtualAddress, size_t size);
status_t mipsel_remap_address_range(addr_t *virtualAddress, size_t size,
bool unmap);
#ifdef __cplusplus
}
#endif
#endif /* _KERNEL_ARCH_MIPSEL_VM_TRANSLATION_MAP_H */
@@ -0,0 +1,9 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_VM_TYPES_H
#define _KERNEL_ARCH_MIPSEL_VM_TYPES_H
#endif /* _KERNEL_ARCH_MIPSEL_VM_TYPES_H */
+11
View File
@@ -0,0 +1,11 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_CPU_H
#define _KERNEL_ARCH_MIPSEL_CPU_H
#define PAGE_SIZE 4096
#endif /* _KERNEL_ARCH_MIPSEL_CPU_H */
@@ -0,0 +1,11 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_KTYPES_H
#define _KERNEL_ARCH_MIPSEL_KTYPES_H
typedef unsigned long addr;
#endif /* _KERNEL_ARCH_MIPSEL_KTYPES_H */
@@ -0,0 +1,18 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_MIPSEL_TYPES_H
#define _KERNEL_ARCH_MIPSEL_TYPES_H
typedef unsigned long long uint64;
typedef long long int64;
typedef unsigned int uint32;
typedef int int32;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned char uint8;
typedef char int8;
#endif /* _KERNEL_ARCH_MIPSEL_TYPES_H */
@@ -0,0 +1,20 @@
/*
* Copyright 2007, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SYSTEM_ARCH_MIPSEL_COMMPAGE_DEFS_H
#define _SYSTEM_ARCH_MIPSEL_COMMPAGE_DEFS_H
#warning IMPLEMENT COMMPAGE
#ifndef _SYSTEM_COMMPAGE_DEFS_H
# error Must not be included directly. Include <commpage_defs.h> instead!
#endif
#define COMMPAGE_ENTRY_MIPSEL_SYSCALL (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 0)
#define COMMPAGE_ENTRY_MIPSEL_MEMCPY (COMMPAGE_ENTRY_FIRST_ARCH_SPECIFIC + 1)
#define ARCH_USER_COMMPAGE_ADDR (0xffff0000)
#endif /* _SYSTEM_ARCH_MIPSEL_COMMPAGE_DEFS_H */
@@ -0,0 +1,19 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _SYSTEM_ARCH_MIPSEL_CONFIG_H
#define _SYSTEM_ARCH_MIPSEL_CONFIG_H
#warning IMPLEMENT _SYSTEM_ARCH_MIPSEL_CONFIG_H
#define FUNCTION_CALL_PARAMETER_ALIGNMENT_TYPE unsigned int
#define STACK_GROWS_DOWNWARDS
//#define ATOMIC_FUNCS_ARE_SYSCALLS
#define ATOMIC64_FUNCS_ARE_SYSCALLS
#endif /* _SYSTEM_ARCH_MIPSEL_CONFIG_H */
@@ -0,0 +1,53 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _SYSTEM_ARCH_MIPSEL_ELF_H
#define _SYSTEM_ARCH_MIPSEL_ELF_H
#warning DEFINE mipsel relocation types
/* relocation types */
#define R_MIPSEL_NONE 0
#define R_MIPSEL_ADDR32 1
#define R_MIPSEL_ADDR24 2
#define R_MIPSEL_ADDR16 3
#define R_MIPSEL_ADDR16_LO 4
#define R_MIPSEL_ADDR16_HI 5
#define R_MIPSEL_ADDR16_HA 6
#define R_MIPSEL_ADDR14 7
#define R_MIPSEL_ADDR14_BRTAKEN 8
#define R_MIPSEL_ADDR14_BRNTAKEN 9
#define R_MIPSEL_REL24 10
#define R_MIPSEL_REL14 11
#define R_MIPSEL_REL14_BRTAKEN 12
#define R_MIPSEL_REL14_BRNTAKEN 13
#define R_MIPSEL_GOT16 14
#define R_MIPSEL_GOT16_LO 15
#define R_MIPSEL_GOT16_HI 16
#define R_MIPSEL_GOT16_HA 17
#define R_MIPSEL_PLTREL24 18
#define R_MIPSEL_COPY 19
#define R_MIPSEL_GLOB_DAT 20
#define R_MIPSEL_JMP_SLOT 21
#define R_MIPSEL_RELATIVE 22
#define R_MIPSEL_LOCAL24PC 23
#define R_MIPSEL_UADDR32 24
#define R_MIPSEL_UADDR16 25
#define R_MIPSEL_REL32 26
#define R_MIPSEL_PLT32 27
#define R_MIPSEL_PLTREL32 28
#define R_MIPSEL_PLT16_LO 29
#define R_MIPSEL_PLT16_HI 30
#define R_MIPSEL_PLT16_HA 31
#define R_MIPSEL_SDAREL16 32
#define R_MIPSEL_SECTOFF 33
#define R_MIPSEL_SECTOFF_LO 34
#define R_MIPSEL_SECTOFF_HI 35
#define R_MIPSEL_SECTOFF_HA 36
#define R_MIPSEL_ADDR30 37
#endif /* _SYSTEM_ARCH_MIPSEL_ELF_H */
@@ -0,0 +1,18 @@
/*
* Copyright 2006-2009, Ingo Weinhold <[email protected]>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _SYSTEM_ARCH_REAL_TIME_DATA_H
#define _SYSTEM_ARCH_REAL_TIME_DATA_H
#include <SupportDefs.h>
struct arch_real_time_data {
bigtime_t system_time_offset;
uint32 system_time_conversion_factor;
};
#endif /* _SYSTEM_ARCH_REAL_TIME_DATA_H */
@@ -0,0 +1,17 @@
/*
* Copyright 2009 Haiku Inc.
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef SYSTEM_ARCH_MIPSEL_ASM_DEFS_H
#define SYSTEM_ARCH_MIPSEL_ASM_DEFS_H
#define SYMBOL(name) .global name; name
#define SYMBOL_END(name) 1: .size name, 1b - name
#define STATIC_FUNCTION(name) .type name, @function; name
#define FUNCTION(name) .global name; .type name, @function; name
#define FUNCTION_END(name) 1: .size name, 1b - name
#endif /* SYSTEM_ARCH_MIPSEL_ASM_DEFS_H */