【问题标题】:Bochs Emulator -> Blinking Booting from Floppy?Bochs Emulator -> 从软盘启动时闪烁?
【发布时间】:2021-02-08 19:59:19
【问题描述】:

我的 Bochs 模拟器/汇编代码有问题,问题出在:

00060739512i[BIOS  ] Booting from 0000:7c00
00061082284e[CPU0  ] load_seg_reg(SS): not writable data segment
00061082284e[CPU0  ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00061082284e[CPU0  ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00061082284i[CPU0  ] CPU is in protected mode (active)
00061082284i[CPU0  ] CS.mode = 32 bit
00061082284i[CPU0  ] SS.mode = 16 bit
00061082284i[CPU0  ] EFER   = 0x00000000
00061082284i[CPU0  ] | EAX=60000008  EBX=00007e00  ECX=00090002  EDX=00000000
00061082284i[CPU0  ] | ESP=00007c00  EBP=00007c00  ESI=000e0000  EDI=0000ffac
00061082284i[CPU0  ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00061082284i[CPU0  ] | SEG sltr(index|ti|rpl)     base    limit G D
00061082284i[CPU0  ] |  CS:0008( 0001| 0|  0) 00000000 ffffffff 1 1
00061082284i[CPU0  ] |  DS:0008( 0001| 0|  0) 00000000 ffffffff 1 1
00061082284i[CPU0  ] |  SS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00061082284i[CPU0  ] |  ES:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00061082284i[CPU0  ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00061082284i[CPU0  ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00061082284i[CPU0  ] | EIP=00007e56 (00007e56)
00061082284i[CPU0  ] | CR0=0x60000011 CR2=0x00000000
00061082284i[CPU0  ] | CR3=0x00000000 CR4=0x00000000
00061082284i[CPU0  ] 0x0000000000007e56>> mov ss, ax : 8ED0
00061082284e[CPU0  ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting

gdt.asm

gdt_start:
    dd 0
    dd 0
gdt_codedesc:
    dw 0xFFFF       ; Limit
    dw 0x0000       ; Base (low)
    db 0x00         ; Base (medium)
    db 10011010b    ; Flags
    db 11001111b    ; Flags + Upper Limit
    db 0x00         ; Base (high)
gdt_datadesc:
    dw 0xFFFF
    dw 0x0000
    db 0x00
    db 10010010b
    db 11001111b
    db 0x00

gdt_end;

gdt_descriptor:
    gdt_size:
        dw gdt_end - gdt_start - 1
        dd gdt_start

codeseg equ gdt_codedesc - gdt_start
dataseg equ gdt_codedesc - gdt_start

ExtendedProgram.asm(这是主要的“类”(我是一名 Java 开发人员 :))所有事情都发生了,这也控制了 gdt.asm :))

[org 0x7e00]

jmp EnterProtectedMode

%include "gdt.asm"
%include "print.asm"

EnterProtectedMode:
    call EnableA20
    cli
    lgdt [gdt_descriptor]
    mov eax, cr0
    or eax, 1
    mov cr0, eax
    jmp codeseg:StartProtectedMode

EnableA20:
    in al, 0x92
    or al, 2
    out 0x92, al
    ret


[bits 32]
StartProtectedMode:
    
    mov ax, dataseg
    mov ds, ax
    mov ss, ax
    mov es, ax
    mov fs, ax
    mov gs, ax

    mov ebp, 0x90000
    mov esp, ebp

    mov[0xb8000], byte 'h'

    jmp $

times 2048-($-$$) db 0

有人知道如何解决这个问题吗?我正在关注本教程:https://www.youtube.com/watch?v=pXzortxPZR8&list=PLxN4E629pPnKKqYsNVXpmCza8l0Jb6l8-&index=4 感谢您的帮助!

【问题讨论】:

  • 代码需要在问题中
  • 已修复它@Joshua
  • -> 问题可以关闭了。我已经解决了!
  • 您可以自行删除。
  • @ЅΔDDEV 如果您愿意,也可以自行回答。

标签: assembly x86 nasm bochs


【解决方案1】:

codeseg equ gdt_codedesc - gdt_start dataseg equ gdt_ -> codedesc 必须是 datadesc - gdt_start

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-01
    相关资源
    最近更新 更多