|
Last change
on this file since 22010 was 21942, checked in by dmik, 14 years ago |
|
Use custom startup code for PE loader.
This allows to grab the lowest memory address before any DLL
(including the C library) kicks in and reserves memory for its own
purposes. This fixes #54.
|
-
Property svn:eol-style
set to
native
|
|
File size:
754 bytes
|
| Line | |
|---|
| 1 | /** @file
|
|---|
| 2 | *
|
|---|
| 3 | * Minimalistic application entry point.
|
|---|
| 4 | *
|
|---|
| 5 | * This gets control when the executable is loaded.
|
|---|
| 6 | *
|
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | .globl WEAK$ZERO
|
|---|
| 11 |
|
|---|
| 12 | WEAK$ZERO = 0
|
|---|
| 13 |
|
|---|
| 14 | .globl __text
|
|---|
| 15 | .globl ___main
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | .text
|
|---|
| 19 |
|
|---|
| 20 | /*
|
|---|
| 21 | * Entry point.
|
|---|
| 22 | *
|
|---|
| 23 | * It calls the function that must be defined as
|
|---|
| 24 | * <code>
|
|---|
| 25 | * extern "C" int simple_main(void)
|
|---|
| 26 | * <code>
|
|---|
| 27 | * and returns its return code to the system.
|
|---|
| 28 | */
|
|---|
| 29 | __text:
|
|---|
| 30 |
|
|---|
| 31 | cld
|
|---|
| 32 | call _simple_main
|
|---|
| 33 | ret
|
|---|
| 34 |
|
|---|
| 35 | /*
|
|---|
| 36 | * GCC always generates a call to ___main from _main, so use a dummy
|
|---|
| 37 | * funciton.
|
|---|
| 38 | */
|
|---|
| 39 | ___main:
|
|---|
| 40 | ret
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | .data
|
|---|
| 44 |
|
|---|
| 45 | /*
|
|---|
| 46 | * force creation of the data segment to keep the assumed order of
|
|---|
| 47 | * objects in the executable (CODE, DATA/BSS, STACK)
|
|---|
| 48 | */
|
|---|
| 49 | .long 0
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.