I'm attempting to port my OS to x86_64, but it has been a horrible experience so far. Currently, I'm stuck at getting strlen to work.
First, let me paste this:
Code: Select all
(gdb) disas
Dump of assembler code for function strlen:
0x00000000000012eb <+0>: lea -0x1(%rdi),%rax
0x00000000000012ef <+4>: cmpb $0x0,0x1(%rax)
=> 0x00000000000012f3 <+8>: lea 0x1(%rax),%rax
0x00000000000012f7 <+12>: jne 0x12ef <strlen+4>
0x00000000000012f9 <+14>: sub %rdi,%rax
0x00000000000012fc <+17>: retq
End of assembler dump.
(gdb) i r rax
rax 0x1fff 8191
(gdb) si
0x00000000000012f4 95 while (*str)
(gdb) si
0x00000000000012f7 95 while (*str)
(gdb) i r rax
rax 0x1fff 8191
This is how I run qemu:
Code: Select all
qemu-system-x86_64-m 256m -cpu qemu64 -serial mon:stdio -kernel .\bin\i386-loader -s
I've been fighting this for a few days now and wanted to reach out to see if anyone has any idea...