Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No real-mode output? #9

Open
rgambord opened this issue Jun 17, 2019 · 1 comment
Open

No real-mode output? #9

rgambord opened this issue Jun 17, 2019 · 1 comment

Comments

@rgambord
Copy link

Notice, no output after "Testing real mode".

$make
cc -Wall -Wextra -Werror -O2 -g   -c -o kvm-hello-world.o kvm-hello-world.c
as   -o guest16.o guest16.s
cc -Wall -Wextra -Werror -O2 -g -m32 -ffreestanding -fno-pic -c -o guest32.o guest.c
ld -T guest.ld -m elf_i386 guest32.o -o guest32.img
ld -b binary -r guest32.img -o guest32.img.o
cc -Wall -Wextra -Werror -O2 -g -m64 -ffreestanding -fno-pic -c -o guest64.o guest.c
ld -T guest.ld guest64.o -o guest64.img
ld -b binary -r guest64.img -o guest64.img.o
ld -T payload.ld -o payload.o
cc kvm-hello-world.o payload.o -o kvm-hello-world
./kvm-hello-world
Testing real mode
./kvm-hello-world -s
Testing protected mode
Hello, world!
./kvm-hello-world -p
Testing 32-bit paging
Hello, world!
./kvm-hello-world -l
Testing 64-bit mode
Hello, world!
@letang01
Copy link

letang01 commented May 5, 2021

    .code16
    .global code16, code16_end

guest16:

    mov $0xe9, %dx  # io port 0xe9

    # load the address location to bx, then data to al, then compare with null, if yes, break, 

    mov $message, %bx
    loaddata:
    mov (%bx), %al
    cmpb $0,%al
    jz done
    out %al, (%dx)
    inc %bx
    jmp loaddata
    
    done:
    movw $42, %ax
    movw %ax, 0x400
    hlt
    
    message:
    .ascii "Hello world\n"

guest16_end:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants