yyu / osfs01

Operating System From Scratch : learn OS by practice
52 stars 26 forks source link

Ubuntu 17.04 #4

Open pxc3113 opened 7 years ago

pxc3113 commented 7 years ago

zhiwei@zhiwei-Lenovo-Rescuer-15ISK:~/osfs01-master$ make gzip -cd a.img.gz > a.img nasm boot.asm -o boot.bin dd if=boot.bin of=a.img bs=512 count=1 conv=notrunc 1+0 records in 1+0 records out 512 bytes copied, 8.446e-05 s, 6.1 MB/s bochs

                    Bochs x86 Emulator 2.6
        Built from SVN snapshot on September 2nd, 2012

======================================================================== 00000000000i[ ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins' 00000000000i[ ] BXSHARE not set. using compile time default '/usr/share/bochs' 00000000000i[ ] lt_dlhandle is 0x3ab85c0 00000000000i[PLGIN] loaded plugin libbx_unmapped.so 00000000000i[ ] lt_dlhandle is 0x3ab9100 00000000000i[PLGIN] loaded plugin libbx_biosdev.so 00000000000i[ ] lt_dlhandle is 0x3ab9a80 00000000000i[PLGIN] loaded plugin libbx_speaker.so 00000000000i[ ] lt_dlhandle is 0x3ab9e30 00000000000i[PLGIN] loaded plugin libbx_extfpuirq.so 00000000000i[ ] lt_dlhandle is 0x3ab9fd0 00000000000i[PLGIN] loaded plugin libbx_parallel.so 00000000000i[ ] lt_dlhandle is 0x3abd640 00000000000i[PLGIN] loaded plugin libbx_serial.so 00000000000i[ ] lt_dlhandle is 0x3ac1220 00000000000i[PLGIN] loaded plugin libbx_gameport.so 00000000000i[ ] lt_dlhandle is 0x3ac1cc0 00000000000i[PLGIN] loaded plugin libbx_iodebug.so 00000000000i[ ] reading configuration from bochsrc 00000000000e[ ] bochsrc:25: 'keyboard_mapping' will be replaced by new 'keyboard' option. 00000000000i[ ] lt_dlhandle is (nil) 00000000000p[ ] >>PANIC<< dlopen failed for module 'x': file not found

Event type: PANIC Device: [ ] Message: dlopen failed for module 'x': file not found

A PANIC has occurred. Do you want to: cont - continue execution alwayscont - continue execution, and don't ask again. This affects only PANIC events from device [ ] die - stop execution now abort - dump core debug - continue and return to bochs debugger Choose one of the actions above: [die]

arturaugusto commented 6 years ago

same here.

running on:

Linux artpc 4.11.0-14-generic #20~16.04.1-Ubuntu SMP Wed Aug 9 09:06:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

NASM version 2.11.08

Bochs x86 Emulator 2.6 Built from SVN snapshot on September 2nd, 2012

make output:

gzip -cd a.img.gz > a.img
nasm boot.asm -o boot.bin
dd if=boot.bin of=a.img bs=512 count=1 conv=notrunc
1+0 records in
1+0 records out
512 bytes copied, 8,0473e-05 s, 6,4 MB/s
bochs
========================================================================
                        Bochs x86 Emulator 2.6
            Built from SVN snapshot on September 2nd, 2012
========================================================================
00000000000i[     ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins'
00000000000i[     ] BXSHARE not set. using compile time default '/usr/share/bochs'
00000000000i[     ] lt_dlhandle is 0x3b244a0
00000000000i[PLGIN] loaded plugin libbx_unmapped.so
00000000000i[     ] lt_dlhandle is 0x3b25100
00000000000i[PLGIN] loaded plugin libbx_biosdev.so
00000000000i[     ] lt_dlhandle is 0x3b25a80
00000000000i[PLGIN] loaded plugin libbx_speaker.so
00000000000i[     ] lt_dlhandle is 0x3b25e30
00000000000i[PLGIN] loaded plugin libbx_extfpuirq.so
00000000000i[     ] lt_dlhandle is 0x3b27990
00000000000i[PLGIN] loaded plugin libbx_parallel.so
00000000000i[     ] lt_dlhandle is 0x3b29640
00000000000i[PLGIN] loaded plugin libbx_serial.so
00000000000i[     ] lt_dlhandle is 0x3b2d220
00000000000i[PLGIN] loaded plugin libbx_gameport.so
00000000000i[     ] lt_dlhandle is 0x3b2dcc0
00000000000i[PLGIN] loaded plugin libbx_iodebug.so
00000000000i[     ] reading configuration from bochsrc
00000000000e[     ] bochsrc:25: 'keyboard_mapping' will be replaced by new 'keyboard' option.
00000000000i[     ] lt_dlhandle is (nil)
00000000000p[     ] >>PANIC<< dlopen failed for module 'x': file not found
========================================================================
Event type: PANIC
Device: [     ]
Message: dlopen failed for module 'x': file not found

A PANIC has occurred.  Do you want to:
  cont       - continue execution
  alwayscont - continue execution, and don't ask again.
               This affects only PANIC events from device [     ]
  die        - stop execution now
  abort      - dump core 
  debug      - continue and return to bochs debugger
Choose one of the actions above: [die] 
00000000000i[CPU0 ] CPU is in real mode (active)
00000000000i[CPU0 ] CS.mode = 16 bit
00000000000i[CPU0 ] SS.mode = 16 bit
00000000000i[CPU0 ] EFER   = 0x00000000
00000000000i[CPU0 ] | EAX=00000000  EBX=00000000  ECX=00000000  EDX=00000000
00000000000i[CPU0 ] | ESP=00000000  EBP=00000000  ESI=00000000  EDI=00000000
00000000000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf ZF af PF cf
00000000000i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00000000000i[CPU0 ] |  CS:0000( 0000| 0|  0) 00000000 00000000 0 0
00000000000i[CPU0 ] |  DS:0000( 0000| 0|  0) 00000000 00000000 0 0
00000000000i[CPU0 ] |  SS:0000( 0000| 0|  0) 00000000 00000000 0 0
00000000000i[CPU0 ] |  ES:0000( 0000| 0|  0) 00000000 00000000 0 0
00000000000i[CPU0 ] |  FS:0000( 0000| 0|  0) 00000000 00000000 0 0
00000000000i[CPU0 ] |  GS:0000( 0000| 0|  0) 00000000 00000000 0 0
00000000000i[CPU0 ] | EIP=00000000 (00000000)
00000000000i[CPU0 ] | CR0=0x00000000 CR2=0x00000000
00000000000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
bx_dbg_read_linear: physical memory read error (phy=0x0000000000000000, lin=0x0000000000000000)
00000000000i[CTRL ] quit_sim called with exit code 1
Makefile:2: recipe for target 'run' failed
make: *** [run] Error 1
arturaugusto commented 6 years ago

On my linux mint system, I solved the problem installing bochs-x:

sudo apt-get install bochs-x

But now, I only get a black screen on the emulator when I run make.

this is the output:

gzip -cd a.img.gz > a.img
nasm boot.asm -o boot.bin
dd if=boot.bin of=a.img bs=512 count=1 conv=notrunc
1+0 records in
1+0 records out
512 bytes copied, 0,000230546 s, 2,2 MB/s
bochs
========================================================================
                        Bochs x86 Emulator 2.6
            Built from SVN snapshot on September 2nd, 2012
========================================================================
00000000000i[     ] LTDL_LIBRARY_PATH not set. using compile time default '/usr/lib/bochs/plugins'
00000000000i[     ] BXSHARE not set. using compile time default '/usr/share/bochs'
00000000000i[     ] lt_dlhandle is 0x32b04a0
00000000000i[PLGIN] loaded plugin libbx_unmapped.so
00000000000i[     ] lt_dlhandle is 0x32b1100
00000000000i[PLGIN] loaded plugin libbx_biosdev.so
00000000000i[     ] lt_dlhandle is 0x32b1a80
00000000000i[PLGIN] loaded plugin libbx_speaker.so
00000000000i[     ] lt_dlhandle is 0x32b1e30
00000000000i[PLGIN] loaded plugin libbx_extfpuirq.so
00000000000i[     ] lt_dlhandle is 0x32b3990
00000000000i[PLGIN] loaded plugin libbx_parallel.so
00000000000i[     ] lt_dlhandle is 0x32b5640
00000000000i[PLGIN] loaded plugin libbx_serial.so
00000000000i[     ] lt_dlhandle is 0x32b9220
00000000000i[PLGIN] loaded plugin libbx_gameport.so
00000000000i[     ] lt_dlhandle is 0x32b9cc0
00000000000i[PLGIN] loaded plugin libbx_iodebug.so
00000000000i[     ] reading configuration from bochsrc
00000000000e[     ] bochsrc:25: 'keyboard_mapping' will be replaced by new 'keyboard' option.
00000000000i[     ] lt_dlhandle is 0x32ba560
00000000000i[PLGIN] loaded plugin libbx_x.so
00000000000i[     ] installing x module as the Bochs GUI
00000000000i[     ] Bochs x86 Emulator 2.6
00000000000i[     ]   Built from SVN snapshot on September 2nd, 2012
00000000000i[     ] System configuration
00000000000i[     ]   processors: 1 (cores=1, HT threads=1)
00000000000i[     ]   A20 line support: yes
00000000000i[     ] IPS is set to 4000000
00000000000i[     ] CPU configuration
00000000000i[     ]   level: 6
00000000000i[     ]   SMP support: no
00000000000i[     ]   APIC support: xapic
00000000000i[     ]   FPU support: yes
00000000000i[     ]   MMX support: yes
00000000000i[     ]   3dnow! support: no
00000000000i[     ]   SEP support: yes
00000000000i[     ]   SSE support: sse2
00000000000i[     ]   XSAVE support: no 
00000000000i[     ]   AES support: no
00000000000i[     ]   MOVBE support: no
00000000000i[     ]   ADX support: no
00000000000i[     ]   x86-64 support: yes
00000000000i[     ]   1G paging support: no
00000000000i[     ]   MWAIT support: yes
00000000000i[     ]   AVX support: no
00000000000i[     ]   VMX support: 1
00000000000i[     ] Optimization configuration
00000000000i[     ]   RepeatSpeedups support: yes
00000000000i[     ]   Fast function calls: yes
00000000000i[     ]   Handlers Chaining speedups: no
00000000000i[     ] Devices configuration
00000000000i[     ]   NE2000 support: yes
00000000000i[     ]   PCI support: yes, enabled=yes
00000000000i[     ]   SB16 support: yes
00000000000i[     ]   USB support: yes
00000000000i[     ]   VGA extension support: vbe cirrus
00000000000i[MEM0 ] allocated memory at 0x7f8ec23e3010. after alignment, vector=0x7f8ec23e4000
00000000000i[MEM0 ] 32,00MB
00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32
00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('/usr/share/bochs/BIOS-bochs-latest')
00000000000i[     ] lt_dlhandle is 0x347e3c0
00000000000i[PLGIN] loaded plugin libbx_hdimage.so
00000000000i[     ] lt_dlhandle is 0x347ed50
00000000000i[PLGIN] loaded plugin libbx_pci.so
00000000000i[     ] lt_dlhandle is 0x347f8d0
00000000000i[PLGIN] loaded plugin libbx_pci2isa.so
00000000000i[     ] lt_dlhandle is 0x34802e0
00000000000i[PLGIN] loaded plugin libbx_acpi.so
00000000000i[     ] lt_dlhandle is 0x3480ce0
00000000000i[PLGIN] loaded plugin libbx_cmos.so
00000000000i[     ] lt_dlhandle is 0x3481620
00000000000i[PLGIN] loaded plugin libbx_dma.so
00000000000i[     ] lt_dlhandle is 0x34820b0
00000000000i[PLGIN] loaded plugin libbx_pic.so
00000000000i[     ] lt_dlhandle is 0x3482950
00000000000i[PLGIN] loaded plugin libbx_pit.so
00000000000i[     ] lt_dlhandle is 0x3483380
00000000000i[PLGIN] loaded plugin libbx_floppy.so
00000000000i[     ] lt_dlhandle is 0x3483f70
00000000000i[PLGIN] loaded plugin libbx_vga.so
00000000000i[     ] lt_dlhandle is 0x3484700
00000000000i[PLGIN] loaded plugin libbx_ioapic.so
00000000000i[     ] lt_dlhandle is 0x3485140
00000000000i[PLGIN] loaded plugin libbx_keyboard.so
00000000000i[     ] lt_dlhandle is 0x34859e0
00000000000i[PLGIN] loaded plugin libbx_harddrv.so
00000000000i[     ] lt_dlhandle is 0x3497ad0
00000000000i[PLGIN] loaded plugin libbx_pci_ide.so
00000000000i[PLGIN] init_dev of 'pci' plugin device by virtual method
00000000000i[PCI  ] 440FX Host bridge present at device 0, function 0
00000000000i[PLGIN] init_dev of 'pci2isa' plugin device by virtual method
00000000000i[PCI  ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
00000000000i[PLGIN] init_dev of 'cmos' plugin device by virtual method
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Sun Dec 31 13:32:53 2017 (time0=1514734373)
00000000000i[PLGIN] init_dev of 'dma' plugin device by virtual method
00000000000i[DMA  ] channel 4 used by cascade
00000000000i[PLGIN] init_dev of 'pic' plugin device by virtual method
00000000000i[PLGIN] init_dev of 'pit' plugin device by virtual method
00000000000i[PLGIN] init_dev of 'floppy' plugin device by virtual method
00000000000i[DMA  ] channel 2 used by Floppy Drive
00000000000i[FDD  ] fd0: 'a.img' ro=0, h=2,t=80,spt=18
00000000000i[PLGIN] init_dev of 'vga' plugin device by virtual method
00000000000i[MEM0 ] Register memory access handlers: 0x00000000000a0000 - 0x00000000000bffff
00000000000i[VGA  ] interval=200000
00000000000i[MEM0 ] Register memory access handlers: 0x00000000e0000000 - 0x00000000e0ffffff
00000000000i[BXVGA] VBE Bochs Display Extension Enabled
00000000000i[XGUI ] test_alloc_colors: 16 colors available out of 16 colors tried
00000000000i[XGUI ] font 8 wide x 16 high, display depth = 24
00000000000i[KMAP ] Loading keymap from '/usr/share/bochs/keymaps/x11-pc-us.map'
00000000000i[KMAP ] Loaded 168 symbols
00000000000i[MEM0 ] rom at 0xc0000/41472 ('/usr/share/vgabios/vgabios.bin')
00000000000i[PLGIN] init_dev of 'acpi' plugin device by virtual method
00000000000i[PCI  ] ACPI Controller present at device 1, function 3
00000000000i[PLGIN] init_dev of 'ioapic' plugin device by virtual method
00000000000i[IOAP ] initializing I/O APIC
00000000000i[MEM0 ] Register memory access handlers: 0x00000000fec00000 - 0x00000000fec00fff
00000000000i[PLGIN] init_dev of 'keyboard' plugin device by virtual method
00000000000i[KBD  ] will paste characters every 1000 keyboard ticks
00000000000i[PLGIN] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD   ] Using boot sequence floppy, none, none
00000000000i[HD   ] Floppy boot signature check is enabled
00000000000i[PLGIN] init_dev of 'pci_ide' plugin device by virtual method
00000000000i[PCI  ] PIIX3 PCI IDE controller present at device 1, function 1
00000000000i[PLGIN] init_dev of 'unmapped' plugin device by virtual method
00000000000i[PLGIN] init_dev of 'biosdev' plugin device by virtual method
00000000000i[PLGIN] init_dev of 'speaker' plugin device by virtual method
00000000000i[PLGIN] init_dev of 'extfpuirq' plugin device by virtual method
00000000000i[PLGIN] init_dev of 'parallel' plugin device by virtual method
00000000000i[PAR  ] parallel port 1 at 0x0378 irq 7
00000000000i[PLGIN] init_dev of 'serial' plugin device by virtual method
00000000000i[SER  ] com1 at 0x03f8 irq 4
00000000000i[PLGIN] init_dev of 'gameport' plugin device by virtual method
00000000000i[PLGIN] init_dev of 'iodebug' plugin device by virtual method
00000000000i[PLGIN] register state of 'pci' plugin device by virtual method
00000000000i[PLGIN] register state of 'pci2isa' plugin device by virtual method
00000000000i[PLGIN] register state of 'cmos' plugin device by virtual method
00000000000i[PLGIN] register state of 'dma' plugin device by virtual method
00000000000i[PLGIN] register state of 'pic' plugin device by virtual method
00000000000i[PLGIN] register state of 'pit' plugin device by virtual method
00000000000i[PLGIN] register state of 'floppy' plugin device by virtual method
00000000000i[PLGIN] register state of 'vga' plugin device by virtual method
00000000000i[PLGIN] register state of 'unmapped' plugin device by virtual method
00000000000i[PLGIN] register state of 'biosdev' plugin device by virtual method
00000000000i[PLGIN] register state of 'speaker' plugin device by virtual method
00000000000i[PLGIN] register state of 'extfpuirq' plugin device by virtual method
00000000000i[PLGIN] register state of 'parallel' plugin device by virtual method
00000000000i[PLGIN] register state of 'serial' plugin device by virtual method
00000000000i[PLGIN] register state of 'gameport' plugin device by virtual method
00000000000i[PLGIN] register state of 'iodebug' plugin device by virtual method
00000000000i[PLGIN] register state of 'acpi' plugin device by virtual method
00000000000i[PLGIN] register state of 'ioapic' plugin device by virtual method
00000000000i[PLGIN] register state of 'keyboard' plugin device by virtual method
00000000000i[PLGIN] register state of 'harddrv' plugin device by virtual method
00000000000i[PLGIN] register state of 'pci_ide' plugin device by virtual method
00000000000i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000
00000000000i[CPU0 ] CPUID[0x00000000]: 00000002 756e6547 6c65746e 49656e69
00000000000i[CPU0 ] CPUID[0x00000001]: 00000633 00010800 00002028 1fcbfbff
00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100000
00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00000000000i[CPU0 ] CPUID[0x80000005]: 01ff01ff 01ff01ff 40020140 40020140
00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000
00000000000i[PLGIN] reset of 'pci' plugin device by virtual method
00000000000i[PLGIN] reset of 'pci2isa' plugin device by virtual method
00000000000i[PLGIN] reset of 'cmos' plugin device by virtual method
00000000000i[PLGIN] reset of 'dma' plugin device by virtual method
00000000000i[PLGIN] reset of 'pic' plugin device by virtual method
00000000000i[PLGIN] reset of 'pit' plugin device by virtual method
00000000000i[PLGIN] reset of 'floppy' plugin device by virtual method
00000000000i[PLGIN] reset of 'vga' plugin device by virtual method
00000000000i[PLGIN] reset of 'acpi' plugin device by virtual method
00000000000i[PLGIN] reset of 'ioapic' plugin device by virtual method
00000000000i[PLGIN] reset of 'keyboard' plugin device by virtual method
00000000000i[PLGIN] reset of 'harddrv' plugin device by virtual method
00000000000i[PLGIN] reset of 'pci_ide' plugin device by virtual method
00000000000i[PLGIN] reset of 'unmapped' plugin device by virtual method
00000000000i[PLGIN] reset of 'biosdev' plugin device by virtual method
00000000000i[PLGIN] reset of 'speaker' plugin device by virtual method
00000000000e[SPEAK] Failed to open /dev/console: Permission denied
00000000000e[SPEAK] Deactivating beep on console
00000000000i[PLGIN] reset of 'extfpuirq' plugin device by virtual method
00000000000i[PLGIN] reset of 'parallel' plugin device by virtual method
00000000000i[PLGIN] reset of 'serial' plugin device by virtual method
00000000000i[PLGIN] reset of 'gameport' plugin device by virtual method
00000000000i[PLGIN] reset of 'iodebug' plugin device by virtual method
00000000000i[XGUI ] Mouse capture off
00000000000i[     ] set SIGINT handler to bx_debug_ctrlc_handler
Next at t=0
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b         ; ea5be000f0
00000000000i[XGUI ] Mouse capture off
<bochs:1> 
arturaugusto commented 6 years ago

Followed the bochs manual, and I was missing to press c on debugger to continue the emulation.