1
1
forked from 0ad/0ad
Commit Graph

59 Commits

Author SHA1 Message Date
8c068aab07 Removes possibility to link lowlevel library dynamically.
Tested By: Langbart
Differential Revision: https://code.wildfiregames.com/D4470
This was SVN commit r26281.
2022-01-31 06:53:30 +00:00
43137fef3f Make all Wildfire Games copyright headers consistent by always ending with a period and using (C) instead of (c).
Differential Revision: https://code.wildfiregames.com/D716
Refs 09e974e1cb
Reviewed By: bb
Change in agreement with leper.

This was SVN commit r19899.
2017-07-10 14:26:24 +00:00
b18f74da44 Remove trailing whitespace and whitespace in empty lines of source/ except source/third_party/.
This was SVN commit r18987.
2016-11-23 11:18:37 +00:00
3537ae31d5 sync with work:
x86_x64: update MSR definitions to include model 2F (westmere ex);
update bus clock computation for sandy bridge; remove unused
cpu_Serialize; use namespace, add model names
mahaf: cope with stricter security for services/drivers
ApicId -> GetApicId, move to apic module
aken: add batch file to install driver (optional)

This was SVN commit r10815.
2011-12-27 14:12:31 +00:00
0d23e3f333 post-alpha sync with work.
debug stack trace fixes, remove more asm, change CONTINUE/OK scheme to
OK/ALL_COMPLETE, fix tests

This was SVN commit r9871.
2011-07-18 09:21:56 +00:00
cccd6849a7 cleanup (requires update-workspaces)
lib_errors.cpp: replace with status.cpp, adapt to needs at work
wutil: fix runtime warning reported via feedback box
config: merge CONFIG_PARANOIA and !CONFIG_FINAL into
CONFIG_ENABLE_CHECKS
add openmp, pointer_typedefs.h

This was SVN commit r9410.
2011-05-03 12:38:42 +00:00
002e3f5606 minor fixes from work; also add sys_WideFromArgv
This was SVN commit r8856.
2011-01-04 19:53:38 +00:00
383cf7b220 cleanup:
use intrinsics for cpu_AtomicAdd and cpu_CAS, get rid of the
corresponding assembly implementations. (wrapper functions are necessary
at work because mere declarations aren't enough to export the functions
from DLL)
also remove no longer needed fminf

This was SVN commit r8521.
2010-11-02 13:38:56 +00:00
52851faeb6 cleanup - remove old cpu_memcpy and cpu_i64FromDouble that are no longer needed
This was SVN commit r8517.
2010-11-01 11:09:03 +00:00
657ec9aa45 WIP timer thread safety:
CAS functions now implemented directly in external asm files (avoids
wrapper functions)
reinstated cpu_CAS64 (checking ARCH_IA32 at every call site is onerous)
(temporarily disable timer monotonicity check)

