kernel/vfs: Don't ignore buffer length in write(stream)

This commit is contained in:
jn 2023-01-30 20:42:21 +01:00
parent d94611a250
commit 73eee3e599
2 changed files with 19 additions and 1 deletions

View File

@ -233,16 +233,19 @@ shell_clear_buffer:
; outputs:
; none
print_character_to_terminal:
push r0
push r1
push r2
mov.8 [shell_char_buffer], r0
mov r0, 1
mov r1, [shell_terminal_stream_struct_ptr]
mov r2, shell_char_buffer
call write
pop r2
pop r1
pop r0
ret
; print a string to the terminal
@ -257,6 +260,7 @@ print_str_to_terminal:
mov r1, [shell_terminal_stream_struct_ptr]
mov r2, r0
print_str_to_terminal_loop:
mov r0, 1
call write
inc r2
cmp.8 [r2], 0x00

View File

@ -91,7 +91,7 @@ stream_read:
; write specified number of bytes into the specified file
; inputs:
; r0: number of bytes to write (ignored if file struct is a stream)
; r0: number of bytes to write
; r1: pointer to file struct
; r2: pointer to source buffer (always 4 bytes if file struct is a stream)
; outputs:
@ -111,6 +111,20 @@ write:
pop r3
ret
stream_write:
push r31
push r2
mov r31, r0 ; number of bytes to write = loop count
stream_write_loop:
call stream_write_char
inc r2
loop stream_write_loop
pop r2
pop r31
ret
stream_write_char:
push r0
push r1