123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /*
- * vm86.h
- *
- * Copyright (C) 2016 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef _VM86_H_
- #define _VM86_H_
- #include <common.h>
- #include <thread.h>
- #include <interrupt.h>
- #define EFLAGS_VM (1<<17)
- #define EFLAGS_IF (1<<9)
- #define EFLAGS_DF (1<<10)
- #define PREFIX_LOCK (1<<0)
- #define PREFIX_OPSIZE (1<<1)
- #define PREFIX_ADDRSIZE (1<<2)
- #define PREFIX_REP (1<<3)
- #define PREFIX_REPNZ (1<<4)
- #define PREFIX_ES (1<<5)
- #define PREFIX_SS (1<<6)
- #define PREFIX_FS (1<<7)
- #define PREFIX_GS (1<<8)
- #define VM86_MEM_START 0x10000
- #define VM86_MEM_END 0x90000
- #define VM86_MEM_PARAGRAPHS ((VM86_MEM_END - VM86_MEM_START) >> 4)
- #define VM86_TRAMPOLINE_CS 0x0000
- #define VM86_TRAMPOLINE_IP 0xE000
- #define VM86_TRAMPOLINE_SS 0x0000
- #define VM86_TRAMPOLINE_SP 0xDFFA
- typedef struct
- {
- dword_t edi, esi, ebp, unused, ebx, edx, ecx, eax;
- dword_t eip, cs, eflags, esp, ss, es, ds, fs, gs;
- } vm86_registers_t;
- word_t vm86_alloc(word_t size);
- void vm86_free(word_t paragraph);
- void vm86_handler(registers_ext_vm86_t *regs);
- dword_t vm86_interrupt(byte_t number, vm86_registers_t *regs);
- #endif
|