Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,16 @@ LIBS = -lc -lgcc
HANDLER_LDFLAGS = -nostartfiles -static -Wl,-u,_start
HANDLER_LIBS = -nostdlib -lgcc
else
AMIGA_CPUFLAGS ?= -m68000 -mtune=68020-60 -msoft-float
# Tuned for the 68000 itself: the 68020 build serves the faster CPUs, and
# -mtune=68020-60 picks clr.l, cmpi.l, long shifts and mulu that cost a
# 68000 more.
AMIGA_CPUFLAGS ?= -m68000 -msoft-float
# Except handler_main.c, which holds the packet loop and the streaming
# read path. Tuned for the 68000, they cost a 68040 one E-clock tick per
# Read() (-0.85% sequential read in CDBench); tuned for the 68020-60,
# they cost a 68000 nothing measurable. The 68020 build and the
# LTO-linked ROM profile leave this empty.
AMIGA_LOOP_CPUFLAGS ?= -mtune=68020-60
AMIGA_SYSFLAGS ?= -noixemul
# Use register arguments inside the OS3 handler, including the ROM profile.
# Keep this on both compilation and linking for LTO. OS entry points use
Expand Down Expand Up @@ -208,7 +217,11 @@ AMIGA_020_BUILD = build/amiga-020

# 68020 release variant: hardware mul/div and 020 addressing modes make
# the handler both faster and smaller than the 68000 build.
AMIGA_020_CPUFLAGS ?= -m68020 -msoft-float
# ODFS_M68K_UNALIGNED_OK lets the code use word and long accesses at odd
# addresses. GCC cannot tell us: its __mc680x0__ macros follow -mtune,
# not -m, so -m68000 -mtune=68020-60 defines __mc68020__ too. Leave it
# out of any build that may run on a 68000.
AMIGA_020_CPUFLAGS ?= -m68020 -msoft-float -DODFS_M68K_UNALIGNED_OK

# ---- shared source lists ----

Expand Down Expand Up @@ -361,6 +374,7 @@ amiga-020:
@$(MAKE) --no-print-directory \
AMIGA_BUILD=$(AMIGA_020_BUILD) \
AMIGA_CPUFLAGS="$(AMIGA_020_CPUFLAGS)" \
AMIGA_LOOP_CPUFLAGS= \
SIZE_LIMIT_DESC="release Amiga 68020 handler" \
amiga

Expand Down Expand Up @@ -461,6 +475,7 @@ rom:
AMIGA_BUILD=$(ROM_BUILD) \
AMIGA_OPT=-Os \
LTO="$(ROM_LTO)" \
AMIGA_LOOP_CPUFLAGS= \
AMIGA_AR=$(AMIGA_TOOL_PREFIX)-gcc-ar \
CPPFLAGS="$(CPPFLAGS) -DODFS_PROFILE_ROM" \
AMIGA_SIZE_LIMIT=$(ROM_SIZE_LIMIT) \
Expand All @@ -479,6 +494,7 @@ rom-test:
AMIGA_BUILD=$(ROM_TEST_BUILD) \
AMIGA_OPT=-Os \
LTO="$(ROM_LTO)" \
AMIGA_LOOP_CPUFLAGS= \
AMIGA_AR=$(AMIGA_TOOL_PREFIX)-gcc-ar \
CPPFLAGS="$(CPPFLAGS) -DODFS_PROFILE_ROM" \
ENFORCE_SIZE_LIMITS=0 \
Expand Down Expand Up @@ -612,7 +628,9 @@ $(AMIGA_BUILD)/libodfs.a: $(AMIGA_LIB_OBJS)
$(AMIGA_BUILD)/%.o: %.c Makefile
@mkdir -p $(@D)
@echo " CC $<"
@$(CC) $(CPPFLAGS) $(AMIGA_INCLUDES) $(CFLAGS) $(AMIGA_ABIFLAGS) -c -o $@ $<
@$(CC) $(CPPFLAGS) $(AMIGA_INCLUDES) $(CFLAGS) $(AMIGA_ABIFLAGS) $(OBJ_CPUFLAGS) -c -o $@ $<

$(AMIGA_BUILD)/platform/amiga/handler_main.o: OBJ_CPUFLAGS = $(AMIGA_LOOP_CPUFLAGS)

# ---- Amiga assembly ----

Expand Down
7 changes: 4 additions & 3 deletions backends/iso9660/iso9660.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
/* read little-endian 32 from a both-byte-order 8-byte field */
static inline uint32_t iso_read_le32(const uint8_t *p)
{
#if defined(__mc68020__) || defined(__mc68030__) || \
defined(__mc68040__) || defined(__mc68060__)
#if defined(ODFS_M68K_UNALIGNED_OK)
/* GCC keeps to aligned accesses on every m68k and would assemble
* the value byte by byte; the 68020 and later load it unaligned */
* the value byte by byte; the 68020 and later load it unaligned.
* Rock Ridge fields can sit at odd addresses, so only a build that
* never runs on a 68000 may do this (see the Makefile). */
uint32_t v;

__asm__("move.l %1,%0" : "=d" (v) : "m" (*(const uint8_t (*)[4])p));
Expand Down
6 changes: 4 additions & 2 deletions platform/amiga/os3/string.S
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ _memcpy:
1: move.l 4(sp),d0
rts

/* Source and destination differ in alignment; n > 16. */
/* Source and destination differ in alignment; n > 16. A build that
* may run on a 68000 asks exec whether the CPU allows unaligned long
* moves; see ODFS_M68K_UNALIGNED_OK in the Makefile. */
.Lunaligned:
#ifndef __mc68020__
#ifndef ODFS_M68K_UNALIGNED_OK
move.l 4.w,d1
exg d1,a0
btst #AFB_68020,AttnFlags+1(a0)
Expand Down
Loading