summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorGordon Willem Klok <gwk@cvs.openbsd.org>2007-11-03 20:58:31 +0000
committerGordon Willem Klok <gwk@cvs.openbsd.org>2007-11-03 20:58:31 +0000
commit5d81872aedf347a92ede87e4ddfe06286f71d510 (patch)
tree9beeaf6718521c0c0b0496984b6aca4cac714190 /sys/arch/amd64
parent172fba44f6ca1e2563d8b9914c4f24aa18b8eca3 (diff)
Add acpi_acquire_global_lock(), and acpi_release_global_lock to
amd64 the not ghetto architecture. ok toby@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/locore.S31
1 files changed, 30 insertions, 1 deletions
diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S
index 7a382441870..c08b504cd86 100644
--- a/sys/arch/amd64/amd64/locore.S
+++ b/sys/arch/amd64/amd64/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.24 2007/10/10 15:53:51 art Exp $ */
+/* $OpenBSD: locore.S,v 1.25 2007/11/03 20:58:30 gwk Exp $ */
/* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */
/*
@@ -115,6 +115,7 @@
#include "lapic.h"
#include "ioapic.h"
#include "ksyms.h"
+#include "acpi.h"
#include <sys/errno.h>
#include <sys/syscall.h>
@@ -1084,3 +1085,31 @@ ENTRY(pagezero)
jne 1b
sfence
ret
+
+#if NACPI > 0
+ENTRY(acpi_acquire_global_lock)
+ movq %rdi, %rcx
+1: movl (%rcx), %eax
+ movl %eax, %edx
+ andl $~1, %edx
+ btsl $1, %edx
+ adcl $0, %edx
+ lock
+ cmpxchgl %edx, (%rcx)
+ jnz 1b
+ andl $3, %edx
+ cmpl $3, %edx
+ sbb %eax, %eax
+ ret
+
+ENTRY(acpi_release_global_lock)
+ movq %rdi, %rcx
+1: movl (%rcx), %eax
+ movl %eax, %edx
+ andl $~3, %edx
+ lock
+ cmpxchgl %edx, (%rcx)
+ jnz 1b
+ andl $1, %eax
+ ret
+#endif