Skip to content

Commit 7de24ce

Browse files
committed
* move framebuffer to .bss in bounce tests
* fix .rodata addressing in test bss
1 parent ed99335 commit 7de24ce

File tree

5 files changed

+118
-12
lines changed

5 files changed

+118
-12
lines changed

test_bounce.s

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,29 @@ _start:
2828
mov x0, STDOUT_FILENO
2929
svc 0
3030

31+
// clear fb
32+
movi v0.16b, ' '
33+
movi v1.16b, ' '
34+
adrf x1, fb
35+
adrf x2, fb_end
36+
and x4, x2, -32
37+
and x3, x2, -16
38+
.Lclear_fb:
39+
cmp x1, x4
40+
beq .Lclear_fb_tail_0
41+
stp q0, q1, [x1], 32
42+
b .Lclear_fb
43+
.Lclear_fb_tail_0:
44+
cmp x1, x3
45+
beq .Lclear_fb_tail_1
46+
str q0, [x1], 16
47+
.Lclear_fb_tail_1:
48+
cmp x1, x2
49+
beq .Lfb_done
50+
str b0, [x1], 1
51+
b .Lclear_fb_tail_1
52+
53+
.Lfb_done:
3154
mov w5, wzr // blip pos_x
3255
mov w6, wzr // blip pos_y
3356
mov x7, FRAMES
@@ -95,8 +118,9 @@ fb_cursor_len = . - fb_cursor_cmd
95118
timespec:
96119
.dword 0, 15500000
97120

98-
.section .data
121+
.section .bss
99122
.align 6
100123
fb:
101-
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
124+
.fill FB_DIM_Y * FB_DIM_X
125+
fb_end:
102126
fb_len = . - fb

test_bounce_neon.s

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
// symbols supplied by CLI
1414
.endif
1515

16+
// load 'far' address as a +/-4GB offset from PC
17+
.macro adrf Xn, addr:req
18+
adrp \Xn, \addr
19+
add \Xn, \Xn, :lo12:\addr
20+
.endm
21+
1622
.text
1723
_start:
1824
// clear screen
@@ -22,6 +28,29 @@ _start:
2228
mov x0, STDOUT_FILENO
2329
svc 0
2430

31+
// clear fb
32+
movi v0.16b, ' '
33+
movi v1.16b, ' '
34+
adrf x1, fb
35+
adrf x2, fb_end
36+
and x4, x2, -32
37+
and x3, x2, -16
38+
.Lclear_fb:
39+
cmp x1, x4
40+
beq .Lclear_fb_tail_0
41+
stp q0, q1, [x1], 32
42+
b .Lclear_fb
43+
.Lclear_fb_tail_0:
44+
cmp x1, x3
45+
beq .Lclear_fb_tail_1
46+
str q0, [x1], 16
47+
.Lclear_fb_tail_1:
48+
cmp x1, x2
49+
beq .Lfb_done
50+
str b0, [x1], 1
51+
b .Lclear_fb_tail_1
52+
53+
.Lfb_done:
2554
// four Q-form regs hold SoA { pos_x, pos_y, step_x, step_y }
2655
ldr q0, =0x00000000000000100000002000000030 // blip{0..3} pos_x
2756
ldr q1, =0x00000000000000100000000000000010 // blip{0..3} pos_y
@@ -45,7 +74,7 @@ _start:
4574

4675
// access to fb: addr & len as per SYS_write
4776
ldr x2, =fb_len
48-
adr x1, fb
77+
adrf x1, fb
4978

5079
// plot blips in fb
5180
mov v7.16b, v0.16b
@@ -102,7 +131,6 @@ _start:
102131
mov x0, xzr
103132
svc 0
104133

105-
.section .rodata
106134
fb_clear_cmd:
107135
.ascii "\033[2J"
108136
fb_clear_len = . - fb_clear_cmd
@@ -114,8 +142,9 @@ fb_cursor_len = . - fb_cursor_cmd
114142
timespec:
115143
.dword 0, 15500000
116144

117-
.section .data
145+
.section .bss
118146
.align 6
119147
fb:
120-
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
148+
.fill FB_DIM_Y * FB_DIM_X
149+
fb_end:
121150
fb_len = . - fb

test_bounce_neon_aosoa.s

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,29 @@ _start:
2828
mov x0, STDOUT_FILENO
2929
svc 0
3030

31+
// clear fb
32+
movi v0.16b, ' '
33+
movi v1.16b, ' '
34+
adrf x1, fb
35+
adrf x2, fb_end
36+
and x4, x2, -32
37+
and x3, x2, -16
38+
.Lclear_fb:
39+
cmp x1, x4
40+
beq .Lclear_fb_tail_0
41+
stp q0, q1, [x1], 32
42+
b .Lclear_fb
43+
.Lclear_fb_tail_0:
44+
cmp x1, x3
45+
beq .Lclear_fb_tail_1
46+
str q0, [x1], 16
47+
.Lclear_fb_tail_1:
48+
cmp x1, x2
49+
beq .Lfb_done
50+
str b0, [x1], 1
51+
b .Lclear_fb_tail_1
52+
53+
.Lfb_done:
3154
mov w4, FB_DIM_X
3255
mov w5, FB_DIM_X - 2
3356
mov w6, FB_DIM_Y - 1
@@ -138,8 +161,9 @@ fb_cursor_len = . - fb_cursor_cmd
138161
timespec:
139162
.dword 0, 15500000
140163

141-
.section .data
164+
.section .bss
142165
.align 6
143166
fb:
144-
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
167+
.fill FB_DIM_Y * FB_DIM_X
168+
fb_end:
145169
fb_len = . - fb

test_bounce_neon_aosoa_bg.s

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,29 @@ _start:
4040
mov x0, STDOUT_FILENO
4141
svc 0
4242

43+
// clear fb
44+
movi v0.16b, ' '
45+
movi v1.16b, ' '
46+
adrf x1, fb
47+
adrf x2, fb_end
48+
and x4, x2, -32
49+
and x3, x2, -16
50+
.Lclear_fb:
51+
cmp x1, x4
52+
beq .Lclear_fb_tail_0
53+
stp q0, q1, [x1], 32
54+
b .Lclear_fb
55+
.Lclear_fb_tail_0:
56+
cmp x1, x3
57+
beq .Lclear_fb_tail_1
58+
str q0, [x1], 16
59+
.Lclear_fb_tail_1:
60+
cmp x1, x2
61+
beq .Lfb_done
62+
str b0, [x1], 1
63+
b .Lclear_fb_tail_1
64+
65+
.Lfb_done:
4366
mov w4, FB_DIM_X
4467
mov w5, FB_DIM_X - 2
4568
mov w6, FB_DIM_Y - 1
@@ -338,13 +361,13 @@ fb_cursor_len = . - fb_cursor_cmd
338361
timespec:
339362
.dword 0, 15500000
340363

341-
.section .data
364+
.section .bss
342365
.align 6
343366
fb:
344-
.fill FB_DIM_Y * FB_DIM_X, 1, ' '
367+
.fill FB_DIM_Y * FB_DIM_X
368+
fb_end:
345369
fb_len = . - fb
346370

347-
.section .bss
348371
.align 6
349372
grid:
350373
.fill (((FB_DIM_X + GRID_DISTANCE_X - 2) / GRID_DISTANCE_X) * ((FB_DIM_Y + GRID_DISTANCE_Y - 2) / GRID_DISTANCE_Y) + 3) / 4 * 64

test_bss.s

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
.equ SYS_exit, 93
55
.equ STDOUT_FILENO, 1
66

7+
// load 'far' address as a +/-4GB offset from PC
8+
.macro adrf Xn, addr:req
9+
adrp \Xn, \addr
10+
add \Xn, \Xn, :lo12:\addr
11+
.endm
12+
713
.text
814
_start:
915
mov x8, SYS_write
1016
mov x2, len
11-
adr x1, buf
17+
adrf x1, buf
1218
mov x0, STDOUT_FILENO
1319
svc 0
1420

0 commit comments

Comments
 (0)