Skip to content

Commit

Permalink
* move framebuffer to .bss in bounce tests
Browse files Browse the repository at this point in the history
* fix .rodata addressing in test bss
  • Loading branch information
blu committed Sep 8, 2021
1 parent ed99335 commit 7de24ce
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 12 deletions.
28 changes: 26 additions & 2 deletions test_bounce.s
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ _start:
mov x0, STDOUT_FILENO
svc 0

// clear fb
movi v0.16b, ' '
movi v1.16b, ' '
adrf x1, fb
adrf x2, fb_end
and x4, x2, -32
and x3, x2, -16
.Lclear_fb:
cmp x1, x4
beq .Lclear_fb_tail_0
stp q0, q1, [x1], 32
b .Lclear_fb
.Lclear_fb_tail_0:
cmp x1, x3
beq .Lclear_fb_tail_1
str q0, [x1], 16
.Lclear_fb_tail_1:
cmp x1, x2
beq .Lfb_done
str b0, [x1], 1
b .Lclear_fb_tail_1

.Lfb_done:
mov w5, wzr // blip pos_x
mov w6, wzr // blip pos_y
mov x7, FRAMES
Expand Down Expand Up @@ -95,8 +118,9 @@ fb_cursor_len = . - fb_cursor_cmd
timespec:
.dword 0, 15500000

.section .data
.section .bss
.align 6
fb:
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
.fill FB_DIM_Y * FB_DIM_X
fb_end:
fb_len = . - fb
37 changes: 33 additions & 4 deletions test_bounce_neon.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 @@ -22,6 +28,29 @@ _start:
mov x0, STDOUT_FILENO
svc 0

// clear fb
movi v0.16b, ' '
movi v1.16b, ' '
adrf x1, fb
adrf x2, fb_end
and x4, x2, -32
and x3, x2, -16
.Lclear_fb:
cmp x1, x4
beq .Lclear_fb_tail_0
stp q0, q1, [x1], 32
b .Lclear_fb
.Lclear_fb_tail_0:
cmp x1, x3
beq .Lclear_fb_tail_1
str q0, [x1], 16
.Lclear_fb_tail_1:
cmp x1, x2
beq .Lfb_done
str b0, [x1], 1
b .Lclear_fb_tail_1

.Lfb_done:
// four Q-form regs hold SoA { pos_x, pos_y, step_x, step_y }
ldr q0, =0x00000000000000100000002000000030 // blip{0..3} pos_x
ldr q1, =0x00000000000000100000000000000010 // blip{0..3} pos_y
Expand All @@ -45,7 +74,7 @@ _start:

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

// plot blips in fb
mov v7.16b, v0.16b
Expand Down Expand Up @@ -102,7 +131,6 @@ _start:
mov x0, xzr
svc 0

.section .rodata
fb_clear_cmd:
.ascii "\033[2J"
fb_clear_len = . - fb_clear_cmd
Expand All @@ -114,8 +142,9 @@ fb_cursor_len = . - fb_cursor_cmd
timespec:
.dword 0, 15500000

.section .data
.section .bss
.align 6
fb:
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
.fill FB_DIM_Y * FB_DIM_X
fb_end:
fb_len = . - fb
28 changes: 26 additions & 2 deletions test_bounce_neon_aosoa.s
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ _start:
mov x0, STDOUT_FILENO
svc 0

// clear fb
movi v0.16b, ' '
movi v1.16b, ' '
adrf x1, fb
adrf x2, fb_end
and x4, x2, -32
and x3, x2, -16
.Lclear_fb:
cmp x1, x4
beq .Lclear_fb_tail_0
stp q0, q1, [x1], 32
b .Lclear_fb
.Lclear_fb_tail_0:
cmp x1, x3
beq .Lclear_fb_tail_1
str q0, [x1], 16
.Lclear_fb_tail_1:
cmp x1, x2
beq .Lfb_done
str b0, [x1], 1
b .Lclear_fb_tail_1

.Lfb_done:
mov w4, FB_DIM_X
mov w5, FB_DIM_X - 2
mov w6, FB_DIM_Y - 1
Expand Down Expand Up @@ -138,8 +161,9 @@ fb_cursor_len = . - fb_cursor_cmd
timespec:
.dword 0, 15500000

.section .data
.section .bss
.align 6
fb:
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
.fill FB_DIM_Y * FB_DIM_X
fb_end:
fb_len = . - fb
29 changes: 26 additions & 3 deletions test_bounce_neon_aosoa_bg.s
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ _start:
mov x0, STDOUT_FILENO
svc 0

// clear fb
movi v0.16b, ' '
movi v1.16b, ' '
adrf x1, fb
adrf x2, fb_end
and x4, x2, -32
and x3, x2, -16
.Lclear_fb:
cmp x1, x4
beq .Lclear_fb_tail_0
stp q0, q1, [x1], 32
b .Lclear_fb
.Lclear_fb_tail_0:
cmp x1, x3
beq .Lclear_fb_tail_1
str q0, [x1], 16
.Lclear_fb_tail_1:
cmp x1, x2
beq .Lfb_done
str b0, [x1], 1
b .Lclear_fb_tail_1

.Lfb_done:
mov w4, FB_DIM_X
mov w5, FB_DIM_X - 2
mov w6, FB_DIM_Y - 1
Expand Down Expand Up @@ -338,13 +361,13 @@ fb_cursor_len = . - fb_cursor_cmd
timespec:
.dword 0, 15500000

.section .data
.section .bss
.align 6
fb:
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
.fill FB_DIM_Y * FB_DIM_X
fb_end:
fb_len = . - fb

.section .bss
.align 6
grid:
.fill (((FB_DIM_X + GRID_DISTANCE_X - 2) / GRID_DISTANCE_X) * ((FB_DIM_Y + GRID_DISTANCE_Y - 2) / GRID_DISTANCE_Y) + 3) / 4 * 64
Expand Down
8 changes: 7 additions & 1 deletion test_bss.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 7de24ce

Please sign in to comment.