mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-31 17:31:53 +00:00
- replaced floating-point page shift calculation by integer routine, fixing
the VOSF problems under NetBSD/m68k - fixed off-by-7 error in 1-bit window update routines
This commit is contained in:
parent
33892da9ef
commit
01d43035d5
@ -327,7 +327,12 @@ static bool Screen_fault_handler_init()
|
|||||||
// Setup SIGSEGV handler to process writes to frame buffer
|
// Setup SIGSEGV handler to process writes to frame buffer
|
||||||
sigemptyset(&vosf_sa.sa_mask);
|
sigemptyset(&vosf_sa.sa_mask);
|
||||||
vosf_sa.sa_handler = (void (*)(int)) Screen_fault_handler;
|
vosf_sa.sa_handler = (void (*)(int)) Screen_fault_handler;
|
||||||
|
#if !EMULATED_68K && defined(__NetBSD__)
|
||||||
|
sigaddset(&vosf_sa.sa_mask, SIGALRM);
|
||||||
|
vosf_sa.sa_flags = SA_ONSTACK;
|
||||||
|
#else
|
||||||
vosf_sa.sa_flags = 0;
|
vosf_sa.sa_flags = 0;
|
||||||
|
#endif
|
||||||
return (sigaction(SIGSEGV, &vosf_sa, NULL) == 0);
|
return (sigaction(SIGSEGV, &vosf_sa, NULL) == 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -355,7 +360,7 @@ static inline void update_display_window_vosf(void)
|
|||||||
PFLAG_CLEAR(page);
|
PFLAG_CLEAR(page);
|
||||||
++page;
|
++page;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the dirty pages read-only again
|
// Make the dirty pages read-only again
|
||||||
const int32 offset = first_page << mainBuffer.pageBits;
|
const int32 offset = first_page << mainBuffer.pageBits;
|
||||||
const uint32 length = (page - first_page) << mainBuffer.pageBits;
|
const uint32 length = (page - first_page) << mainBuffer.pageBits;
|
||||||
@ -393,7 +398,7 @@ static inline void update_display_window_vosf(void)
|
|||||||
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
uint8 * const p2 = &the_buffer_copy[j * bytes_per_row];
|
||||||
for (i = (VideoMonitor.x>>3) - 1; i > (x2>>3); i--) {
|
for (i = (VideoMonitor.x>>3) - 1; i > (x2>>3); i--) {
|
||||||
if (p1[i] != p2[i]) {
|
if (p1[i] != p2[i]) {
|
||||||
x2 = i << 3;
|
x2 = (i << 3) + 7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VOSF
|
#ifdef ENABLE_VOSF
|
||||||
# include <math.h> // log()
|
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
@ -219,6 +218,17 @@ static struct sigaction vosf_sa;
|
|||||||
static pthread_mutex_t Screen_draw_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to protect frame buffer (dirtyPages in fact)
|
static pthread_mutex_t Screen_draw_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to protect frame buffer (dirtyPages in fact)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int log_base_2(uint32 x)
|
||||||
|
{
|
||||||
|
uint32 mask = 0x80000000;
|
||||||
|
int l = 31;
|
||||||
|
while (l >= 0 && (x & mask) == 0) {
|
||||||
|
mask >>= 1;
|
||||||
|
l--;
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VideoRefresh function
|
// VideoRefresh function
|
||||||
@ -804,7 +814,7 @@ bool VideoInitBuffer()
|
|||||||
|
|
||||||
mainBuffer.pageSize = page_size;
|
mainBuffer.pageSize = page_size;
|
||||||
mainBuffer.pageCount = (mainBuffer.memLength + page_mask)/mainBuffer.pageSize;
|
mainBuffer.pageCount = (mainBuffer.memLength + page_mask)/mainBuffer.pageSize;
|
||||||
mainBuffer.pageBits = int( log(mainBuffer.pageSize) / log(2.0) );
|
mainBuffer.pageBits = log_base_2(mainBuffer.pageSize);
|
||||||
|
|
||||||
if (mainBuffer.dirtyPages != 0)
|
if (mainBuffer.dirtyPages != 0)
|
||||||
free(mainBuffer.dirtyPages);
|
free(mainBuffer.dirtyPages);
|
||||||
@ -1766,12 +1776,12 @@ static void update_display_static(void)
|
|||||||
for (i=(VideoMonitor.x>>3); i>(x2>>3); i--) {
|
for (i=(VideoMonitor.x>>3); i>(x2>>3); i--) {
|
||||||
p--; p2--;
|
p--; p2--;
|
||||||
if (*p != *p2) {
|
if (*p != *p2) {
|
||||||
x2 = i << 3;
|
x2 = (i << 3) + 7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wide = x2 - x1;
|
wide = x2 - x1 + 1;
|
||||||
|
|
||||||
// Update copy of the_buffer
|
// Update copy of the_buffer
|
||||||
if (high && wide) {
|
if (high && wide) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user