I am trying to write good and basic 'cleaning bss' code for my bootloader but AI's arguing me and I don't know what to do..My code is this:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ChatGPT is offering me different solutions, making mistakes and just updating 1 line for every iteration (my long question)I'm feeling really crazywe have 9 bytes for clean.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;chatGPT_cleaning:
cmp x3, #8
blt there_is_a_remainder
clean_aggressively:
str xzr, [x2], #8sub x3, x3, #8
cbz x3, cleaning_done
b clean_aggressively
there_is_a_remainder:
str xzr, [x2], #1
sub x3, x3, #1
b there_is_a_remainder
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-> Cleaned 8 bytes of 9 bytes.-> Cleaned 8 bytes of 1 bytes. ???What happens here, code is clean 8 bytes but gpt says if there is a 8x+k for x =0, it cleans just k???
Or it really cleans 8 bytes of 1 bytes, some hotel rooms are raided?Maybe we can use a security prosedure, adding an extra 8 bytes to end of the bss section. So we don't have to calculate remainders.continue:str xzr, [x2], #8sub x3, x3, #8cbnz x3, continueBut now the problem is negative values of size on x3 register.Uhh...I'll write an article about this problem..As a real engineer, please comment and write some advise, what should I do exactly?I think my first code improved to two functions (one is for big size values and other one is smalls) is the answer just now, I don't know....