Author: hyperion
Date: Sun May 25 03:39:15 2008
New Revision: 33690
URL:
http://svn.reactos.org/svn/reactos?rev=33690&view=rev
Log:
modified bochs-2.3.6-poison.patch
- register POISON opcode for *all* modes (16/32 bits, memory/register), not just for 16
bits/register; opcode now actually works
- flush all caches after new bytes are poisoned, so that any new breakpoints are
immediately effective; like many things about this patch, this is inefficient but it
works
modified poison.h
- qualify all pointers as const *and* volatile, so that any pointer can be passed
Modified:
vendor/bochs/bochs-2.3.6-poison.patch
vendor/bochs/poison.h
Modified: vendor/bochs/bochs-2.3.6-poison.patch
URL:
http://svn.reactos.org/svn/reactos/vendor/bochs/bochs-2.3.6-poison.patch?re…
==============================================================================
--- vendor/bochs/bochs-2.3.6-poison.patch [iso-8859-1] (original)
+++ vendor/bochs/bochs-2.3.6-poison.patch [iso-8859-1] Sun May 25 03:39:15 2008
@@ -1,4 +1,4 @@
-diff -U 3 -P -r bochs-2.3.6\cpu\cpu.h bochs-2.3.6-poison\cpu\cpu.h
+diff -U3 -P -r bochs-2.3.6\cpu\cpu.h bochs-2.3.6-poison\cpu\cpu.h
--- bochs-2.3.6\cpu\cpu.h Sat Dec 22 18:17:40 2007
+++ bochs-2.3.6-poison\cpu\cpu.h Thu May 22 23:19:39 2008
@@ -29,6 +29,7 @@
@@ -21,9 +21,9 @@
};
#if BX_SUPPORT_ICACHE
-diff -U 3 -P -r bochs-2.3.6\cpu\fetchdecode.cpp bochs-2.3.6-poison\cpu\fetchdecode.cpp
+diff -U3 -P -r bochs-2.3.6\cpu\fetchdecode.cpp bochs-2.3.6-poison\cpu\fetchdecode.cpp
--- bochs-2.3.6\cpu\fetchdecode.cpp Sat Dec 22 18:17:40 2007
-+++ bochs-2.3.6-poison\cpu\fetchdecode.cpp Sat May 24 06:01:56 2008
++++ bochs-2.3.6-poison\cpu\fetchdecode.cpp Sun May 25 10:54:42 2008
@@ -521,7 +521,7 @@
/* 0F 24 /wr */ { BxTraceEnd, &BX_CPU_C::MOV_RdTd }, // not implemented
/* 0F 25 /wr */ { 0, &BX_CPU_C::BxError },
@@ -33,7 +33,34 @@
/* 0F 28 /wr */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f28 },
/* 0F 29 /wr */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f29 },
/* 0F 2A /wr */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f2a },
-@@ -2971,4 +2971,40 @@
+@@ -1085,7 +1085,7 @@
+ /* 0F 24 /dr */ { BxTraceEnd, &BX_CPU_C::MOV_RdTd }, // not implemented
+ /* 0F 25 /dr */ { 0, &BX_CPU_C::BxError },
+ /* 0F 26 /dr */ { BxTraceEnd, &BX_CPU_C::MOV_TdRd }, // not implemented
+- /* 0F 27 /dr */ { 0, &BX_CPU_C::BxError },
++ /* 0F 27 /dr */ { BxRepeatable, &BX_CPU_C::REP_BxPoison },
+ /* 0F 28 /dr */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f28 },
+ /* 0F 29 /dr */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f29 },
+ /* 0F 2A /dr */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f2a },
+@@ -1656,7 +1656,7 @@
+ /* 0F 24 /wm */ { BxTraceEnd, &BX_CPU_C::MOV_RdTd }, // not implemented
+ /* 0F 25 /wm */ { 0, &BX_CPU_C::BxError },
+ /* 0F 26 /wm */ { BxTraceEnd, &BX_CPU_C::MOV_TdRd }, // not implemented
+- /* 0F 27 /wm */ { 0, &BX_CPU_C::BxError },
++ /* 0F 27 /wm */ { BxRepeatable, &BX_CPU_C::REP_BxPoison },
+ /* 0F 28 /wm */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f28 },
+ /* 0F 29 /wm */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f29 },
+ /* 0F 2A /wm */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f2a },
+@@ -2220,7 +2220,7 @@
+ /* 0F 24 /dm */ { BxTraceEnd, &BX_CPU_C::MOV_RdTd }, // not implemented
+ /* 0F 25 /dm */ { 0, &BX_CPU_C::BxError },
+ /* 0F 26 /dm */ { BxTraceEnd, &BX_CPU_C::MOV_TdRd }, // not implemented
+- /* 0F 27 /dm */ { 0, &BX_CPU_C::BxError },
++ /* 0F 27 /dm */ { BxRepeatable, &BX_CPU_C::REP_BxPoison },
+ /* 0F 28 /dm */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f28 },
+ /* 0F 29 /dm */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f29 },
+ /* 0F 2A /dm */ { BxPrefixSSE, NULL, BxOpcodeGroupSSE_0f2a },
+@@ -2971,4 +2971,51 @@
BX_DEBUG(("WARNING: Encountered an unknown i (signalling illegal i)"));
BX_CPU_THIS_PTR UndefinedOpcode(i);
@@ -72,11 +99,22 @@
+ }
+
+ BX_CPU_THIS_PTR repeat(i, &BX_CPU_C::BxPoison);
++
++ if (EAX & (0x00000001 | 0x00000002)) {
++ invalidate_prefetch_q();
++
++#if BX_SUPPORT_ICACHE
++ flushICaches();
++#endif
++
++ BX_CPU_THIS_PTR TLB_flush(1);
++ }
++
+ BX_DEBUG(("POISON: %lu r, %lu w", (unsigned long)(BX_CPU_THIS_PTR
poisoned_bytes_read.size()), (unsigned long)(BX_CPU_THIS_PTR
poisoned_bytes_write.size())));
}
-diff -U 3 -P -r bochs-2.3.6\cpu\paging.cpp bochs-2.3.6-poison\cpu\paging.cpp
+diff -U3 -P -r bochs-2.3.6\cpu\paging.cpp bochs-2.3.6-poison\cpu\paging.cpp
--- bochs-2.3.6\cpu\paging.cpp Sun Dec 23 18:21:28 2007
-+++ bochs-2.3.6-poison\cpu\paging.cpp Fri May 23 17:44:29 2008
++++ bochs-2.3.6-poison\cpu\paging.cpp Sun May 25 07:16:39 2008
@@ -1114,6 +1114,34 @@
void BX_CPU_C::access_linear(bx_address laddr, unsigned len, unsigned curr_pl, unsigned
rw, void *data)
Modified: vendor/bochs/poison.h
URL:
http://svn.reactos.org/svn/reactos/vendor/bochs/poison.h?rev=33690&r1=3…
==============================================================================
--- vendor/bochs/poison.h [iso-8859-1] (original)
+++ vendor/bochs/poison.h [iso-8859-1] Sun May 25 03:39:15 2008
@@ -19,7 +19,7 @@
#if defined(_MSC_VER)
#include <intrin.h>
-_POISONAPI void _POISON(const void * addr, int flags)
+_POISONAPI void _POISON(const volatile void * addr, int flags)
{
_ReadWriteBarrier();
__asm mov eax, flags
@@ -28,7 +28,7 @@
__asm _emit 027h
}
-_POISONAPI void _REP_POISON(const void * addr, int flags, size_t count)
+_POISONAPI void _REP_POISON(const volatile void * addr, int flags, size_t count)
{
_ReadWriteBarrier();
__asm mov eax, flags
@@ -41,32 +41,32 @@
#endif
#if defined(__GNUC__)
-_POISONAPI void _POISON(const void * addr, int flags)
+_POISONAPI void _POISON(const volatile void * addr, int flags)
{
__asm__ __volatile__("" : : : "memory");
__asm__ __volatile__(".byte 0x0f; .byte 0x27" : "=S"(addr) :
"S"(addr), "a"(flags) : "memory");
}
-_POISONAPI void _REP_POISON(const void * addr, int flags, size_t count)
+_POISONAPI void _REP_POISON(const volatile void * addr, int flags, size_t count)
{
__asm__ __volatile__("" : : : "memory");
__asm__ __volatile__("rep; .byte 0x0f; .byte 0x27" : "=S"(addr),
"=c"(count) : "S"(addr), "a"(flags), "c"(count) :
"memory");
}
#endif
-_POISONAPI void POISON_BYTE_R(const void * addr) { _POISON(addr, _POISON_R); }
-_POISONAPI void POISON_BYTE_W(const void * addr) { _POISON(addr, _POISON_W); }
-_POISONAPI void POISON_BYTE_RW(const void * addr) { _POISON(addr, _POISON_R | _POISON_W);
}
-_POISONAPI void POISON_MEMORY_R(const void * addr, size_t count) { _REP_POISON(addr,
_POISON_R, count); }
-_POISONAPI void POISON_MEMORY_W(const void * addr, size_t count) { _REP_POISON(addr,
_POISON_W, count); }
-_POISONAPI void POISON_MEMORY_RW(const void * addr, size_t count) { _REP_POISON(addr,
_POISON_R | _POISON_W, count); }
+_POISONAPI void POISON_BYTE_R(const volatile void * addr) { _POISON(addr, _POISON_R); }
+_POISONAPI void POISON_BYTE_W(const volatile void * addr) { _POISON(addr, _POISON_W); }
+_POISONAPI void POISON_BYTE_RW(const volatile void * addr) { _POISON(addr, _POISON_R |
_POISON_W); }
+_POISONAPI void POISON_MEMORY_R(const volatile void * addr, size_t count) {
_REP_POISON(addr, _POISON_R, count); }
+_POISONAPI void POISON_MEMORY_W(const volatile void * addr, size_t count) {
_REP_POISON(addr, _POISON_W, count); }
+_POISONAPI void POISON_MEMORY_RW(const volatile void * addr, size_t count) {
_REP_POISON(addr, _POISON_R | _POISON_W, count); }
-_POISONAPI void UNPOISON_BYTE_R(const void * addr) { _POISON(addr, _UNPOISON_R); }
-_POISONAPI void UNPOISON_BYTE_W(const void * addr) { _POISON(addr, _UNPOISON_W); }
-_POISONAPI void UNPOISON_BYTE_RW(const void * addr) { _POISON(addr, _UNPOISON_R |
_UNPOISON_W); }
-_POISONAPI void UNPOISON_MEMORY_R(const void * addr, size_t count) { _REP_POISON(addr,
_UNPOISON_R, count); }
-_POISONAPI void UNPOISON_MEMORY_W(const void * addr, size_t count) { _REP_POISON(addr,
_UNPOISON_W, count); }
-_POISONAPI void UNPOISON_MEMORY_RW(const void * addr, size_t count) { _REP_POISON(addr,
_UNPOISON_R | _UNPOISON_W, count); }
+_POISONAPI void UNPOISON_BYTE_R(const volatile void * addr) { _POISON(addr, _UNPOISON_R);
}
+_POISONAPI void UNPOISON_BYTE_W(const volatile void * addr) { _POISON(addr, _UNPOISON_W);
}
+_POISONAPI void UNPOISON_BYTE_RW(const volatile void * addr) { _POISON(addr, _UNPOISON_R
| _UNPOISON_W); }
+_POISONAPI void UNPOISON_MEMORY_R(const volatile void * addr, size_t count) {
_REP_POISON(addr, _UNPOISON_R, count); }
+_POISONAPI void UNPOISON_MEMORY_W(const volatile void * addr, size_t count) {
_REP_POISON(addr, _UNPOISON_W, count); }
+_POISONAPI void UNPOISON_MEMORY_RW(const volatile void * addr, size_t count) {
_REP_POISON(addr, _UNPOISON_R | _UNPOISON_W, count); }
#undef _POISONAPI