Closed TaiseiIto closed 2 years ago
コンソールからの入力とRS232からの入力を共通して受け付けられるshellを作ろう
Virtual Box でもシリアル入出力に対応するために,名前付きpipeで自作OSと通信するサーバーを作ろう
Readにタイムアウトを設定する方法があるらしい
次はexecute_command関数でcommandをパースしてargcとargvを生成しよう
の前にシリアルポートでもプロンプトを表示させよう
キーが入力された時の動作もshell.cに統合するか
Virtual Boxで実行時にtest0.txtのみ正常に表示されないバグ
load_file関数の直前に命令文を入れると消えるハイゼンバグ 今はまだファイル数が少ないのでこのバグは後回しにしよう
シリアル出力
kernel.bin
updated time 2022/04/09 19:48:24
size 0x0001c370 bytes
cluster number 0x0011
に対して,kernel.mapを見ると,
.bss 0x0000000000122380 0x11c
COMMON 0x0000000000122380 0x18 disk.o
0x0000000000122380 first_sector
0x0000000000122384 cluster_size
0x0000000000122388 root_directory_entries
0x000000000012238c file_allocation_tables
0x0000000000122390 number_of_clusters
0x0000000000122394 cluster0
COMMON 0x0000000000122398 0x4 gdt.o
0x0000000000122398 kernel_code_segment_selector
0x000000000012239a whole_memory_segment_selector
COMMON 0x000000000012239c 0x4 graphic.o
0x000000000012239c vram
COMMON 0x00000000001223a0 0xc keyboard.o
0x00000000001223a0 keyboard_send_buffer
0x00000000001223a4 last_keyboard_transmission
0x00000000001223a8 keyboard_interrupt_queue
COMMON 0x00000000001223ac 0x4 memory.o
0x00000000001223ac root_memory_section
COMMON 0x00000000001223b0 0x1c mouse.o
0x00000000001223b0 mouse_event
0x00000000001223c4 mouse_id
0x00000000001223c8 mouse_interrupt_queue
COMMON 0x00000000001223cc 0x4 pit.o
0x00000000001223cc pit_interrupt_queue
COMMON 0x00000000001223d0 0x5 rtc.o
0x00000000001223d0 rtc_interrupt_queue
0x00000000001223d4 status_register_b
*fill* 0x00000000001223d5 0x3
COMMON 0x00000000001223d8 0x8 serial.o
0x00000000001223d8 serial_interrupt_queue
0x00000000001223dc com1_transmission_queue
COMMON 0x00000000001223e0 0xbc task.o
0x00000000001223e0 main_task_level
0x00000000001223f0 current_task_level
0x00000000001223f4 highest_task_level
0x0000000000122400 main_task
0x0000000000122498 lowest_task_level
test0.txtは0x00122400に読み込まれているが,それとmain_task, lowest_task_levelが重なってしまっている.
システムコールexitを実装しよう
ELFフォーマットについて勉強しよう
ELF magic number is correct.
ELF sign is "ELF".
32 bits CPU
Endian = Little endian
ELF header version = 0x01
ABI = 0x00
Ability = Executable
Instruction set = x86
ELF version = 0x00000001
Entry point = 0x08049018
Program header table = 0x00000034
Section header table = 0x00003198
Flags = 0x00000000
Header size = 0x0034
Program header table entry size = 0x0020
Number of program header table entries = 0x0007
Section header table entry size = 0x0028
Number of section header table entries = 0x0009
Section names entry index = 0x0008
ELF magic number is correct.
ELF sign is "ELF".
32 bits CPU
Endian = Little endian
ELF header version = 0x01
ABI = 0x00
Ability = Executable
Instruction set = x86
ELF version = 0x00000001
Entry point = 0x08049018
Program header = 0x00000034
Section header = 0x00003198
Flags = 0x00000000
ELF header size = 0x0034
Program header size = 0x0020
Number of program headers = 0x0007
Section header size = 0x0028
Number of section headers = 0x0009
Section names header index = 0x0008
Program Header [0x0000]
Segment type Load
Offset in file = 0x00000000
Deployment destination = 0x08048000
Size in file = 0x0000013c
Size in memory = 0x0000013c
Flags : Readable
Alignment = 0x00001000
Program Header [0x0001]
Segment type Load
Offset in file = 0x00001000
Deployment destination = 0x08049000
Size in file = 0x00000036
Size in memory = 0x00000036
Flags : Executable Readable
Alignment = 0x00001000
Program Header [0x0002]
Segment type Load
Offset in file = 0x00002000
Deployment destination = 0x0804a000
Size in file = 0x00000070
Size in memory = 0x00000070
Flags : Readable
Alignment = 0x00001000
Program Header [0x0003]
Segment type Load
Offset in file = 0x00003000
Deployment destination = 0x0804c000
Size in file = 0x0000000c
Size in memory = 0x0000000c
Flags : Writable Readable
Alignment = 0x00001000
Program Header [0x0004]
Segment type Note
Offset in file = 0x00000114
Deployment destination = 0x08048114
Size in file = 0x00000028
Size in memory = 0x00000028
Flags : Readable
Alignment = 0x00000004
Program Header [0x0005]
Segment type Invalid
Offset in file = 0x00000114
Deployment destination = 0x08048114
Size in file = 0x00000028
Size in memory = 0x00000028
Flags : Readable
Alignment = 0x00000004
Program Header [0x0006]
Segment type Invalid
Offset in file = 0x00000000
Deployment destination = 0x00000000
Size in file = 0x00000000
Size in memory = 0x00000000
Flags : Writable Readable
Alignment = 0x00000010
Section Header [0x0000]
Name index = 0x00000000
Segment type NULL
Flags :
Deployment destination = 0x00000000
Offset in file = 0x00000000
Size = 0x00000000
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000000
Entry size = 0x00000000
Section Header [0x0001]
Name index = 0x0000001b
Segment type NOTE
Flags : ALLOC
Deployment destination = 0x08048114
Offset in file = 0x00000114
Size = 0x00000028
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000004
Entry size = 0x00000000
Section Header [0x0002]
Name index = 0x0000002e
Segment type PROGBITS
Flags : ALLOC EXECINSTR
Deployment destination = 0x08049000
Offset in file = 0x00001000
Size = 0x00000036
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000001
Entry size = 0x00000000
Section Header [0x0003]
Name index = 0x00000034
Segment type PROGBITS
Flags : ALLOC
Deployment destination = 0x0804a000
Offset in file = 0x00002000
Size = 0x00000070
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000004
Entry size = 0x00000000
Section Header [0x0004]
Name index = 0x0000003e
Segment type PROGBITS
Flags : WRITE ALLOC
Deployment destination = 0x0804c000
Offset in file = 0x00003000
Size = 0x0000000c
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000004
Entry size = 0x00000004
Section Header [0x0005]
Name index = 0x00000047
Segment type PROGBITS
Flags : MERGE STRINGS
Deployment destination = 0x00000000
Offset in file = 0x0000300c
Size = 0x00000031
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000001
Entry size = 0x00000001
Section Header [0x0006]
Name index = 0x00000001
Segment type SYMTAB
Flags :
Deployment destination = 0x00000000
Offset in file = 0x00003040
Size = 0x000000b0
Linked section header index = 0x00000007
Extra information = 0x00000005
Alignment = 0x00000004
Entry size = 0x00000010
Section Header [0x0007]
Name index = 0x00000009
Segment type STRTAB
Flags :
Deployment destination = 0x00000000
Offset in file = 0x000030f0
Size = 0x00000056
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000001
Entry size = 0x00000000
Section Header [0x0008]
Name index = 0x00000011
Segment type STRTAB
Flags :
Deployment destination = 0x00000000
Offset in file = 0x00003146
Size = 0x00000050
Linked section header index = 0x00000000
Extra information = 0x00000000
Alignment = 0x00000001
Entry size = 0x00000000
メモリの二重開放がどこかで起きている
com_taskの作成していないタスクキューを開放している
コンソール画面を実装しよう