Make data sections not executable

This commit is contained in:
2025-07-25 23:44:33 +02:00
parent 51ea7ee453
commit 98010a17e3
3 changed files with 125 additions and 51 deletions

View File

@@ -3,7 +3,7 @@
# obtain one at https://mozilla.org/MPL/2.0/.
.global write_s, write_c
.global memcmp, memchr, memmem, memcpy
.global memcmp, memchr, memmem, memcpy, bzero
.section .text
@@ -211,3 +211,19 @@ memcpy:
.Lmemcpy_end:
mv a0, t0
ret
# Zeroes a chank of memory.
#
# Parameters:
# a0 - Memory pointer.
# a1 - Memory size.
bzero:
mv t0, a0
.Lbzero_loop:
bgt t0, a1, .Lbzero_end
sb zero, (t0)
addi t0, t0, 1
.Lbzero_end:
ret