Relicense Sortix to the ISC license.
I hereby relicense all my work on Sortix under the ISC license as below.
All Sortix contributions by other people are already under this license,
are not substantial enough to be copyrightable, or have been removed.
All imported code from other projects is compatible with this license.
All GPL licensed code from other projects had previously been removed.
Copyright 2011-2016 Jonas 'Sortie' Termansen and contributors.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2016-03-02 17:38:16 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011, 2012, 2014 Jonas 'Sortie' Termansen.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* x64/crt0.S
|
|
|
|
* Implement the _start symbol at which execution begins which performs the
|
|
|
|
* task of initializing the standard library and executing the main function.
|
|
|
|
*/
|
2012-09-08 08:37:16 -04:00
|
|
|
|
|
|
|
.section .text
|
|
|
|
|
|
|
|
.global _start
|
2014-12-28 13:18:45 -05:00
|
|
|
.global __start
|
2012-09-08 08:37:16 -04:00
|
|
|
.type _start, @function
|
2014-12-28 13:18:45 -05:00
|
|
|
.type __start, @function
|
2012-09-08 08:37:16 -04:00
|
|
|
_start:
|
2014-12-28 13:18:45 -05:00
|
|
|
__start:
|
2012-12-07 14:35:00 -05:00
|
|
|
# Set up end of the stack frame linked list.
|
|
|
|
xorl %ebp, %ebp
|
|
|
|
pushq %rbp # rip=0
|
|
|
|
pushq %rbp # rbp=0
|
|
|
|
movq %rsp, %rbp
|
|
|
|
|
2012-09-08 08:37:16 -04:00
|
|
|
movq %rcx, environ # envp
|
|
|
|
|
2014-11-27 18:13:28 -05:00
|
|
|
# Initialize the standard library.
|
|
|
|
subq $8, %rsp
|
2012-09-08 08:37:16 -04:00
|
|
|
pushq %rsi
|
|
|
|
pushq %rdi
|
2013-02-16 10:06:30 -05:00
|
|
|
pushq %rcx
|
2012-09-08 08:37:16 -04:00
|
|
|
call initialize_standard_library
|
|
|
|
|
|
|
|
# Run the global constructors.
|
|
|
|
call _init
|
|
|
|
|
|
|
|
# Run main
|
2013-02-16 10:06:30 -05:00
|
|
|
popq %rdx # Note! envp is now %rdx (previously %rcx)
|
2012-09-08 08:37:16 -04:00
|
|
|
popq %rdi
|
|
|
|
popq %rsi
|
2014-11-27 18:13:28 -05:00
|
|
|
addq $8, %rsp
|
2012-09-08 08:37:16 -04:00
|
|
|
call main
|
|
|
|
|
|
|
|
# Terminate the process with main's exit code.
|
|
|
|
movl %eax, %edi
|
|
|
|
call exit
|
2013-05-22 16:06:18 -04:00
|
|
|
.size _start, .-_start
|
2014-12-28 13:18:45 -05:00
|
|
|
.size __start, .-__start
|