| Код | use16
mov ax, 7C0h mov ds, ax
mov ah, 02h mov al, 07h mov ch, 00h mov cl, 02h mov dh, 00h xor si, si mov bx, 0h
int 13h
jmp 0000:7E00h
;этот код считан по адресу 0000:7E00h mov ax, 7C0h mov ds, ax mov es, ax
movups xmm0, [128]
.......... ........
|
В общем, прога вполне рабочая. До тех пор, пока не воткну movups
Лог Bochs (там можно увидеть, в частности, какие инструкции поддерживает процессор):
| Код | 00000000000i[ ] Bochs x86 Emulator 2.6.7 00000000000i[ ] Built from SVN snapshot on November 2, 2014 00000000000i[ ] Compiled on Nov 2 2014 at 09:29:40 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[ ] SMP support: no 00000000000i[ ] level: 6 00000000000i[ ] APIC support: xapic 00000000000i[ ] FPU support: yes 00000000000i[ ] MMX support: yes 00000000000i[ ] 3dnow! support: no 00000000000i[ ] SEP support: yes 00000000000i[ ] SIMD support: sse2 00000000000i[ ] XSAVE support: no 00000000000i[ ] AES support: no 00000000000i[ ] SHA 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[ ] VMX support: 1 00000000000i[ ] Optimization configuration 00000000000i[ ] RepeatSpeedups support: yes 00000000000i[ ] Fast function calls: yes 00000000000i[ ] Handlers Chaining speedups: yes 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 voodoo 00000000000i[MEM0 ] allocated memory at 03C4C020. after alignment, vector=03C4D000 00000000000i[MEM0 ] 32,00MB 00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32 00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('C:\Program Files (x86)\Bochs-2.6.7/BIOS-bochs-latest') 00000000000i[SNDLOW] Sound lowlevel module 'win' initialized 00000000000i[PLUGIN] init_dev of 'pci' plugin device by virtual method 00000000000i[DEV ] i440FX PMC present at device 0, function 0 00000000000i[PLUGIN] init_dev of 'pci2isa' plugin device by virtual method 00000000000i[DEV ] PIIX3 PCI-to-ISA bridge present at device 1, function 0 00000000000i[PLUGIN] init_dev of 'cmos' plugin device by virtual method 00000000000i[CMOS ] Using local time for initial clock 00000000000i[CMOS ] Setting initial clock to: Fri May 01 00:30:44 2015 (time0=1430429444) 00000000000i[PLUGIN] init_dev of 'dma' plugin device by virtual method 00000000000i[DMA ] channel 4 used by cascade 00000000000i[PLUGIN] init_dev of 'pic' plugin device by virtual method 00000000000i[PLUGIN] init_dev of 'pit' plugin device by virtual method 00000000000i[PLUGIN] init_dev of 'vga' plugin device by virtual method 00000000000i[MEM0 ] Register memory access handlers: 0x0000000a0000 - 0x0000000bffff 00000000000i[VGA ] interval=200000 00000000000i[MEM0 ] Register memory access handlers: 0x0000e0000000 - 0x0000e0ffffff 00000000000i[BXVGA ] VBE Bochs Display Extension Enabled 00000000000i[WINGUI] Desktop Window dimensions: 1920 x 1080 00000000000i[WINGUI] Number of Mouse Buttons = 3 00000000000i[WINGUI] IME disabled 00000000000i[MEM0 ] rom at 0xc0000/41472 ('C:\Program Files (x86)\Bochs-2.6.7/VGABIOS-lgpl-latest') 00000000000i[PLUGIN] init_dev of 'floppy' plugin device by virtual method 00000000000i[DMA ] channel 2 used by Floppy Drive 00000000000i[PLUGIN] init_dev of 'acpi' plugin device by virtual method 00000000000i[DEV ] ACPI Controller present at device 1, function 3 00000000000i[PLUGIN] init_dev of 'ioapic' plugin device by virtual method 00000000000i[IOAPIC] initializing I/O APIC 00000000000i[MEM0 ] Register memory access handlers: 0x0000fec00000 - 0x0000fec00fff 00000000000i[IOAPIC] IOAPIC enabled (base address = 0xfec00000) 00000000000i[PLUGIN] init_dev of 'keyboard' plugin device by virtual method 00000000000i[KBD ] will paste characters every 400 keyboard ticks 00000000000i[PLUGIN] init_dev of 'harddrv' plugin device by virtual method 00000000000i[HD ] HD on ata0-0: 'C:\Users\S\Documents\dfdfdf.BIN', 'flat' mode 00000000000i[IMG ] hd_size: 4096 00000000000i[HD ] ata0-0: using specified geometry: CHS=1/1/8 00000000000i[HD ] translation on ata0-0 set to 'none' 00000000000i[HD ] Using boot sequence disk, none, none 00000000000i[HD ] Floppy boot signature check is enabled 00000000000i[PLUGIN] init_dev of 'pci_ide' plugin device by virtual method 00000000000i[DEV ] PIIX3 PCI IDE controller present at device 1, function 1 00000000000i[PLUGIN] init_dev of 'unmapped' plugin device by virtual method 00000000000i[PLUGIN] init_dev of 'biosdev' plugin device by virtual method 00000000000i[PLUGIN] init_dev of 'speaker' plugin device by virtual method 00000000000i[PCSPK ] Using lowlevel sound support for output 00000000000i[PLUGIN] init_dev of 'extfpuirq' plugin device by virtual method 00000000000i[PLUGIN] init_dev of 'parallel' plugin device by virtual method 00000000000i[PAR ] parallel port 1 at 0x0378 irq 7 00000000000i[PLUGIN] init_dev of 'serial' plugin device by virtual method 00000000000i[SER ] com1 at 0x03f8 irq 4 (mode: null) 00000000000i[PLUGIN] init_dev of 'gameport' plugin device by virtual method 00000000000i[PLUGIN] init_dev of 'usb_uhci' plugin device by virtual method 00000000000i[DEV ] Experimental USB UHCI present at device 1, function 2 00000000000i[UHCI ] USB UHCI initialized 00000000000i[PLUGIN] register state of 'pci' plugin device by virtual method 00000000000i[PLUGIN] register state of 'pci2isa' plugin device by virtual method 00000000000i[PLUGIN] register state of 'cmos' plugin device by virtual method 00000000000i[PLUGIN] register state of 'dma' plugin device by virtual method 00000000000i[PLUGIN] register state of 'pic' plugin device by virtual method 00000000000i[PLUGIN] register state of 'pit' plugin device by virtual method 00000000000i[PLUGIN] register state of 'vga' plugin device by virtual method 00000000000i[PLUGIN] register state of 'floppy' plugin device by virtual method 00000000000i[PLUGIN] register state of 'unmapped' plugin device by virtual method 00000000000i[PLUGIN] register state of 'biosdev' plugin device by virtual method 00000000000i[PLUGIN] register state of 'speaker' plugin device by virtual method 00000000000i[PLUGIN] register state of 'extfpuirq' plugin device by virtual method 00000000000i[PLUGIN] register state of 'parallel' plugin device by virtual method 00000000000i[PLUGIN] register state of 'serial' plugin device by virtual method 00000000000i[PLUGIN] register state of 'gameport' plugin device by virtual method 00000000000i[PLUGIN] register state of 'usb_uhci' plugin device by virtual method 00000000000i[PLUGIN] register state of 'acpi' plugin device by virtual method 00000000000i[PLUGIN] register state of 'ioapic' plugin device by virtual method 00000000000i[PLUGIN] register state of 'keyboard' plugin device by virtual method 00000000000i[PLUGIN] register state of 'harddrv' plugin device by virtual method 00000000000i[PLUGIN] 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 0x0000fee00000 00000000000i[CPU0 ] CPUID[0x00000000]: 00000005 756e6547 6c65746e 49656e69 00000000000i[CPU0 ] CPUID[0x00000001]: 00000633 00010800 00002028 1fcbfbff 00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000 00000000000i[CPU0 ] CPUID[0x00000005]: 00000040 00000040 00000003 00000020 00000000000i[PLUGIN] reset of 'pci' plugin device by virtual method 00000000000i[PLUGIN] reset of 'pci2isa' plugin device by virtual method 00000000000i[PLUGIN] reset of 'cmos' plugin device by virtual method 00000000000i[PLUGIN] reset of 'dma' plugin device by virtual method 00000000000i[PLUGIN] reset of 'pic' plugin device by virtual method 00000000000i[PLUGIN] reset of 'pit' plugin device by virtual method 00000000000i[PLUGIN] reset of 'vga' plugin device by virtual method 00000000000i[PLUGIN] reset of 'floppy' plugin device by virtual method 00000000000i[PLUGIN] reset of 'acpi' plugin device by virtual method 00000000000i[PLUGIN] reset of 'ioapic' plugin device by virtual method 00000000000i[PLUGIN] reset of 'keyboard' plugin device by virtual method 00000000000i[PLUGIN] reset of 'harddrv' plugin device by virtual method 00000000000i[PLUGIN] reset of 'pci_ide' plugin device by virtual method 00000000000i[PLUGIN] reset of 'unmapped' plugin device by virtual method 00000000000i[PLUGIN] reset of 'biosdev' plugin device by virtual method 00000000000i[PLUGIN] reset of 'speaker' plugin device by virtual method 00000000000i[PLUGIN] reset of 'extfpuirq' plugin device by virtual method 00000000000i[PLUGIN] reset of 'parallel' plugin device by virtual method 00000000000i[PLUGIN] reset of 'serial' plugin device by virtual method 00000000000i[PLUGIN] reset of 'gameport' plugin device by virtual method 00000000000i[PLUGIN] reset of 'usb_uhci' plugin device by virtual method 00000004634i[BIOS ] $Revision: 12412 $ $Date: 2014-07-10 09:28:59 +0200 (Do, 10. Jul 2014) $ 00000318038i[KBD ] reset-disable command received 00000320732i[BIOS ] Starting rombios32 00000321175i[BIOS ] Shutdown flag 0 00000321738i[BIOS ] ram_size=0x02000000 00000322194i[BIOS ] ram_end=32MB 00000637664i[WINGUI] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8 00001179654i[BIOS ] Found 1 cpu(s) 00001193718i[BIOS ] bios_table_addr: 0x000fa498 end=0x000fcc00 00001521001i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush) 00001849636i[P2ISA ] PCI IRQ routing: PIRQA# set to 0x0b 00001849662i[P2ISA ] PCI IRQ routing: PIRQB# set to 0x09 00001849662i[P2ISA ] PCI IRQ routing: PIRQC# set to 0x0b 00001849662i[P2ISA ] PCI IRQ routing: PIRQD# set to 0x09 00001849662i[P2ISA ] write: ELCR2 = 0x0a 00001850349i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a 00001858002i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600 00001860146i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601 00001862264i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101 00001862811i[PIDE ] new BM-DMA address: 0xc000 00001863350i[BIOS ] region 4: 0x0000c000 00001865116i[BIOS ] PCI: bus=0 devfn=0x0a: vendor_id=0x8086 device_id=0x7020 class=0x0c03 00001865474i[UHCI ] new base address: 0xc020 00001866177i[BIOS ] region 4: 0x0000c020 00001866377i[UHCI ] new irq line = 9 00001868002i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680 00001868504i[ACPI ] new irq line = 11 00001868538i[ACPI ] new irq line = 9 00001868557i[ACPI ] new PM base address: 0xb000 00001868557i[ACPI ] new SM base address: 0xb100 00001868589i[PCI ] setting SMRAM control register to 0x4a 00002032707i[CPU0 ] Enter to System Management Mode 00002032707i[CPU0 ] enter_system_management_mode: temporary disable VMX while in SMM mode 00002032711i[CPU0 ] RSM: Resuming from System Management Mode 00002196733i[PCI ] setting SMRAM control register to 0x0a 00002211339i[BIOS ] MP table addr=0x000fa570 MPC table addr=0x000fa4a0 size=0xc8 00002213321i[BIOS ] SMBIOS table addr=0x000fa580 00002215292i[BIOS ] ACPI tables: RSDP addr=0x000fa6a0 ACPI DATA addr=0x01ff0000 size=0xf72 00002218693i[BIOS ] Firmware waking vector 0x1ff00cc 00002220635i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush) 00002221216i[BIOS ] bios_table_cur_addr: 0x000fa6c4 00002348973i[VBIOS ] VGABios $Id: vgabios.c,v 1.76 2013/02/10 08:07:03 vruppert Exp $
00002349058i[BXVGA ] VBE known Display Interface b0c0 00002349077i[BXVGA ] VBE known Display Interface b0c5 00002352001i[VBIOS ] VBE Bios $Id: vbe.c,v 1.65 2014/07/08 18:02:25 vruppert Exp $ 00002695845i[BIOS ] ata0-0: PCHS=1/1/8 translation=none LCHS=1/1/8 00006573000i[BIOS ] IDE time out 00018720405i[BIOS ] Booting from 0000:7c00
|
Ну и да, падает не при компиляции, конечно же, а во время выполнения.
Вот если я вставляю команду, когда перешел в защищенный режим:
| Код | mov eax, esi
add eax, 32; p1 mov ebx, eax add ebx, 4 * 4 ;matrix mov edx, ebx add edx, 32 * 4 ;result finit
;filling matrix fldz mov ecx, 16 fill_matr: fst dword [ebx] add ebx, 4 loop fill_matr sub ebx, 16 * 4 fld1 fst dword [ebx] fst dword [ebx + 4 * 4] fst dword [ebx + 8 * 4] fst dword [ebx + 12 * 4]
;filling vector fild word [si] fstp dword [eax] fild word [si + 2] fstp dword [eax + 4] fldz fstp dword [eax + 8] fld1 fstp dword [eax + 12] movups xmm0, [eax]
|
Лог:
| Код | 00112836024i[BIOS ] Booting from 0000:7c00 00112941191e[CPU0 ] interrupt(): gate.type(9) != {5,6,7,14,15} 00112941191e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d) 00112941191e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08) 00112941191i[CPU0 ] CPU is in protected mode (active) 00112941191i[CPU0 ] CS.mode = 32 bit 00112941191i[CPU0 ] SS.mode = 16 bit 00112941191i[CPU0 ] EFER = 0x00000000 00112941191i[CPU0 ] | EAX=00000020 EBX=00000030 ECX=00000000 EDX=000000b0 00112941191i[CPU0 ] | ESP=0000fff0 EBP=0000ffec ESI=00000000 EDI=00000200 00112941191i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf 00112941191i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D 00112941191i[CPU0 ] | CS:0008( 0001| 0| 0) 00007c00 0000ffff 0 1 00112941191i[CPU0 ] | DS:0030( 0006| 0| 0) 00100000 000fffff 0 1 00112941191i[CPU0 ] | SS:0010( 0002| 0| 0) 00008ea6 00000400 0 0 00112941191i[CPU0 ] | ES:0028( 0005| 0| 0) 000a0000 0000ffff 0 0 00112941191i[CPU0 ] | FS:0000( 0005| 0| 0) 00000000 0000ffff 0 0 00112941191i[CPU0 ] | GS:0000( 0005| 0| 0) 00000000 0000ffff 0 0 00112941191i[CPU0 ] | EIP=0000049f (0000049f) 00112941191i[CPU0 ] | CR0=0x60000011 CR2=0x00000000 00112941191i[CPU0 ] | CR3=0x00000000 CR4=0x00000000 00112941191i[CPU0 ] 0x000000000000049f>> movups xmm0, dqword ptr ds:[eax] : 0F1000 00112941191e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting 00112941191i[SYS ] bx_pc_system_c::Reset(HARDWARE) called 00112941191i[CPU0 ] cpu hardware reset
|
|