Skip to content

Commit

Permalink
Added new target for ARMv7 platforms that use platform register.
Browse files Browse the repository at this point in the history
  • Loading branch information
WillClinger committed May 31, 2016
1 parent 413f8e2 commit 2ab9d50
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 18 deletions.
15 changes: 9 additions & 6 deletions doc/HOWTO-BUILD
Expand Up @@ -74,13 +74,16 @@ To build native Larceny:
> (setup 'scheme: 'larceny 'host: 'linux86 'sassy 'string-rep: 'flat1)
> (setup 'scheme: 'larceny 'host: 'macosx-el 'sassy)

To build native Larceny on little-endian ARMv7 on any Linux
system an explicit target: is required to specify the floating
point ABI for the runtime [5]:
To build native Larceny for little-endian ARMv7 running Linux
an explicit target: will be required [5]:

> (setup 'scheme: 'larceny
'host: 'linux-arm-el
'target: 'linux-arm-el-hardfp 'native)
> (setup 'scheme: 'larceny
'host: 'linux-arm-el
'target: 'linux-arm-el-hardfp 'native)

To build native Larceny for ARMv7 target platforms that reserve
the ARM platform register, specify 'linux-arm-el-hardfp0 instead
of 'linux-arm-el-hardfp.

To build Petit Larceny:
> (setup 'scheme: 'larceny 'host: 'linux86 'always-source)
Expand Down
20 changes: 16 additions & 4 deletions setup.sch
Expand Up @@ -263,11 +263,15 @@
(define (platform->endianness sym)
(case sym
((macosx solaris clr-be) 'big)
((macosx-el linux-el linux-arm-el linux-arm-el-hardfp cygwin win32 clr-el) 'little)
((macosx-el linux-el linux-arm-el linux-arm-el-hardfp linux-arm-el-hardfp0
cygwin win32 clr-el)
'little)
(else (error 'platform->endianness "Unhandled case: ~a" sym))))
(define (platform->os sym)
(case sym
((macosx macosx-el solaris linux-el cygwin linux-arm-el linux-arm-el-hardfp) 'unix)
((macosx macosx-el solaris linux-el cygwin linux-arm-el linux-arm-el-hardfp
linux-arm-el-hardfp0)
'unix)
((win32) 'win32)
((clr-be) 'unix) ; FIXME
((clr-el) 'win32) ; FIXME
Expand Down Expand Up @@ -320,7 +324,7 @@
((macosx) 'features-petit-macosx)
((solaris) (cond (native 'features-sparc-solaris)
(else 'features-petit-solaris)))
((linux-arm-el-hardfp)
((linux-arm-el-hardfp linux-arm-el-hardfp0)
(cond (native 'features-arm-el-hardfp-linux)
(else (error 'setup.sch "Only the native system is supported on ARM Linux"))))
((linux-el) (cond (sassy 'features-x86-sassy-linux)
Expand Down Expand Up @@ -354,7 +358,8 @@
macosx-el) "petitmacosx")
((solaris) "petitsparcsolaris")
((cygwin) "petitcygwinmswindows")
((linux-el linux-arm-el-hardfp) "petitdebianlinux")
((linux-el linux-arm-el-hardfp linux-arm-el-hardfp0)
"petitdebianlinux")
((clr-be clr-le) "common"))) ; FIXME

(set! *host:endianness* (platform->endianness host-arch))
Expand Down Expand Up @@ -398,6 +403,13 @@
(set! *heap-type* 'arm-native)
(set! *runtime-type* 'arm-native))

((linux-arm-el-hardfp0)
(set! *target:machine* 'arm)
(set! *target:machine-source* "Fence")
(set! *makefile-configuration* 'arm-hardfp-linux-gcc-v4-gas)
(set! *heap-type* 'arm-native0)
(set! *runtime-type* 'arm-native0))

;; Win32 native is just Petit with extasm of NASM rather than C

((win32)
Expand Down
12 changes: 6 additions & 6 deletions src/Build/build-entry-defns.sch
Expand Up @@ -2,7 +2,7 @@
(let ((make-heap (case *heap-type*
((petit) make-petit-heap)
((sassy) make-sasstrap-heap)
((arm-native) make-arm-heap)
((arm-native arm-native0) make-arm-heap)
((sparc-native) make-sparc-heap)) ))
(apply make-heap args))) ; Defined in Lib/makefile.sch

Expand Down Expand Up @@ -49,7 +49,7 @@
((win32) "libpetit.lib")
(else "libpetit.a")))
((sparc-native) "larceny.bin")
((arm-native) "larceny.bin")
((arm-native arm-native0) "larceny.bin")
((sassy-native)
(case *host:os*
((win32) "larceny.bin.exe")
Expand All @@ -69,7 +69,7 @@
(case *runtime-type*
((petit) (build-application *petit-executable-name* '())
(copy-script "petit"))
((sparc-native sassy-native arm-native)
((sparc-native sassy-native arm-native arm-native0)
(let* ((name (case *host:os*
((win32) "larceny.bin.exe")
(else "larceny.bin")))
Expand All @@ -88,7 +88,7 @@
(make-petit-development-environment))
((sparc-native)
(make-development-environment))
((arm-native)
((arm-native arm-native0)
(make-development-environment))
((sassy)
(make-development-environment)
Expand All @@ -111,7 +111,7 @@
(compile-and-assemble313 (param-filename 'auxiliary "pp.sch"))
(build-application
"petit-r5rs.bin" (param-filename 'auxiliary '("pp.lop"))))
((sparc-native arm-native sassy)
((sparc-native arm-native arm-native0 sassy)
(compile-file (param-filename 'auxiliary "pp.sch"))
(copy-script "larceny-r5rs"))
(else (error 'build-r5rs-files "Unknown heap type"))))
Expand All @@ -126,7 +126,7 @@
(build-application "petit-larceny.bin"
(petit-development-environment-lop-files)))
(copy-script "larceny"))
((sparc-native arm-native sassy)
((sparc-native arm-native arm-native0 sassy)
'done)
(else (error 'build-larceny-files "Unknown heap type"))))

Expand Down
3 changes: 2 additions & 1 deletion src/Build/nbuild-files.sch
Expand Up @@ -88,7 +88,8 @@
"ecodes.sch"
"layouts.sch"
,@(case *runtime-type*
((sparc-native sassy-native arm-native) '("regs.sch"))
((sparc-native sassy-native arm-native arm-native0)
'("regs.sch"))
(else '())))))

(define *nbuild:sparcasm-files*
Expand Down
4 changes: 3 additions & 1 deletion src/Build/petit-unix-defns.sch
Expand Up @@ -89,6 +89,7 @@
((sparc-native) (config (in-rts "sparc-regs.cfg")))
((sassy-native) (config (in-rts "iasn-regs.cfg")))
((arm-native) (config (in-rts "fence-arm-regs.cfg")))
((arm-native0) (config (in-rts "fence-arm-regs0.cfg")))
((petit) #t)
(else (error "No registers config file for this runtime-type: " *runtime-type*)))
(catfiles (map in-include
Expand All @@ -106,7 +107,8 @@
"layouts.ah"
"mprocs.ah"
,@(case *runtime-type*
((sparc-native sassy-native arm-native) '("regs.ah"))
((sparc-native sassy-native arm-native arm-native0)
'("regs.ah"))
(else '()))))
(in-include "asmdefs.h"))

Expand Down
2 changes: 2 additions & 0 deletions src/Rts/fence-arm-regs.cfg
Expand Up @@ -3,6 +3,8 @@
; Copyright 1998 Lars T Hansen.
;
; Configuration file for Fence register names, ARMv6 / ARMv7.
;
; Uses original register assignment, which should work on all ARMv7 platforms

(define-files "regs.ch" "regs.ah" "regs.sch")

Expand Down
63 changes: 63 additions & 0 deletions src/Rts/fence-arm-regs0.cfg
@@ -0,0 +1,63 @@
; -*- mode: scheme -*-
;
; Copyright 1998 Lars T Hansen.
;
; Configuration file for Fence register names, ARMv6 / ARMv7.

(define-files "regs.ch" "regs.ah" "regs.sch")

; These are platform-invariant and the hardware mappings are private
; between the Cant back-ends and the (minimal) assembly code in the
; Rts to support millicode. At least for now.

(define-const result "-1" #f #f "$r.result")
(define-const second "-2" #f #f "$r.second")
(define-const stkp "-3" #f #f "$r.stkp")
(define-const globals "-4" #f #f "$r.globals")
(define-const tmp "-5" #f #f "$r.tmp")
(define-const reg0 "0" #f #f "$r.reg0")

; These are specific to the ARM mapping. We need a mechanism to
; properly parameterize on platform here.

; ARM hardware register assignments for MacScheme registers.

(define-const armRESULT "0" #f #f "arm.RESULT")
(define-const armSECOND "1" #f #f "arm.SECOND")
(define-const armGLOBALS "2" #f #f "arm.GLOBALS")
(define-const armSTKP "3" #f #f "arm.STKP")
(define-const armTMP0 "4" #f #f "arm.TMP0") ; This is $r.tmp in pass5p2.
(define-const armREG0 "5" #f #f "arm.REG0")
(define-const armREG1 "6" #f #f "arm.REG1")
(define-const armREG2 "7" #f #f "arm.REG2")
(define-const armREG3 "8" #f #f "arm.REG3")
(define-const armREG4 "10" #f #f "arm.REG4")
(define-const armREG5 "11" #f #f "arm.REG5")
(define-const armTMP1 "12" #f #f "arm.TMP1") ; Not exposed to pass5p2.

; Other ARM hardware registers. FP=R11, not used here.

(define-const armSP "13" #f #f "arm.SP")
(define-const armLR "14" #f #f "arm.LR")
(define-const armPC "15" #f #f "arm.PC")

(define-const _result (string-append "r" armRESULT) #f "RESULT" #f)
(define-const _second (string-append "r" armSECOND) #f "SECOND" #f)
(define-const _globals (string-append "r" armGLOBALS) #f "GLOBALS" #f)
(define-const _stkp (string-append "r" armSTKP) #f "STKP" #f)
(define-const _tmp0 (string-append "r" armTMP0) #f "TMP0" #f)
(define-const _reg0 (string-append "r" armREG0) #f "REG0" #f)
(define-const _reg1 (string-append "r" armREG1) #f "REG1" #f)
(define-const _reg2 (string-append "r" armREG2) #f "REG2" #f)
(define-const _reg3 (string-append "r" armREG3) #f "REG3" #f)
(define-const _reg4 (string-append "r" armREG4) #f "REG4" #f)
(define-const _reg5 (string-append "r" armREG5) #f "REG5" #f)
(define-const _tmp1 (string-append "r" armTMP1) #f "TMP1" #f)

; These are also specific to the ARM mapping.

(define-const _lastreg "5" "LASTREG" "LASTREG" "*lastreg*")
(define-const _nregs "6" "NREGS" "NREGS" "*nregs*")
(define-const _nhwregs "6" #f #f "*nhwregs*")

; eof

0 comments on commit 2ab9d50

Please sign in to comment.