Skip to content

Commit 7c575c4

Browse files
Kalamateedeadwood
authored and
deadwood
committed
add riscv to the configure targets. adjust the distfiles-quick to properly support variants, and fix mmakefile's quick targets. addjust headers to support riscv.
1 parent e2a8b7f commit 7c575c4

File tree

16 files changed

+183
-53
lines changed

16 files changed

+183
-53
lines changed

Diff for: arch/all-darwin/boot/mmakefile.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
include $(SRCDIR)/config/aros.cfg
33

44
#MM- distfiles-darwin-$(AROS_TARGET_CPU) : distfiles-system
5-
#MM- distfiles-quick-darwin-$(AROS_TARGET_CPU) : distfiles-system
5+
#MM- distfiles-darwin-$(AROS_TARGET_CPU)-quick : distfiles-system
66

77
#MM- boot-darwin: iconset-$(AROS_TARGET_ICONSET)-icons-aros-darwin-system

Diff for: arch/all-linux/boot/mmakefile.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
include $(SRCDIR)/config/aros.cfg
33

44
#MM- distfiles-linux-$(AROS_TARGET_CPU) : distfiles-system
5-
#MM- distfiles-quick-linux-$(AROS_TARGET_CPU) : distfiles-system
5+
#MM- distfiles-linux-$(AROS_TARGET_CPU)-quick : distfiles-system
66

77
#MM- boot-linux : iconset-$(AROS_TARGET_ICONSET)-icons-aros-linux-system

Diff for: arch/all-mingw32/boot/mmakefile.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include $(SRCDIR)/config/aros.cfg
33

44
#MM- distfiles-mingw32-$(AROS_TARGET_CPU) : distfiles-system
5-
#MM- distfiles-quick-mingw32-$(AROS_TARGET_CPU) : distfiles-system
5+
#MM- distfiles-mingw32-$(AROS_TARGET_CPU)-quick : distfiles-system
66

77
#MM- boot-mingw32: iconset-$(AROS_TARGET_ICONSET)-icons-aros-windows-system
88

Diff for: arch/arm-raspi/boot/mmakefile.src

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ ARM_BSP := aros-$(AROS_TARGET_CPU)-bsp.rom
1818
#MM- distfiles-raspi-arm : distfiles-raspi
1919
#MM- distfiles-raspi-armeb : distfiles-raspi-be
2020

21-
#MM- distfiles-quick-raspi-armhf : distfiles-raspi
22-
#MM- distfiles-quick-raspi-arm : distfiles-raspi
23-
#MM- distfiles-quick-raspi-armeb : distfiles-raspi-be
21+
#MM- distfiles-raspi-armhf-quick : distfiles-raspi
22+
#MM- distfiles-raspi-arm-quick : distfiles-raspi
23+
#MM- distfiles-raspi-armeb-quick : distfiles-raspi-be
2424

2525
#MM- distfiles-raspi-quick : distfiles-raspi
2626

Diff for: arch/i386-pc/mmakefile.src

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
#MM- boot-distfiles-pc-i386 : bootdisk systemdisk
3-
#MM- boot-distfiles-quick-pc-i386 : bootdisk-quick systemdisk-quick
3+
#MM- boot-distfiles-pc-i386-quick : bootdisk-quick systemdisk-quick
44
#MM- distfiles-pc-i386 : bootiso
5-
#MM- distfiles-quick-pc-i386 : bootiso-quick
5+
#MM- distfiles-pc-i386-quick : bootiso-quick

Diff for: arch/m68k-all/include/aros/cpucontext.h

+9
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,13 @@ struct ExceptionContext
1313
IPTR pc;
1414
} __packed;
1515

16+
/* Special hack for setting the 'Z' condition code upon exit
17+
* for m68k architectures.
18+
*/
19+
#define AROS_INTFUNC_INIT inline ULONG _handler(void) {
20+
#define AROS_INTFUNC_EXIT }; register ULONG _res asm ("d0") = _handler(); \
21+
asm volatile ("tst.l %0\n" : : "r" (_res)); \
22+
return _res; /* gcc only generates movem/unlk/rts */ \
23+
AROS_USERFUNC_EXIT }
24+
1625
#endif

Diff for: arch/mmakefile.src

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
include $(SRCDIR)/config/aros.cfg
33

4-
#MM- boot-distfiles : boot-distfiles-$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
5-
#MM- boot-distfiles-quick : boot-distfiles-quick-$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
4+
#MM- boot-distfiles : boot-distfiles-$(AROS_TARGET_PLATFORM)
5+
#MM- boot-distfiles-quick : boot-distfiles-$(AROS_TARGET_PLATFORM)-quick
66

