72.4kg

 

という事で続きであるが。。。

良く分かっていないが、色々といじっている状態の中、まずはMakefile

コンパイル時のオプションに -g を追加

後、qemuのオプションも下記のような感じに。

(これ、両方ともちゃんと分かっていない。。。)

 

bootpack.hrb : bootpack.c hrb.ld naskfunc.o Makefile       # リンク,コンパイル

        x86_64-elf-gcc -c -g -march=i486 -m32 -nostdlib bootpack.c -o bootpack.o

run :

        $(MAKE) img

        qemu-system-i386 -L . -m 32 -rtc base=localtime -vga std -monitor stdio -s -S -drive file=haribote.img,format=raw,if=floppy -boot a

赤字部分を追加

 

で、実行してgdbもインストールされているっぽいので使ってみた。

$ make run

make -r img

make -r haribote.img

nasm ipl10.nas -o ipl10.bin -l ipl10.lst

nasm -f elf32 asmhead.nas -o asmhead.bin -l asmhead.lst

nasm -f elf32 naskfunc.nas -o naskfunc.o -l naskfunc.lst

x86_64-elf-gcc -c -g -march=i486 -m32 -nostdlib bootpack.c -o bootpack.o

x86_64-elf-ld -m elf_i386 -e HariMain -o bootpack.hrb -T hrb.ld bootpack.o naskfunc.o

cat asmhead.bin bootpack.hrb > haribote.sys

mformat -f 1440 -C -B ipl10.bin -i haribote.img ::

mcopy -i haribote.img haribote.sys ::

qemu-system-i386 -L . -m 32 -rtc base=localtime -vga std -monitor stdio -s -S -drive file=haribote.img,format=raw,if=floppy -boot a

QEMU 5.0.0 monitor - type 'help' for more information

(qemu) 

 

別ウインドウを立ち上げて、そちらでgdb起動

$ gdb

GNU gdb (GDB) 9.1

Copyright (C) 2020 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Type "show copying" and "show warranty" for details.

This GDB was configured as "x86_64-apple-darwin19.4.0".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>.

Find the GDB manual and other documentation resources online at:

    <http://www.gnu.org/software/gdb/documentation/>.

 

For help, type "help".

Type "apropos word" to search for commands related to "word".

(gdb) target remote localhost:1234

Remote debugging using localhost:1234

warning: No executable has been specified and target does not support

determining executable automatically.  Try using the "file" command.

0x0000fff0 in ?? ()

(gdb) 

 

ここで、

(gdb) layout asm

お?

f:id:kanazo3:20200516000705j:plain

こんなの出てきた。。。

まぁ、良く分からない場所のアドレスにいるって事なんでしょうな。。。

 

これは、完全にハマり方向へ向かっているな。。。(涙)

 

続く。。