]> gitweb.factorcode.org Git - factor.git/commitdiff
arm64: ADR encoding
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 14 Mar 2021 01:46:37 +0000 (19:46 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 26 Mar 2021 23:11:03 +0000 (18:11 -0500)
basis/bootstrap/assembler/arm.64.factor
basis/cpu/arm/assembler/assembler.factor
basis/cpu/arm/assembler/opcodes/opcodes.factor

index 1d5ed0b08325f8c0761ccaa24d760ba9f8a20fed..c5a2e5d067edcb356c5de017c81c1e6d00885f46 100644 (file)
@@ -5,7 +5,7 @@ compiler.constants compiler.units cpu.arm.assembler
 cpu.arm.assembler.opcodes generic.single.private
 kernel kernel.private layouts locals locals.backend
 math math.private memory namespaces sequences slots.private
-strings.private threads.private vocabs ;
+strings.private threads.private vocabs make ;
 IN: bootstrap.arm
 
 8 \ cell set
@@ -75,13 +75,13 @@ big-endian off
 
 
 ! : pic-tail-reg ( -- reg ) RBX ;
-! : return-reg ( -- reg ) RAX ;
+: return-reg ( -- reg ) X0 ;
 ! : nv-reg ( -- reg ) RBX ;
 ! : stack-reg ( -- reg ) RSP ;
 ! : frame-reg ( -- reg ) RBP ;
 ! : link-reg ( -- reg ) R11 ;
 ! : ctx-reg ( -- reg ) R12 ;
-! : vm-reg ( -- reg ) R13 ;
+: vm-reg ( -- reg ) X7 ;
 : ds-reg ( -- reg ) X5 ;
 : rs-reg ( -- reg ) X6 ;
 ! : fixnum>slot@ ( -- ) temp0 1 SAR ;
@@ -153,7 +153,10 @@ big-endian off
 : jit-jump-quot ( -- ) ;
     ! arg1 quot-entry-point-offset [+] JMP ;
 
-: jit-call-quot ( -- ) ;
+: jit-call-quot ( -- )
+    quot-entry-point-offset arg1 ADR
+    arg1 BR ;
+
     ! arg1 quot-entry-point-offset [+] CALL ;
 
 : signal-handler-save-regs ( -- regs ) { } ;
index 98208ac3a420de0fed0c4596c3000613c499eca1..163aa3897a4257d0a185e5a1390fd06a9fe1d6a6 100644 (file)
@@ -20,11 +20,11 @@ TUPLE: arm64-assembler ip labels out ;
 : ip ( -- address ) arm64-assembler get ip>> ;
 : >out ( instruction -- ) arm64-assembler get out>> push ;
 
-: ADRP ( imm Rd -- )
-    [
-        ip 12 on-bits unmask - -12 shift
-        [ 2 bits ] [ -2 shift ] bi
-    ] dip ADRP-encode >out ;
+: ADR ( imm21 Rd -- )
+    [ [ 2 bits ] [ 19 bits ] bi ] dip ADR-encode >out ;
+
+: ADRP ( imm21 Rd -- )
+    [ [ 2 bits ] [ 19 bits ] bi ] dip ADRP-encode >out ;
 
 : BL ( offset -- ) ip - 4 / BL-encode >out ;
 : BR ( register -- ) BR-encode >out ;
index b3dd0f2dc9a69644e062a0bc5a05fc96b642df1d..4d87a4a4406135344b1981112102d4f46b319aef 100644 (file)
@@ -6,7 +6,8 @@ multiline parser sequences vocabs.parser words words.symbol ;
 IN: cpu.arm.assembler.opcodes
 
 ! https://developer.arm.com/documentation/ddi0487/latest/
-! https://static.docs.arm.com/ddi0487/fb/DDI0487F_b_armv8_arm.pdf
+! https://static.docs.arm.com/ddi0487/fb/DDI0487F_b_armv8_arm.pdf ! initial work
+! https://static.docs.arm.com/ddi0487/fb/DDI0487G_a_armv8_arm.pdf ! 3/13/21
 
 <<
 SYNTAX: REGISTERS: