libbarrelfish: merging arch specific hearders for k1om and x86_64
authorReto Achermann <reto.achermann@inf.ethz.ch>
Thu, 18 Jun 2015 16:50:29 +0000 (18:50 +0200)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Fri, 19 Jun 2015 10:09:30 +0000 (12:09 +0200)
Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

lib/barrelfish/Hakefile
lib/barrelfish/arch/x86_64/ldt.c
lib/barrelfish/include/arch/k1om/arch/fpu.h [deleted file]
lib/barrelfish/include/arch/k1om/arch/ldt.h [deleted file]
lib/barrelfish/include/arch/k1om/arch/registers.h [deleted file]
lib/barrelfish/include/arch/k1om/arch/threads.h [deleted file]
lib/barrelfish/include/target/k1om/registers_target.h [deleted file]

index 8959d52..e791bd5 100644 (file)
@@ -94,6 +94,9 @@
       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
       arch_assembly "armv7-m" = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
       arch_assembly _         = []
+      
+      arch_include "k1om"     = "include/arch/x86_64" 
+      arch_include _          = ""
 
   in
     build library { target = "barrelfish",
                                               ("spawn", ["rpcclient"]),
                                               ("arrakis", ["rpcclient"])],
                     addCFlags = [ "-DMORECORE_PAGESIZE="++(morecore_pagesize arch) ],
-                    addIncludes = [ "include", "include" ./. arch_dir ],
+                    addIncludes = [ "include", "include" ./. arch_dir, (arch_include arch) ],
                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
                   }
  ) | arch <- allArchitectures ] ++
       arch_assembly "x86_64"  = [ "arch/x86_64/entry.S" ]
       arch_assembly "arm"     = [ "arch/arm/entry.S", "arch/arm/syscall.S" ]
       arch_assembly _         = []
+      
+      arch_include "k1om"     = "include/arch/x86_64" 
+      arch_include _          =  ""
 
   in
     build library { target = "arrakis",
                                               ("octopus", ["rpcclient"]),
                                               ("spawn", ["rpcclient"]),
                                               ("arrakis", ["rpcclient"])],
-                    addIncludes = [ "include", "include" ./. arch_dir ],
+                    addIncludes = [ "include", "include" ./. arch_dir, (arch_include arch) ],
                     addGeneratedDependencies = [ "/include/asmoffsets.h" ]
                   }
  ) | arch <- allArchitectures ]
index b31f882..cda6b41 100644 (file)
 #include <barrelfish/syscalls.h>
 #include <barrelfish/ldt.h>
 #include <arch/ldt.h>
-#ifdef __k1om__
-#include <target/k1om/barrelfish_kpi/cpu_target.h> // segment_descriptor
-#else
 #include <target/x86_64/barrelfish_kpi/cpu_target.h> // segment_descriptor
-#endif
 #include <barrelfish_kpi/cpu_arch.h> // segment_descriptor
 #include <stdio.h>
 #include <string.h>
