Skip to content

arm64 port fallout#18

Draft
lkundrak wants to merge 5 commits intoMitchBradley:masterfrom
lkundrak:lr/arm64-fallout
Draft

arm64 port fallout#18
lkundrak wants to merge 5 commits intoMitchBradley:masterfrom
lkundrak:lr/arm64-fallout

Conversation

@lkundrak
Copy link
Copy Markdown
Contributor

The arm64 port broke 32-bit architectures.

This PR is marked draft, because it restores other arches at expense of last commit breaking arm64 in a way I don't know how to fix. Maybe @iamtooch can help beating this into shape?

The arm64 port patch somewhat heavy-handedly reworked the dictionary
allocation, essentially ruining other platforms. Most notably, the extra
mprotect() is going to fail, because it requires the memory to be
page-aligned.

Let's use mmap directly, so that we 1.) always get page-aligned memory
and 2.) can set the protection flags right away, simplifying the whole
thing.

I have zero idea why arm64 is a special case, with the custom heap
management. Perhaps some Mac-specific oddity. This has been tested
on Linux with x86, arm, and mips targets.

Fixes: 95a5761 ('Add support for arm64.')
It relies on native (1x0) word that's only implemented or used on arm64.
Otherwise all other platforms are broken:

  ${BP}/forth/lib/1x0.fth:52: (1x0) ?
  make: *** [emuofw.rom] Error 1

Fixes: 95a5761 ('Add support for arm64.')
The arm64 port broke them all:

  ${BP}/forth/kernel/metacompile.fth:700: \t64-t ?
  make: *** [emuofw.rom] Error 1

I have no idea what this does, I cargo-culted it.

Fixes: 95a5761 ('Add support for arm64.')
The arm64 port, apparently accidentally, dropped the conditional that
checked if "host_cpu" exists, ruining the construction of HOSTDIR if
there's none in the environment:

  ./build emuofw.rom
  forth: Can't open dictionary file ${HOSTDIR}/../build/builder.dic
  make: *** [Makefile:6: emuofw.rom] Error 1
  make: Leaving directory 'cpu/x86/pc/emu/build'

Bring it back.

Fixes: 95a5761 ('Add support for arm64.')
It's only there on arm64. This presumably breaks "see" on that platform,
but that's possibly better than breaking all other platforms:

  --- Rebuilding tools.dic
  --- Cmd: ${HOSTDIR}/x86forth ${BP}/cpu/x86/build/kernel.dic ../tools.bth
  ${BP}/forth/lib/decomp.fth:40: create-cf? ?
  --- Saving tools.dic ---

Fixes: 95a5761 ('Add support for arm64.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant