Changeset 3598 for trunk/kStuff/kLdr
- Timestamp:
- Oct 4, 2007, 8:46:12 PM (18 years ago)
- Location:
- trunk/kStuff/kLdr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kStuff/kLdr/Makefile.kmk
r3585 r3598 147 147 kLdrStatic_SDKS.win = WINPSDK W2K3DDK 148 148 kLdrStatic_INCS := $(PATH_SUB_CURRENT) $(PATH_SUB_ROOT)/include 149 kLdrStatic_DEFS.darwin = __DARWIN__ 150 kLdrStatic_DEFS.os2 = __OS2__ 149 151 kLdrStatic_DEFS.win = __WIN__ 150 kLdrStatic_DEFS.os2 = __OS2__151 kLdrStatic_DEFS.darwin = __DARWIN__152 152 kLdrStatic_SOURCES = $(kLdr_SOURCES) 153 153 -
trunk/kStuff/kLdr/kLdrDyldFind.c
r3582 r3598 304 304 if (!kLdrDyldAppDir[0]) 305 305 { 306 #if defined(__OS2__) 306 #if K_OS == K_OS_DARWIN 307 /** @todo implement this! */ 308 kLdrDyldWindowsAppDir[0] = kLdrDyldAppDir[0] = '.'; 309 kLdrDyldWindowsAppDir[1] = kLdrDyldAppDir[1] = '\0'; 310 311 #elif K_OS == K_OS_OS2 307 312 PPIB pPib; 308 313 PTIB pTib; … … 791 796 */ 792 797 if (*penmSearch == KLDRDYLD_SEARCH_HOST) 793 #if defined(__OS2__) 798 #if K_OS == K_OS_DARWIN 799 /** @todo *penmSearch = KLDRDYLD_SEARCH_DARWIN; */ 800 *penmSearch = KLDRDYLD_SEARCH_UNIX_COMMON; 801 #elif K_OS == K_OS_OS2 794 802 *penmSearch = KLDRDYLD_SEARCH_OS2; 795 803 #elif K_OS == K_OS_WINDOWS -
trunk/kStuff/kLdr/kLdrDyldOS.c
r3582 r3598 43 43 44 44 #else 45 # error "port me" 45 # include <k/kHlpAlloc.h> 46 46 47 #endif 47 48 … … 76 77 77 78 #else 78 # error "Port me" 79 void *pv; 80 81 if (!cb) 82 cb = 1 * 1024*1024; /* 1MB */ 83 84 if (!kHlpPageAlloc(&pv, cb, KPROT_READWRITE, K_FALSE)) 85 return pv; 86 return NULL; 79 87 #endif 80 88 } … … 92 100 int kldrDyldOSStartExe(KUPTR uMainEPAddress, void *pvStack, KSIZE cbStack) 93 101 { 94 #if defined(__OS2__) 95 96 #elif K_OS == K_OS_WINDOWS 102 #if K_OS == K_OS_WINDOWS 97 103 /* 98 104 * Invoke the entrypoint on the current stack for now. … … 109 115 for (;;) 110 116 TerminateProcess(GetCurrentProcess(), rc); 111 112 /*#elif defined(__NT__)*/113 #else114 # error "Port me"115 117 #endif 116 118 … … 126 128 kldrDyldDoLoadExe(pExe); 127 129 } 130 -
trunk/kStuff/kLdr/kLdrDyldSem.c
r3577 r3598 31 31 #include <k/kDefs.h> 32 32 #include <k/kHlpSem.h> 33 #include <k/kHlpAssert.h> 33 34 34 #if K_OS == K_OS_OS2 35 #if K_OS == K_OS_DARWIN 36 # include <mach/mach.h> 37 38 #elif K_OS == K_OS_OS2 35 39 # define INCL_BASE 36 40 # define INCL_ERRORS 37 41 # include <os2.h> 42 38 43 #elif K_OS == K_OS_WINDOWS 39 44 # include <Windows.h> 45 40 46 #else 41 47 # error "port me" … … 47 53 * Global Variables * 48 54 *******************************************************************************/ 49 #if K_OS == K_OS_OS2 55 #if K_OS == K_OS_DARWIN 56 /** The loader sempahore. */ 57 static semaphore_t g_Semaphore = MACH_PORT_NULL; 58 59 #elif K_OS == K_OS_OS2 50 60 /** The loader sempahore. */ 51 61 static HMTX g_hmtx; … … 54 64 /** The loader sempahore. */ 55 65 static CRITICAL_SECTION g_CritSect; 66 56 67 #else 57 68 # error "port me" … … 64 75 * @returns 0 on success, non-zero OS status code on failure. 65 76 */ 66 int 77 int kLdrDyldSemInit(void) 67 78 { 68 #if K_OS == K_OS_OS2 79 #if K_OS == K_OS_DARWIN 80 kern_return_t krc; 81 82 krc = semaphore_create(mach_task_self(), &g_Semaphore, SYNC_POLICY_FIFO, 0); 83 if (krc != KERN_SUCCESS) 84 return krc; 85 86 #elif K_OS == K_OS_OS2 69 87 APIRET rc; 70 88 g_hmtx = NULLHANDLE; … … 86 104 * Terminates the loader semaphore. 87 105 */ 88 void 106 void kLdrDyldSemTerm(void) 89 107 { 90 #if K_OS == K_OS_OS2 108 #if K_OS == K_OS_DARWIN 109 kern_return_t krc; 110 semaphore_t Semaphore = g_Semaphore; 111 g_Semaphore = MACH_PORT_NULL; 112 krc = semaphore_destroy(mach_task_self(), Semaphore); 113 kHlpAssert(krc == KERN_SUCCESS); (void)krc; 114 115 #elif K_OS == K_OS_OS2 91 116 HMTX hmtx = g_hmtx; 92 117 g_hmtx = NULLHANDLE; … … 108 133 * @returns 0 on success, non-zero OS status code on failure. 109 134 */ 110 int 135 int kLdrDyldSemRequest(void) 111 136 { 112 #if K_OS == K_OS_OS2 137 #if K_OS == K_OS_DARWIN 138 /* not sure about this... */ 139 kern_return_t krc; 140 do krc = semaphore_wait(g_Semaphore); 141 while (krc == KERN_ABORTED); 142 if (krc == KERN_SUCCESS) 143 return 0; 144 return krc; 145 146 #elif K_OS == K_OS_OS2 113 147 APIRET rc = DosRequestMutexSem(g_hmtx, 5000); 114 148 if (rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT || rc == ERROR_INTERRUPT) … … 140 174 * The caller is responsible for making sure it's the semaphore owner! 141 175 */ 142 void 176 void kLdrDyldSemRelease(void) 143 177 { 144 #if K_OS == K_OS_OS2 178 #if K_OS == K_OS_DARWIN 179 /* not too sure about this... */ 180 kern_return_t krc = semaphore_signal(g_Semaphore); 181 kHlpAssert(krc == KERN_SUCCESS); (void)krc; 182 183 #elif K_OS == K_OS_OS2 145 184 APIRET rc = DosReleaseMutexSem(g_hmtx); 146 185 kHlpAssert(!rc); (void)rc; … … 152 191 # error "port me" 153 192 #endif 154 155 193 } 156 194
Note:
See TracChangeset
for help on using the changeset viewer.