kernel/arch/sparc: stubs to get the kernel to link
Add empty implementation of timer, elf, vm, debugger support, to let the kernel link. Also add the kernel linker script. Change-Id: If0795fa6554aea3df1ee544c25cc4832634ffd78 Reviewed-on: https://review.haiku-os.org/c/1108 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
|
||||
#include <arch_cpu.h>
|
||||
#include <kernel.h>
|
||||
|
||||
|
||||
#define IFRAME_TRACE_DEPTH 4
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _ALPHA_TYPES_H
|
||||
#define _ALPHA_TYPES_H
|
||||
#ifndef _SPARC_TYPES_H
|
||||
#define _SPARC_TYPES_H
|
||||
|
||||
typedef unsigned long uint64;
|
||||
typedef long int64;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2008, François Revol, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SYSTEM_ARCH_SPARC_ASM_DEFS_H
|
||||
#define SYSTEM_ARCH_SPARC_ASM_DEFS_H
|
||||
|
||||
|
||||
/* include arch version helpers */
|
||||
//#include <arch_sparc_version.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_SPARC_ASM_DEFS_H */
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
SubDir HAIKU_TOP src system boot arch sparc ;
|
||||
|
||||
{
|
||||
local defines = _BOOT_MODE ;
|
||||
|
||||
defines = [ FDefines $(defines) ] ;
|
||||
SubDirCcFlags $(defines) ;
|
||||
SubDirC++Flags $(defines) -fno-rtti ;
|
||||
}
|
||||
|
||||
|
||||
local kernelLibArchObjects =
|
||||
<src!system!kernel!lib!arch!$(TARGET_ARCH)>byteorder.o
|
||||
<src!system!kernel!lib!arch!$(TARGET_ARCH)>memcpy.o
|
||||
<src!system!kernel!lib!arch!$(TARGET_ARCH)>memset.o
|
||||
;
|
||||
|
||||
BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
|
||||
debug_uart_8250.cpp
|
||||
#arch_uart_8250.cpp
|
||||
arch_elf.cpp
|
||||
: # additional flags
|
||||
:
|
||||
$(kernelArchObjects)
|
||||
$(kernelLibArchObjects)
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles arch_elf.cpp arch_uart_8250.cpp ]
|
||||
= [ FDirName $(HAIKU_TOP) src system kernel arch $(TARGET_KERNEL_ARCH) ] ;
|
||||
|
||||
SEARCH on [ FGristFiles debug_uart_8250.cpp ]
|
||||
= [ FDirName $(HAIKU_TOP) src system kernel arch generic ] ;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
SubDir HAIKU_TOP src system kernel arch sparc ;
|
||||
|
||||
KernelMergeObject kernel_arch_sparc.o :
|
||||
arch_asm.S
|
||||
arch_commpage.cpp
|
||||
arch_cpu.cpp
|
||||
arch_debug.cpp
|
||||
arch_debug_console.cpp
|
||||
arch_elf.cpp
|
||||
arch_int.cpp
|
||||
arch_platform.cpp
|
||||
arch_real_time_clock.cpp
|
||||
arch_smp.cpp
|
||||
arch_system_info.cpp
|
||||
arch_timer.cpp
|
||||
arch_thread.cpp
|
||||
arch_user_debugger.cpp
|
||||
arch_vm.cpp
|
||||
arch_vm_translation_map.cpp
|
||||
:
|
||||
$(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused
|
||||
:
|
||||
;
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2007, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <commpage.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include <cpu.h>
|
||||
#include <elf.h>
|
||||
#include <smp.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_commpage_init(void)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_commpage_init_post_cpus(void)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 2019, Adrien Destugues, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include <arch/cpu.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <commpage.h>
|
||||
#include <elf.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_preboot_init_percpu(kernel_args *args, int curr_cpu)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_init_percpu(kernel_args *args, int curr_cpu)
|
||||
{
|
||||
//detect_cpu(curr_cpu);
|
||||
|
||||
// we only support one anyway...
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_init(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_init_post_vm(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_init_post_modules(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_sync_icache(void *address, size_t len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_memory_read_barrier(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_memory_write_barrier(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_invalidate_TLB_range(addr_t start, addr_t end)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_global_TLB_invalidate(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_cpu_user_TLB_invalidate(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_cpu_shutdown(bool reboot)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright 2019, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrien Destugues <[email protected]>
|
||||
*/
|
||||
|
||||
|
||||
#include <arch/debug.h>
|
||||
|
||||
|
||||
void
|
||||
arch_debug_stack_trace(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
arch_debug_contains_call(Thread *thread, const char *symbol,
|
||||
addr_t start, addr_t end)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
arch_debug_get_caller(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_debug_save_registers(struct arch_debug_registers* registers)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_debug_call_with_fault_handler(cpu_ent* cpu, jmp_buf jumpBuffer,
|
||||
void (*function)(void*), void* parameter)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
arch_is_debug_variable_defined(const char* variableName)
|
||||
{
|
||||
// TODO: Implement!
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_debug_variable(const char* variableName, uint64 value)
|
||||
{
|
||||
// TODO: Implement!
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_get_debug_variable(const char* variableName, uint64* value)
|
||||
{
|
||||
// TODO: Implement!
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
|
||||
int32 skipIframes, int32 skipFrames, uint32 flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ssize_t
|
||||
arch_debug_gdb_get_registers(char* buffer, size_t bufferSize)
|
||||
{
|
||||
// TODO: Implement!
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
arch_debug_get_interrupt_pc(bool* _isSyscall)
|
||||
{
|
||||
// TODO: Implement!
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_debug_init(kernel_args *args)
|
||||
{
|
||||
#if 0
|
||||
add_debugger_command("where", &stack_trace, "Same as \"sc\"");
|
||||
add_debugger_command("bt", &stack_trace, "Same as \"sc\" (as in gdb)");
|
||||
add_debugger_command("sc", &stack_trace, "Stack crawl for current thread");
|
||||
#endif
|
||||
|
||||
return B_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2003-2006, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <arch/debug_console.h>
|
||||
#include <boot/kernel_args.h>
|
||||
#include <kernel.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void
|
||||
arch_debug_remove_interrupt_handler(uint32 line)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_debug_install_interrupt_handlers(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
arch_debug_blue_screen_try_getchar(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char
|
||||
arch_debug_blue_screen_getchar(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
arch_debug_serial_try_getchar(void)
|
||||
{
|
||||
// TODO: Implement correctly!
|
||||
return arch_debug_serial_getchar();
|
||||
}
|
||||
|
||||
|
||||
char
|
||||
arch_debug_serial_getchar(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_debug_serial_putchar(const char c)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_debug_serial_puts(const char *s)
|
||||
{
|
||||
while (*s != '\0') {
|
||||
arch_debug_serial_putchar(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_debug_serial_early_boot_message(const char *string)
|
||||
{
|
||||
// this function will only be called in fatal situations
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_debug_console_init(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_debug_console_init_settings(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 2019, Adrien Destugues <[email protected]>
|
||||
* Copyright 2010, Ithamar R. Adema <[email protected]>
|
||||
* Copyright 2009, Johannes Wischert, [email protected].
|
||||
* Copyright 2005, Ingo Weinhold <[email protected]>.
|
||||
* Copyright 2002, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include <elf_priv.h>
|
||||
#include <arch/elf.h>
|
||||
|
||||
|
||||
//#define TRACE_ARCH_ELF
|
||||
#ifdef TRACE_ARCH_ELF
|
||||
# define TRACE(x) dprintf x
|
||||
# define CHATTY 1
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
# define CHATTY 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _BOOT_MODE
|
||||
static bool
|
||||
is_in_image(struct elf_image_info *image, addr_t address)
|
||||
{
|
||||
return (address >= image->text_region.start
|
||||
&& address < image->text_region.start + image->text_region.size)
|
||||
|| (address >= image->data_region.start
|
||||
&& address < image->data_region.start + image->data_region.size);
|
||||
}
|
||||
#endif // !_BOOT_MODE
|
||||
|
||||
|
||||
int
|
||||
arch_elf_relocate_rel(struct elf_image_info *image,
|
||||
struct elf_image_info *resolve_image, Elf64_Rel *rel, int rel_len)
|
||||
{
|
||||
// there are no rel entries in M68K elf
|
||||
return B_NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
write_32(addr_t P, Elf32_Word value)
|
||||
{
|
||||
*(Elf32_Word*)P = value;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
write_16(addr_t P, Elf32_Word value)
|
||||
{
|
||||
// bits 16:29
|
||||
*(Elf32_Half*)P = (Elf32_Half)value;
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
write_16_check(addr_t P, Elf32_Word value)
|
||||
{
|
||||
// bits 15:0
|
||||
if ((value & 0xffff0000) && (~value & 0xffff8000))
|
||||
return false;
|
||||
*(Elf32_Half*)P = (Elf32_Half)value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
write_8(addr_t P, Elf32_Word value)
|
||||
{
|
||||
// bits 7:0
|
||||
*(uint8 *)P = (uint8)value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
write_8_check(addr_t P, Elf32_Word value)
|
||||
{
|
||||
// bits 7:0
|
||||
if ((value & 0xffffff00) && (~value & 0xffffff80))
|
||||
return false;
|
||||
*(uint8 *)P = (uint8)value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
arch_elf_relocate_rela(struct elf_image_info *image,
|
||||
struct elf_image_info *resolve_image, Elf64_Rela *rel, int rel_len)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2003-2011, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrien Destugues, [email protected]
|
||||
*/
|
||||
|
||||
|
||||
#include <int.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_int_init(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_int_init_post_vm(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_int_init_post_device_manager(struct kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_int_init_io(kernel_args* args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_int_enable_io_interrupt(int irq)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_int_disable_io_interrupt(int irq)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_int_assign_to_cpu(int32 irq, int32 cpu)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/* Copyright 2019, Adrien Destugues, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <arch/platform.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_platform_init(struct kernel_args *kernelArgs)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_platform_init_post_vm(struct kernel_args *kernelArgs)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_platform_init_post_thread(struct kernel_args *kernelArgs)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#include <arch/real_time_clock.h>
|
||||
|
||||
#include <real_time_clock.h>
|
||||
#include <real_time_data.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_rtc_init(kernel_args *args, struct real_time_data *data)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
uint32
|
||||
arch_rtc_get_hw_time(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_rtc_set_hw_time(uint32 seconds)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_rtc_set_system_time_offset(struct real_time_data *data, bigtime_t offset)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
arch_rtc_get_system_time_offset(struct real_time_data *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* François Revol <[email protected]>
|
||||
*
|
||||
* Copyright 2004, Axel Dörfler, [email protected]
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
|
||||
#include <boot/stage2.h>
|
||||
#include <arch/smp.h>
|
||||
#include <debug.h>
|
||||
#include <int.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_smp_init(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_smp_per_cpu_init(kernel_args *args, int32 cpu)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_smp_send_multicast_ici(CPUSet& cpuSet)
|
||||
{
|
||||
#if KDEBUG
|
||||
if (are_interrupts_enabled())
|
||||
panic("arch_smp_send_multicast_ici: called with interrupts enabled");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_smp_send_ici(int32 target_cpu)
|
||||
{
|
||||
panic("called arch_smp_send_ici!\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_smp_send_broadcast_ici()
|
||||
{
|
||||
panic("called arch_smp_send_broadcast_ici\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* François Revol <[email protected]>
|
||||
*
|
||||
* Copyright 2006, Ingo Weinhold <[email protected]>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
#include <arch_cpu.h>
|
||||
#include <arch/system_info.h>
|
||||
#include <boot/kernel_args.h>
|
||||
|
||||
|
||||
static uint64 sCPUClockFrequency;
|
||||
static uint64 sBusClockFrequency;
|
||||
static uint16 sCPURevision;
|
||||
|
||||
|
||||
void
|
||||
arch_fill_topology_node(cpu_topology_node_info* node, int32 cpu)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_system_info_init(struct kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/* Copyright 2019, Adrien Destugues, [email protected]
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <arch_cpu.h>
|
||||
#include <arch/thread.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <kernel.h>
|
||||
#include <thread.h>
|
||||
#include <vm/vm_types.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_thread_init(struct kernel_args *args)
|
||||
{
|
||||
// Initialize the static initial arch_thread state (sInitialState).
|
||||
// Currently nothing to do, i.e. zero initialized is just fine.
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_team_init_team_struct(Team *team, bool kernel)
|
||||
{
|
||||
// Nothing to do. The structure is empty.
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_thread_init_thread_struct(Thread *thread)
|
||||
{
|
||||
// set up an initial state (stack & fpu)
|
||||
//memcpy(&thread->arch_info, &sInitialState, sizeof(struct arch_thread));
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_thread_init_kthread_stack(Thread* thread, void* _stack, void* _stackTop,
|
||||
void (*function)(void*), const void* data)
|
||||
{
|
||||
#if 0
|
||||
addr_t *kstack = (addr_t *)t->kernel_stack_base;
|
||||
addr_t *kstackTop = (addr_t *)t->kernel_stack_base;
|
||||
|
||||
// clear the kernel stack
|
||||
#ifdef DEBUG_KERNEL_STACKS
|
||||
# ifdef STACK_GROWS_DOWNWARDS
|
||||
memset((void *)((addr_t)kstack + KERNEL_STACK_GUARD_PAGES * B_PAGE_SIZE), 0,
|
||||
KERNEL_STACK_SIZE);
|
||||
# else
|
||||
memset(kstack, 0, KERNEL_STACK_SIZE);
|
||||
# endif
|
||||
#else
|
||||
memset(kstack, 0, KERNEL_STACK_SIZE);
|
||||
#endif
|
||||
|
||||
// space for frame pointer and return address, and stack frames must be
|
||||
// 16 byte aligned
|
||||
kstackTop -= 2;
|
||||
kstackTop = (addr_t*)((addr_t)kstackTop & ~0xf);
|
||||
|
||||
// LR, CR, r2, r13-r31, f13-f31, as pushed by m68k_context_switch()
|
||||
kstackTop -= 22 + 2 * 19;
|
||||
|
||||
// let LR point to m68k_kernel_thread_root()
|
||||
kstackTop[0] = (addr_t)&m68k_kernel_thread_root;
|
||||
|
||||
// the arguments of m68k_kernel_thread_root() are the functions to call,
|
||||
// provided in registers r13-r15
|
||||
kstackTop[3] = (addr_t)entry_func;
|
||||
kstackTop[4] = (addr_t)start_func;
|
||||
kstackTop[5] = (addr_t)exit_func;
|
||||
|
||||
// save this stack position
|
||||
t->arch_info.sp = (void *)kstackTop;
|
||||
|
||||
return B_OK;
|
||||
#else
|
||||
panic("arch_thread_init_kthread_stack(): Implement me!");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_thread_init_tls(Thread *thread)
|
||||
{
|
||||
// TODO: Implement!
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_thread_context_switch(Thread *from, Thread *to)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_thread_dump_info(void *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_thread_enter_userspace(Thread *thread, addr_t entry, void *arg1, void *arg2)
|
||||
{
|
||||
panic("arch_thread_enter_uspace(): not yet implemented\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
arch_on_signal_stack(Thread *thread)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_setup_signal_frame(Thread *thread, struct sigaction *sa,
|
||||
struct signal_frame_data *signalFrameData)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
arch_restore_signal_frame(struct signal_frame_data* signalFrameData)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_check_syscall_restart(Thread *thread)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** Saves everything needed to restore the frame in the child fork in the
|
||||
* arch_fork_arg structure to be passed to arch_restore_fork_frame().
|
||||
* Also makes sure to return the right value.
|
||||
*/
|
||||
|
||||
void
|
||||
arch_store_fork_frame(struct arch_fork_arg *arg)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/** Restores the frame from a forked team as specified by the provided
|
||||
* arch_fork_arg structure.
|
||||
* Needs to be called from within the child team, ie. instead of
|
||||
* arch_thread_enter_uspace() as thread "starter".
|
||||
* This function does not return to the caller, but will enter userland
|
||||
* in the child team at the same position where the parent team left of.
|
||||
*/
|
||||
|
||||
void
|
||||
arch_restore_fork_frame(struct arch_fork_arg *arg)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2019, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Adrien Destugues <[email protected]>
|
||||
*/
|
||||
|
||||
|
||||
#include <kernel.h>
|
||||
#include <debug.h>
|
||||
#include <timer.h>
|
||||
#include <arch/timer.h>
|
||||
|
||||
|
||||
void
|
||||
arch_timer_set_hardware_timer(bigtime_t timeout)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_timer_clear_hardware_timer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
arch_init_timer(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
system_time(void)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2019, Adrien Destugues, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <debugger.h>
|
||||
#include <int.h>
|
||||
#include <thread.h>
|
||||
#include <arch/user_debugger.h>
|
||||
|
||||
|
||||
void
|
||||
arch_clear_team_debug_info(struct arch_team_debug_info *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_destroy_team_debug_info(struct arch_team_debug_info *info)
|
||||
{
|
||||
arch_clear_team_debug_info(info);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_clear_thread_debug_info(struct arch_thread_debug_info *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_destroy_thread_debug_info(struct arch_thread_debug_info *info)
|
||||
{
|
||||
arch_clear_thread_debug_info(info);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_update_thread_single_step()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_set_debug_cpu_state(const debug_cpu_state *cpuState)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_get_debug_cpu_state(debug_cpu_state *cpuState)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_get_thread_debug_cpu_state(Thread* thread, debug_cpu_state* cpuState)
|
||||
{
|
||||
return B_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_breakpoint(void *address)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_clear_breakpoint(void *address)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_set_watchpoint(void *address, uint32 type, int32 length)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_clear_watchpoint(void *address)
|
||||
{
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
bool
|
||||
arch_has_breakpoints(struct arch_team_debug_info *info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
* Copyright 2003-2005, Axel Dörfler, [email protected].
|
||||
* Copyright 2019, Adrien Destugues, [email protected]
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/VMAddressSpace.h>
|
||||
#include <arch/vm.h>
|
||||
|
||||
|
||||
//#define TRACE_ARCH_VM
|
||||
#ifdef TRACE_ARCH_VM
|
||||
# define TRACE(x) dprintf x
|
||||
#else
|
||||
# define TRACE(x) ;
|
||||
#endif
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_init(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_init_post_area(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_init_post_modules(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_init_end(kernel_args *args)
|
||||
{
|
||||
TRACE(("arch_vm_init_end(): %lu virtual ranges to keep:\n",
|
||||
args->arch_args.num_virtual_ranges_to_keep));
|
||||
|
||||
for (int i = 0; i < (int)args->arch_args.num_virtual_ranges_to_keep; i++) {
|
||||
addr_range &range = args->arch_args.virtual_ranges_to_keep[i];
|
||||
|
||||
TRACE((" start: %p, size: 0x%lx\n", (void*)range.start, range.size));
|
||||
|
||||
#if 0
|
||||
// skip ranges outside the kernel address space
|
||||
if (!IS_KERNEL_ADDRESS(range.start)) {
|
||||
TRACE((" no kernel address, skipping...\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
phys_addr_t physicalAddress;
|
||||
void *address = (void*)range.start;
|
||||
if (vm_get_page_mapping(VMAddressSpace::KernelID(), range.start,
|
||||
&physicalAddress) != B_OK)
|
||||
panic("arch_vm_init_end(): No page mapping for %p\n", address);
|
||||
area_id area = vm_map_physical_memory(VMAddressSpace::KernelID(),
|
||||
"boot loader reserved area", &address,
|
||||
B_EXACT_ADDRESS, range.size,
|
||||
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
|
||||
physicalAddress, true);
|
||||
if (area < 0) {
|
||||
panic("arch_vm_init_end(): Failed to create area for boot loader "
|
||||
"reserved area: %p - %p\n", (void*)range.start,
|
||||
(void*)(range.start + range.size));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Throw away any address space mappings we've inherited from the boot
|
||||
// loader and have not yet turned into an area.
|
||||
vm_free_unused_boot_loader_range(0, 0xffffffff - B_PAGE_SIZE + 1);
|
||||
#endif
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_vm_aspace_swap(struct VMAddressSpace *from, struct VMAddressSpace *to)
|
||||
{
|
||||
// This functions is only invoked when a userland thread is in the process
|
||||
// of dying. It switches to the kernel team and does whatever cleanup is
|
||||
// necessary (in case it is the team's main thread, it will delete the
|
||||
// team).
|
||||
// It is however not necessary to change the page directory. Userland team's
|
||||
// page directories include all kernel mappings as well. Furthermore our
|
||||
// arch specific translation map data objects are ref-counted, so they won't
|
||||
// go away as long as they are still used on any CPU.
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
arch_vm_supports_protection(uint32 protection)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
arch_vm_unset_memory_type(VMArea *area)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_set_memory_type(VMArea *area, addr_t physicalBase, uint32 type)
|
||||
{
|
||||
if (type == 0)
|
||||
return B_OK;
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2007-2010, François Revol, [email protected].
|
||||
* Copyright 2008-2010, Ingo Weinhold, [email protected].
|
||||
* Copyright 2002-2007, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Copyright 2019, Adrien Destugues, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
* Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <kernel.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_priv.h>
|
||||
#include <vm/VMAddressSpace.h>
|
||||
|
||||
|
||||
#define TRACE_VM_TMAP
|
||||
#ifdef TRACE_VM_TMAP
|
||||
# define TRACE(x...) dprintf(x)
|
||||
#else
|
||||
# define TRACE(x...) ;
|
||||
#endif
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_translation_map_init(kernel_args *args,
|
||||
VMPhysicalPageMapper** _physicalPageMapper)
|
||||
{
|
||||
TRACE("vm_translation_map_init: entry\n");
|
||||
|
||||
#ifdef TRACE_VM_TMAP
|
||||
TRACE("physical memory ranges:\n");
|
||||
for (uint32 i = 0; i < args->num_physical_memory_ranges; i++) {
|
||||
phys_addr_t start = args->physical_memory_range[i].start;
|
||||
phys_addr_t end = start + args->physical_memory_range[i].size;
|
||||
TRACE(" %#10" B_PRIxPHYSADDR " - %#10" B_PRIxPHYSADDR "\n", start,
|
||||
end);
|
||||
}
|
||||
|
||||
TRACE("allocated physical ranges:\n");
|
||||
for (uint32 i = 0; i < args->num_physical_allocated_ranges; i++) {
|
||||
phys_addr_t start = args->physical_allocated_range[i].start;
|
||||
phys_addr_t end = start + args->physical_allocated_range[i].size;
|
||||
TRACE(" %#10" B_PRIxPHYSADDR " - %#10" B_PRIxPHYSADDR "\n", start,
|
||||
end);
|
||||
}
|
||||
|
||||
TRACE("allocated virtual ranges:\n");
|
||||
for (uint32 i = 0; i < args->num_virtual_allocated_ranges; i++) {
|
||||
addr_t start = args->virtual_allocated_range[i].start;
|
||||
addr_t end = start + args->virtual_allocated_range[i].size;
|
||||
TRACE(" %#10" B_PRIxADDR " - %#10" B_PRIxADDR "\n", start, end);
|
||||
}
|
||||
#endif
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_translation_map_init_post_sem(kernel_args *args)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_translation_map_init_post_area(kernel_args *args)
|
||||
{
|
||||
TRACE("vm_translation_map_init_post_area: entry\n");
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_translation_map_early_map(kernel_args *args, addr_t va, phys_addr_t pa,
|
||||
uint8 attributes, phys_addr_t (*get_free_page)(kernel_args *))
|
||||
{
|
||||
TRACE("early_tmap: entry pa 0x%lx va 0x%lx\n", pa, va);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
arch_vm_translation_map_create_map(bool kernel, VMTranslationMap** _map)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress,
|
||||
uint32 protection)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
SubDir HAIKU_TOP src system kernel lib arch sparc ;
|
||||
|
||||
SEARCH_SOURCE += [ FDirName $(librootSources) os arch generic ] ;
|
||||
|
||||
local librootSources = [ FDirName $(HAIKU_TOP) src system libroot ] ;
|
||||
local posixSources = [ FDirName $(librootSources) posix ] ;
|
||||
|
||||
SEARCH_SOURCE += [ FDirName $(librootSources) os arch $(TARGET_ARCH) ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(librootSources) os arch generic ] ;
|
||||
|
||||
KernelMergeObject kernel_os_arch_$(TARGET_ARCH).o :
|
||||
generic_system_time_nsecs.cpp
|
||||
: $(TARGET_KERNEL_PIC_CCFLAGS)
|
||||
;
|
||||
|
||||
SEARCH_SOURCE += [ FDirName $(posixSources) arch $(TARGET_ARCH) ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(posixSources) string arch generic ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(posixSources) string arch $(TARGET_ARCH) ] ;
|
||||
|
||||
KernelMergeObject kernel_lib_posix_arch_$(TARGET_ARCH).o :
|
||||
siglongjmp.S
|
||||
sigsetjmp.S
|
||||
|
||||
memcpy.c
|
||||
memset.c
|
||||
: $(TARGET_KERNEL_PIC_CCFLAGS)
|
||||
;
|
||||
@@ -0,0 +1,60 @@
|
||||
OUTPUT_FORMAT("elf64-sparc")
|
||||
OUTPUT_ARCH(sparc:v9)
|
||||
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = 0xFFFFFFFF80000000 + SIZEOF_HEADERS;
|
||||
|
||||
.interp : { *(.interp) }
|
||||
.hash : { *(.hash) }
|
||||
.dynsym : { *(.dynsym) }
|
||||
.dynstr : { *(.dynstr) }
|
||||
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
|
||||
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
|
||||
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
|
||||
.rela.got : { *(.rela.got) }
|
||||
.rela.ctors : { *(.rela.ctors) }
|
||||
.rela.dtors : { *(.rela.dtors) }
|
||||
.rela.init : { *(.rela.init) }
|
||||
.rela.fini : { *(.rela.fini) }
|
||||
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
.init : { *(.init) } =0x90909090
|
||||
.plt : { *(.plt) }
|
||||
|
||||
/* text/read-only data */
|
||||
.text : { *(.text .text.* .gnu.linkonce.t.*) } =0x90909090
|
||||
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
. = ALIGN(0x8);
|
||||
altcodepatch_begin = .;
|
||||
.altcodepatch : { *(.altcodepatch) }
|
||||
altcodepatch_end = .;
|
||||
|
||||
/* writable data */
|
||||
. = ALIGN(0x1000);
|
||||
__data_start = .;
|
||||
.data : { *(.data .gnu.linkonce.d.*) }
|
||||
|
||||
. = ALIGN(0x4);
|
||||
__ctor_list = .;
|
||||
.ctors : { *(.ctors) }
|
||||
__ctor_end = .;
|
||||
__dtor_list = .;
|
||||
.dtors : { *(.dtors) }
|
||||
__dtor_end = .;
|
||||
.got : { *(.got.plt) *(.got) }
|
||||
.dynamic : { *(.dynamic) }
|
||||
|
||||
/* uninitialized data (in same segment as writable data) */
|
||||
__bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
|
||||
. = ALIGN(0x1000);
|
||||
_end = . ;
|
||||
|
||||
/* Strip unnecessary stuff */
|
||||
/DISCARD/ : { *(.comment .note .eh_frame) }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
SubDir HAIKU_TOP src system libroot posix arch sparc ;
|
||||
|
||||
local architectureObject ;
|
||||
for architectureObject in [ MultiArchSubDirSetup sparc ] {
|
||||
on $(architectureObject) {
|
||||
local architecture = $(TARGET_PACKAGING_ARCH) ;
|
||||
|
||||
UsePrivateSystemHeaders ;
|
||||
|
||||
local genericSources =
|
||||
setjmp_save_sigs.c
|
||||
longjmp_return.c
|
||||
;
|
||||
|
||||
MergeObject <$(architecture)>posix_arch_$(TARGET_ARCH).o :
|
||||
sigsetjmp.S
|
||||
siglongjmp.S
|
||||
|
||||
$(genericSources)
|
||||
;
|
||||
|
||||
SEARCH on [ FGristFiles $(genericSources) ]
|
||||
= [ FDirName $(SUBDIR) $(DOTDOT) generic ] ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk
|
||||
* Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
|
||||
|
||||
#include <asm_defs.h>
|
||||
|
||||
|
||||
/* int __siglongjmp(jmp_buf buffer, int value) */
|
||||
FUNCTION(siglongjmp):
|
||||
FUNCTION(longjmp):
|
||||
FUNCTION(_longjmp):
|
||||
ret
|
||||
FUNCTION_END(siglongjmp)
|
||||
FUNCTION_END(longjmp)
|
||||
FUNCTION_END(_longjmp)
|
||||
|
||||
#pragma weak longjmp=siglongjmp
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/* Copyright 2019, Adrien Destugues, pulkomandy@pulkomandy.tk.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <asm_defs.h>
|
||||
|
||||
|
||||
/* int setjmp(jmp_buf buffer) */
|
||||
FUNCTION(setjmp):
|
||||
FUNCTION(_setjmp):
|
||||
ret
|
||||
FUNCTION_END(setjmp)
|
||||
Reference in New Issue
Block a user