refactor include_asm (#201)

This commit is contained in:
Ethan Roseman 2021-03-10 02:10:12 +09:00 committed by GitHub
parent b7a2673672
commit a923a3f1b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 12 deletions

19
include/include_asm.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef __INCLUDE_ASM_H__
#define __INCLUDE_ASM_H__
#define STRINGIFY_(x) #x
#define STRINGIFY(x) STRINGIFY_(x)
#if !defined(SPLAT) && !defined(__CTX__)
#ifndef INCLUDE_ASM
#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...) \
TYPE NAME(ARGS); \
TYPE __attribute__((naked)) NAME(ARGS) { __asm__( ".include \"ver/"STRINGIFY(VERSION)"/asm/nonmatchings/"FOLDER"/"#NAME".s\"\n.set reorder\n.set at"); }
#endif
__asm__( ".include \"include/macro.inc\"\n");
#else
#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...)
#endif
#endif

View File

@ -2,18 +2,7 @@
#define _MACROS_H_
#include "common.h"
#define STRINGIFY_(x) #x
#define STRINGIFY(x) STRINGIFY_(x)
#ifndef SPLAT
#ifndef INCLUDE_ASM
#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...) \
TYPE __attribute__((naked)) NAME(ARGS) { __asm__( ".include \"include/macro.inc\"\n.include \"ver/"STRINGIFY(VERSION)"/asm/nonmatchings/"FOLDER"/"#NAME".s\"\n.set reorder\n.set at"); }
#endif
#else
#define INCLUDE_ASM(TYPE, FOLDER, NAME, ARGS...)
#endif
#include "include_asm.h"
#define ALIGN16(val) (((val) + 0xF) & ~0xF)