1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12/* 13 * A default crt0 for ia32. It does the bare minimum required to get into 14 * main() with a sensible C environment. 15 * 16 * This file will only be linked in if: 17 * - no other file already provides a _start symbol, and 18 * - _start is an undefined external symbol (force this by passing 19 * "-u _start" to ld). 20 */ 21 22#define __ASM__ 23#include <autoconf.h> 24#include <sel4platsupport/gen_config.h> 25 26#ifdef CONFIG_LIB_SEL4_PLAT_SUPPORT_START 27 28#include <sel4/arch/constants.h> 29 30 .global _start 31 32 .text 33 34_start: 35 leal _stack_top, %esp 36 37 /* Setup segment selector for IPC buffer access. */ 38 movw $IPCBUF_GDT_SELECTOR, %ax 39 movw %ax, %fs 40 41 /* Setup the global "bootinfo" structure. */ 42 pushl %ebx 43 call seL4_InitBootInfo 44 addl $4, %esp 45 46 /* Call constructors and other initialisation functions. */ 47 call _init 48 49 /* Start main. */ 50 call main 51 52 /* Call exit with the return value from main. */ 53 pushl %eax 54 call exit 551: jmp 1b 56 57 .bss 58 .balign 8 59 60_stack_bottom: 61 .space 16384 62_stack_top: 63 64#endif /* CONFIG_LIB_SEL4_PLAT_SUPPORT_START */ 65