Patch by Jan Klötzke:
* In vm86 mode CS will have arbitrary values so we check for both USER_CODE_SEG and the VM flag in EFLAGS. This is also done when entering interrupt gates. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25607 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -157,6 +157,10 @@ struct iframe {
|
|||||||
uint32 user_ss;
|
uint32 user_ss;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define IFRAME_IS_USER(f) ( ((f)->cs == USER_CODE_SEG) \
|
||||||
|
|| (((f)->flags & 0x20000) != 0 ))
|
||||||
|
#define IFRAME_IS_VM86(f) ( ((f)->flags & 0x20000) != 0 )
|
||||||
|
|
||||||
// features
|
// features
|
||||||
enum x86_feature_type {
|
enum x86_feature_type {
|
||||||
FEATURE_COMMON = 0, // cpuid eax=1, ecx register
|
FEATURE_COMMON = 0, // cpuid eax=1, ecx register
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ unexpected_exception(struct iframe* frame)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame->cs == USER_CODE_SEG) {
|
if (IFRAME_IS_USER(frame)) {
|
||||||
enable_interrupts();
|
enable_interrupts();
|
||||||
|
|
||||||
if (user_debug_exception_occurred(type, signal))
|
if (user_debug_exception_occurred(type, signal))
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ i386_get_user_iframe(void)
|
|||||||
struct iframe* frame = get_current_iframe();
|
struct iframe* frame = get_current_iframe();
|
||||||
|
|
||||||
while (frame != NULL) {
|
while (frame != NULL) {
|
||||||
if (frame->cs == USER_CODE_SEG)
|
if (IFRAME_IS_USER(frame))
|
||||||
return frame;
|
return frame;
|
||||||
frame = get_previous_iframe(frame);
|
frame = get_previous_iframe(frame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -778,7 +778,7 @@ x86_handle_debug_exception(struct iframe *frame)
|
|||||||
|
|
||||||
TRACE(("i386_handle_debug_exception(): DR6: %lx, DR7: %lx\n", dr6, dr7));
|
TRACE(("i386_handle_debug_exception(): DR6: %lx, DR7: %lx\n", dr6, dr7));
|
||||||
|
|
||||||
if (frame->cs != USER_CODE_SEG) {
|
if (!IFRAME_IS_USER(frame)) {
|
||||||
panic("debug exception in kernel mode: dr6: 0x%lx, dr7: 0x%lx", dr6,
|
panic("debug exception in kernel mode: dr6: 0x%lx, dr7: 0x%lx", dr6,
|
||||||
dr7);
|
dr7);
|
||||||
return;
|
return;
|
||||||
@@ -850,7 +850,7 @@ x86_handle_breakpoint_exception(struct iframe *frame)
|
|||||||
{
|
{
|
||||||
TRACE(("i386_handle_breakpoint_exception()\n"));
|
TRACE(("i386_handle_breakpoint_exception()\n"));
|
||||||
|
|
||||||
if (frame->cs != USER_CODE_SEG) {
|
if (!IFRAME_IS_USER(frame)) {
|
||||||
panic("breakpoint exception in kernel mode");
|
panic("breakpoint exception in kernel mode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user