- Timestamp:
- Apr 7, 2002, 5:44:11 PM (23 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r7886 r8203 1 ; $Id: KERNEL32.DEF,v 1.13 2 2002-02-12 12:00:41sandervl Exp $1 ; $Id: KERNEL32.DEF,v 1.133 2002-04-07 15:44:10 sandervl Exp $ 2 2 3 3 ;Basis is Windows95 KERNEL32 … … 1077 1077 1078 1078 ;VMutex 1079 enter__6VMutexFUlPUl @1204 NONAME1080 leave__6VMutexFPUl @1205 NONAME1081 __ct__6VMutexF iPUl@1206 NONAME1079 ;; enter__6VMutexFUlPUl @1204 NONAME 1080 ;; leave__6VMutexFPUl @1205 NONAME 1081 __ct__6VMutexFv @1206 NONAME 1082 1082 __dt__6VMutexFv @1207 NONAME 1083 1083 -
trunk/src/kernel32/initkernel32.cpp
r8010 r8203 1 /* $Id: initkernel32.cpp,v 1.1 3 2002-02-24 20:29:56sandervl Exp $1 /* $Id: initkernel32.cpp,v 1.14 2002-04-07 15:44:10 sandervl Exp $ 2 2 * 3 3 * KERNEL32 DLL entry point … … 136 136 return 0UL; 137 137 138 InitializeMemMaps(); 139 138 140 PROFILE_LoadOdinIni(); 139 141 dllHandle = RegisterLxDll(hModule, 0, (PVOID)&kernel32_PEResTab); -
trunk/src/kernel32/kernel32dbg.def
r7886 r8203 1 ; $Id: kernel32dbg.def,v 1. 8 2002-02-12 12:00:42sandervl Exp $1 ; $Id: kernel32dbg.def,v 1.9 2002-04-07 15:44:10 sandervl Exp $ 2 2 3 3 ;Basis is Windows95 KERNEL32 … … 1077 1077 1078 1078 ;VMutex 1079 enter__6VMutexFUlPUl @1204 NONAME1080 leave__6VMutexFPUl @1205 NONAME1081 __ct__6VMutexF iPUl@1206 NONAME1079 ;; enter__6VMutexFUlPUl @1204 NONAME 1080 ;; leave__6VMutexFPUl @1205 NONAME 1081 __ct__6VMutexFv @1206 NONAME 1082 1082 __dt__6VMutexFv @1207 NONAME 1083 1083 -
trunk/src/kernel32/mmap.cpp
r8121 r8203 1 /* $Id: mmap.cpp,v 1.5 4 2002-03-24 13:10:30sandervl Exp $ */1 /* $Id: mmap.cpp,v 1.55 2002-04-07 15:44:11 sandervl Exp $ */ 2 2 3 3 /* … … 29 29 #include <string.h> 30 30 #include <win\virtual.h> 31 #include < vmutex.h>31 #include <odincrt.h> 32 32 #include <handlemanager.h> 33 33 #include "mmap.h" … … 38 38 #include "dbglocal.h" 39 39 40 //NOTE: This must be in the local data segment -> if a shared semaphore was41 // created by a different process, the handle returned by DosOpenMutexSem42 // will be returned in hGlobalMapMutex43 HMTX hGlobalMapMutex = 0;44 45 40 //Global DLL Data 46 41 #pragma data_seg(_GLOBALDATA) 47 Win32MemMap 48 VMutex globalmapMutex(VMUTEX_SHARED, &hGlobalMapMutex);42 Win32MemMap *Win32MemMap::memmaps = NULL; 43 CRITICAL_SECTION_OS2 globalmapcritsect = {0}; 49 44 #pragma data_seg() 50 VMutex globalviewMutex;51 45 Win32MemMapView *Win32MemMapView::mapviews = NULL; 52 46 47 //****************************************************************************** 48 //****************************************************************************** 49 void InitializeMemMaps() 50 { 51 if(globalmapcritsect.hmtxLock == 0) { 52 dprintf(("InitializeMemMaps -> create shared critical section")); 53 DosInitializeCriticalSection(&globalmapcritsect, MEMMAP_CRITSECTION_NAME); 54 } 55 else { 56 dprintf(("InitializeMemMaps -> access shared critical section")); 57 DosAccessCriticalSection(&globalmapcritsect, MEMMAP_CRITSECTION_NAME); 58 } 59 } 53 60 //****************************************************************************** 54 61 //TODO: sharing between processes … … 57 64 : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), image(0) 58 65 { 59 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);66 DosEnterCriticalSection(&globalmapcritsect); 60 67 next = memmaps; 61 68 memmaps = this; 62 globalmapMutex.leave(&hGlobalMapMutex);69 DosLeaveCriticalSection(&globalmapcritsect); 63 70 64 71 hMemFile = hfile; … … 80 87 : nrMappings(0), pMapping(NULL), mMapAccess(0), referenced(0), image(0) 81 88 { 82 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);89 DosEnterCriticalSection(&globalmapcritsect); 83 90 next = memmaps; 84 91 memmaps = this; 85 globalmapMutex.leave(&hGlobalMapMutex);92 DosLeaveCriticalSection(&globalmapcritsect); 86 93 87 94 hMemFile = -1; … … 169 176 mapMutex.leave(); 170 177 171 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);178 DosEnterCriticalSection(&globalmapcritsect); 172 179 Win32MemMap *map = memmaps; 173 180 … … 186 193 else dprintf(("Win32MemMap::~Win32MemMap: map not found!! (%x)", this)); 187 194 } 188 globalmapMutex.leave(&hGlobalMapMutex);195 DosLeaveCriticalSection(&globalmapcritsect); 189 196 } 190 197 //****************************************************************************** … … 511 518 return NULL; 512 519 513 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);520 DosEnterCriticalSection(&globalmapcritsect); 514 521 Win32MemMap *map = memmaps; 515 522 … … 521 528 } 522 529 } 523 globalmapMutex.leave(&hGlobalMapMutex);530 DosLeaveCriticalSection(&globalmapcritsect); 524 531 if(!map) dprintf(("Win32MemMap::findMap: couldn't find map %s", lpszName)); 525 532 return map; … … 529 536 Win32MemMap *Win32MemMap::findMap(ULONG address) 530 537 { 531 globalmapMutex.enter(VMUTEX_WAIT_FOREVER, &hGlobalMapMutex);538 DosEnterCriticalSection(&globalmapcritsect); 532 539 Win32MemMap *map = memmaps; 533 540 … … 542 549 } 543 550 } 544 globalmapMutex.leave(&hGlobalMapMutex);551 DosLeaveCriticalSection(&globalmapcritsect); 545 552 return map; 546 553 } … … 553 560 554 561 //delete all maps created by this process 555 globalviewMutex.enter();562 DosEnterCriticalSection(&globalmapcritsect); 556 563 while(map) { 557 564 nextmap = map->next; … … 571 578 map = nextmap; 572 579 } 573 globalviewMutex.leave();580 DosLeaveCriticalSection(&globalmapcritsect); 574 581 } 575 582 //****************************************************************************** … … 630 637 dprintf(("Win32MemMapView::Win32MemMapView: created %x (alias for %x), size %d", pMapView, viewaddr, size)); 631 638 632 globalviewMutex.enter();639 DosEnterCriticalSection(&globalmapcritsect); 633 640 if(tmpview == NULL || tmpview->getViewAddr() > pMapView) { 634 641 next = mapviews; … … 645 652 tmpview->next = this; 646 653 } 647 globalviewMutex.leave();654 DosLeaveCriticalSection(&globalmapcritsect); 648 655 } 649 656 //****************************************************************************** … … 667 674 } 668 675 669 globalviewMutex.enter();676 DosEnterCriticalSection(&globalmapcritsect); 670 677 Win32MemMapView *view = mapviews; 671 678 … … 684 691 else dprintf(("Win32MemMapView::~Win32MemMapView: map not found!! (%x)", this)); 685 692 } 686 globalviewMutex.leave();693 DosLeaveCriticalSection(&globalmapcritsect); 687 694 } 688 695 //****************************************************************************** … … 690 697 void Win32MemMapView::deleteViews(Win32MemMap *map) 691 698 { 692 globalviewMutex.enter();699 DosEnterCriticalSection(&globalmapcritsect); 693 700 Win32MemMapView *view = mapviews, *nextview; 694 701 … … 698 705 if(view->getParentMap() == map) 699 706 { 700 globalviewMutex.leave();707 DosLeaveCriticalSection(&globalmapcritsect); 701 708 delete view; 702 globalviewMutex.enter();709 DosEnterCriticalSection(&globalmapcritsect); 703 710 } 704 711 view = nextview; 705 712 } 706 713 } 707 globalviewMutex.leave();714 DosLeaveCriticalSection(&globalmapcritsect); 708 715 } 709 716 //****************************************************************************** … … 716 723 if(mapviews == NULL) return NULL; 717 724 718 globalviewMutex.enter();725 DosEnterCriticalSection(&globalmapcritsect); 719 726 Win32MemMapView *view = mapviews; 720 727 ULONG ulViewAddr; … … 764 771 #endif 765 772 766 globalviewMutex.leave();773 DosLeaveCriticalSection(&globalmapcritsect); 767 774 768 775 if(pView) … … 777 784 Win32MemMapView *view = mapviews; 778 785 779 globalviewMutex.enter();786 DosEnterCriticalSection(&globalmapcritsect); 780 787 if(view != NULL) { 781 788 while(view) { … … 787 794 } 788 795 } 789 globalviewMutex.leave();796 DosLeaveCriticalSection(&globalmapcritsect); 790 797 return view; 791 798 } -
trunk/src/kernel32/mmap.h
r7550 r8203 1 /* $Id: mmap.h,v 1.2 0 2001-12-05 18:06:02sandervl Exp $ */1 /* $Id: mmap.h,v 1.21 2002-04-07 15:44:11 sandervl Exp $ */ 2 2 3 3 /* … … 22 22 #define PAGE_SHIFT 12 23 23 #endif 24 25 #define MEMMAP_CRITSECTION_NAME "\\SEM32\\ODIN_MMAP.SEM" 24 26 25 27 //commit 4 pages at once when the app accesses it … … 169 171 //****************************************************************************** 170 172 173 void InitializeMemMaps(); 174 171 175 #endif //__MMAP_H__ -
trunk/src/kernel32/vmutex.cpp
r3206 r8203 1 /* $Id: vmutex.cpp,v 1. 9 2000-03-23 19:23:47sandervl Exp $ */1 /* $Id: vmutex.cpp,v 1.10 2002-04-07 15:44:11 sandervl Exp $ */ 2 2 3 3 /* … … 19 19 #define INCL_DOSERRORS 20 20 #include <os2wrap.h> //Odin32 OS/2 api wrappers 21 #include <win32type.h> 21 22 #include <vmutex.h> 22 #include < win32type.h>23 #include <odincrt.h> 23 24 #include <misc.h> 24 25 … … 28 29 /******************************************************************************/ 29 30 /******************************************************************************/ 30 VMutex::VMutex( int fShared, HMTX *phMutex) : waiting(0)31 VMutex::VMutex() 31 32 { 32 APIRET rc; 33 34 this->fShared = fShared; 35 rc = DosCreateMutexSem(NULL, &sem_handle, (fShared == VMUTEX_SHARED) ? DC_SEM_SHARED : 0, FALSE); 36 if(rc != 0) { 37 dprintf(("Error creating mutex %X\n", rc)); 38 sem_handle = 0; 39 } 40 if(fShared) { 41 *phMutex = sem_handle; 42 } 33 DosInitializeCriticalSection(&critsect, NULL); 43 34 } 44 35 /******************************************************************************/ … … 46 37 VMutex::~VMutex() 47 38 { 48 int i; 49 50 if(sem_handle) { 51 if(fShared != VMUTEX_SHARED) { 52 for(i=0;i<waiting;i++) { 53 DosReleaseMutexSem(sem_handle); 54 } 55 } 56 DosCloseMutexSem(sem_handle); 57 } 58 } 59 /******************************************************************************/ 60 /******************************************************************************/ 61 void VMutex::enter(ULONG timeout, HMTX *phMutex) 62 { 63 APIRET rc; 64 65 if(fShared == VMUTEX_SHARED && phMutex == NULL) { 66 DebugInt3(); 67 return; 68 } 69 if(sem_handle) { 70 if(fShared == VMUTEX_SHARED && *phMutex == 0) { 71 //must open the shared semaphore first (other process created it) 72 *phMutex = sem_handle; 73 rc = DosOpenMutexSem(NULL, phMutex); 74 if(rc) { 75 DebugInt3(); 76 } 77 } 78 waiting++; 79 rc = DosRequestMutexSem((fShared == VMUTEX_SHARED) ? *phMutex : sem_handle, timeout); 80 waiting--; 81 } 82 } 83 /******************************************************************************/ 84 /******************************************************************************/ 85 void VMutex::leave(HMTX *phMutex) 86 { 87 if((fShared == VMUTEX_SHARED && phMutex == NULL) || 88 (fShared == VMUTEX_SHARED && *phMutex == 0)) { 89 DebugInt3(); 90 //should always call enter first... 91 return; 92 } 93 DosReleaseMutexSem((fShared == VMUTEX_SHARED) ? *phMutex : sem_handle); 39 DosDeleteCriticalSection(&critsect); 94 40 } 95 41 /******************************************************************************/
Note:
See TracChangeset
for help on using the changeset viewer.