7-
#MM- distfiles : distfiles-$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
8-
#MM- distfiles-quick : distfiles-quick-$(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
7+
#MM- distfiles : distfiles-$(AROS_TARGET_PLATFORM)
8+
#MM- distfiles-quick : distfiles-$(AROS_TARGET_PLATFORM)-quick

Diff for: arch/ppc-sam440/mmakefile.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
include $(SRCDIR)/config/aros.cfg
66

77
#MM- distfiles-sam440-ppc : bootiso
8-
#MM- distfiles-quick-sam440-ppc : bootiso-quick
8+
#MM- distfiles-sam440-ppc-quick : bootiso-quick
99

1010
#MM- AROS-sam440-ppc : kernel-sam440-ppc software-sam440-ppc
1111

Diff for: arch/x86_64-pc/mmakefile.src

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ include $(SRCDIR)/config/aros.cfg
44
#MM- distfiles-pc-x86_64 : \
55
#MM bootiso
66

7-
#MM- distfiles-quick-pc-x86_64 : \
7+
#MM- distfiles-pc-x86_64-quick : \
88
#MM bootiso-quick

Diff for: compiler/include/aros/printertag.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2012, The AROS Development Team. All rights reserved.
2+
* Copyright (C) 2012-2023, The AROS Development Team. All rights reserved.
33
* Author: Jason S. McMullan <[email protected]>
44
*
55
* Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
@@ -23,6 +23,8 @@
2323
#define AROS_PRINTER_MAGIC 0xe12fff1e /* bx lr */
2424
#elif defined(__ppc__)
2525
#define AROS_PRINTER_MAGIC 0x4e800020 /* blr */
26+
#elif defined(__riscv)
27+
#define AROS_PRINTER_MAGIC 0x8082 /* ret */
2628
#else
2729
#error AROS_PRINTER_MAGIC is not defined for your architecture
2830
#endif

Diff for: compiler/include/dos/elf.h

+26-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define DOS_ELF_H
33

44
/*
5-
Copyright (C) 1995-2020, The AROS Development Team. All rights reserved.
5+
Copyright (C) 1995-2023, The AROS Development Team. All rights reserved.
66
$Id$
77
88
Desc: Definition of ELF file structures.
@@ -50,11 +50,20 @@
5050
#define ET_REL 1
5151
#define ET_EXEC 2
5252

53+
#define EM_M32 1
54+
#define EM_SPARC 2
5355
#define EM_386 3
5456
#define EM_68K 4
57+
#define EM_88K 5
58+
#define EM_486 6
59+
#define EM_860 7
60+
#define EM_MIPS 8
5561
#define EM_PPC 20
62+
#define EM_PPC64 21
5663
#define EM_ARM 40
5764
#define EM_X86_64 62 /* AMD x86-64 */
65+
#define EM_AARCH64 183
66+
#define EM_RISCV 243
5867

5968
#define R_386_NONE 0
6069
#define R_386_32 1
@@ -342,6 +351,7 @@ struct attrs_subsection
342351
#define AROS_ELF_REL SHT_RELA
343352
#define relo rela
344353
#else
354+
//consider using EM_486 if AROS is built for better than a 386
345355
#define AROS_ELF_MACHINE EM_386
346356
#define AROS_ELF_REL SHT_REL
347357
#define relo rel
@@ -357,10 +367,24 @@ struct attrs_subsection
357367
#define AROS_ELF_REL SHT_RELA
358368
#define relo rela
359369
#endif
360-
#ifdef __arm__
370+
#if defined(__aarch64__)
371+
#define AROS_ELF_MACHINE EM_AARCH64
372+
#define AROS_ELF_REL SHT_RELA
373+
#define relo rela
374+
#elif defined(__arm__)
361375
#define AROS_ELF_MACHINE EM_ARM
362376
#define AROS_ELF_REL SHT_RELA
363377
#define relo rela
364378
#endif
379+
#if defined(__riscv64)
380+
#define AROS_ELF_MACHINE EM_RISCV
381+
#define AROS_ELF_REL SHT_RELA
382+
#define relo rela
383+
#elif defined(__riscv)
384+
#define AROS_ELF_MACHINE EM_RISCV
385+
#define AROS_ELF_REL SHT_RELA
386+
#define relo rel
387+
#endif
388+
365389

366390
#endif

Diff for: compiler/include/exec/interrupts.h

+14-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define EXEC_INTERRUPTS_H
33

