genode/repos/base-hw/src/core/spec/x86_64/crt0.s
Norman Feske a974726e26 hw: skeleton for building on x86_64
This patch contains the initial code needed to build and bootstrap the
base-hw kernel on x86 64-bit platforms. It gets stuck earlier
because the binary contains 64-bit instructions, but it is started in
32-bit mode. The initial setup of page tables and switch to long mode is
still missing from the crt0 code.
2015-03-27 11:53:16 +01:00

46 lines
1.2 KiB
ArmAsm

/**
* \brief Startup code for Genode 64Bit applications
* \author Sebastian Sumpf
* \author Martin Stein
* \date 2011-05-11
*/
/*
* Copyright (C) 2011-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/**************************
** .text (program code) **
**************************/
.section ".text"
/* program entry-point */
.global _core_start
_core_start:
/* initialize GLOBAL OFFSET TABLE */
leaq _GLOBAL_OFFSET_TABLE_(%rip), %r15
/* create proper environment for the main thread */
call init_main_thread
/* apply environment that was created by init_main_thread */
movq init_main_thread_result@GOTPCREL(%rip), %rax
movq (%rax), %rsp
/* clear the base pointer in order that stack backtraces will work */
xorq %rbp, %rbp
/*
* We jump into initial C code instead of calling it as it should never
* return on the one hand and because the alignment of the stack pointer
* that init_main_thread returned expects a jump at the other hand. The
* latter matters because GCC expects the initial stack pointer to be
* aligned to 16 byte for at least the handling of floating points.
*/
jmp _main