对于某些编译器,有一个结构的打包说明符,例如::
RealView ARM compiler has "__packed" Gnu C Compiler has "__attribute__ ((__packed__))" Visual C++ has no equivalent, it only has the "#pragma pack(1)"
我需要一些我可以放入结构定义的东西.
任何信息/黑客/建议?TIA ...
我处于以当前权限级别(CPL = 0)运行的32位保护模式.我试图通过将EFLAGS.VM(位17)标志设置为1(和IOPL为0)并对我的16位实模式代码执行FAR JMP来进入v8086模式.我使用当前的标志PUSHF; 将EFLAGS.VM(第17位)设置为1; 将EFLAGS.IOPL(第22位和第23位)设置为0; 设置新的EFLAGS POPF.这个代码看起来像:
bits 32
cli
[snip]
pushf ; Get current EFLAGS
pop eax
or eax, 1<<EFLAGS_VM_BIT ; Set VM flag to enter v8086 mode
and eax, ~(3<<EFLAGS_IOPL_BITS)
; Set IOPL to 0
; IF flag already 0 because of earlier CLI
push eax
popf ; Reload new flags
jmp CODE32_SEL:v86_mode_entry
; Far JMP to v8086 entry point
; v8086 code entry point
bits 16
v86_mode_entry:
hlt ; Halt should double fault …Run Code Online (Sandbox Code Playgroud) 当我的页面错误处理程序中断被调用时(它应该挂起系统),在调用之前有一些变量被推送到堆栈中。我启用了虚拟内存,当我设置一个无效的堆栈指针(esp)并且 int14 处理程序被调用时,它会立即导致另一个页面错误等等。我应该如何解决这种情况?
我的 int14 代码:
isr14:
; interrupt handler for isr14
jmp $
iretd
Run Code Online (Sandbox Code Playgroud)
导致它中断的代码:
mov esp, 0x1000 ; 0x1000 is not mapped in the VM directory
push dword 'A'
jmp $
Run Code Online (Sandbox Code Playgroud)
我的 IDT 表的部分:
irq14:
dw isr14
dw 0x0008
db 0x00
db 10101110b
dw 0x0000
irq15:
........
Run Code Online (Sandbox Code Playgroud)