The atomic and system_time function are now included in the
kernel_os_arch_x86.o file that is genereated by libroot. Removed duplicate implementations from this file. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4337 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -10,93 +10,6 @@
|
|||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/* int32 atomic_add(vint32 *val, int32 incr) */
|
|
||||||
FUNCTION(atomic_add):
|
|
||||||
movl 4(%esp),%edx
|
|
||||||
movl 8(%esp),%eax
|
|
||||||
lock
|
|
||||||
xaddl %eax,(%edx)
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* int32 atomic_and(vint32 *val, int32 incr) */
|
|
||||||
FUNCTION(atomic_and):
|
|
||||||
movl 4(%esp),%edx
|
|
||||||
|
|
||||||
_atomic_and1:
|
|
||||||
movl 8(%esp),%ecx
|
|
||||||
movl (%edx),%eax
|
|
||||||
andl %eax,%ecx
|
|
||||||
|
|
||||||
lock
|
|
||||||
cmpxchgl %ecx,(%edx)
|
|
||||||
|
|
||||||
jnz _atomic_and1
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* int32 atomic_or(vint32 *val, int32 incr) */
|
|
||||||
FUNCTION(atomic_or):
|
|
||||||
movl 4(%esp),%edx
|
|
||||||
|
|
||||||
_atomic_or1:
|
|
||||||
movl 8(%esp),%ecx
|
|
||||||
movl (%edx),%eax
|
|
||||||
orl %eax,%ecx
|
|
||||||
|
|
||||||
lock
|
|
||||||
cmpxchgl %ecx,(%edx)
|
|
||||||
|
|
||||||
jnz _atomic_or1
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* int32 atomic_set(vint32 *val, int32 set_to) */
|
|
||||||
FUNCTION(atomic_set):
|
|
||||||
movl 4(%esp),%edx
|
|
||||||
movl 8(%esp),%eax
|
|
||||||
xchg %eax,(%edx)
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* int32 test_and_set(vint32 *val, int32 set_to, int32 test_val) */
|
|
||||||
FUNCTION(test_and_set):
|
|
||||||
movl 4(%esp),%edx
|
|
||||||
movl 8(%esp),%ecx
|
|
||||||
movl 12(%esp),%eax
|
|
||||||
|
|
||||||
lock
|
|
||||||
cmpxchgl %ecx,(%edx)
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* saves the conversion factor needed for system_time */
|
|
||||||
.global cv_factor
|
|
||||||
cv_factor:
|
|
||||||
.word 0
|
|
||||||
|
|
||||||
FUNCTION(setup_system_time):
|
|
||||||
movl 4(%esp),%eax
|
|
||||||
movl %eax,cv_factor
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* uint64 system_time(); */
|
|
||||||
FUNCTION(system_time):
|
|
||||||
/* load 64-bit factor into %eax (low), %edx (high) */
|
|
||||||
rdtsc /* time in %edx,%eax */
|
|
||||||
|
|
||||||
pushl %ebx
|
|
||||||
movl cv_factor, %ebx
|
|
||||||
movl %edx, %ecx /* save high half */
|
|
||||||
mull %ebx /* truncate %eax, but keep %edx */
|
|
||||||
movl %ecx, %eax
|
|
||||||
movl %edx, %ecx /* save high half of low */
|
|
||||||
mull %ebx /*, %eax*/
|
|
||||||
/* now compute [%edx, %eax] + [%ecx], propagating carry */
|
|
||||||
subl %ebx, %ebx /* need zero to propagate carry */
|
|
||||||
addl %ecx, %eax
|
|
||||||
adc %ebx, %edx
|
|
||||||
popl %ebx
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* void arch_cpu_global_TLB_invalidate(); */
|
/* void arch_cpu_global_TLB_invalidate(); */
|
||||||
FUNCTION(arch_cpu_global_TLB_invalidate):
|
FUNCTION(arch_cpu_global_TLB_invalidate):
|
||||||
movl %cr3,%eax
|
movl %cr3,%eax
|
||||||
|
|||||||
Reference in New Issue
Block a user