diff options
author | Andreas Rumpf <andreas@andi> | 2008-06-22 16:14:11 +0200 |
---|---|---|
committer | Andreas Rumpf <andreas@andi> | 2008-06-22 16:14:11 +0200 |
commit | 405b86068e6a3d39970b9129ceec0a9108464b28 (patch) | |
tree | c0449946f54baae6ea88baf453157ddd7faa8f86 /lib/amd64.asm.in | |
download | Nim-405b86068e6a3d39970b9129ceec0a9108464b28.tar.gz |
Initial import
Diffstat (limited to 'lib/amd64.asm.in')
-rwxr-xr-x | lib/amd64.asm.in | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/amd64.asm.in b/lib/amd64.asm.in new file mode 100755 index 000000000..2c14bf241 --- /dev/null +++ b/lib/amd64.asm.in @@ -0,0 +1,39 @@ +; This contains the CPU-dependant variants of some routines. +; (C) 2005 Andreas Rumpf +; This code was inspired by the Freepascal compiler's sources +; All routines here have the _cdecl calling convention because +; that is the only convention any C compiler supports. + +\python{ +# as usual I use my own preprocessor :-) +import os + +def c(name): + if os.name == 'posix': + return name + else: + return "_" + name + +def arg: + if os.name == 'posix': + return 'rdi' + else: + return 'rcx' # on win64 uses its own calling convention; this sucks! +} + +segment code + +global \c{cpu_inc_locked} +global \c{cpu_dec_locked} + +\c{cpu_dec_locked}: + lock + dec [\arg] + setz al + ret + +\c{cpu_inc_locked}: + lock + inc [\arg] + setz al + ret |