Temporary fix for SLiRP - at least it now works, but waltje should look at this and possibly redo it when he feels like it;
The 12 MHz 286 is now correctly 12.5 MHz.
This commit is contained in:
@@ -240,7 +240,7 @@ CPU cpus_286[] =
|
|||||||
{"286/6", CPU_286, 0, 6000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
{"286/6", CPU_286, 0, 6000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
||||||
{"286/8", CPU_286, 1, 8000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
{"286/8", CPU_286, 1, 8000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
||||||
{"286/10", CPU_286, 2, 10000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
{"286/10", CPU_286, 2, 10000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
||||||
{"286/12", CPU_286, 3, 12000000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
{"286/12", CPU_286, 3, 12500000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
||||||
{"286/16", CPU_286, 4, 16000000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
{"286/16", CPU_286, 4, 16000000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
||||||
{"286/20", CPU_286, 5, 20000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
{"286/20", CPU_286, 5, 20000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
||||||
{"286/25", CPU_286, 6, 25000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
{"286/25", CPU_286, 6, 25000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
||||||
@@ -266,7 +266,7 @@ CPU cpus_ps2_m30_286[] =
|
|||||||
{
|
{
|
||||||
/*286*/
|
/*286*/
|
||||||
{"286/10", CPU_286, 2, 10000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
{"286/10", CPU_286, 2, 10000000, 1, 0, 0, 0, 0, 0, 2,2,2,2},
|
||||||
{"286/12", CPU_286, 3, 12000000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
{"286/12", CPU_286, 3, 12500000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
||||||
{"286/16", CPU_286, 4, 16000000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
{"286/16", CPU_286, 4, 16000000, 1, 0, 0, 0, 0, 0, 3,3,3,3},
|
||||||
{"286/20", CPU_286, 5, 20000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
{"286/20", CPU_286, 5, 20000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
||||||
{"286/25", CPU_286, 6, 25000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
{"286/25", CPU_286, 6, 25000000, 1, 0, 0, 0, 0, 0, 4,4,4,4},
|
||||||
|
@@ -63,6 +63,25 @@ slirp_tic(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct
|
||||||
|
{
|
||||||
|
int busy;
|
||||||
|
int queue_in_use;
|
||||||
|
|
||||||
|
event_t *wake_poll_thread;
|
||||||
|
event_t *poll_complete;
|
||||||
|
event_t *queue_not_in_use;
|
||||||
|
} poll_data;
|
||||||
|
|
||||||
|
|
||||||
|
void network_slirp_wait_for_poll()
|
||||||
|
{
|
||||||
|
while (poll_data.busy)
|
||||||
|
thread_wait_event(poll_data.poll_complete, -1);
|
||||||
|
thread_reset_event(poll_data.poll_complete);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Handle the receiving of frames. */
|
/* Handle the receiving of frames. */
|
||||||
static void
|
static void
|
||||||
poll_thread(void *arg)
|
poll_thread(void *arg)
|
||||||
@@ -76,6 +95,10 @@ poll_thread(void *arg)
|
|||||||
evt = thread_create_event();
|
evt = thread_create_event();
|
||||||
|
|
||||||
while (slirpq != NULL) {
|
while (slirpq != NULL) {
|
||||||
|
startslirp();
|
||||||
|
|
||||||
|
network_slirp_wait_for_poll();
|
||||||
|
|
||||||
/* See if there is any work. */
|
/* See if there is any work. */
|
||||||
slirp_tic();
|
slirp_tic();
|
||||||
|
|
||||||
@@ -98,10 +121,12 @@ poll_thread(void *arg)
|
|||||||
|
|
||||||
/* Done with this one. */
|
/* Done with this one. */
|
||||||
free(qp);
|
free(qp);
|
||||||
|
|
||||||
|
endslirp();
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_destroy_event(evt);
|
thread_destroy_event(evt);
|
||||||
poll_tid = NULL;
|
evt = poll_tid = NULL;
|
||||||
|
|
||||||
pclog("SLiRP: polling stopped.\n");
|
pclog("SLiRP: polling stopped.\n");
|
||||||
}
|
}
|
||||||
@@ -125,6 +150,9 @@ network_slirp_setup(uint8_t *mac, NETRXCB func, void *arg)
|
|||||||
poll_rx = func;
|
poll_rx = func;
|
||||||
poll_arg = arg;
|
poll_arg = arg;
|
||||||
|
|
||||||
|
poll_data.wake_poll_thread = thread_create_event();
|
||||||
|
poll_data.poll_complete = thread_create_event();
|
||||||
|
|
||||||
pclog("SLiRP: starting thread..\n");
|
pclog("SLiRP: starting thread..\n");
|
||||||
poll_tid = thread_create(poll_thread, mac);
|
poll_tid = thread_create(poll_thread, mac);
|
||||||
|
|
||||||
@@ -184,8 +212,14 @@ network_slirp_test(void)
|
|||||||
void
|
void
|
||||||
network_slirp_in(uint8_t *pkt, int pkt_len)
|
network_slirp_in(uint8_t *pkt, int pkt_len)
|
||||||
{
|
{
|
||||||
if (slirpq != NULL)
|
if (slirpq != NULL) {
|
||||||
|
poll_data.busy = 1;
|
||||||
|
|
||||||
slirp_input((const uint8_t *)pkt, pkt_len);
|
slirp_input((const uint8_t *)pkt, pkt_len);
|
||||||
|
|
||||||
|
poll_data.busy = 0;
|
||||||
|
thread_set_event(poll_data.poll_complete);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@ int firsttime=1;
|
|||||||
void setpitclock(float clock)
|
void setpitclock(float clock)
|
||||||
{
|
{
|
||||||
cpuclock=clock;
|
cpuclock=clock;
|
||||||
PITCONST=clock/1193182.0;
|
PITCONST=clock/(1193181.0 + (2.0 / 3.0));
|
||||||
CGACONST=(clock/(19687503.0/11.0));
|
CGACONST=(clock/(19687503.0/11.0));
|
||||||
MDACONST=(clock/2032125.0);
|
MDACONST=(clock/2032125.0);
|
||||||
VGACONST1=(clock/25175000.0);
|
VGACONST1=(clock/25175000.0);
|
||||||
@@ -79,9 +79,9 @@ void clearpit()
|
|||||||
float pit_timer0_freq()
|
float pit_timer0_freq()
|
||||||
{
|
{
|
||||||
if (pit.l[0])
|
if (pit.l[0])
|
||||||
return 1193182.0f/(float)pit.l[0];
|
return (1193181.0 + (2.0 / 3.0))/(float)pit.l[0];
|
||||||
else
|
else
|
||||||
return 1193182.0f/(float)0x10000;
|
return (1193181.0 + (2.0 / 3.0))/(float)0x10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pit_set_out(PIT *pit, int t, int out)
|
static void pit_set_out(PIT *pit, int t, int out)
|
||||||
|
@@ -20,5 +20,13 @@ extern void thread_destroy_event(event_t *_event);
|
|||||||
|
|
||||||
extern void thread_sleep(int t);
|
extern void thread_sleep(int t);
|
||||||
|
|
||||||
|
extern void *thread_create_mutex(wchar_t *name);
|
||||||
|
extern void thread_close_mutex(void *mutex);
|
||||||
|
extern uint8_t thread_wait_mutex(void *mutex);
|
||||||
|
extern uint8_t thread_release_mutex(void *mutex);
|
||||||
|
|
||||||
|
extern void startslirp(void);
|
||||||
|
extern void endslirp(void);
|
||||||
|
|
||||||
|
|
||||||
#endif /*PLAT_THREAD_H*/
|
#endif /*PLAT_THREAD_H*/
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "../ibm.h"
|
#include "../ibm.h"
|
||||||
#include "../cpu/cpu.h"
|
#include "../cpu/cpu.h"
|
||||||
#include "../mem.h"
|
#include "../mem.h"
|
||||||
|
#include "../pic.h"
|
||||||
#include "../rom.h"
|
#include "../rom.h"
|
||||||
#include "../device.h"
|
#include "../device.h"
|
||||||
#include "../nvr.h"
|
#include "../nvr.h"
|
||||||
@@ -98,6 +99,7 @@ int winsizex=640, winsizey=480;
|
|||||||
int efwinsizey=480;
|
int efwinsizey=480;
|
||||||
int gfx_present[GFX_MAX];
|
int gfx_present[GFX_MAX];
|
||||||
HANDLE ghMutex;
|
HANDLE ghMutex;
|
||||||
|
HANDLE slirpMutex;
|
||||||
HANDLE mainthreadh;
|
HANDLE mainthreadh;
|
||||||
int infocus=1;
|
int infocus=1;
|
||||||
int drawits=0;
|
int drawits=0;
|
||||||
@@ -278,6 +280,16 @@ void endblit(void)
|
|||||||
ReleaseMutex(ghMutex);
|
ReleaseMutex(ghMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void startslirp(void)
|
||||||
|
{
|
||||||
|
WaitForSingleObject(slirpMutex, INFINITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void endslirp(void)
|
||||||
|
{
|
||||||
|
ReleaseMutex(slirpMutex);
|
||||||
|
}
|
||||||
|
|
||||||
void leave_fullscreen(void)
|
void leave_fullscreen(void)
|
||||||
{
|
{
|
||||||
leave_fullscreen_flag = 1;
|
leave_fullscreen_flag = 1;
|
||||||
@@ -428,6 +440,35 @@ void thread_destroy_event(event_t *_event)
|
|||||||
free(event);
|
free(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *thread_create_mutex(wchar_t *name)
|
||||||
|
{
|
||||||
|
return (void*) CreateMutex(NULL, FALSE, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void thread_close_mutex(void *mutex)
|
||||||
|
{
|
||||||
|
CloseHandle((HANDLE) mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t thread_wait_mutex(void *mutex)
|
||||||
|
{
|
||||||
|
DWORD dwres = WaitForSingleObject((HANDLE) mutex, INFINITE);
|
||||||
|
|
||||||
|
switch (dwres)
|
||||||
|
{
|
||||||
|
case WAIT_OBJECT_0:
|
||||||
|
return 1;
|
||||||
|
case WAIT_ABANDONED:
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t thread_release_mutex(void *mutex)
|
||||||
|
{
|
||||||
|
return !!ReleaseMutex((HANDLE) mutex);
|
||||||
|
}
|
||||||
|
|
||||||
static void init_cdrom_host_drives(void)
|
static void init_cdrom_host_drives(void)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -1780,7 +1821,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpsz
|
|||||||
|
|
||||||
atexit(releasemouse);
|
atexit(releasemouse);
|
||||||
|
|
||||||
ghMutex = CreateMutex(NULL, FALSE, NULL);
|
ghMutex = CreateMutex(NULL, FALSE, L"86Box.BlitMutex");
|
||||||
|
slirpMutex = CreateMutex(NULL, FALSE, L"86Box.SlirpMutex");
|
||||||
mainthreadh=(HANDLE)_beginthread(mainthread,0,NULL);
|
mainthreadh=(HANDLE)_beginthread(mainthread,0,NULL);
|
||||||
SetThreadPriority(mainthreadh, THREAD_PRIORITY_HIGHEST);
|
SetThreadPriority(mainthreadh, THREAD_PRIORITY_HIGHEST);
|
||||||
|
|
||||||
@@ -2235,6 +2277,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case IDM_CONFIG_LOAD:
|
case IDM_CONFIG_LOAD:
|
||||||
|
picint(1 << 12);
|
||||||
|
break;
|
||||||
|
|
||||||
pause = 1;
|
pause = 1;
|
||||||
if (!file_dlg_st(hwnd, IDS_2160, "", 0))
|
if (!file_dlg_st(hwnd, IDS_2160, "", 0))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user