44
/*
5-
Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5+
Copyright © 1995-2023, The AROS Development Team. All rights reserved.
66
$Id$
77
88
Desc: Interrupt structures
@@ -17,7 +17,11 @@
1717
#endif
1818

1919
/* CPU-dependent struct ExceptionContext */
20-
#if defined __x86_64__
20+
#if defined __aarch64__
21+
#include <aros/aarch64/cpucontext.h>
22+
#elif defined __arm__
23+
#include <aros/arm/cpucontext.h>
24+
#elif defined __x86_64__
2125
#include <aros/x86_64/cpucontext.h>
2226
#include <aros/irqtypes.h>
2327
#elif defined __i386__
@@ -27,10 +31,10 @@
2731
#include <aros/m68k/cpucontext.h>
2832
#elif defined __powerpc__
2933
#include <aros/ppc/cpucontext.h>
30-
#elif defined __aarch64__
31-
#include <aros/aarch64/cpucontext.h>
32-
#elif defined __arm__
33-
#include <aros/arm/cpucontext.h>
34+
#elif defined __riscv64
35+
#include <aros/riscv64/cpucontext.h>
36+
#elif defined __riscv
37+
#include <aros/riscv/cpucontext.h>
3438
#else
3539
#error unsupported CPU type
3640
#endif
@@ -124,20 +128,12 @@ struct SoftIntList
124128
#define AROS_INTH1(n, type, data) AROS_INTH4(n, type, data, __ufi_intmask, __ufi_custom, __ufi_code)
125129
#define AROS_INTH0(n) AROS_INTH4(n, APTR, data, __ufi_intmask, __ufi_custom, __ufi_code)
126130

127-
#ifdef __mc68000
128-
/* Special hack for setting the 'Z' condition code upon exit
129-
* for m68k architectures.
130-
*/
131-
#define AROS_INTFUNC_INIT inline ULONG _handler(void) {
132-
#define AROS_INTFUNC_EXIT }; register ULONG _res asm ("d0") = _handler(); \
133-
asm volatile ("tst.l %0\n" : : "r" (_res)); \
134-
return _res; /* gcc only generates movem/unlk/rts */ \
135-
AROS_USERFUNC_EXIT }
136-
#else /* ! __mc68000 */
137-
/* Everybody else */
131+
#if !defined(AROS_INTFUNC_INIT)
138132
#define AROS_INTFUNC_INIT
133+
#endif
134+
#if !defined(AROS_INTFUNC_EXIT)
139135
#define AROS_INTFUNC_EXIT AROS_USERFUNC_EXIT }
140-
#endif /* ! __mc68000 */
136+
#endif
141137

142138
#endif /* __AROS__ */
143139

Diff for: config/make.cfg.in

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
# Copyright � 1995-2021, The AROS Development Team. All rights reserved.
1+
# Copyright � 1995-2023, The AROS Development Team. All rights reserved.
22
# $Id$
33
#
44
# Static makefile rule file for AROS.
55

6-
ifneq ($(AROS_TARGET_VARIANT),)
7-
AROS_TARGET_SUFFIX =-$(AROS_TARGET_VARIANT)
8-
ifeq ($(AROS_TARGET_ARCH),pc)
9-
# 'pc' target has 'tiny' variant for boot floppy, which affects only GRUB options.
10-
# It should not affect AROS_TARGET_PLATFORM
11-
AROS_TARGET_PLATFORM := $(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
12-
else
13-
AROS_TARGET_PLATFORM := $(AROS_TARGET_VARIANT)-$(AROS_TARGET_CPU)
14-
endif
15-
else
16-
AROS_TARGET_SUFFIX =
17-
AROS_TARGET_PLATFORM := $(AROS_TARGET_ARCH)-$(AROS_TARGET_CPU)
18-
endif
6+
AROS_TARGET_SUFFIX = @aros_target_suffix@
197

208
# All files corresponding to a specific host go here.
219
DIR_HOST := bin/$(AROS_HOST_ARCH)-$(AROS_HOST_CPU)

Diff for: config/target.cfg.in

+2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ STRIP_PLAIN := $(strip @aros_target_strip@)
158158
# MAGIC: This is needed here for MetaMake to work. mmake will read the
159159
# configured version of this file to find out a number of variables.
160160
# --------------------------------------------------------------------------
161+
AROS_TARGET_PLATFORM := @aros_target_platform@
162+
161163
HOSTDIR := $(TOP)/bin/$(AROS_HOST_ARCH)-$(AROS_HOST_CPU)
162164
TOOLDIR := $(HOSTDIR)/tools
163165
GENMFSCRIPT := $(TOOLDIR)/genmf.py

Diff for: configure

+57-2
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ aros_target_ranlib
753753
aros_target_ar
754754
aros_target_suffix
755755
aros_target_variant
756+
aros_target_platform
756757
aros_target_cpu_mode
757758
aros_target_cpu
758759
aros_target_family
@@ -9741,6 +9742,9 @@ case "$target_cpu" in
97419742
;;
97429743
*powerpc*)
97439744
;;
9745+
*riscv*)
9746+
riscv_isa_extra="ISA_RISCV_FLAGS = -march=$""(GCC_DEFAULT_CPU) -mabi=$""(GCC_DEFAULT_MODE)"
9747+
;;
97449748
esac
97459749

