Added stub versions of everything needed to build the kernel.

The whole kernel now builds and there are no undefined references when
linking, I just need to fix some strange relocation errors I'm getting
(probably a problem with the linker script) and then I'll have a kernel
image.
This commit is contained in:
Alex Smith 2012-06-15 22:50:59 +01:00
parent 146f966921
commit 043c61dde5
17 changed files with 904 additions and 4 deletions

View File

@ -7,7 +7,21 @@ UsePrivateKernelHeaders ;
UsePrivateHeaders shared ;
KernelMergeObject kernel_arch_x86_64.o :
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_thread.cpp
arch_timer.cpp
arch_user_debugger.cpp
arch_vm.cpp
arch_vm_translation_map.cpp
:
$(TARGET_KERNEL_PIC_CCFLAGS)
;

View File

@ -0,0 +1,21 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <commpage.h>
status_t
arch_commpage_init(void)
{
return B_OK;
}
status_t
arch_commpage_init_post_cpus(void)
{
return B_OK;
}

View File

@ -1,6 +1,10 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk
* Copyright 2002-2010, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
* Distributed under the terms of the NewOS License.
*/
@ -8,8 +12,6 @@
#include <boot/kernel_args.h>
// #pragma mark -
status_t
arch_cpu_preboot_init_percpu(kernel_args *args, int cpu)
@ -46,6 +48,13 @@ arch_cpu_init_post_modules(kernel_args *args)
}
void
arch_cpu_user_TLB_invalidate(void)
{
}
void
arch_cpu_global_TLB_invalidate(void)
{
@ -102,6 +111,33 @@ error:
}
status_t
arch_cpu_user_memcpy(void *to, const void *from, size_t size,
addr_t *faultHandler)
{
char *d = (char *)to;
const char *s = (const char *)from;
addr_t oldFaultHandler = *faultHandler;
// this check is to trick the gcc4 compiler and have it keep the error label
if (s == NULL)
goto error;
*faultHandler = (addr_t)&&error;
for (; size != 0; size--) {
*d++ = *s++;
}
*faultHandler = oldFaultHandler;
return 0;
error:
*faultHandler = oldFaultHandler;
return B_BAD_ADDRESS;
}
status_t
arch_cpu_user_memset(void *s, char c, size_t count, addr_t *faultHandler)
{

View File

@ -0,0 +1,102 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <debug.h>
#include <arch/debug.h>
void
arch_debug_save_registers(struct arch_debug_registers* registers)
{
}
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;
}
int32
arch_debug_get_stack_trace(addr_t* returnAddresses, int32 maxCount,
int32 skipIframes, int32 skipFrames, uint32 flags)
{
return 0;
}
void*
arch_debug_get_interrupt_pc(bool* _isSyscall)
{
return NULL;
}
void
arch_debug_unset_current_thread(void)
{
}
bool
arch_is_debug_variable_defined(const char* variableName)
{
return false;
}
status_t
arch_set_debug_variable(const char* variableName, uint64 value)
{
return B_OK;
}
status_t
arch_get_debug_variable(const char* variableName, uint64* value)
{
return B_OK;
}
ssize_t
arch_debug_gdb_get_registers(char* buffer, size_t bufferSize)
{
return B_ERROR;
}
status_t
arch_debug_init(kernel_args *args)
{
return B_OK;
}
void
arch_debug_call_with_fault_handler(cpu_ent* cpu, jmp_buf jumpBuffer,
void (*function)(void*), void* parameter)
{
// To be implemented in asm, not here.
}

View File

@ -0,0 +1,91 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <debug.h>
#include <arch/cpu.h>
#include <arch/debug_console.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 -1;
}
char
arch_debug_blue_screen_getchar(void)
{
while(true)
PAUSE();
return 0;
}
int
arch_debug_serial_try_getchar(void)
{
return -1;
}
char
arch_debug_serial_getchar(void)
{
while(true)
PAUSE();
return 0;
}
void
arch_debug_serial_putchar(const char c)
{
}
void
arch_debug_serial_puts(const char *s)
{
}
void
arch_debug_serial_early_boot_message(const char *string)
{
}
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;
}

View File

@ -0,0 +1,82 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <elf.h>
// Currently got generic elf.cpp #ifdef'd out for x86_64, define stub versions here.
status_t
elf_load_user_image(const char *path, Team *team, int flags, addr_t *_entry)
{
return B_ERROR;
}
image_id
load_kernel_add_on(const char *path)
{
return 0;
}
status_t
unload_kernel_add_on(image_id id)
{
return B_ERROR;
}
status_t
elf_debug_lookup_symbol_address(addr_t address, addr_t *_baseAddress,
const char **_symbolName, const char **_imageName, bool *_exactMatch)
{
return B_ERROR;
}
addr_t
elf_debug_lookup_symbol(const char* searchName)
{
return 0;
}
struct elf_image_info *
elf_get_kernel_image()
{
return NULL;
}
image_id
elf_create_memory_image(const char* imageName, addr_t text, size_t textSize,
addr_t data, size_t dataSize)
{
return B_ERROR;
}
status_t
elf_add_memory_image_symbol(image_id id, const char* name, addr_t address,
size_t size, int32 type)
{
return B_ERROR;
}
status_t
elf_init(struct kernel_args *args)
{
return B_OK;
}
status_t
get_image_symbol(image_id image, const char *name, int32 symbolType,
void **_symbolLocation)
{
return B_OK;
}
status_t
_user_read_kernel_image_symbols(image_id id, struct Elf32_Sym* symbolTable,
int32* _symbolCount, char* stringTable, size_t* _stringTableSize,
addr_t* _imageDelta)
{
return B_ERROR;
}