This was SVN commit r8515.
2010-11-01 09:54:03 +00:00
0c3d69ae29 fixes from work: clarify that cpu_MemoryBarrier has no runtime cost by renaming to COMPILER_FENCE and moving to code_annotation.h; fix 32-bit Parallel Studio 2011 warning.
This was SVN commit r8486.
2010-10-29 12:54:51 +00:00
f5f65c23c0 OSX compat: remove cpu_CAS64 wrapper, since intptr_t and i64 apparently aren't compatible types. IA-32 code should call ia32_asm_CAS64 if it wants to CAS 64-bit values.
This was SVN commit r8080.
2010-09-05 15:38:34 +00:00
8ab70776a5 fix: cpu_CAS64 should use i64 for compatibility with 64-bit CAS
This was SVN commit r7786.
2010-07-22 18:57:36 +00:00
aa44bac652 from work: add thread-safe timer; add CAS64 (required for thread-safe timer); remove topology init requirements, no longer cache results (simplifies GroupPolicy_PerCache); add scoped affinitizer; whrt: fix race condition reported by parallel inspector. also refactor cache and TLB detection.
This was SVN commit r7785.
2010-07-22 16:17:33 +00:00
12568b0229 further fixes from work (where i've finally managed to (temporarily) sign the Aken driver)
in particular, remove two hindrances to displaying the error dialog
during early init.

This was SVN commit r7754.
2010-07-14 12:23:53 +00:00
c634a62f4c from work: cpu_AtomicAdd - return previous value (required for atomic test&set)
numa: move allocator into higher-level VirtualMemory module, since
VirtualAllocExNuma requires Server 2008 and the workaround doesn't
require numa support

This was SVN commit r7753.
2010-07-14 08:52:20 +00:00
ee72115b7a Fix Linux compile error
This was SVN commit r7743.
2010-07-12 22:14:28 +00:00
98770fa4cc # fix race conditions in ModuleInit and related cleanup.
CAS: uintptr_t->intptr_t to allow use of both cpu_CAS and cpu_AtomicAdd
topology: remove non-thread safe caching, expose ApicIds, use ModuleInit
x86_x64: use ModuleInit instead of unsafe static flags; zero-init regs
instead of just setting ecx
ModuleInitState now holds the LibError returned by the init callback (so
that the second init doesn't appear to succeed despite the first
failing)
wnuma: cleanup, add ACPI SLIT relative distance detection

This was SVN commit r7741.
2010-07-12 12:57:58 +00:00
c2fd939898 license change to the more permissible Expat/MIT license for lib/ (see forum thread)
This was SVN commit r7316.
2010-02-08 16:23:39 +00:00
7738eecbb0 icc build fix
This was SVN commit r7204.
2009-11-16 23:45:56 +00:00
44066f5ae4 GCC build fix
This was SVN commit r7191.
2009-11-12 19:35:28 +00:00
7a6109f474 debug_SkipNextError changed to debug_SkipErrors (allow skipping multiple instances of the same error code until the next debug_StopSkippingErrors, which returns the number that were skipped)
also:
- add listing of error codes to avoid collisions
- cpu: add cpu_MemoryBarrier
- wchar: warn whenever a character is replaced/invalid bytes are
encountered

This was SVN commit r7189.
2009-11-10 15:48:41 +00:00
1743645fd3 Simplify the overly-complex CppDoc-breaking file headers
This was SVN commit r6832.
2009-04-18 17:51:05 +00:00
214b0e6683 Removed outdated licensing information
This was SVN commit r6831.
2009-04-18 17:17:34 +00:00
c9fa7f13d9 Add GPL header
This was SVN commit r6830.
2009-04-18 17:00:33 +00:00
e14d5be529 timing-related fix (only occurs with certain timer resolutions due to incorrect arithmetic)
frequency_filter wasn't dealing correctly with resolution = 0
.. which was happening due to incorrect cpu_i64FromDouble macros

This was SVN commit r6200.
2008-07-05 08:27:33 +00:00
0994b71316 fixes
bits: avoid warning, document ceil_log2 corner case
cpu, x86_x64: remove unused cpu_MemoryFence
wdbg_heap: avoid warning
test_bits: fix incorrect test values
TerrainOverlay: fix use of struct vs. class, correct unintended
search&destroy of intended->ssize_tended (LOL)

This was SVN commit r6119.
2008-06-26 20:12:42 +00:00
04127c7af3 fixes/improvements to lib code from work
- topology.cpp: modify interface due to thread-safety issue. caller is
now responsible for ensuring the first _Detect call isn't reentered;
everything else is safe.
- fix thread-safety issue in wnuma; use winit mechanism to ensure it's
ready before use
- VFS now takes a cacheSize parameter (required for being able to
disable read-only file caches for the image loader at work)
- allow dynarray that isn't actually holding memory
- debug_stl: VC9 fix (disable this code except on the exact STL version
on which it was tested)
- zlib, lib_api: changes to macro used to toggle between static and
dynamic linking
- add boost filesystem header in external_libraries
- amd64: cpu_ topology functions are now provided by x86_x64
- cpu: remove cpu_ClockFrequency (dangerous, may be tempting to use
during WHRT init which would cause a crash). use x86_x64_ClockFrequency
or os_cpu_ClockFrequency instead.
- werrno: cope with newer boost versions
- wmman: follow SUSv3 in rejecting zero-length mappings

This was SVN commit r5954.
2008-05-13 19:43:02 +00:00
ffdff6888d add NUMA and shared-L2-cache detect code (required at work)
enable most of IA-32 specific code to be used in amd64 (resides in
directory lib/sysdep/x86_x64)

bits: add IsBitSet
remove mem_PageSize (use os_cpu_PageSize instead)
cpuid: change interface to allow gracefully supporting later
subfunctions that require input parameters
amd64_asm.asm: add amd64 implementation of cpuid
cpu: move functions provided by OS to sysdep/os_cpu.cpp
cpu topology: avoid trouble when process affinity is set by remapping
processor numbers to 0..PopulationCount(processAffinity)
topology.cpp: move ex-ia32 topology code here.

This was SVN commit r5945.
2008-05-12 18:15:08 +00:00
c0ed950657 had to remove uint and ulong from lib/types.h due to conflict with other library.
this snowballed into a massive search+destroy of the hodgepodge of
mostly equivalent types we had in use (int, uint, unsigned, unsigned
int, i32, u32, ulong, uintN).

it is more efficient to use 64-bit types in 64-bit mode, so the
preferred default is size_t (for anything remotely resembling a size or
index). tile coordinates are ssize_t to allow more efficient conversion
to/from floating point. flags are int because we almost never need more
than 15 distinct bits, bit test/set is not slower and int is fastest to
type. finally, some data that is pretty much directly passed to OpenGL
is now typed accordingly.

after several hours, the code now requires fewer casts and less
guesswork.

other changes:
- unit and player IDs now have an "invalid id" constant in the
respective class to avoid casting and -1
- fix some endian/64-bit bugs in the map (un)packing. added a
convenience function to write/read a size_t.
- ia32: change CPUID interface to allow passing in ecx (required for
cache topology detection, which I need at work). remove some unneeded
functions from asm, replace with intrinsics where possible.

This was SVN commit r5942.
2008-05-11 18:48:32 +00:00
cc243f67eb fixes/improvements made at work:
- fix lots of 64-bit warnings
- round_up/down now templates
- avoid warning with definition of byte swap functions; remove
duplication of that in wsdl
- codec_zlib.cpp: avoid domination warning
- vfs/file_cache: VFS is now responsible for handling zero-length files
(no longer considered an error; just returns zero pointer and size=0)
- cpu: export all functions (thus obviating cpu_memcpy_thunk). this
required renaming asm functions and adding thunk functions that call
them
- winit: fix segment merge statement, reinstate /include (otherwise init
functions are stripped by linker)
- wstartup: VC CRT init section definitions have changed in amd64 build;
match their definition
- wsysdep.cpp: more descriptive text for osError = 0

This was SVN commit r5899.
2008-05-01 15:41:42 +00:00
a915bdc1b6 fix problems related to 64-bit compilation in lib
. dbghelp is now pulled in by a separate external_libraries header
. disable _SECURE_SCL (improves perf)
. amd64: initial implementation of essential functions, not yet complete
. manifest: disabled on ICC because its IPO module incorrectly
interprets /manifestdependency
. wdbg_sym: no longer support stack walks on non-ia32 win2k (avoids
trouble due to mixing SEH and dtors)
. winit and wstartup: had to remove forced symbol include - does not
link otherwise on ICC (for reasons unknown). function pointers are
actually included and called on x64 windows (compiling with MSC)

This was SVN commit r5895.
2008-04-19 18:10:00 +00:00
1aa514a6ef fix (i.e. remove) mahaf warnings when running on least-permission account or when running multiple game instances
cpu, timer: fixes for when using lib code from DLL (required for work)

This was SVN commit r5787.
2008-03-24 15:44:37 +00:00
2e5d9452aa part2: misc source/lib fixes/improvements
move all except user-specified config choices out of config.h and into
appropriate headers
CPU_IA32 -> ARCH_IA32
wsdl: disable use of ddraw (will soon be replaced by WMI)

use shared_ptr without namespace qualifier (it's in tr1)
debug_warn -> debug_assert(0)
LIB_API to allow building as DLL
smart pointers: reduce use of .get()
cache_adt: use map instead of hash_map (avoids needing a hashCompare
class). also remove spurious warning
code_annotation.h: better cassert implementation
move FPS measuring portion of timer.cpp into frequency_filter
move include of memory headers into mmgr.h (to avoid errors, we must
ensure they are included if mmgr is used)
posix_filesystem.h: move definition of mkdir to wfilesystem
stl: disable iterator checks in release mode
wmi: fix COM init bug, use smart pointers
wutil: add code to get DLL module handle (if compiled as such), add
WinScopedLock
timer: fix handling of raw ticks

This was SVN commit r5517.
2007-12-20 20:09:19 +00:00
7a5655edde # major refactoring of system-dependent code (simplifies build system)
cpu.cpp: avoided the need for wrapper functions by calling the
OS-specific function directly (declared in central header, implemented
in the platform's cpp file)

avoid the need for init in cpu and ia32 via if(!init) Init() pattern.

optimized memcpy now requires SSE support

remove error-prone CAS macro; replace with cpu_CAS
config: no longer require inline asm for float->int conversions
lib_error: remove special-case in CHECK_ERR for windows (no longer
needed)

This was SVN commit r5365.
2007-09-23 15:36:29 +00:00
b776e58c67 use (newly added) cpu_PageSize instead of sysconf (avoids a critical order dependency on windows)
refactored sysdep code:
- avoid many #if OS_xxx.
- remove bsd.cpp, merge its contents with osx
- move linux-specific parts of unix/ into linux/

This was SVN commit r5363.
2007-09-23 08:05:38 +00:00
84e4e5aa12 POSIX doesn't really specify _SC_NPROCESSORS_CONF, so add a sysdep routine for that. ia32 now uses it, which is one more step towards unbreaking macosx. thanks to ali for the report :)
This was SVN commit r5300.
2007-08-25 16:32:00 +00:00
5919fc7877 fixes, documentation and cleanup.
. allocators: add static_calloc. also: documention was duplicated in
header; merge it.
. wdir_watch: fix last remaining static object init issues
. add rationale and explanations to lib_errors, wsdl, qpc, whrt.
. cpu/ia32: remove throttling detection (hacky); will be taken care of
by tsc.
. ia32: expose vendor
. wdbg_sym: add its own critical section (safer, less contention)

This was SVN commit r5114.
2007-05-29 16:28:34 +00:00
c45ef68a88 add work-in-progress WHRT (win high res timer). works well enough, but calibration is not yet complete nor is TSC usable.
cpu: accessor functions ensure what they return is valid. no longer
needs to call wtime_reset_impl (ugh). uses ModuleInitState.
ia32: add APIC ID accessor and prevent redundant init

This was SVN commit r5093.
2007-05-26 16:57:39 +00:00
cded0936c5 # housekeeping
. update moduleInit mechanism and move it out of lib.cpp. now has a
thread-safe reference count and allows repeated init/shutdown (required
for self-tests)
. vfs now depends on h_mgr; h_mgr need therefore no longer explicitly be
shutdown (e.g. in self-tests)
. acpi: minor fixes
. cpu: AtomicAdd and CAS now take volatile variable (safer)
. mahaf: unload driver on shutdown (did this for DriverVerifier, but
it's 'cleaner' in general)
. wdbg_sym
. wfilesystem: get rid of manual declarations of deprecated functions;
implement them via trampoline instead

This was SVN commit r5086.
2007-05-21 23:24:56 +00:00
160bd14bb0 robustify CPU freq detection and timer code, hopefully solve lockup issue
cpu: cache CPU info to prevent calling freq measurement code several
times
config: mention e.g. fopen_s instead of only the secure string functions
ia32: exception-safe scheduler setting; no longer use absolute max
priority (risky, could hang machine if loop contains a bug)
wtime: add note on TSC safety, slight improvements
timer: try and prevent timer from returning the same value

This was SVN commit r5075.
2007-05-16 15:56:47 +00:00
b755ddefda remove all author/modified by tags.
make include guards consistent.

This was SVN commit r5040.
2007-05-07 16:33:24 +00:00
73683b6109 # SwEng
. the massive renaming undertaking: camelCase functions -> PascalCase.
. add some cppdoc.
. minor additional renaming improvements: e.g. GetIsClosed -> IsClosed
. in entity code, replace constructs like "pvec = new vector; return
pvec; use *pvec; delete pvec" with a simple stack variable passed as
output parameter (avoid unnecessary dynamic allocs)
. timer: simpler handling of raw ticks vs normal timer (less #if)

This was SVN commit r5017.
2007-05-02 12:07:08 +00:00
5a427440d0 #SwEng
fpclassify fix
EntityManager: rename getExtant -> GetExtantAsHandles, fix its
implementation+call site to avoid dynamic alloc/auto ptr, rename extant
-> IsExtant
vsnprintf2 -> sys_vsnprintf. remove printf.h (function is declared in
sysdep header)
use SUS/posix-ish strcasecmp instead of defining that to the
windows-only stricmp
add cppdoc for ia32/cpu

This was SVN commit r5011.
2007-04-30 19:58:04 +00:00
be3f3bdbfb # SwEng / MacOSX compat
further cleanup to sysdep.h: avoid pulling in win and ia32; split header
up into stl, compiler, and the actual sys_* API. (all but the latter are
in PCH).

timer: also avoid dragging in ia32
win: move snprintf fix to posix.h
cpu: simplify reasoning about cores, now given as logicalPerCore (not
package)
vfs_optimizer: fix if archive building is partially disabled

This was SVN commit r5008.
2007-04-30 14:35:19 +00:00
623e649acb # big refactoring in CPU-specific code, fix for dual core vs. HT detection
all cpu-related stuff is now defined in cpu.h (with cpu_ prefix and
fully encapsulated). fix quite brittle core/HT unit/package detection.
implement mkdir on VC8, where it is deprecated
add strdup on MacOSX
move ia32 code into separate subdir. functions implemented in asm are
called ia32_asm_*.
add some unix versions of sysdep functions (cannot test them)
timer: fix for amd64 linux

This was SVN commit r4995.
2007-04-25 18:19:35 +00:00
871cdb6ef9 # SwEng (reduce full recompiles by splitting up master error header)
- error codes now accessed as ERR::NO_MEM, INFO::OK etc.
- no more X-macros => the above are now recognized by visual assist
- error codes are defined by the module originating them (lib_errors has
some generic ones)
  => no full rebuild when adding some
- error descriptions are now in C++ files => can be changed without full
rebuild

added AT_STARTUP in lib.h.

This was SVN commit r4374.
2006-09-22 13:19:40 +00:00
3d26549032 Fixed file properties - removed svn:executable and svn:keywords (left over from CVS conversion?) from all files; set svn:eol-style=native for *.cpp, *.h (and fixed files with inconsistent line endings)
This was SVN commit r3802.
2006-04-23 23:14:18 +00:00
836cd08d5e # add CppDoc file header to all files, along with their descriptions.
also:
- renamed wdll to delay_load, and wdll_ver to dll_ver
- removed empty wcpu

This was SVN commit r3751.
2006-04-11 23:59:08 +00:00
34637ba5dc # refactor sysdep API, split it into parts
- split up detect.cpp into snd, cpu, gfx (headers were already split)
- rename detect functions for more clarity (e.g. get_cur_vmode ->
gfx_get_video_mode)
- rename lib/res/sound/snd to snd_mgr to avoid conflict with
sysdep/snd.cpp
- waio: set errno in aio_rw (addresses bug #73)

This was SVN commit r3745.
2006-04-10 20:12:25 +00:00