| 1 | ; $Id: kLdrA-os2.asm 3537 2007-08-23 00:39:06Z bird $
|
|---|
| 2 | ;; @file
|
|---|
| 3 | ;
|
|---|
| 4 | ; kLdr - The Dynamic Loader, asm helpers.
|
|---|
| 5 | ;
|
|---|
| 6 | ; Copyright (c) 2006 knut st. osmundsen <bird@anduin.net>
|
|---|
| 7 | ;
|
|---|
| 8 | ;
|
|---|
| 9 | ; This file is part of kLdr.
|
|---|
| 10 | ;
|
|---|
| 11 | ; kLdr is free software; you can redistribute it and/or modify
|
|---|
| 12 | ; it under the terms of the GNU General Public License as published by
|
|---|
| 13 | ; the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | ; (at your option) any later version.
|
|---|
| 15 | ;
|
|---|
| 16 | ; kLdr is distributed in the hope that it will be useful,
|
|---|
| 17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | ; GNU General Public License for more details.
|
|---|
| 20 | ;
|
|---|
| 21 | ; You should have received a copy of the GNU General Public License
|
|---|
| 22 | ; along with kLdr; if not, write to the Free Software
|
|---|
| 23 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | ;
|
|---|
| 25 | ;
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | segment TEXT32 public align=16 CLASS=CODE use32
|
|---|
| 29 |
|
|---|
| 30 | ;
|
|---|
| 31 | ; _DLL_InitTerm
|
|---|
| 32 | ;
|
|---|
| 33 | ..start:
|
|---|
| 34 | extern _DLL_InitTerm
|
|---|
| 35 | jmp _DLL_InitTerm
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | ;
|
|---|
| 39 | ; kLdrLoadExe wrapper which loads the bootstrap stack.
|
|---|
| 40 | ;
|
|---|
| 41 | global _kLdrDyldLoadExe
|
|---|
| 42 | _kLdrDyldLoadExe:
|
|---|
| 43 | push ebp
|
|---|
| 44 | mov ebp, esp
|
|---|
| 45 |
|
|---|
| 46 | ; switch stack.
|
|---|
| 47 | ; extern _abStack
|
|---|
| 48 | ; lea esp, [_abStack + 8192 - 4]
|
|---|
| 49 | push dword [ebp + 8 + 20]
|
|---|
| 50 | push dword [ebp + 8 + 16]
|
|---|
| 51 | push dword [ebp + 8 + 12]
|
|---|
| 52 | push dword [ebp + 8 + 8]
|
|---|
| 53 |
|
|---|
| 54 | ; call worker on the new stack.
|
|---|
| 55 | extern _kldrDyldLoadExe
|
|---|
| 56 | call _kldrDyldLoadExe
|
|---|
| 57 |
|
|---|
| 58 | ; we shouldn't return!
|
|---|
| 59 | we_re_not_supposed_to_get_here:
|
|---|
| 60 | int3
|
|---|
| 61 | int3
|
|---|
| 62 | jmp short we_re_not_supposed_to_get_here
|
|---|
| 63 |
|
|---|