um_body.append(' SEND_ENTRYPOINT_PARAMS("xglUnmapMemory(mem %p)\\n", mem);')
um_body.append(' // insert into packet the data that was written by CPU between the xglMapMemory call and here')
um_body.append(' // Note must do this prior to the real xglUnMap() or else may get a FAULT')
- um_body.append(' entry = find_mem_info_entry_lock(mem);')
+ um_body.append(' glv_enter_critical_section(&g_memInfoLock);')
+ um_body.append(' entry = find_mem_info_entry(mem);')
um_body.append(' CREATE_TRACE_PACKET(xglUnmapMemory, (entry) ? entry->size : 0);')
um_body.append(' pPacket = interpret_body_as_xglUnmapMemory(pHeader);')
um_body.append(' if (entry)')
um_body.append(' {')
um_body.append(' glv_LogError("Failed to copy app memory into trace packet (idx = %u) on xglUnmapMemory\\n", pHeader->global_packet_index);')
um_body.append(' }')
+ um_body.append(' glv_leave_critical_section(&g_memInfoLock);')
um_body.append(' result = real_xglUnmapMemory(mem);')
um_body.append(' pPacket->mem = mem;')
um_body.append(' pPacket->result = result;')