0.9.3.66:
[sbcl.git] / src / runtime / x86-linux-os.c
index 336dc5b..5b55fdc 100644 (file)
@@ -40,7 +40,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <asm/ldt.h>
-#include <linux/unistd.h>
+#include <sys/syscall.h>
 #include <sys/mman.h>
 #include <linux/version.h>
 #include "thread.h"             /* dynamic_values_bytes */
 #define user_desc  modify_ldt_ldt_s
 #endif
 
-_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount );
+#define modify_ldt sbcl_modify_ldt
+static inline int modify_ldt (int func, void *ptr, unsigned long bytecount)
+{
+  return syscall (SYS_modify_ldt, func, ptr, bytecount);
+}
 
 #include "validate.h"
 size_t os_vm_page_size;
@@ -94,7 +98,7 @@ int arch_os_thread_init(struct thread *thread) {
     if (modify_ldt (1, &ldt_entry, sizeof (ldt_entry)) != 0) {
         modify_ldt_lock=0;
         /* modify_ldt call failed: something magical is not happening */
-        return -1;
+        return 0;
     }
     __asm__ __volatile__ ("movw %w0, %%fs" : : "q"
                           ((n << 3) /* selector number */
@@ -113,10 +117,8 @@ int arch_os_thread_init(struct thread *thread) {
     sigstack.ss_sp=((void *) thread)+dynamic_values_bytes;
     sigstack.ss_flags=0;
     sigstack.ss_size = 32*SIGSTKSZ;
-    sigaltstack(&sigstack,0);
-    if(sigaltstack(&sigstack,0)<0) {
+    if(sigaltstack(&sigstack,0)<0)
         lose("Cannot sigaltstack: %s\n",strerror(errno));
-    }
 #endif
     return 1;
 }
@@ -124,7 +126,7 @@ int arch_os_thread_init(struct thread *thread) {
 struct thread *debug_get_fs() {
     register u32 fs;
     __asm__ __volatile__ ("movl %%fs,%0" : "=r" (fs)  : );
-    return fs;
+    return (struct thread *)fs;
 }
 
 /* free any arch/os-specific resources used by thread, which is now
@@ -213,4 +215,3 @@ void
 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
 {
 }
-