Ticket #3345: 0ad-arm64-v2.patch

File 0ad-arm64-v2.patch, 4.8 KB (added by Martin Michlmayr, 9 years ago)

ARM64 support - version 2

  • build/premake/premake4.lua

     
    8686            arch = "x86"
    8787        elseif string.find(machine, "arm") == 1 then
    8888            arch = "arm"
     89        elseif string.find(machine, "aarch64") == 1 then
     90            arch = "aarch64"
    8991        else
    9092            print("WARNING: Cannot determine architecture from GCC, assuming x86")
    9193        end
     
    828830        table.insert(source_dirs, "lib/sysdep/arch/x86_x64");
    829831    elseif arch == "arm" then
    830832        table.insert(source_dirs, "lib/sysdep/arch/arm");
     833    elseif arch == "aarch64" then
     834        table.insert(source_dirs, "lib/sysdep/arch/aarch64");
    831835    end
    832836
    833837    -- OS-specific
  • source/lib/byte_order.h

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    3333#ifndef BYTE_ORDER
    3434# define LITTLE_ENDIAN 0x4321
    3535# define BIG_ENDIAN    0x1234
    36 # if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_MIPS || defined(__LITTLE_ENDIAN__)
     36# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || defined(__LITTLE_ENDIAN__)
    3737#  define BYTE_ORDER LITTLE_ENDIAN
    3838# else
    3939#  define BYTE_ORDER BIG_ENDIAN
  • source/lib/sysdep/arch/aarch64/aarch64.cpp

     
     1/* Copyright (c) 2012 Wildfire Games
     2 *
     3 * Permission is hereby granted, free of charge, to any person obtaining
     4 * a copy of this software and associated documentation files (the
     5 * "Software"), to deal in the Software without restriction, including
     6 * without limitation the rights to use, copy, modify, merge, publish,
     7 * distribute, sublicense, and/or sell copies of the Software, and to
     8 * permit persons to whom the Software is furnished to do so, subject to
     9 * the following conditions:
     10 *
     11 * The above copyright notice and this permission notice shall be included
     12 * in all copies or substantial portions of the Software.
     13 *
     14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
     18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     21 */
     22
     23/*
     24 * routines specific to ARM64
     25 */
     26
     27#include "precompiled.h"
     28
     29#include "lib/sysdep/cpu.h"
     30
     31intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
     32{
     33    return __sync_fetch_and_add(location, increment);
     34}
     35
     36bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue)
     37{
     38    return __sync_bool_compare_and_swap(location, expected, newValue);
     39}
     40
     41bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue)
     42{
     43    return __sync_bool_compare_and_swap(location, expected, newValue);
     44}
     45
     46const char* cpu_IdentifierString()
     47{
     48    return "unknown"; // TODO
     49}
  • source/lib/sysdep/arch.h

     
    5858#else
    5959# define ARCH_ARM 0
    6060#endif
     61// .. AArch64 (ARM64)
     62#if defined(__aarch64__)
     63# define ARCH_AARCH64 1
     64#else
     65# define ARCH_AARCH64 0
     66#endif
    6167// .. MIPS
    6268#if defined(__MIPS__) || defined(__mips__) || defined(__mips)
    6369# define ARCH_MIPS 1
     
    6672#endif
    6773
    6874// ensure exactly one architecture has been detected
    69 #if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_MIPS) != 1
     75#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS) != 1
    7076# error "architecture not correctly detected (either none or multiple ARCH_* defined)"
    7177#endif
    7278
  • source/ps/GameSetup/HWDetect.cpp

     
    223223    scriptInterface.SetProperty(settings, "arch_ia32", ARCH_IA32);
    224224    scriptInterface.SetProperty(settings, "arch_amd64", ARCH_AMD64);
    225225    scriptInterface.SetProperty(settings, "arch_arm", ARCH_ARM);
     226    scriptInterface.SetProperty(settings, "arch_aarch64", ARCH_AARCH64);
    226227
    227228#ifdef NDEBUG
    228229    scriptInterface.SetProperty(settings, "build_debug", 0);