Last patch of the vm86 patch series from Jan Klötzke - thanks!:

* The new function vm86_do_int(struct vm86_state *state, uint8 vec) provides a
  facility to call BIOS interupt handlers. The function must only be called from
  a user thread context because the lower 1MB of the address space is used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25610 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-05-22 13:54:28 +00:00
parent 7da0a81c0e
commit 15173df4e9
7 changed files with 828 additions and 0 deletions
@@ -157,6 +157,37 @@ struct iframe {
uint32 user_ss;
};
struct vm86_iframe {
uint32 type; // iframe type
uint32 __null_gs;
uint32 __null_fs;
uint32 __null_es;
uint32 __null_ds;
uint32 edi;
uint32 esi;
uint32 ebp;
uint32 __kern_esp;
uint32 ebx;
uint32 edx;
uint32 ecx;
uint32 eax;
uint32 orig_eax;
uint32 orig_edx;
uint32 vector;
uint32 error_code;
uint32 eip;
uint16 cs, __csh;
uint32 flags;
uint32 esp;
uint16 ss, __ssh;
/* vm86 mode specific part */
uint16 es, __esh;
uint16 ds, __dsh;
uint16 fs, __fsh;
uint16 gs, __gsh;
};
#define IFRAME_IS_USER(f) ( ((f)->cs == USER_CODE_SEG) \
|| (((f)->flags & 0x20000) != 0 ))
#define IFRAME_IS_VM86(f) ( ((f)->flags & 0x20000) != 0 )
+38
View File
@@ -0,0 +1,38 @@
/*
* Copyright 2008 Jan Klötzke
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _VM86_H
#define _VM86_H
#include <OS.h>
#include <arch_cpu.h>
#ifdef __cplusplus
extern "C" {
#endif
#define VM86_MIN_RAM_SIZE 0x1000
#define RETURN_TO_32_INT 255
struct vm86_state {
struct vm86_iframe regs;
area_id bios_area;
area_id ram_area;
unsigned int if_flag : 1;
};
status_t x86_vm86_enter(struct vm86_iframe *frame);
void x86_vm86_return(struct vm86_iframe *frame, status_t retval);
status_t vm86_prepare(struct vm86_state *state, unsigned int ram_size);
void vm86_cleanup(struct vm86_state *state);
status_t vm86_do_int(struct vm86_state *state, uint8 vec);
#ifdef __cplusplus
}
#endif
#endif