Skip to content

Commit

Permalink
* refactor .data and .rodata address computations in tests to use HI2…
Browse files Browse the repository at this point in the history
…1/LO12

* refactor bounce tests to work with huge framebuffers
  • Loading branch information
blu committed Sep 7, 2021
1 parent 842d6d4 commit ed99335
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 32 deletions.
11 changes: 8 additions & 3 deletions test_bounce.s
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
// symbols supplied by CLI
.endif

// load 'far' address as a +/-4GB offset from PC
.macro adrf Xn, addr:req
adrp \Xn, \addr
add \Xn, \Xn, :lo12:\addr
.endm

.text
_start:
// clear screen
Expand All @@ -35,8 +41,8 @@ _start:
svc 0

// access to fb: addr & len as per SYS_write
mov x2, fb_len
adr x1, fb
ldr w2, =fb_len
adrf x1, fb

// plot blip in fb
mov w3, 0x5d5b
Expand Down Expand Up @@ -78,7 +84,6 @@ _start:
mov x0, xzr
svc 0

.section .rodata
fb_clear_cmd:
.ascii "\033[2J"
fb_clear_len = . - fb_clear_cmd
Expand Down
2 changes: 1 addition & 1 deletion test_bounce_neon.s
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _start:
svc 0

// access to fb: addr & len as per SYS_write
mov x2, fb_len
ldr x2, =fb_len
adr x1, fb

// plot blips in fb
Expand Down
19 changes: 12 additions & 7 deletions test_bounce_neon_aosoa.s
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
// symbols supplied by CLI
.endif

// load 'far' address as a +/-4GB offset from PC
.macro adrf Xn, addr:req
adrp \Xn, \addr
add \Xn, \Xn, :lo12:\addr
.endm

.text
_start:
// clear screen
Expand All @@ -38,12 +44,12 @@ _start:
svc 0

// access to fb: addr & len as per SYS_write
mov x2, fb_len
adr x1, fb
ldr w2, =fb_len
adrf x1, fb

// plot blips in fb
adr x10, blip
adr x11, blip_end
adrf x10, blip
adrf x11, blip_end
mov x12, x11
.Lpack_plot:
// four Q-form regs hold SoA { pos_x, pos_y, step_x, step_y }
Expand Down Expand Up @@ -93,8 +99,8 @@ _start:
svc 0

// erase blips from fb
adr x10, blip_end
adr x11, erase_end
adrf x10, blip_end
adrf x11, erase_end
.Lpack_erase:
ldp w4, w5, [x10], 8
ldp w6, w7, [x10], 8
Expand All @@ -121,7 +127,6 @@ _start:
mov x0, xzr
svc 0

.section .rodata
fb_clear_cmd:
.ascii "\033[2J"
fb_clear_len = . - fb_clear_cmd
Expand Down
36 changes: 18 additions & 18 deletions test_bounce_neon_aosoa_bg.s
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
.equ GRID_STEP_Y_2, 0
.equ GRID_STEP_Y_3, 1

// load 'far' address as a +/-4GB offset from PC
.macro adrf Xn, addr:req
adrp \Xn, \addr
add \Xn, \Xn, :lo12:\addr
.endm

.text
_start:
// clear screen
Expand All @@ -51,10 +57,8 @@ _start:
adr x12, grid_step_xxx0
adr x13, grid_step_1234

adrp x7, grid
add x7, x7, :lo12:grid
adrp x8, grid_end
add x8, x8, :lo12:grid_end
adrf x7, grid
adrf x8, grid_end
mov w9, wzr
.Lgen_grid:
// how many x-coords exceed end-of-line - 2?
Expand Down Expand Up @@ -139,14 +143,12 @@ _start:
svc 0

// access to fb: addr & len as per SYS_write
mov x2, fb_len
adr x1, fb
ldr w2, =fb_len
adrf x1, fb

// plot grid in fb
adrp x10, grid
add x10, x10, :lo12:grid
adrp x11, grid_end
add x11, x11, :lo12:grid_end
adrf x10, grid
adrf x11, grid_end
mov x12, x11
.Lgrid_plot:
// four Q-form regs hold SoA { pos_x, pos_y, step_x, step_y }
Expand Down Expand Up @@ -192,8 +194,8 @@ _start:
bne .Lgrid_plot

// plot blips in fb
adr x10, blip
adr x11, blip_end
adrf x10, blip
adrf x11, blip_end
mov x12, x11
.Lpack_plot:
// four Q-form regs hold SoA { pos_x, pos_y, step_x, step_y }
Expand Down Expand Up @@ -243,10 +245,8 @@ _start:
svc 0

// erase grid from fb
adrp x10, grid_end
add x10, x10, :lo12:grid_end
adrp x11, grid_erase_end
add x11, x11, :lo12:grid_erase_end
adrf x10, grid_end
adrf x11, grid_erase_end
.Lgrid_erase:
ldp w4, w5, [x10], 8
ldp w6, w7, [x10], 8
Expand All @@ -261,8 +261,8 @@ _start:
bne .Lgrid_erase

// erase blips from fb
adr x10, blip_end
adr x11, erase_end
adrf x10, blip_end
adrf x11, erase_end
.Lpack_erase:
ldp w4, w5, [x10], 8
ldp w6, w7, [x10], 8
Expand Down
8 changes: 7 additions & 1 deletion test_cross_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
.equ SYS_exit, 93
.equ STDOUT_FILENO, 1

// load 'far' address as a +/-4GB offset from PC
.macro adrf Xn, addr:req
adrp \Xn, \addr
add \Xn, \Xn, :lo12:\addr
.endm

.text
_start:
mov x8, SYS_write
adr x1, buf
adrf x1, buf
ldrb w2, [x1, -1]
mov x0, STDOUT_FILENO
svc 0
Expand Down
8 changes: 7 additions & 1 deletion test_data.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
.equ SYS_exit, 93
.equ STDOUT_FILENO, 1

// load 'far' address as a +/-4GB offset from PC
.macro adrf Xn, addr:req
adrp \Xn, \addr
add \Xn, \Xn, :lo12:\addr
.endm

.text
_start:
mov x8, SYS_write
mov x2, len
adr x1, buf
adrf x1, buf
ldr w3, =0x4c45525f
str w3, [x1, 13]
mov x0, STDOUT_FILENO
Expand Down
8 changes: 7 additions & 1 deletion test_rodata.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
.equ SYS_exit, 93
.equ STDOUT_FILENO, 1

// load 'far' address as a +/-4GB offset from PC
.macro adrf Xn, addr:req
adrp \Xn, \addr
add \Xn, \Xn, :lo12:\addr
.endm

.text
_start:
mov x8, SYS_write
mov x2, len
adr x1, buf
adrf x1, buf
mov x0, STDOUT_FILENO
svc 0

Expand Down

0 comments on commit ed99335

Please sign in to comment.