Index: /trunk/kLdr/Makefile.kmk
===================================================================
--- /trunk/kLdr/Makefile.kmk	(revision 2834)
+++ /trunk/kLdr/Makefile.kmk	(revision 2835)
@@ -92,4 +92,5 @@
 	kLdr.c \
 	kLdrDy.c \
+	kLdrDyldMod.c \
 	kLdrDySearch.c \
 	kLdrHlp.c \
Index: /trunk/kLdr/kLdr.h
===================================================================
--- /trunk/kLdr/kLdr.h	(revision 2834)
+++ /trunk/kLdr/kLdr.h	(revision 2835)
@@ -254,4 +254,26 @@
 /** @defgroup grp_kLdrMod   kLdrMod - The executable image intepreter
  * @{ */
+
+/**
+ * Stack information.
+ */
+typedef struct KLDRSTACKINFO
+{
+    /** The base address of the stack (sub) segment, link address.
+     * Set this to ~(uintptr_t)0 if the module doesn't include any stack (sub)segment. */
+    uintmax_t           uLinkAddress;
+    /** The base address of the stack (sub) segment, actual load address.
+     * Set this to ~(uintptr_t)0 if the module doesn't include any stack (sub)segment or if
+     * the module isn't mapped (loaded) yet. */
+    uintmax_t           uLoadAddress;
+    /** The stack size of the main thread.
+     * If no stack (sub)segment in the module, this is the stack size of the main thread.
+     * If the module doesn't contain this kind of information this field will be set to 0. */
+    uintmax_t           cbStack;
+    /** The stack size of non-main threads.
+     * If the module doesn't contain this kind of information this field will be set to 0. */
+    uintmax_t           cbStackThread;
+} KLDRSTACKINFO, *PKLDRSTACKINFO;
+
 
 /**
@@ -538,4 +560,5 @@
 int     kLdrModRelocateBits(PKLDRMOD pMod, void *pvBits, uintmax_t NewBaseAddress, uintmax_t OldBaseAddress, PFNKLDRMODGETIMPORT pfnGetImport, void *pvUser);
 int     kLdrModCanExecuteOn(PKLDRMOD pMod, KLDRARCH enmArch, KLDRCPU enmCpu);
+int     kLdrModGetStackInfo(PKLDRMOD pMod, PKLDRSTACKINFO pStackInfo);
 
 /** @} */
@@ -605,5 +628,5 @@
 int     kLdrDyldFindByAddress(uintptr_t Address, PHKLDRMOD phMod, uint32_t *piSegment, uintptr_t *poffSegment);
 int     kLdrDyldGetName(HKLDRMOD hMod, char *pszName, size_t cchName);
-int     kLdrDyldGetFilename(HKLDRMOD hMod, char *pszFilename, size_t cchFilenamep);
+int     kLdrDyldGetFilename(HKLDRMOD hMod, char *pszFilename, size_t cchFilename);
 int     kLdrDyldQuerySymbol(HKLDRMOD hMod, uint32_t uSymbolOrdinal, const char *pszSymbolName, uintptr_t *pValue, uint32_t *pfKind);
 
Index: /trunk/kLdr/kLdrDySearch.c
===================================================================
--- /trunk/kLdr/kLdrDySearch.c	(revision 2834)
+++ /trunk/kLdr/kLdrDySearch.c	(revision 2835)
@@ -35,2 +35,41 @@
 
 
+/**
+ * Locates and opens a module using the specified search method.
+ *
+ * @returns 0 and *ppRdr on success, non-zero OS specific error on failure.
+ *
+ * @param   pszName         Partial or complete name, it's specific to the search method to determin which.
+ * @param   pszPrefix       Prefix that might be used (that's method specific).
+ * @param   pszSuffix       Suffix that can be applied to an incomplete name.
+ * @param   enmSearch       The file search method to apply.
+ * @param   fFlags          Search flags.
+ * @param   ppMod           Where to store the file provider instance on success.
+ */
+int kldrDyldFindNewModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
+                          KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod)
+{
+    *ppMod = NULL;
+    return -1;
+}
+
+
+/**
+ * Locates an already open module using the specified search method.
+ *
+ * @returns 0 and *ppMod on success, non-zero OS specific error on failure.
+ *
+ * @param   pszName         Partial or complete name, it's specific to the search method to determin which.
+ * @param   pszPrefix       Prefix that might be used (that's method specific).
+ * @param   pszSuffix       Suffix that can be applied to an incomplete name.
+ * @param   enmSearch       The file search method to apply.
+ * @param   fFlags          Search flags.
+ * @param   ppMod           Where to store the file provider instance on success.
+ */
+int kldrDyldFindExistingModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
+                               KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod)
+{
+    *ppMod = NULL;
+    return -1;
+}
+
Index: /trunk/kLdr/kLdrDyldMod.c
===================================================================
--- /trunk/kLdr/kLdrDyldMod.c	(revision 2835)
+++ /trunk/kLdr/kLdrDyldMod.c	(revision 2835)
@@ -0,0 +1,39 @@
+/* $Id: $ */
+/** @file
+ *
+ * kLdr - The Dynamic Loader, Dyld module methods.
+ *
+ * Copyright (c) 2006 knut st. osmundsen <bird-kbuild-src@anduin.net>
+ *
+ *
+ * This file is part of kLdr.
+ *
+ * kLdr is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * kLdr is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with kLdr; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <kLdr.h>
+#include "kLdrInternal.h"
+#include "kLdrHlp.h"
+
+
+
+
+
Index: /trunk/kLdr/kLdrInternal.h
===================================================================
--- /trunk/kLdr/kLdrInternal.h	(revision 2834)
+++ /trunk/kLdr/kLdrInternal.h	(revision 2835)
@@ -134,4 +134,39 @@
 
 
+int kldrDyldFindNewModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
+                          KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod);
+int kldrDyldFindExistingModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
+                               KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod);
+
+
+int kldrDyldModCreate(PKLDRRDR pRdr, PPKLDRDYLDMOD ppMod);
+int kldrDyldModDestroy(PKLDRDYLDMOD pMod);
+int kldrDyldModAddDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pModDep);
+int kldrDyldModRemoveDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pModDep);
+int kldrDyldModDynamicLoad(PKLDRDYLDMOD pMod);
+int kldrDyldModDynamicUnload(PKLDRDYLDMOD pMod);
+int kldrDyldModMarkGlobal(PKLDRDYLDMOD pMod);
+int kldrDyldModMarkSpecific(PKLDRDYLDMOD pMod);
+int kldrDyldModSetBindable(PKLDRDYLDMOD pMod);
+int kldrDyldModClearBindable(PKLDRDYLDMOD pMod);
+int kldrDyldModSetDeepBindable(PKLDRDYLDMOD pMod);
+int kldrDyldModClearDeepBindable(PKLDRDYLDMOD pMod);
+int kldrDyldModMap(PKLDRDYLDMOD pMod);
+int kldrDyldModUnmap(PKLDRDYLDMOD pMod);
+int kldrDyldModLoadDependencies(PKLDRDYLDMOD pMod);
+int kldrDyldModFixup(PKLDRDYLDMOD pMod);
+int kldrDyldModCallInit(PKLDRDYLDMOD pMod);
+int kldrDyldModCallTerm(PKLDRDYLDMOD pMod);
+int kldrDyldModGetStackInfo(PKLDRDYLDMOD pMod, void *pvStack, size_t *pcbStack, size_t);
+int kldrDyldModStartExe(PKLDRDYLDMOD pMod);
+
+int kldrDyldModGetName(PKLDRDYLDMOD pMod, char *pszName, size_t cchName);
+int kldrDyldModGetFilename(PKLDRDYLDMOD pMod, char *pszFilename, size_t cchFilename);
+int kldrDyldModQuerySymbol(PKLDRDYLDMOD pMod, uint32_t uSymbolOrdinal, const char *pszSymbolName, uintptr_t *pValue, uint32_t *pfKind);
+
+
+void kldrDyldFailure(const char *pszFilename, ...);
+
+
 /** Pointer to the head module (the executable). */
 extern PKLDRDYLDMOD     kLdrDyldModuleHead;
@@ -140,9 +175,7 @@
 /** The Library search path. */
 extern char             kLdrDyldLibraryPath[4096];
+/** The global error buffer. */
+extern char             g_szkLdrDyldError[1024];
 
-
-#if 0
-void kldrFailure(const char *pszFilename, ...);
-#endif
 
 /** @} */
