summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-11-15 18:31:54 -0500
committerIan Moffett <ian@osmora.org>2025-11-15 18:31:54 -0500
commit7a1e4b743bc45dbd869eeb19eb262654225a090a (patch)
treef96e280c1c126a6106a21730ddba8ff3bfd0ef4e /sys/arch
parented12cadce8cd41e0097ed71e15f2b2e729dbbf87 (diff)
kern/amd64: io: Add uart_puts() helper for strings
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/cpu/boot.S6
-rw-r--r--sys/arch/amd64/io/uart.S31
2 files changed, 33 insertions, 4 deletions
diff --git a/sys/arch/amd64/cpu/boot.S b/sys/arch/amd64/cpu/boot.S
index 12ba9e4..26b2b8b 100644
--- a/sys/arch/amd64/cpu/boot.S
+++ b/sys/arch/amd64/cpu/boot.S
@@ -30,7 +30,7 @@
.text
.globl _start
.extern uart_init
- .extern uart_write
+ .extern uart_puts
.extern idt_load
.extern gdt_load
.extern GDTR
@@ -46,8 +46,7 @@ _start:
call idt_load /* Load our IDT */
lea bootmsg(%rip), %rdi
- movq bootmsg_len, %rsi
- call uart_write
+ call uart_puts
call kmain /* Call our kernel entrypoint */
1: cli
@@ -60,7 +59,6 @@ bootmsg:
.ascii "[ 00:00 delta @ crev : 89 seconds]\n"
.ascii "** booting rv7 ...\n"
.byte 0x00
-bootmsg_len: .quad . - bootmsg
/* vim: ft=gas :
*/
diff --git a/sys/arch/amd64/io/uart.S b/sys/arch/amd64/io/uart.S
index 8e190ed..b67527a 100644
--- a/sys/arch/amd64/io/uart.S
+++ b/sys/arch/amd64/io/uart.S
@@ -95,5 +95,36 @@ uart_write:
.done:
retq
+ .globl uart_puts
+uart_puts:
+ /*
+ * void uart_puts(const char *s);
+ */
+
+ push %r12
+ push %r13
+ push %r14
+ push %r15
+ push %rbx
+ push %rbp
+
+ mov %rsi, %rcx
+ mov %rdi, %rsi
+.putsloop:
+ lodsb
+ or %al, %al
+ jz .putsdone
+ mov $UART_COM1, %dx
+ out %al, %dx
+ jmp .putsloop
+.putsdone:
+
+ pop %rbp
+ pop %rbx
+ pop %r15
+ pop %r14
+ pop %r13
+ pop %r12
+
/* vim: ft=gas :
*/