97469750
# This is the target configuration switch.
@@ -10360,6 +10364,34 @@ printf "%s\n" "$darwin_sdk_path" >&6; }
1036010364
esac
1036110365
;;
1036210366

10367+
native)
10368+
case "$aros_target_variant" in
10369+
*sifive_u*)
10370+
aros_flavour="standalone"
10371+
aros_target_arch="native"
10372+
aros_object_format="riscvelf_aros"
10373+
aros_isa_flags="$""(ISA_RISCV_FLAGS)"
10374+
aros_shared_default="no"
10375+
case "$target_cpu" in
10376+
*riscv64*)
10377+
PLATFORM_EXECSMP="#define __AROSPLATFORM_SMP__"
10378+
aros_target_cpu="riscv64"
10379+
gcc_default_cpu="rv64imafdc"
10380+
gcc_default_mode="lp64"
10381+
;;
10382+
*riscv*)
10383+
aros_target_cpu="riscv"
10384+
gcc_default_cpu="rv32imafdc"
10385+
gcc_default_mode="ilp32"
10386+
;;
10387+
*)
10388+
as_fn_error $? "\"Unsupported CPU '$target_cpu' for SiFive Unleashed\"" "$LINENO" 5
10389+
;;
10390+
esac
10391+
;;
10392+
esac
10393+
;;
10394+
1036310395
stm32f7_discovery)
1036410396
aros_flavour="standalone"
1036510397
aros_target_arch="stm32f7_discovery"
@@ -11139,6 +11171,9 @@ printf "%s\n" "$aros_target_cpu_mode" >&6; }
1113911171
aros_isa_extra="$x86_isa_extra$export_newline$x86_64_isa_extra$export_newline"
1114011172
aros_kernel_ldflags="$aros_kernel_ldflags -m32"
1114111173
;;
11174+
riscv)
11175+
aros_isa_extra="$riscv_isa_extra$export_newline"
11176+
;;
1114211177
esac
1114311178

1114411179
# Some architectures may need custom ELF specs.
@@ -17699,12 +17734,18 @@ if ! test "$gcc_default_cpu" = "" ; then
1769917734
fi
1770017735

1770117736
if ! test "$gcc_default_fpu" = "" ; then
17702-
target_extra_cfg+="$export_firstextraline""GCC_DEFAULT_FPU := $gcc_default_fpu"
17737+
target_extra_cfg+="$export_firstextraline""GCC_DEFAULT_FPU := $gcc_default_fpu$export_newline"
1770317738
export_firstextraline=""
1770417739
fi
1770517740

1770617741
if ! test "$gcc_default_float_abi" = "" ; then
17707-
target_extra_cfg+="$export_newline""# ARM gcc default config$export_newline""GCC_DEFAULT_FLOAT_ABI := $gcc_default_float_abi$export_newline""GCC_DEFAULT_MODE := $gcc_default_mode$export_newline"
17742+
target_extra_cfg+="$export_firstextraline""GCC_DEFAULT_FLOAT_ABI := $gcc_default_float_abi$export_newline"
17743+
export_firstextraline=""
17744+
fi
17745+
17746+
if ! test "$gcc_default_mode" = "" ; then
17747+
target_extra_cfg+="$export_firstextraline""GCC_DEFAULT_MODE := $gcc_default_mode$export_newline"
17748+
export_firstextraline=""
1770817749
fi
1770917750

1771017751
if test "$use_libatomic" = "yes" ; then
@@ -17716,6 +17757,19 @@ aros_target_options+="$export_newline""# Enable Nouveau Gfx Driver$export_newlin
1771617757

1771717758
aros_kernel_cflags="$aros_kernel_cflags $aros_kernel_export_cflags"
1771817759

17760+
if test "$aros_target_variant" = ""; then
17761+
aros_target_platform="$aros_target_arch-$aros_target_cpu"
17762+
else
17763+
case "$target_os" in
17764+
pc)
17765+
aros_target_platform="$aros_target_arch-$aros_target_cpu"
17766+
;;
17767+
*)
17768+
aros_target_platform="$aros_target_variant-$aros_target_cpu"
17769+
;;
17770+
esac
17771+
fi
17772+
1771917773
CC=$CC
1772017774
CFLAGS=$CFLAGS
1772117775
CHMOD=$CHMOD
@@ -17903,6 +17957,7 @@ aros_kernel_ranlib=$aros_kernel_ranlib
1790317957

1790417958

1790517959

17960+
1790617961

1790717962

1790817963
# Native version related

0 commit comments

Comments
 (0)