Implement syscalls, hello world from userspace
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS {
|
||||
/* . = 0xffff000000000000; */
|
||||
. = 0x0000000000000000;
|
||||
|
||||
.rodata ALIGN(4K):
|
||||
|
@ -16,7 +16,7 @@ all: $(TARGET)
|
||||
|
||||
hello: $(OBJ)
|
||||
$(LD) $^ $(LDFLAGS) -o $@
|
||||
echo $(realpath $@) >> $(FILES)
|
||||
echo $(realpath hello) >> $(FILES)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET)
|
||||
|
@ -1,6 +1,18 @@
|
||||
.section .data
|
||||
STRING:
|
||||
.string "Hello World from userspace"
|
||||
STRING_LEN:
|
||||
.quad . - STRING
|
||||
|
||||
.section .text
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
.spin:
|
||||
jmp .spin
|
||||
movq $1, %rax
|
||||
lea STRING(%rip), %rdi
|
||||
lea STRING_LEN(%rip), %rsi
|
||||
syscall
|
||||
|
||||
movq $2, %rax
|
||||
syscall
|
||||
|
||||
|
Reference in New Issue
Block a user