diff --git a/lib/barrelfish/include/arch/k1om/arch/fpu.h b/lib/barrelfish/include/arch/k1om/arch/fpu.h
deleted file mode 100644 (file)
index a586bd8..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * \file
- * \brief FPU accessor functions.
- */
-
-/*
- * Copyright (c) 2010, 2011, ETH Zurich.
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached LICENSE file.
- * If you do not find this file, copies can be found by writing to:
- * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
- */
-
-#ifndef X86_64_FPU_H
-#define X86_64_FPU_H
-
-/// Exception number for FPU (device) not available
-#define FPU_UNAVAILABLE_TRAP    7
-
-static inline void fpu_copy(struct registers_fpu_x86_64 *dst,
-                            struct registers_fpu_x86_64 *src)
-{
-    // XXX: Round to next 16-byte boundary
-    uint8_t *dregs = dst->registers, *sregs = src->registers;
-    dregs += 16 - ((uintptr_t)dregs % 16);
-    sregs += 16 - ((uintptr_t)sregs % 16);
-
-    memcpy(dregs, sregs, 512);
-}
-
-#endif
diff --git a/lib/barrelfish/include/arch/k1om/arch/ldt.h b/lib/barrelfish/include/arch/k1om/arch/ldt.h
deleted file mode 100644 (file)
index b793b31..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * \file
- * \brief Local descriptor table (LDT) management
- */
-
-/*
- * Copyright (c) 2011, ETH Zurich.
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached LICENSE file.
- * If you do not find this file, copies can be found by writing to:
- * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
- */
-
-#ifndef LIBBARRELFISH_ARCH_LDT_H
-#define LIBBARRELFISH_ARCH_LDT_H
-
-#include <barrelfish/ldt.h>
-
-void ldt_init_disabled(dispatcher_handle_t handle);
-errval_t ldt_alloc_segment_disabled(dispatcher_handle_t handle, void *segbase,
-                                    uint16_t *ret_selector);
-errval_t ldt_free_segment_ondisp(dispatcher_handle_t handle, uint16_t selector);
-
-#endif // LIBBARRELFISH_ARCH_LDT_H
diff --git a/lib/barrelfish/include/arch/k1om/arch/registers.h b/lib/barrelfish/include/arch/k1om/arch/registers.h
deleted file mode 100644 (file)
index 0c63897..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * \file
- * \brief Arch independent accessor functions for use in generic code.
- * Generic include for userland
- */
-
-/*
- * Copyright (c) 2010, ETH Zurich.
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached LICENSE file.
- * If you do not find this file, copies can be found by writing to:
- * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
- */
-
-#ifndef ARCH_X86_64_BARRELFISH_REGISTERS_H
-#define ARCH_X86_64_BARRELFISH_REGISTERS_H
-
-#include <barrelfish_kpi/registers_arch.h>
-#include <target/k1om/registers_target.h>
-
-static inline void
-registers_set_initial(arch_registers_state_t *regs, struct thread *thread,
-                      lvaddr_t entry, lvaddr_t stack, uint64_t arg1,
-                      uint64_t arg2, uint64_t arg3, uint64_t arg4)
-{
-    registers_x86_64_set_initial(regs, thread, entry, stack, arg1, arg2, arg3, arg4);
-}
-
-#endif // ARCH_X86_64_BARRELFISH_REGISTERS_H
diff --git a/lib/barrelfish/include/arch/k1om/arch/threads.h b/lib/barrelfish/include/arch/k1om/arch/threads.h
deleted file mode 100644 (file)
index 874b516..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * \file
- * \brief Threads architecture-specific code
- */
-
-/*
- * Copyright (c) 2007, 2008, 2009, 2010, ETH Zurich.
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached LICENSE file.
- * If you do not find this file, copies can be found by writing to:
- * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
- */
-
-#ifndef LIBBARRELFISH_ARCH_THREADS_H
-#define LIBBARRELFISH_ARCH_THREADS_H
-
-#include <barrelfish/syscall_arch.h>
-
-/* this is a label defined in the assembler code that implements cap_invoke() */
-extern void barrelfish_cap_invoke_post_syscall_instr(void);
-extern void barrelfish_lrpc_post_syscall_instr(void);
-
-#if 0 // Using the old format of dispatcher_frame and not called by anyone -akhi
-/**
- * Returns true iff the thread with the given save area has successfully
- * performed a syscall. Used for the thread_invoke_cap_and_exit() hack.
- */
-static inline bool thread_check_syscall_succeeded(uintptr_t *save_area)
-{
-    return ((save_area[RIP_REG] == (lvaddr_t)barrelfish_cap_invoke_post_syscall_instr
-             || save_area[RIP_REG] == (lvaddr_t)barrelfish_lrpc_post_syscall_instr)
-            && save_area[RAX_REG] == 0);
-}
-#endif
-
-/**
- * \brief Enable FPU trap.
- */
-static inline void fpu_trap_on(void)
-{
-    errval_t err = sys_x86_fpu_trap_on();
-    assert_disabled(err_is_ok(err));
-}
-
-#endif // LIBBARRELFISH_ARCH_THREADS_H
diff --git a/lib/barrelfish/include/target/k1om/registers_target.h b/lib/barrelfish/include/target/k1om/registers_target.h
deleted file mode 100644 (file)
index b3d598f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * \file
- * \brief Arch specific definition of the registers, can be included by anyone.
- * Definitions only seen in the user.
- */
-
-/*
- * Copyright (c) 2010, 2012, ETH Zurich.
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached LICENSE file.
- * If you do not find this file, copies can be found by writing to:
- * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
- */
-
-#ifndef TARGET_K1OM_BARRELFISH_REGISTERS_H
-#define TARGET_K1OM_BARRELFISH_REGISTERS_H
-
-#include <target/k1om/barrelfish_kpi/registers_target.h>
-#include <target/k1om/barrelfish_kpi/cpu_target.h>
-#include "threads_priv.h"
-
-static inline void
-registers_x86_64_set_initial(struct registers_x86_64 *regs, struct thread *thread,
-                             lvaddr_t entry, lvaddr_t stack, uint64_t arg1,
-                             uint64_t arg2, uint64_t arg3, uint64_t arg4)
-{
-    // XXX: the x86-64 ELF ABI requires that (RSP - 8) be 16-byte aligned. why?!
-    assert((stack % 16) == 0);
-    stack -= sizeof(uintptr_t);
-
-    regs->rip    = entry;
-    regs->rsp    = stack;
-    regs->eflags = USER_EFLAGS;
-    regs->fs     = thread->thread_seg_selector;
-    regs->gs     = 0;
-
-    regs->rdi = arg1;
-    regs->rsi = arg2;
-    regs->rdx = arg3;
-    regs->rcx = arg4;
-}
-
-#endif // TARGET_X86_64_BARRELFISH_REGISTERS_H