View File

@ -0,0 +1,58 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <int.h>
#include <arch/int.h>
void
arch_int_enable_io_interrupt(int irq)
{
}
void
arch_int_disable_io_interrupt(int irq)
{
}
void
arch_int_configure_io_interrupt(int irq, uint32 config)
{
}
status_t
arch_int_init(struct kernel_args *args)
{
return B_OK;
}
status_t
arch_int_init_post_vm(struct kernel_args *args)
{
return B_OK;
}
status_t
arch_int_init_io(kernel_args* args)
{
return B_OK;
}
status_t
arch_int_init_post_device_manager(struct kernel_args *args)
{
return B_OK;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
* Axel Dörfler, axeld@pinc-software.de
*/
#include <arch/platform.h>
//#include <apm.h>
status_t
arch_platform_init(struct kernel_args *args)
{
return B_OK;
}
status_t
arch_platform_init_post_vm(struct kernel_args *args)
{
return B_OK;
}
status_t
arch_platform_init_post_thread(struct kernel_args *args)
{
//apm_init(args);
return B_OK;
}

View File

@ -0,0 +1,45 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <arch/real_time_clock.h>
#include <real_time_clock.h>
#include <real_time_data.h>
status_t
arch_rtc_init(struct 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;
}

View File

@ -0,0 +1,37 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <smp.h>
#include <arch/smp.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_broadcast_ici(void)
{
}
void
arch_smp_send_ici(int32 target_cpu)
{
}

View File

@ -0,0 +1,21 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <arch/system_info.h>
status_t
arch_get_system_info(system_info *info, size_t size)
{
return B_OK;
}
status_t
arch_system_info_init(struct kernel_args *args)
{
return B_OK;
}

View File

@ -0,0 +1,104 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <arch/thread.h>
#include <team.h>
#include <thread.h>
status_t
arch_thread_init(struct kernel_args *args)
{
return B_OK;
}
status_t
arch_team_init_team_struct(Team *p, bool kernel)
{
return B_ERROR;
}
status_t
arch_thread_init_thread_struct(Thread *thread)
{
return B_ERROR;
}
void
arch_thread_init_kthread_stack(Thread* thread, void* _stack, void* _stackTop,
void (*function)(void*), const void* data)
{
}
status_t
arch_thread_init_tls(Thread *thread)
{
return B_ERROR;
}
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* args1,
void* args2)
{
return B_ERROR;
}
bool
arch_on_signal_stack(Thread *thread)
{
return false;
}
status_t
arch_setup_signal_frame(Thread* thread, struct sigaction* action,
struct signal_frame_data* signalFrameData)
{
return B_ERROR;
}
int64
arch_restore_signal_frame(struct signal_frame_data* signalFrameData)
{
return 0;
}
void
arch_store_fork_frame(struct arch_fork_arg *arg)
{
}
void
arch_restore_fork_frame(struct arch_fork_arg* arg)
{
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <timer.h>
#include <arch/timer.h>
void
arch_timer_set_hardware_timer(bigtime_t timeout)
{
}
void
arch_timer_clear_hardware_timer(void)
{
}
int
arch_init_timer(kernel_args *args)
{
return 0;
}

View File

@ -0,0 +1,106 @@
/*
* Copyright 2005-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <arch/user_debugger.h>
#include <debugger.h>
// The software breakpoint instruction (int3).
const uint8 kX86SoftwareBreakpoint[1] = { 0xcc };
void
arch_clear_team_debug_info(struct arch_team_debug_info *info)
{
}
void
arch_destroy_team_debug_info(struct arch_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)
{
}
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_set_breakpoint(void *address)
{
return B_OK;
}
status_t
arch_clear_breakpoint(void *address)
{
return B_OK;
}
status_t
arch_set_watchpoint(void *address, uint32 type, int32 length)
{
return B_OK;
}
status_t
arch_clear_watchpoint(void *address)
{
return B_OK;
}
bool
arch_has_breakpoints(struct arch_team_debug_info *info)
{
return false;
}
void
x86_init_user_debug()
{
}

View File

@ -0,0 +1,66 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <vm/vm.h>
#include <arch/vm.h>
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_end(kernel_args *args)
{
return B_OK;
}
status_t
arch_vm_init_post_modules(kernel_args *args)
{
return B_OK;
}
void
arch_vm_aspace_swap(struct VMAddressSpace *from, struct VMAddressSpace *to)
{
}
bool
arch_vm_supports_protection(uint32 protection)
{
return true;
}
void
arch_vm_unset_memory_type(struct VMArea *area)
{
}
status_t
arch_vm_set_memory_type(struct VMArea *area, phys_addr_t physicalBase,
uint32 type)
{
return B_OK;
}

View File

@ -0,0 +1,52 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Distributed under the terms of the MIT License.
*/
#include <arch/vm_translation_map.h>
status_t
arch_vm_translation_map_create_map(bool kernel, VMTranslationMap** _map)
{
return B_ERROR;
}
status_t
arch_vm_translation_map_init(kernel_args *args,
VMPhysicalPageMapper** _physicalPageMapper)
{
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)
{
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 *))
{
return B_ERROR;
}
bool
arch_vm_translation_map_is_kernel_page_accessible(addr_t virtualAddress,
uint32 protection)
{
return true;
}