mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 17:45:31 -07:00
Conflict resolution.
This commit is contained in:
@@ -51,6 +51,7 @@ AppDir:
|
||||
- libgles2 # if QT:BOOL=ON
|
||||
- libglvnd0 # if QT:BOOL=ON
|
||||
- libglx0 # if QT:BOOL=ON
|
||||
- libgomp1
|
||||
- libgs9
|
||||
- libpng16-16
|
||||
- libqt5core5a # if QT:BOOL=ON
|
||||
|
||||
2
.github/workflows/c-cpp.yml
vendored
2
.github/workflows/c-cpp.yml
vendored
@@ -95,7 +95,7 @@ jobs:
|
||||
libvncserver:p
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: make
|
||||
run: >-
|
||||
|
||||
16
.github/workflows/cmake.yml
vendored
16
.github/workflows/cmake.yml
vendored
@@ -110,7 +110,7 @@ jobs:
|
||||
${{ matrix.ui.packages }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build build
|
||||
.sonar/build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
|
||||
|
||||
- name: Run sonar-scanner
|
||||
if: 0
|
||||
@@ -136,7 +136,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
run: |
|
||||
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|
||||
.sonar/sonar-scanner-5.0.1.3006-windows/bin/sonar-scanner.bat --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|
||||
|
||||
- name: Generate package
|
||||
run: cmake --install build
|
||||
@@ -233,7 +233,7 @@ jobs:
|
||||
run: dir "C:/Program Files/Microsoft Visual Studio/2022/*/VC/Tools/MSVC/*/include" -include stdatomic.h -recurse | del
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
@@ -264,7 +264,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
build-wrapper-win-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
|
||||
.sonar/build-wrapper-win-x86/build-wrapper-win-x86-64.exe --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
|
||||
|
||||
- name: Run sonar-scanner
|
||||
if: 0
|
||||
@@ -272,7 +272,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
run: |
|
||||
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|
||||
.sonar/sonar-scanner-5.0.1.3006-windows/bin/sonar-scanner.bat --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|
||||
|
||||
- name: Generate package
|
||||
run: |
|
||||
@@ -340,7 +340,7 @@ jobs:
|
||||
${{ matrix.ui.packages }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
@@ -426,7 +426,7 @@ jobs:
|
||||
${{ matrix.ui.packages }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
|
||||
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@@ -113,7 +113,7 @@ jobs:
|
||||
${{ matrix.ui.packages }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
@@ -199,7 +199,7 @@ jobs:
|
||||
${{ matrix.ui.packages }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
@@ -275,7 +275,7 @@ jobs:
|
||||
${{ matrix.ui.packages }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
|
||||
@@ -173,8 +173,8 @@ int gfxcard[2] = { 0, 0 }; /* (C) graphic
|
||||
int show_second_monitors = 1; /* (C) show non-primary monitors */
|
||||
int sound_is_float = 1; /* (C) sound uses FP values */
|
||||
int voodoo_enabled = 0; /* (C) video option */
|
||||
int ibm8514_enabled = 0; /* (C) video option */
|
||||
int xga_enabled = 0; /* (C) video option */
|
||||
int ibm8514_standalone_enabled = 0; /* (C) video option */
|
||||
int xga_standalone_enabled = 0; /* (C) video option */
|
||||
uint32_t mem_size = 0; /* (C) memory size (Installed on system board)*/
|
||||
uint32_t isa_mem_size = 0; /* (C) memory size (ISA Memory Cards) */
|
||||
int cpu_use_dynarec = 0; /* (C) cpu uses/needs Dyna */
|
||||
|
||||
@@ -151,7 +151,7 @@ cdrom_interface_reset(void)
|
||||
device_add(controllers[cdrom_interface_current].device);
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
cdrom_interface_get_internal_name(int cdinterface)
|
||||
{
|
||||
return device_get_internal_name(controllers[cdinterface].device);
|
||||
|
||||
@@ -68,24 +68,24 @@ cdrom_image_backend_log(const char *fmt, ...)
|
||||
|
||||
/* Binary file functions. */
|
||||
static int
|
||||
bin_read(void *p, uint8_t *buffer, uint64_t seek, size_t count)
|
||||
bin_read(void *priv, uint8_t *buffer, uint64_t seek, size_t count)
|
||||
{
|
||||
track_file_t *tf = (track_file_t *) p;
|
||||
track_file_t *tf = (track_file_t *) priv;
|
||||
|
||||
cdrom_image_backend_log("CDROM: binary_read(%08lx, pos=%" PRIu64 " count=%lu\n",
|
||||
tf->file, seek, count);
|
||||
|
||||
if (tf->file == NULL)
|
||||
if (tf->fp == NULL)
|
||||
return 0;
|
||||
|
||||
if (fseeko64(tf->file, seek, SEEK_SET) == -1) {
|
||||
if (fseeko64(tf->fp, seek, SEEK_SET) == -1) {
|
||||
#ifdef ENABLE_CDROM_IMAGE_BACKEND_LOG
|
||||
cdrom_image_backend_log("CDROM: binary_read failed during seek!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fread(buffer, count, 1, tf->file) != 1) {
|
||||
if (fread(buffer, count, 1, tf->fp) != 1) {
|
||||
#ifdef ENABLE_CDROM_IMAGE_BACKEND_LOG
|
||||
cdrom_image_backend_log("CDROM: binary_read failed during read!\n");
|
||||
#endif
|
||||
@@ -96,39 +96,39 @@ bin_read(void *p, uint8_t *buffer, uint64_t seek, size_t count)
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
bin_get_length(void *p)
|
||||
bin_get_length(void *priv)
|
||||
{
|
||||
off64_t len;
|
||||
track_file_t *tf = (track_file_t *) p;
|
||||
track_file_t *tf = (track_file_t *) priv;
|
||||
|
||||
cdrom_image_backend_log("CDROM: binary_length(%08lx)\n", tf->file);
|
||||
|
||||
if (tf->file == NULL)
|
||||
if (tf->fp == NULL)
|
||||
return 0;
|
||||
|
||||
fseeko64(tf->file, 0, SEEK_END);
|
||||
len = ftello64(tf->file);
|
||||
fseeko64(tf->fp, 0, SEEK_END);
|
||||
len = ftello64(tf->fp);
|
||||
cdrom_image_backend_log("CDROM: binary_length(%08lx) = %" PRIu64 "\n", tf->file, len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static void
|
||||
bin_close(void *p)
|
||||
bin_close(void *priv)
|
||||
{
|
||||
track_file_t *tf = (track_file_t *) p;
|
||||
track_file_t *tf = (track_file_t *) priv;
|
||||
|
||||
if (tf == NULL)
|
||||
return;
|
||||
|
||||
if (tf->file != NULL) {
|
||||
fclose(tf->file);
|
||||
tf->file = NULL;
|
||||
if (tf->fp != NULL) {
|
||||
fclose(tf->fp);
|
||||
tf->fp = NULL;
|
||||
}
|
||||
|
||||
memset(tf->fn, 0x00, sizeof(tf->fn));
|
||||
|
||||
free(p);
|
||||
free(priv);
|
||||
}
|
||||
|
||||
static track_file_t *
|
||||
@@ -144,14 +144,14 @@ bin_init(const char *filename, int *error)
|
||||
|
||||
memset(tf->fn, 0x00, sizeof(tf->fn));
|
||||
strncpy(tf->fn, filename, sizeof(tf->fn) - 1);
|
||||
tf->file = plat_fopen64(tf->fn, "rb");
|
||||
tf->fp = plat_fopen64(tf->fn, "rb");
|
||||
cdrom_image_backend_log("CDROM: binary_open(%s) = %08lx\n", tf->fn, tf->file);
|
||||
|
||||
if (stat(tf->fn, &stats) != 0) {
|
||||
/* Use a blank structure if stat failed. */
|
||||
memset(&stats, 0, sizeof(struct stat));
|
||||
}
|
||||
*error = ((tf->file == NULL) || ((stats.st_mode & S_IFMT) == S_IFDIR));
|
||||
*error = ((tf->fp == NULL) || ((stats.st_mode & S_IFMT) == S_IFDIR));
|
||||
|
||||
/* Set the function pointers. */
|
||||
if (!*error) {
|
||||
@@ -162,7 +162,7 @@ bin_init(const char *filename, int *error)
|
||||
/* From the check above, error may still be non-zero if opening a directory.
|
||||
* The error is set for viso to try and open the directory following this function.
|
||||
* However, we need to make sure the descriptor is closed. */
|
||||
if ((tf->file != NULL) && ((stats.st_mode & S_IFMT) == S_IFDIR)) {
|
||||
if ((tf->fp != NULL) && ((stats.st_mode & S_IFMT) == S_IFDIR)) {
|
||||
/* tf is freed by bin_close */
|
||||
bin_close(tf);
|
||||
} else {
|
||||
@@ -203,7 +203,7 @@ static void
|
||||
cdi_clear_tracks(cd_img_t *cdi)
|
||||
{
|
||||
const track_file_t *last = NULL;
|
||||
track_t *cur = NULL;
|
||||
track_t *cur = NULL;
|
||||
|
||||
if ((cdi->tracks == NULL) || (cdi->tracks_num == 0))
|
||||
return;
|
||||
|
||||
@@ -121,8 +121,10 @@ typedef struct {
|
||||
size_t metadata_sectors, all_sectors, entry_map_size, sector_size, file_fifo_pos;
|
||||
uint8_t *metadata;
|
||||
|
||||
track_file_t tf;
|
||||
viso_entry_t *root_dir, **entry_map, *file_fifo[VISO_OPEN_FILES];
|
||||
track_file_t tf;
|
||||
viso_entry_t *root_dir;
|
||||
viso_entry_t **entry_map;
|
||||
viso_entry_t *file_fifo[VISO_OPEN_FILES];
|
||||
} viso_t;
|
||||
|
||||
static const char rr_eid[] = "RRIP_1991A"; /* identifiers used in ER field for Rock Ridge */
|
||||
@@ -148,24 +150,24 @@ cdrom_image_viso_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
static size_t
|
||||
viso_pread(void *ptr, uint64_t offset, size_t size, size_t count, FILE *stream)
|
||||
viso_pread(void *ptr, uint64_t offset, size_t size, size_t count, FILE *fp)
|
||||
{
|
||||
uint64_t cur_pos = ftello64(stream);
|
||||
uint64_t cur_pos = ftello64(fp);
|
||||
size_t ret = 0;
|
||||
if (fseeko64(stream, offset, SEEK_SET) != -1)
|
||||
ret = fread(ptr, size, count, stream);
|
||||
fseeko64(stream, cur_pos, SEEK_SET);
|
||||
if (fseeko64(fp, offset, SEEK_SET) != -1)
|
||||
ret = fread(ptr, size, count, fp);
|
||||
fseeko64(fp, cur_pos, SEEK_SET);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static size_t
|
||||
viso_pwrite(const void *ptr, uint64_t offset, size_t size, size_t count, FILE *stream)
|
||||
viso_pwrite(const void *ptr, uint64_t offset, size_t size, size_t count, FILE *fp)
|
||||
{
|
||||
uint64_t cur_pos = ftello64(stream);
|
||||
uint64_t cur_pos = ftello64(fp);
|
||||
size_t ret = 0;
|
||||
if (fseeko64(stream, offset, SEEK_SET) != -1)
|
||||
ret = fwrite(ptr, size, count, stream);
|
||||
fseeko64(stream, cur_pos, SEEK_SET);
|
||||
if (fseeko64(fp, offset, SEEK_SET) != -1)
|
||||
ret = fwrite(ptr, size, count, fp);
|
||||
fseeko64(fp, cur_pos, SEEK_SET);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -247,17 +249,28 @@ viso_convert_utf8(wchar_t *dest, const char *src, ssize_t buf_size)
|
||||
c -= 'a' - 'A'; \
|
||||
break; \
|
||||
\
|
||||
case ' ': \
|
||||
case '!': \
|
||||
case '"': \
|
||||
case '#': \
|
||||
case '$': \
|
||||
case '%': \
|
||||
case '&': \
|
||||
case '\'': \
|
||||
case '(': \
|
||||
case ')': \
|
||||
case '-': \
|
||||
case '@': \
|
||||
case '^': \
|
||||
case '`': \
|
||||
case '{': \
|
||||
case '}': \
|
||||
case '~': \
|
||||
/* Valid on all sets (non-complying DOS characters). */ \
|
||||
break; \
|
||||
\
|
||||
case ' ': \
|
||||
case '"': \
|
||||
case '+': \
|
||||
case ',': \
|
||||
case '-': \
|
||||
case '.': \
|
||||
case '<': \
|
||||
case '=': \
|
||||
@@ -650,9 +663,9 @@ viso_compare_entries(const void *a, const void *b)
|
||||
}
|
||||
|
||||
int
|
||||
viso_read(void *p, uint8_t *buffer, uint64_t seek, size_t count)
|
||||
viso_read(void *priv, uint8_t *buffer, uint64_t seek, size_t count)
|
||||
{
|
||||
track_file_t *tf = (track_file_t *) p;
|
||||
track_file_t *tf = (track_file_t *) priv;
|
||||
viso_t *viso = (viso_t *) tf->priv;
|
||||
|
||||
/* Handle reads in a sector by sector basis. */
|
||||
@@ -719,18 +732,18 @@ viso_read(void *p, uint8_t *buffer, uint64_t seek, size_t count)
|
||||
}
|
||||
|
||||
uint64_t
|
||||
viso_get_length(void *p)
|
||||
viso_get_length(void *priv)
|
||||
{
|
||||
track_file_t *tf = (track_file_t *) p;
|
||||
track_file_t *tf = (track_file_t *) priv;
|
||||
const viso_t *viso = (viso_t *) tf->priv;
|
||||
|
||||
return ((uint64_t) viso->all_sectors) * viso->sector_size;
|
||||
}
|
||||
|
||||
void
|
||||
viso_close(void *p)
|
||||
viso_close(void *priv)
|
||||
{
|
||||
track_file_t *tf = (track_file_t *) p;
|
||||
track_file_t *tf = (track_file_t *) priv;
|
||||
viso_t *viso = (viso_t *) tf->priv;
|
||||
|
||||
if (viso == NULL)
|
||||
@@ -739,8 +752,8 @@ viso_close(void *p)
|
||||
cdrom_image_viso_log("VISO: close()\n");
|
||||
|
||||
/* De-allocate everything. */
|
||||
if (tf->file)
|
||||
fclose(tf->file);
|
||||
if (tf->fp)
|
||||
fclose(tf->fp);
|
||||
#ifndef ENABLE_CDROM_IMAGE_VISO_LOG
|
||||
remove(nvr_path(viso->tf.fn));
|
||||
#endif
|
||||
@@ -790,8 +803,8 @@ viso_init(const char *dirname, int *error)
|
||||
#else
|
||||
plat_tempfile(viso->tf.fn, "viso", ".tmp");
|
||||
#endif
|
||||
viso->tf.file = plat_fopen64(nvr_path(viso->tf.fn), "w+b");
|
||||
if (!viso->tf.file)
|
||||
viso->tf.fp = plat_fopen64(nvr_path(viso->tf.fn), "w+b");
|
||||
if (!viso->tf.fp)
|
||||
goto end;
|
||||
|
||||
/* Set up directory traversal. */
|
||||
@@ -989,7 +1002,7 @@ next_dir:
|
||||
|
||||
/* Write 16 blank sectors. */
|
||||
for (int i = 0; i < 16; i++)
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.file);
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.fp);
|
||||
|
||||
/* Get current time for the volume descriptors, and calculate
|
||||
the timezone offset for descriptors and file times to use. */
|
||||
@@ -999,7 +1012,7 @@ next_dir:
|
||||
tz_offset = (now - mktime(gmtime(&now))) / (3600 / 4);
|
||||
|
||||
/* Get root directory basename for the volume ID. */
|
||||
char *basename = path_get_filename(viso->root_dir->path);
|
||||
const char *basename = path_get_filename(viso->root_dir->path);
|
||||
if (!basename || (basename[0] == '\0'))
|
||||
basename = EMU_NAME;
|
||||
|
||||
@@ -1012,7 +1025,7 @@ next_dir:
|
||||
/* Fill volume descriptor. */
|
||||
p = data;
|
||||
if (!(viso->format & VISO_FORMAT_ISO))
|
||||
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
|
||||
VISO_LBE_32(p, ftello64(viso->tf.fp) / viso->sector_size); /* sector offset (HSF only) */
|
||||
*p++ = 1 + i; /* type */
|
||||
memcpy(p, (viso->format & VISO_FORMAT_ISO) ? "CD001" : "CDROM", 5); /* standard ID */
|
||||
p += 5;
|
||||
@@ -1035,7 +1048,7 @@ next_dir:
|
||||
|
||||
VISO_SKIP(p, 8); /* unused */
|
||||
|
||||
viso->vol_size_offsets[i] = ftello64(viso->tf.file) + (p - data);
|
||||
viso->vol_size_offsets[i] = ftello64(viso->tf.fp) + (p - data);
|
||||
VISO_LBE_32(p, 0); /* volume space size (filled in later) */
|
||||
|
||||
if (i) {
|
||||
@@ -1052,10 +1065,10 @@ next_dir:
|
||||
VISO_LBE_16(p, viso->sector_size); /* logical block size */
|
||||
|
||||
/* Path table metadata is filled in later. */
|
||||
viso->pt_meta_offsets[i] = ftello64(viso->tf.file) + (p - data);
|
||||
viso->pt_meta_offsets[i] = ftello64(viso->tf.fp) + (p - data);
|
||||
VISO_SKIP(p, 24 + (16 * !(viso->format & VISO_FORMAT_ISO))); /* PT size, LE PT offset, optional LE PT offset (three on HSF), BE PT offset, optional BE PT offset (three on HSF) */
|
||||
|
||||
viso->root_dir->dr_offsets[i] = ftello64(viso->tf.file) + (p - data);
|
||||
viso->root_dir->dr_offsets[i] = ftello64(viso->tf.fp) + (p - data);
|
||||
p += viso_fill_dir_record(p, viso->root_dir, viso, VISO_DIR_CURRENT); /* root directory */
|
||||
|
||||
int copyright_abstract_len = (viso->format & VISO_FORMAT_ISO) ? 37 : 32;
|
||||
@@ -1107,7 +1120,7 @@ next_dir:
|
||||
memset(p, 0x00, viso->sector_size - (p - data));
|
||||
|
||||
/* Write volume descriptor. */
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.file);
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.fp);
|
||||
|
||||
/* Write El Torito boot descriptor. This is an awkward spot for
|
||||
that, but the spec requires it to be the second descriptor. */
|
||||
@@ -1116,7 +1129,7 @@ next_dir:
|
||||
|
||||
p = data;
|
||||
if (!(viso->format & VISO_FORMAT_ISO))
|
||||
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
|
||||
VISO_LBE_32(p, ftello64(viso->tf.fp) / viso->sector_size); /* sector offset (HSF only) */
|
||||
*p++ = 0; /* type */
|
||||
memcpy(p, (viso->format & VISO_FORMAT_ISO) ? "CD001" : "CDROM", 5); /* standard ID */
|
||||
p += 5;
|
||||
@@ -1127,20 +1140,20 @@ next_dir:
|
||||
VISO_SKIP(p, 40);
|
||||
|
||||
/* Save the boot catalog pointer's offset for later. */
|
||||
eltorito_offset = ftello64(viso->tf.file) + (p - data);
|
||||
eltorito_offset = ftello64(viso->tf.fp) + (p - data);
|
||||
|
||||
/* Blank the rest of the working sector. */
|
||||
memset(p, 0x00, viso->sector_size - (p - data));
|
||||
|
||||
/* Write boot descriptor. */
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.file);
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.fp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill terminator. */
|
||||
p = data;
|
||||
if (!(viso->format & VISO_FORMAT_ISO))
|
||||
VISO_LBE_32(p, ftello64(viso->tf.file) / viso->sector_size); /* sector offset (HSF only) */
|
||||
VISO_LBE_32(p, ftello64(viso->tf.fp) / viso->sector_size); /* sector offset (HSF only) */
|
||||
*p++ = 0xff; /* type */
|
||||
memcpy(p, (viso->format & VISO_FORMAT_ISO) ? "CD001" : "CDROM", 5); /* standard ID */
|
||||
p += 5;
|
||||
@@ -1150,22 +1163,22 @@ next_dir:
|
||||
memset(p, 0x00, viso->sector_size - (p - data));
|
||||
|
||||
/* Write terminator. */
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.file);
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.fp);
|
||||
|
||||
/* We start seeing a pattern of padding to even sectors here.
|
||||
mkisofs does this, presumably for a very good reason... */
|
||||
int write = ftello64(viso->tf.file) % (viso->sector_size * 2);
|
||||
int write = ftello64(viso->tf.fp) % (viso->sector_size * 2);
|
||||
if (write) {
|
||||
write = (viso->sector_size * 2) - write;
|
||||
memset(data, 0x00, write);
|
||||
fwrite(data, write, 1, viso->tf.file);
|
||||
fwrite(data, write, 1, viso->tf.fp);
|
||||
}
|
||||
|
||||
/* Handle El Torito boot catalog. */
|
||||
if (eltorito_entry) {
|
||||
/* Write a pointer to this boot catalog to the boot descriptor. */
|
||||
*((uint32_t *) data) = cpu_to_le32(ftello64(viso->tf.file) / viso->sector_size);
|
||||
viso_pwrite(data, eltorito_offset, 4, 1, viso->tf.file);
|
||||
*((uint32_t *) data) = cpu_to_le32(ftello64(viso->tf.fp) / viso->sector_size);
|
||||
viso_pwrite(data, eltorito_offset, 4, 1, viso->tf.fp);
|
||||
|
||||
/* Fill boot catalog validation entry. */
|
||||
p = data;
|
||||
@@ -1195,21 +1208,21 @@ next_dir:
|
||||
*p++ = 0x00; /* reserved */
|
||||
|
||||
/* Save offsets to the boot catalog entry's offset and size fields for later. */
|
||||
eltorito_offset = ftello64(viso->tf.file) + (p - data);
|
||||
eltorito_offset = ftello64(viso->tf.fp) + (p - data);
|
||||
|
||||
/* Blank the rest of the working sector. This includes the sector count,
|
||||
ISO sector offset and 20-byte selection criteria fields at the end. */
|
||||
memset(p, 0x00, viso->sector_size - (p - data));
|
||||
|
||||
/* Write boot catalog. */
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.file);
|
||||
fwrite(data, viso->sector_size, 1, viso->tf.fp);
|
||||
|
||||
/* Pad to the next even sector. */
|
||||
write = ftello64(viso->tf.file) % (viso->sector_size * 2);
|
||||
write = ftello64(viso->tf.fp) % (viso->sector_size * 2);
|
||||
if (write) {
|
||||
write = (viso->sector_size * 2) - write;
|
||||
memset(data, 0x00, write);
|
||||
fwrite(data, write, 1, viso->tf.file);
|
||||
fwrite(data, write, 1, viso->tf.fp);
|
||||
}
|
||||
|
||||
/* Flag that we shouldn't hide the boot code directory if it contains other files. */
|
||||
@@ -1222,12 +1235,12 @@ next_dir:
|
||||
cdrom_image_viso_log("VISO: Generating path table #%d:\n", i);
|
||||
|
||||
/* Save this path table's start offset. */
|
||||
uint64_t pt_start = ftello64(viso->tf.file);
|
||||
uint64_t pt_start = ftello64(viso->tf.fp);
|
||||
|
||||
/* Write this table's sector offset to the corresponding volume descriptor. */
|
||||
uint32_t pt_temp = pt_start / viso->sector_size;
|
||||
*((uint32_t *) data) = (i & 1) ? cpu_to_be32(pt_temp) : cpu_to_le32(pt_temp);
|
||||
viso_pwrite(data, viso->pt_meta_offsets[i >> 1] + 8 + (8 * (i & 1)), 4, 1, viso->tf.file);
|
||||
viso_pwrite(data, viso->pt_meta_offsets[i >> 1] + 8 + (8 * (i & 1)), 4, 1, viso->tf.fp);
|
||||
|
||||
/* Go through directories. */
|
||||
dir = viso->root_dir;
|
||||
@@ -1244,7 +1257,7 @@ next_dir:
|
||||
|
||||
/* Save this directory's path table index and offset. */
|
||||
dir->pt_idx = pt_idx;
|
||||
dir->pt_offsets[i] = ftello64(viso->tf.file);
|
||||
dir->pt_offsets[i] = ftello64(viso->tf.fp);
|
||||
|
||||
/* Fill path table entry. */
|
||||
p = data;
|
||||
@@ -1280,7 +1293,7 @@ next_dir:
|
||||
*p++ = 0x00;
|
||||
|
||||
/* Write path table entry. */
|
||||
fwrite(data, p - data, 1, viso->tf.file);
|
||||
fwrite(data, p - data, 1, viso->tf.fp);
|
||||
|
||||
/* Increment path table index and stop if it overflows. */
|
||||
if (++pt_idx == 0)
|
||||
@@ -1291,17 +1304,17 @@ next_dir:
|
||||
}
|
||||
|
||||
/* Write this table's size to the corresponding volume descriptor. */
|
||||
pt_temp = ftello64(viso->tf.file) - pt_start;
|
||||
pt_temp = ftello64(viso->tf.fp) - pt_start;
|
||||
p = data;
|
||||
VISO_LBE_32(p, pt_temp);
|
||||
viso_pwrite(data, viso->pt_meta_offsets[i >> 1], 8, 1, viso->tf.file);
|
||||
viso_pwrite(data, viso->pt_meta_offsets[i >> 1], 8, 1, viso->tf.fp);
|
||||
|
||||
/* Pad to the next even sector. */
|
||||
write = ftello64(viso->tf.file) % (viso->sector_size * 2);
|
||||
write = ftello64(viso->tf.fp) % (viso->sector_size * 2);
|
||||
if (write) {
|
||||
write = (viso->sector_size * 2) - write;
|
||||
memset(data, 0x00, write);
|
||||
fwrite(data, write, 1, viso->tf.file);
|
||||
fwrite(data, write, 1, viso->tf.fp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1320,25 +1333,25 @@ next_dir:
|
||||
}
|
||||
|
||||
/* Pad to the next sector if required. */
|
||||
write = ftello64(viso->tf.file) % viso->sector_size;
|
||||
write = ftello64(viso->tf.fp) % viso->sector_size;
|
||||
if (write) {
|
||||
write = viso->sector_size - write;
|
||||
memset(data, 0x00, write);
|
||||
fwrite(data, write, 1, viso->tf.file);
|
||||
fwrite(data, write, 1, viso->tf.fp);
|
||||
}
|
||||
|
||||
/* Save this directory's child record array's start offset. */
|
||||
uint64_t dir_start = ftello64(viso->tf.file);
|
||||
uint64_t dir_start = ftello64(viso->tf.fp);
|
||||
|
||||
/* Write this directory's child record array's sector offset to its record... */
|
||||
uint32_t dir_temp = dir_start / viso->sector_size;
|
||||
p = data;
|
||||
VISO_LBE_32(p, dir_temp);
|
||||
viso_pwrite(data, dir->dr_offsets[i] + 2, 8, 1, viso->tf.file);
|
||||
viso_pwrite(data, dir->dr_offsets[i] + 2, 8, 1, viso->tf.fp);
|
||||
|
||||
/* ...and to its path table entries. */
|
||||
viso_pwrite(data, dir->pt_offsets[i << 1], 4, 1, viso->tf.file); /* little endian */
|
||||
viso_pwrite(data + 4, dir->pt_offsets[(i << 1) | 1], 4, 1, viso->tf.file); /* big endian */
|
||||
viso_pwrite(data, dir->pt_offsets[i << 1], 4, 1, viso->tf.fp); /* little endian */
|
||||
viso_pwrite(data + 4, dir->pt_offsets[(i << 1) | 1], 4, 1, viso->tf.fp); /* big endian */
|
||||
|
||||
if (i == max_vd) /* overwrite pt_offsets in the union if we no longer need them */
|
||||
dir->file = NULL;
|
||||
@@ -1358,15 +1371,15 @@ next_dir:
|
||||
viso_fill_dir_record(data, entry, viso, dir_type);
|
||||
|
||||
/* Entries cannot cross sector boundaries, so pad to the next sector if needed. */
|
||||
write = viso->sector_size - (ftello64(viso->tf.file) % viso->sector_size);
|
||||
write = viso->sector_size - (ftello64(viso->tf.fp) % viso->sector_size);
|
||||
if (write < data[0]) {
|
||||
p = data + (viso->sector_size * 2) - write;
|
||||
memset(p, 0x00, write);
|
||||
fwrite(p, write, 1, viso->tf.file);
|
||||
fwrite(p, write, 1, viso->tf.fp);
|
||||
}
|
||||
|
||||
/* Save this entry's record's offset. This overwrites name_short in the union. */
|
||||
entry->dr_offsets[i] = ftello64(viso->tf.file);
|
||||
entry->dr_offsets[i] = ftello64(viso->tf.fp);
|
||||
|
||||
/* Write data related to the . and .. pseudo-subdirectories,
|
||||
while advancing the current directory type. */
|
||||
@@ -1379,13 +1392,13 @@ next_dir:
|
||||
} else if (dir_type == VISO_DIR_PARENT) {
|
||||
/* Copy the parent directory's offset and size. The root directory's
|
||||
parent size is a special, self-referential case handled later. */
|
||||
viso_pread(data + 2, dir->parent->dr_offsets[i] + 2, 16, 1, viso->tf.file);
|
||||
viso_pread(data + 2, dir->parent->dr_offsets[i] + 2, 16, 1, viso->tf.fp);
|
||||
|
||||
dir_type = i ? VISO_DIR_JOLIET : VISO_DIR_REGULAR;
|
||||
}
|
||||
|
||||
/* Write entry. */
|
||||
fwrite(data, data[0], 1, viso->tf.file);
|
||||
fwrite(data, data[0], 1, viso->tf.fp);
|
||||
next_entry:
|
||||
/* Move on to the next entry, and stop if the end of this directory was reached. */
|
||||
entry = entry->next;
|
||||
@@ -1394,13 +1407,13 @@ next_entry:
|
||||
}
|
||||
|
||||
/* Write this directory's child record array's size to its parent and . records. */
|
||||
dir_temp = ftello64(viso->tf.file) - dir_start;
|
||||
dir_temp = ftello64(viso->tf.fp) - dir_start;
|
||||
p = data;
|
||||
VISO_LBE_32(p, dir_temp);
|
||||
viso_pwrite(data, dir->dr_offsets[i] + 10, 8, 1, viso->tf.file);
|
||||
viso_pwrite(data, dir->first_child->dr_offsets[i] + 10, 8, 1, viso->tf.file);
|
||||
viso_pwrite(data, dir->dr_offsets[i] + 10, 8, 1, viso->tf.fp);
|
||||
viso_pwrite(data, dir->first_child->dr_offsets[i] + 10, 8, 1, viso->tf.fp);
|
||||
if (dir->parent == dir) /* write size to .. on root directory as well */
|
||||
viso_pwrite(data, dir->first_child->next->dr_offsets[i] + 10, 8, 1, viso->tf.file);
|
||||
viso_pwrite(data, dir->first_child->next->dr_offsets[i] + 10, 8, 1, viso->tf.fp);
|
||||
|
||||
/* Move on to the next directory. */
|
||||
dir_type = VISO_DIR_CURRENT;
|
||||
@@ -1408,11 +1421,11 @@ next_entry:
|
||||
}
|
||||
|
||||
/* Pad to the next even sector. */
|
||||
write = ftello64(viso->tf.file) % (viso->sector_size * 2);
|
||||
write = ftello64(viso->tf.fp) % (viso->sector_size * 2);
|
||||
if (write) {
|
||||
write = (viso->sector_size * 2) - write;
|
||||
memset(data, 0x00, write);
|
||||
fwrite(data, write, 1, viso->tf.file);
|
||||
fwrite(data, write, 1, viso->tf.fp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1450,13 +1463,13 @@ next_entry:
|
||||
goto end;
|
||||
|
||||
/* Pad metadata to the new size's next sector. */
|
||||
while (ftello64(viso->tf.file) % viso->sector_size)
|
||||
fwrite(data, orig_sector_size, 1, viso->tf.file);
|
||||
while (ftello64(viso->tf.fp) % viso->sector_size)
|
||||
fwrite(data, orig_sector_size, 1, viso->tf.fp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Start sector counts. */
|
||||
viso->metadata_sectors = ftello64(viso->tf.file) / viso->sector_size;
|
||||
viso->metadata_sectors = ftello64(viso->tf.fp) / viso->sector_size;
|
||||
viso->all_sectors = viso->metadata_sectors;
|
||||
|
||||
/* Go through files, assigning sectors to them. */
|
||||
@@ -1490,12 +1503,12 @@ next_entry:
|
||||
*((uint16_t *) &data[0]) = cpu_to_le16(1);
|
||||
}
|
||||
*((uint32_t *) &data[2]) = cpu_to_le32(viso->all_sectors * base_factor);
|
||||
viso_pwrite(data, eltorito_offset, 6, 1, viso->tf.file);
|
||||
viso_pwrite(data, eltorito_offset, 6, 1, viso->tf.fp);
|
||||
} else {
|
||||
p = data;
|
||||
VISO_LBE_32(p, viso->all_sectors * base_factor);
|
||||
for (int i = 0; i <= max_vd; i++)
|
||||
viso_pwrite(data, entry->dr_offsets[i] + 2, 8, 1, viso->tf.file);
|
||||
viso_pwrite(data, entry->dr_offsets[i] + 2, 8, 1, viso->tf.fp);
|
||||
}
|
||||
|
||||
/* Save this file's base offset. This overwrites dr_offsets in the union. */
|
||||
@@ -1521,22 +1534,22 @@ next_entry:
|
||||
p = data;
|
||||
VISO_LBE_32(p, viso->all_sectors);
|
||||
for (int i = 0; i < (sizeof(viso->vol_size_offsets) / sizeof(viso->vol_size_offsets[0])); i++)
|
||||
viso_pwrite(data, viso->vol_size_offsets[i], 8, 1, viso->tf.file);
|
||||
viso_pwrite(data, viso->vol_size_offsets[i], 8, 1, viso->tf.fp);
|
||||
|
||||
/* Metadata processing is finished, read it back to memory. */
|
||||
cdrom_image_viso_log("VISO: Reading back %d %d-byte sectors of metadata\n", viso->metadata_sectors, viso->sector_size);
|
||||
viso->metadata = (uint8_t *) calloc(viso->metadata_sectors, viso->sector_size);
|
||||
if (!viso->metadata)
|
||||
goto end;
|
||||
fseeko64(viso->tf.file, 0, SEEK_SET);
|
||||
fseeko64(viso->tf.fp, 0, SEEK_SET);
|
||||
uint64_t metadata_size = viso->metadata_sectors * viso->sector_size;
|
||||
uint64_t metadata_remain = metadata_size;
|
||||
while (metadata_remain > 0)
|
||||
metadata_remain -= fread(viso->metadata + (metadata_size - metadata_remain), 1, MIN(metadata_remain, viso->sector_size), viso->tf.file);
|
||||
metadata_remain -= fread(viso->metadata + (metadata_size - metadata_remain), 1, MIN(metadata_remain, viso->sector_size), viso->tf.fp);
|
||||
|
||||
/* We no longer need the temporary file; close and delete it. */
|
||||
fclose(viso->tf.file);
|
||||
viso->tf.file = NULL;
|
||||
fclose(viso->tf.fp);
|
||||
viso->tf.fp = NULL;
|
||||
#ifndef ENABLE_CDROM_IMAGE_VISO_LOG
|
||||
remove(nvr_path(viso->tf.fn));
|
||||
#endif
|
||||
|
||||
@@ -748,7 +748,7 @@ compaq_386_init(UNUSED(const device_t *info))
|
||||
|
||||
const device_t compaq_386_device = {
|
||||
.name = "Compaq 386 Memory Control",
|
||||
.internal_name = "opti391",
|
||||
.internal_name = "compaq_386",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = compaq_386_init,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*
|
||||
* Copyright 2020 Miran Grca.
|
||||
*/
|
||||
#define USE_DRB_HACK
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -102,8 +102,9 @@ olivetti_eva_write(uint16_t addr, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
olivetti_eva_read(uint16_t addr, void *priv)
|
||||
{
|
||||
olivetti_eva_t *dev = (olivetti_eva_t *) priv;
|
||||
const olivetti_eva_t *dev = (olivetti_eva_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
switch (addr) {
|
||||
case 0x065:
|
||||
ret = dev->reg_065;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <86box/smram.h>
|
||||
#include <86box/port_92.h>
|
||||
#include <86box/chipset.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct opti602_t {
|
||||
uint8_t idx;
|
||||
@@ -73,7 +74,7 @@ opti602_gpio_write(uint16_t addr, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
opti602_gpio_read(uint16_t addr, void *priv)
|
||||
{
|
||||
opti602_t *dev = (opti602_t *) priv;
|
||||
const opti602_t *dev = (opti602_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
ret = dev->gpio[addr - dev->gpio_base];
|
||||
@@ -195,7 +196,7 @@ opti602_close(void *priv)
|
||||
}
|
||||
|
||||
static void *
|
||||
opti602_init(const device_t *info)
|
||||
opti602_init(UNUSED(const device_t *info))
|
||||
{
|
||||
opti602_t *dev = (opti602_t *) calloc(1, sizeof(opti602_t));
|
||||
|
||||
|
||||
@@ -384,9 +384,9 @@ opti822_reset(void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
opti822_close(void *p)
|
||||
opti822_close(void *priv)
|
||||
{
|
||||
opti822_t *dev = (opti822_t *) p;
|
||||
opti822_t *dev = (opti822_t *) priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*
|
||||
* Copyright 2019-2020 Miran Grca.
|
||||
*/
|
||||
#define USE_DRB_HACK
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -616,9 +617,9 @@ sis_85c496_reset(void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
sis_85c496_close(void *p)
|
||||
sis_85c496_close(void *priv)
|
||||
{
|
||||
sis_85c496_t *dev = (sis_85c496_t *) p;
|
||||
sis_85c496_t *dev = (sis_85c496_t *) priv;
|
||||
|
||||
smram_del(dev->smram);
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ int codegen_in_recompile;
|
||||
void
|
||||
codegen_set_rounding_mode(int mode)
|
||||
{
|
||||
/* cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (cpu_state.npxc & 0xc00); */
|
||||
#if 0
|
||||
cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (cpu_state.npxc & 0xc00);
|
||||
#endif
|
||||
cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (mode << 10);
|
||||
}
|
||||
|
||||
@@ -74,19 +74,25 @@
|
||||
*/
|
||||
|
||||
typedef struct codeblock_t {
|
||||
uint64_t page_mask, page_mask2;
|
||||
uint64_t *dirty_mask, *dirty_mask2;
|
||||
uint64_t page_mask;
|
||||
uint64_t page_mask2;
|
||||
uint64_t *dirty_mask;
|
||||
uint64_t *dirty_mask2;
|
||||
uint64_t cmp;
|
||||
|
||||
/*Previous and next pointers, for the codeblock list associated with
|
||||
each physical page. Two sets of pointers, as a codeblock can be
|
||||
present in two pages.*/
|
||||
struct codeblock_t *prev, *next;
|
||||
struct codeblock_t *prev_2, *next_2;
|
||||
struct codeblock_t *prev;
|
||||
struct codeblock_t *next;
|
||||
struct codeblock_t *prev_2;
|
||||
struct codeblock_t *next_2;
|
||||
|
||||
/*Pointers for codeblock tree, used to search for blocks when hash lookup
|
||||
fails.*/
|
||||
struct codeblock_t *parent, *left, *right;
|
||||
struct codeblock_t *parent;
|
||||
struct codeblock_t *left;
|
||||
struct codeblock_t *right;
|
||||
|
||||
int pnt;
|
||||
int ins;
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
|
||||
#include <86box/86box.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
#include "cpu.h"
|
||||
#include "x86.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "x87.h"
|
||||
#include "386_common.h"
|
||||
#include "cpu.h"
|
||||
|
||||
@@ -8,7 +8,9 @@ ropINC_rw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, cod
|
||||
host_reg = LOAD_REG_W(opcode & 7);
|
||||
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op1, host_reg);
|
||||
// ADD_HOST_REG_IMM_W(host_reg, 1);
|
||||
#if 0
|
||||
ADD_HOST_REG_IMM_W(host_reg, 1);
|
||||
#endif
|
||||
INC_HOST_REG_W(host_reg);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op2, 1);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_INC16);
|
||||
@@ -29,7 +31,9 @@ ropINC_rl(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, cod
|
||||
host_reg = LOAD_REG_L(opcode & 7);
|
||||
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op1, host_reg);
|
||||
// ADD_HOST_REG_IMM(host_reg, 1);
|
||||
#if 0
|
||||
ADD_HOST_REG_IMM(host_reg, 1);
|
||||
#endif
|
||||
INC_HOST_REG(host_reg);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op2, 1);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_INC32);
|
||||
@@ -50,7 +54,9 @@ ropDEC_rw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, cod
|
||||
host_reg = LOAD_REG_W(opcode & 7);
|
||||
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op1, host_reg);
|
||||
// SUB_HOST_REG_IMM_W(host_reg, 1);
|
||||
#if 0
|
||||
SUB_HOST_REG_IMM_W(host_reg, 1);
|
||||
#endif
|
||||
DEC_HOST_REG_W(host_reg);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op2, 1);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_DEC16);
|
||||
@@ -71,7 +77,9 @@ ropDEC_rl(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, cod
|
||||
host_reg = LOAD_REG_L(opcode & 7);
|
||||
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op1, host_reg);
|
||||
// SUB_HOST_REG_IMM(host_reg, 1);
|
||||
#if 0
|
||||
SUB_HOST_REG_IMM(host_reg, 1);
|
||||
#endif
|
||||
DEC_HOST_REG(host_reg);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op2, 1);
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_DEC32);
|
||||
@@ -83,194 +91,206 @@ ropDEC_rl(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, cod
|
||||
return op_pc;
|
||||
}
|
||||
|
||||
#define ROP_ARITH_RMW(name, op, writeback) \
|
||||
static uint32_t rop##name##_b_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_B_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##8); \
|
||||
src_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_B_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_w_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_W(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_W_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##16); \
|
||||
src_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_W_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_l_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_L(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_L_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##32); \
|
||||
src_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_L_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
#define ROP_ARITH_RMW(name, op, writeback) \
|
||||
static uint32_t \
|
||||
rop##name##_b_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_B_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##8); \
|
||||
src_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_B_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_w_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_W(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_W_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##16); \
|
||||
src_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_W_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_l_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_L(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_L_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##32); \
|
||||
src_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_L_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
}
|
||||
|
||||
#define ROP_ARITH_RM(name, op, writeback) \
|
||||
static uint32_t rop##name##_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_B(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##8); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_W(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##16); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_l_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_L(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##32); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
#define ROP_ARITH_RM(name, op, writeback) \
|
||||
static uint32_t \
|
||||
rop##name##_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_B(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##8); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_W(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##16); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_l_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_L(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_##op##32); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op1, dst_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_op2, src_reg); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
codegen_flags_changed = 1; \
|
||||
return op_pc + 1; \
|
||||
}
|
||||
|
||||
ROP_ARITH_RMW(ADD, ADD, 1)
|
||||
|
||||
@@ -194,23 +194,24 @@ ropFSTPd(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, code
|
||||
return new_pc;
|
||||
}
|
||||
|
||||
#define ropFarith(name, size, load, op) \
|
||||
static uint32_t ropF##name##size(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
FP_ENTER(); \
|
||||
op_pc--; \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
\
|
||||
CHECK_SEG_READ(target_seg); \
|
||||
load(target_seg); \
|
||||
\
|
||||
op(FPU_##name); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
#define ropFarith(name, size, load, op) \
|
||||
static uint32_t \
|
||||
ropF##name##size(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
FP_ENTER(); \
|
||||
op_pc--; \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
\
|
||||
CHECK_SEG_READ(target_seg); \
|
||||
load(target_seg); \
|
||||
\
|
||||
op(FPU_##name); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
}
|
||||
|
||||
ropFarith(ADD, s, MEM_LOAD_ADDR_EA_L, FP_OP_S);
|
||||
@@ -239,7 +240,8 @@ ropFarith(SUB, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL);
|
||||
ropFarith(SUBR, il, MEM_LOAD_ADDR_EA_L, FP_OP_IL);
|
||||
|
||||
#define ropFcompare(name, size, load, op) \
|
||||
static uint32_t ropF##name##size(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
static uint32_t \
|
||||
ropF##name##size(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
@@ -270,74 +272,80 @@ ropFcompare(COM, d, MEM_LOAD_ADDR_EA_Q, FP_COMPARE_D);
|
||||
ropFcompare(COM, iw, MEM_LOAD_ADDR_EA_W, FP_COMPARE_IW);
|
||||
ropFcompare(COM, il, MEM_LOAD_ADDR_EA_L, FP_COMPARE_IL);
|
||||
|
||||
/*static uint32_t ropFADDs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
#if 0
|
||||
static uint32_t
|
||||
ropFADDs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
x86seg *target_seg;
|
||||
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
|
||||
FP_OP_S(FPU_ADD);
|
||||
FP_OP_S(FPU_ADD);
|
||||
|
||||
return op_pc + 1;
|
||||
return op_pc + 1;
|
||||
}
|
||||
static uint32_t ropFDIVs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
static uint32_t
|
||||
ropFDIVs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
x86seg *target_seg;
|
||||
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
|
||||
FP_OP_S(FPU_DIV);
|
||||
FP_OP_S(FPU_DIV);
|
||||
|
||||
return op_pc + 1;
|
||||
return op_pc + 1;
|
||||
}
|
||||
static uint32_t ropFMULs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
static uint32_t
|
||||
ropFMULs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
x86seg *target_seg;
|
||||
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
|
||||
FP_OP_S(FPU_MUL);
|
||||
FP_OP_S(FPU_MUL);
|
||||
|
||||
return op_pc + 1;
|
||||
return op_pc + 1;
|
||||
}
|
||||
static uint32_t ropFSUBs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
static uint32_t
|
||||
ropFSUBs(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
x86seg *target_seg;
|
||||
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
FP_ENTER();
|
||||
op_pc--;
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32);
|
||||
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
STORE_IMM_ADDR_L((uintptr_t)&cpu_state.oldpc, op_old_pc);
|
||||
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
CHECK_SEG_READ(target_seg);
|
||||
MEM_LOAD_ADDR_EA_L(target_seg);
|
||||
|
||||
FP_OP_S(FPU_SUB);
|
||||
FP_OP_S(FPU_SUB);
|
||||
|
||||
return op_pc + 1;
|
||||
}*/
|
||||
return op_pc + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32_t
|
||||
ropFADD(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
@@ -658,15 +666,16 @@ ropFCHS(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeb
|
||||
return op_pc;
|
||||
}
|
||||
|
||||
#define opFLDimm(name, v) \
|
||||
static uint32_t ropFLD##name(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
static double fp_imm = v; \
|
||||
\
|
||||
FP_ENTER(); \
|
||||
FP_LOAD_IMM_Q(*(uint64_t *) &fp_imm); \
|
||||
\
|
||||
return op_pc; \
|
||||
#define opFLDimm(name, v) \
|
||||
static uint32_t \
|
||||
ropFLD##name(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
static double fp_imm = v; \
|
||||
\
|
||||
FP_ENTER(); \
|
||||
FP_LOAD_IMM_Q(*(uint64_t *) &fp_imm); \
|
||||
\
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
@@ -678,7 +687,8 @@ opFLDimm(EG2, 0.3010299956639812);
|
||||
opFLDimm(Z, 0.0)
|
||||
// clang-format on
|
||||
|
||||
static uint32_t ropFLDLN2(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block)
|
||||
static uint32_t
|
||||
ropFLDLN2(UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc, UNUSED(codeblock_t *block))
|
||||
{
|
||||
FP_ENTER();
|
||||
FP_LOAD_IMM_Q(0x3fe62e42fefa39f0ULL);
|
||||
|
||||
@@ -214,42 +214,45 @@ BRANCH_COND_S(int pc_offset, uint32_t op_pc, uint32_t offset, int not )
|
||||
}
|
||||
}
|
||||
|
||||
#define ropBRANCH(name, func, not ) \
|
||||
static uint32_t rop##name(uint8_t opcode, uint32_t fetchdat, \
|
||||
uint32_t op_32, uint32_t op_pc, \
|
||||
codeblock_t *block) \
|
||||
{ \
|
||||
uint32_t offset = fetchdat & 0xff; \
|
||||
\
|
||||
if (offset & 0x80) \
|
||||
offset |= 0xffffff00; \
|
||||
\
|
||||
func(1, op_pc, offset, not ); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_w(uint8_t opcode, \
|
||||
uint32_t fetchdat, uint32_t op_32, \
|
||||
uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
uint32_t offset = fetchdat & 0xffff; \
|
||||
\
|
||||
if (offset & 0x8000) \
|
||||
offset |= 0xffff0000; \
|
||||
\
|
||||
func(2, op_pc, offset, not ); \
|
||||
\
|
||||
return op_pc + 2; \
|
||||
} \
|
||||
static uint32_t rop##name##_l(uint8_t opcode, \
|
||||
uint32_t fetchdat, uint32_t op_32, \
|
||||
uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
uint32_t offset = fastreadl(cs + op_pc); \
|
||||
\
|
||||
func(4, op_pc, offset, not ); \
|
||||
\
|
||||
return op_pc + 4; \
|
||||
#define ropBRANCH(name, func, not ) \
|
||||
static uint32_t \
|
||||
rop##name(uint8_t opcode, uint32_t fetchdat, \
|
||||
uint32_t op_32, uint32_t op_pc, \
|
||||
codeblock_t *block) \
|
||||
{ \
|
||||
uint32_t offset = fetchdat & 0xff; \
|
||||
\
|
||||
if (offset & 0x80) \
|
||||
offset |= 0xffffff00; \
|
||||
\
|
||||
func(1, op_pc, offset, not ); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_w(uint8_t opcode, \
|
||||
uint32_t fetchdat, uint32_t op_32, \
|
||||
uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
uint32_t offset = fetchdat & 0xffff; \
|
||||
\
|
||||
if (offset & 0x8000) \
|
||||
offset |= 0xffff0000; \
|
||||
\
|
||||
func(2, op_pc, offset, not ); \
|
||||
\
|
||||
return op_pc + 2; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_l(uint8_t opcode, \
|
||||
uint32_t fetchdat, uint32_t op_32, \
|
||||
uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
uint32_t offset = fastreadl(cs + op_pc); \
|
||||
\
|
||||
func(4, op_pc, offset, not ); \
|
||||
\
|
||||
return op_pc + 4; \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
|
||||
@@ -1,171 +1,183 @@
|
||||
#define ROP_LOGIC(name, op, writeback) \
|
||||
static uint32_t rop##name##_b_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_B_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN8); \
|
||||
src_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_B_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_w_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_W(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_W_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN16); \
|
||||
src_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_W_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_l_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_L(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_L_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN32); \
|
||||
src_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_L_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_B(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN8); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_W(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN16); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t rop##name##_l_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg, dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_L(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN32); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
#define ROP_LOGIC(name, op, writeback) \
|
||||
static uint32_t \
|
||||
rop##name##_b_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_B_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN8); \
|
||||
src_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_B_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_w_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_W(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_W_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN16); \
|
||||
src_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_W_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_l_rmw(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
x86seg *target_seg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
dst_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
SAVE_EA(); \
|
||||
MEM_CHECK_WRITE_L(target_seg); \
|
||||
dst_reg = MEM_LOAD_ADDR_EA_L_NO_ABRT(target_seg); \
|
||||
} \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN32); \
|
||||
src_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) { \
|
||||
if ((fetchdat & 0xc0) == 0xc0) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else { \
|
||||
LOAD_EA(); \
|
||||
MEM_STORE_ADDR_EA_L_NO_ABRT(target_seg, dst_reg); \
|
||||
} \
|
||||
} else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_b_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_B(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_B(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_B((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN8); \
|
||||
op##_HOST_REG_B(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_BL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_B_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_w_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_W(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_W(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_W((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN16); \
|
||||
op##_HOST_REG_W(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR_WL((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_W_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
} \
|
||||
static uint32_t \
|
||||
rop##name##_l_rm(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg; \
|
||||
int dst_reg; \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
src_reg = LOAD_REG_L(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
MEM_LOAD_ADDR_EA_L(target_seg); \
|
||||
src_reg = 0; \
|
||||
} \
|
||||
\
|
||||
dst_reg = LOAD_REG_L((fetchdat >> 3) & 7); \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.flags_op, FLAGS_ZN32); \
|
||||
op##_HOST_REG_L(dst_reg, src_reg); \
|
||||
STORE_HOST_REG_ADDR((uintptr_t) &cpu_state.flags_res, dst_reg); \
|
||||
if (writeback) \
|
||||
STORE_REG_L_RELEASE(dst_reg); \
|
||||
else \
|
||||
RELEASE_REG(dst_reg); \
|
||||
RELEASE_REG(src_reg); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
}
|
||||
|
||||
ROP_LOGIC(AND, AND, 1)
|
||||
|
||||
@@ -95,33 +95,36 @@ ropMOVD_mm_l(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc,
|
||||
return op_pc + 1;
|
||||
}
|
||||
|
||||
#define MMX_OP(name, func) \
|
||||
static uint32_t name(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg1, src_reg2; \
|
||||
int xmm_src, xmm_dst; \
|
||||
\
|
||||
MMX_ENTER(); \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
xmm_src = LOAD_MMX_Q_MMX(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
\
|
||||
CHECK_SEG_READ(target_seg); \
|
||||
\
|
||||
MEM_LOAD_ADDR_EA_Q(target_seg); \
|
||||
src_reg1 = LOAD_Q_REG_1; \
|
||||
src_reg2 = LOAD_Q_REG_2; \
|
||||
xmm_src = LOAD_INT_TO_MMX(src_reg1, src_reg2); \
|
||||
} \
|
||||
xmm_dst = LOAD_MMX_Q_MMX((fetchdat >> 3) & 7); \
|
||||
func(xmm_dst, xmm_src); \
|
||||
STORE_MMX_Q_MMX((fetchdat >> 3) & 7, xmm_dst); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
#define MMX_OP(name, func) \
|
||||
static uint32_t \
|
||||
name(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int src_reg1; \
|
||||
int src_reg2; \
|
||||
int xmm_src; \
|
||||
int xmm_dst; \
|
||||
\
|
||||
MMX_ENTER(); \
|
||||
\
|
||||
if ((fetchdat & 0xc0) == 0xc0) { \
|
||||
xmm_src = LOAD_MMX_Q_MMX(fetchdat & 7); \
|
||||
} else { \
|
||||
x86seg *target_seg = FETCH_EA(op_ea_seg, fetchdat, op_ssegs, &op_pc, op_32); \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
\
|
||||
CHECK_SEG_READ(target_seg); \
|
||||
\
|
||||
MEM_LOAD_ADDR_EA_Q(target_seg); \
|
||||
src_reg1 = LOAD_Q_REG_1; \
|
||||
src_reg2 = LOAD_Q_REG_2; \
|
||||
xmm_src = LOAD_INT_TO_MMX(src_reg1, src_reg2); \
|
||||
} \
|
||||
xmm_dst = LOAD_MMX_Q_MMX((fetchdat >> 3) & 7); \
|
||||
func(xmm_dst, xmm_src); \
|
||||
STORE_MMX_Q_MMX((fetchdat >> 3) & 7, xmm_dst); \
|
||||
\
|
||||
return op_pc + 1; \
|
||||
}
|
||||
|
||||
MMX_OP(ropPAND, MMX_AND)
|
||||
|
||||
@@ -224,30 +224,32 @@ ropLEAVE_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, c
|
||||
return op_pc;
|
||||
}
|
||||
|
||||
#define ROP_PUSH_SEG(seg) \
|
||||
static uint32_t ropPUSH_##seg##_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int host_reg; \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(-2); \
|
||||
host_reg = LOAD_VAR_W((uintptr_t) &seg); \
|
||||
MEM_STORE_ADDR_EA_W(&cpu_state.seg_ss, host_reg); \
|
||||
SP_MODIFY(-2); \
|
||||
\
|
||||
return op_pc; \
|
||||
} \
|
||||
static uint32_t ropPUSH_##seg##_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int host_reg; \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(-4); \
|
||||
host_reg = LOAD_VAR_W((uintptr_t) &seg); \
|
||||
MEM_STORE_ADDR_EA_L(&cpu_state.seg_ss, host_reg); \
|
||||
SP_MODIFY(-4); \
|
||||
\
|
||||
return op_pc; \
|
||||
#define ROP_PUSH_SEG(seg) \
|
||||
static uint32_t \
|
||||
ropPUSH_##seg##_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int host_reg; \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(-2); \
|
||||
host_reg = LOAD_VAR_W((uintptr_t) &seg); \
|
||||
MEM_STORE_ADDR_EA_W(&cpu_state.seg_ss, host_reg); \
|
||||
SP_MODIFY(-2); \
|
||||
\
|
||||
return op_pc; \
|
||||
} \
|
||||
static uint32_t \
|
||||
ropPUSH_##seg##_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int host_reg; \
|
||||
\
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(-4); \
|
||||
host_reg = LOAD_VAR_W((uintptr_t) &seg); \
|
||||
MEM_STORE_ADDR_EA_L(&cpu_state.seg_ss, host_reg); \
|
||||
SP_MODIFY(-4); \
|
||||
\
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
ROP_PUSH_SEG(CS)
|
||||
@@ -257,26 +259,28 @@ ROP_PUSH_SEG(FS)
|
||||
ROP_PUSH_SEG(GS)
|
||||
ROP_PUSH_SEG(SS)
|
||||
|
||||
#define ROP_POP_SEG(seg, rseg) \
|
||||
static uint32_t ropPOP_##seg##_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(0); \
|
||||
MEM_LOAD_ADDR_EA_W(&cpu_state.seg_ss); \
|
||||
LOAD_SEG(0, &rseg); \
|
||||
SP_MODIFY(2); \
|
||||
\
|
||||
return op_pc; \
|
||||
} \
|
||||
static uint32_t ropPOP_##seg##_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(0); \
|
||||
MEM_LOAD_ADDR_EA_W(&cpu_state.seg_ss); \
|
||||
LOAD_SEG(0, &rseg); \
|
||||
SP_MODIFY(4); \
|
||||
\
|
||||
return op_pc; \
|
||||
#define ROP_POP_SEG(seg, rseg) \
|
||||
static uint32_t \
|
||||
ropPOP_##seg##_16(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(0); \
|
||||
MEM_LOAD_ADDR_EA_W(&cpu_state.seg_ss); \
|
||||
LOAD_SEG(0, &rseg); \
|
||||
SP_MODIFY(2); \
|
||||
\
|
||||
return op_pc; \
|
||||
} \
|
||||
static uint32_t \
|
||||
ropPOP_##seg##_32(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
STORE_IMM_ADDR_L((uintptr_t) &cpu_state.oldpc, op_old_pc); \
|
||||
LOAD_STACK_TO_EA(0); \
|
||||
MEM_LOAD_ADDR_EA_W(&cpu_state.seg_ss); \
|
||||
LOAD_SEG(0, &rseg); \
|
||||
SP_MODIFY(4); \
|
||||
\
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
ROP_POP_SEG(DS, cpu_state.seg_ds)
|
||||
|
||||
@@ -219,8 +219,9 @@ CALL_FUNC(uintptr_t func)
|
||||
}
|
||||
|
||||
static __inline void
|
||||
RELEASE_REG(int host_reg)
|
||||
RELEASE_REG(UNUSED(int host_reg))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static __inline int
|
||||
@@ -536,7 +537,7 @@ FETCH_EA_16(x86seg *op_ea_seg, uint32_t fetchdat, int op_ssegs, uint32_t *op_pc)
|
||||
addlong((fetchdat >> 8) & 0xffff);
|
||||
(*op_pc) += 2;
|
||||
} else {
|
||||
int base_reg = 0;
|
||||
int base_reg = 0;
|
||||
int index_reg = 0;
|
||||
|
||||
switch (rm) {
|
||||
@@ -3949,7 +3950,8 @@ FP_LOAD_REG_D(int reg, int *host_reg1, int *host_reg2)
|
||||
static __inline int64_t
|
||||
x87_fround16_64(double b)
|
||||
{
|
||||
int16_t a, c;
|
||||
int16_t a;
|
||||
int16_t c;
|
||||
|
||||
switch ((cpu_state.npxc >> 10) & 3) {
|
||||
case 0: /*Nearest*/
|
||||
@@ -3974,7 +3976,8 @@ x87_fround16_64(double b)
|
||||
static __inline int64_t
|
||||
x87_fround32_64(double b)
|
||||
{
|
||||
int32_t a, c;
|
||||
int32_t a;
|
||||
int32_t c;
|
||||
|
||||
switch ((cpu_state.npxc >> 10) & 3) {
|
||||
case 0: /*Nearest*/
|
||||
@@ -3999,7 +4002,8 @@ x87_fround32_64(double b)
|
||||
static __inline int64_t
|
||||
x87_fround(double b)
|
||||
{
|
||||
int64_t a, c;
|
||||
int64_t a;
|
||||
int64_t c;
|
||||
|
||||
switch ((cpu_state.npxc >> 10) & 3) {
|
||||
case 0: /*Nearest*/
|
||||
@@ -4550,8 +4554,9 @@ FP_COMPARE_IL(void)
|
||||
}
|
||||
|
||||
static __inline void
|
||||
UPDATE_NPXC(int reg)
|
||||
UPDATE_NPXC(UNUSED(int reg))
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static __inline void
|
||||
@@ -4775,13 +4780,14 @@ STORE_MMX_Q_MMX(int guest_reg, int host_reg)
|
||||
addbyte((uint8_t) cpu_state_offset(MM[guest_reg].q));
|
||||
}
|
||||
|
||||
#define MMX_x86_OP(name, opcode) \
|
||||
static __inline void MMX_##name(int dst_reg, int src_reg) \
|
||||
{ \
|
||||
addbyte(0x66); /*op dst_reg, src_reg*/ \
|
||||
addbyte(0x0f); \
|
||||
addbyte(opcode); \
|
||||
addbyte(0xc0 | (dst_reg << 3) | src_reg); \
|
||||
#define MMX_x86_OP(name, opcode) \
|
||||
static __inline void \
|
||||
MMX_##name(int dst_reg, int src_reg) \
|
||||
{ \
|
||||
addbyte(0x66); /*op dst_reg, src_reg*/ \
|
||||
addbyte(0x0f); \
|
||||
addbyte(opcode); \
|
||||
addbyte(0xc0 | (dst_reg << 3) | src_reg); \
|
||||
}
|
||||
|
||||
MMX_x86_OP(AND, 0xdb)
|
||||
@@ -5014,7 +5020,9 @@ LOAD_EA(void)
|
||||
static __inline void
|
||||
MEM_CHECK_WRITE(x86seg *seg)
|
||||
{
|
||||
uint8_t *jump1, *jump2, *jump3 = NULL;
|
||||
uint8_t *jump1 = NULL;
|
||||
uint8_t *jump2 = NULL;
|
||||
uint8_t *jump3 = NULL;
|
||||
|
||||
CHECK_SEG_WRITE(seg);
|
||||
|
||||
@@ -5115,7 +5123,10 @@ MEM_CHECK_WRITE(x86seg *seg)
|
||||
static __inline void
|
||||
MEM_CHECK_WRITE_W(x86seg *seg)
|
||||
{
|
||||
uint8_t *jump1, *jump2, *jump3, *jump4 = NULL;
|
||||
uint8_t *jump1 = NULL;
|
||||
uint8_t *jump2 = NULL;
|
||||
uint8_t *jump3 = NULL;
|
||||
uint8_t *jump4 = NULL;
|
||||
int jump_pos;
|
||||
|
||||
CHECK_SEG_WRITE(seg);
|
||||
@@ -5248,7 +5259,10 @@ MEM_CHECK_WRITE_W(x86seg *seg)
|
||||
static __inline void
|
||||
MEM_CHECK_WRITE_L(x86seg *seg)
|
||||
{
|
||||
uint8_t *jump1, *jump2, *jump3, *jump4 = NULL;
|
||||
uint8_t *jump1 = NULL;
|
||||
uint8_t *jump2 = NULL;
|
||||
uint8_t *jump3 = NULL;
|
||||
uint8_t *jump4 = NULL;
|
||||
int jump_pos;
|
||||
|
||||
CHECK_SEG_WRITE(seg);
|
||||
|
||||
@@ -3619,37 +3619,39 @@ STORE_MMX_Q_MMX(int guest_reg, int host_reg)
|
||||
addbyte((uint8_t) cpu_state_offset(MM[guest_reg].q));
|
||||
}
|
||||
|
||||
#define MMX_x86_OP(name, opcode) \
|
||||
static __inline void MMX_##name(int dst_reg, int src_reg) \
|
||||
{ \
|
||||
addbyte(0x66); /*op dst_reg, src_reg*/ \
|
||||
addbyte(0x0f); \
|
||||
addbyte(opcode); \
|
||||
addbyte(0xc0 | (dst_reg << 3) | src_reg); \
|
||||
#define MMX_x86_OP(name, opcode) \
|
||||
static \
|
||||
__inline void MMX_##name(int dst_reg, int src_reg) \
|
||||
{ \
|
||||
addbyte(0x66); /*op dst_reg, src_reg*/ \
|
||||
addbyte(0x0f); \
|
||||
addbyte(opcode); \
|
||||
addbyte(0xc0 | (dst_reg << 3) | src_reg); \
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
MMX_x86_OP(AND, 0xdb)
|
||||
MMX_x86_OP(ANDN, 0xdf)
|
||||
MMX_x86_OP(OR, 0xeb)
|
||||
MMX_x86_OP(XOR, 0xef)
|
||||
MMX_x86_OP(ANDN, 0xdf)
|
||||
MMX_x86_OP(OR, 0xeb)
|
||||
MMX_x86_OP(XOR, 0xef)
|
||||
|
||||
MMX_x86_OP(ADDB, 0xfc)
|
||||
MMX_x86_OP(ADDW, 0xfd)
|
||||
MMX_x86_OP(ADDD, 0xfe)
|
||||
MMX_x86_OP(ADDSB, 0xec)
|
||||
MMX_x86_OP(ADDSW, 0xed)
|
||||
MMX_x86_OP(ADDUSB, 0xdc)
|
||||
MMX_x86_OP(ADDUSW, 0xdd)
|
||||
MMX_x86_OP(ADDB, 0xfc)
|
||||
MMX_x86_OP(ADDW, 0xfd)
|
||||
MMX_x86_OP(ADDD, 0xfe)
|
||||
MMX_x86_OP(ADDSB, 0xec)
|
||||
MMX_x86_OP(ADDSW, 0xed)
|
||||
MMX_x86_OP(ADDUSB, 0xdc)
|
||||
MMX_x86_OP(ADDUSW, 0xdd)
|
||||
|
||||
MMX_x86_OP(SUBB, 0xf8)
|
||||
MMX_x86_OP(SUBW, 0xf9)
|
||||
MMX_x86_OP(SUBD, 0xfa)
|
||||
MMX_x86_OP(SUBSB, 0xe8)
|
||||
MMX_x86_OP(SUBSW, 0xe9)
|
||||
MMX_x86_OP(SUBUSB, 0xd8)
|
||||
MMX_x86_OP(SUBUSW, 0xd9)
|
||||
MMX_x86_OP(SUBB, 0xf8)
|
||||
MMX_x86_OP(SUBW, 0xf9)
|
||||
MMX_x86_OP(SUBD, 0xfa)
|
||||
MMX_x86_OP(SUBSB, 0xe8)
|
||||
MMX_x86_OP(SUBSW, 0xe9)
|
||||
MMX_x86_OP(SUBUSB, 0xd8)
|
||||
MMX_x86_OP(SUBUSW, 0xd9)
|
||||
|
||||
MMX_x86_OP(PUNPCKLBW, 0x60);
|
||||
MMX_x86_OP(PUNPCKLBW, 0x60);
|
||||
MMX_x86_OP(PUNPCKLWD, 0x61);
|
||||
MMX_x86_OP(PUNPCKLDQ, 0x62);
|
||||
MMX_x86_OP(PCMPGTB, 0x64);
|
||||
@@ -3672,6 +3674,7 @@ MMX_x86_OP(PSLLQ, 0xf3);
|
||||
MMX_x86_OP(PMULLW, 0xd5);
|
||||
MMX_x86_OP(PMULHW, 0xe5);
|
||||
MMX_x86_OP(PMADDWD, 0xf5);
|
||||
// clang-format on
|
||||
|
||||
static __inline void
|
||||
MMX_PACKSSWB(int dst_reg, int src_reg)
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
#define OP_XCHG_AX_(reg) \
|
||||
static uint32_t ropXCHG_AX_##reg(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int ax_reg, host_reg, temp_reg; \
|
||||
\
|
||||
ax_reg = LOAD_REG_W(REG_AX); \
|
||||
host_reg = LOAD_REG_W(REG_##reg); \
|
||||
temp_reg = COPY_REG(host_reg); \
|
||||
STORE_REG_TARGET_W_RELEASE(ax_reg, REG_##reg); \
|
||||
STORE_REG_TARGET_W_RELEASE(temp_reg, REG_AX); \
|
||||
\
|
||||
return op_pc; \
|
||||
#define OP_XCHG_AX_(reg) \
|
||||
static uint32_t \
|
||||
ropXCHG_AX_##reg(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int ax_reg, host_reg, temp_reg; \
|
||||
\
|
||||
ax_reg = LOAD_REG_W(REG_AX); \
|
||||
host_reg = LOAD_REG_W(REG_##reg); \
|
||||
temp_reg = COPY_REG(host_reg); \
|
||||
STORE_REG_TARGET_W_RELEASE(ax_reg, REG_##reg); \
|
||||
STORE_REG_TARGET_W_RELEASE(temp_reg, REG_AX); \
|
||||
\
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
OP_XCHG_AX_(BX)
|
||||
@@ -20,18 +21,19 @@ OP_XCHG_AX_(DI)
|
||||
OP_XCHG_AX_(SP)
|
||||
OP_XCHG_AX_(BP)
|
||||
|
||||
#define OP_XCHG_EAX_(reg) \
|
||||
static uint32_t ropXCHG_EAX_##reg(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int eax_reg, host_reg, temp_reg; \
|
||||
\
|
||||
eax_reg = LOAD_REG_L(REG_EAX); \
|
||||
host_reg = LOAD_REG_L(REG_##reg); \
|
||||
temp_reg = COPY_REG(host_reg); \
|
||||
STORE_REG_TARGET_L_RELEASE(eax_reg, REG_##reg); \
|
||||
STORE_REG_TARGET_L_RELEASE(temp_reg, REG_EAX); \
|
||||
\
|
||||
return op_pc; \
|
||||
#define OP_XCHG_EAX_(reg) \
|
||||
static uint32_t \
|
||||
ropXCHG_EAX_##reg(uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc, codeblock_t *block) \
|
||||
{ \
|
||||
int eax_reg, host_reg, temp_reg; \
|
||||
\
|
||||
eax_reg = LOAD_REG_L(REG_EAX); \
|
||||
host_reg = LOAD_REG_L(REG_##reg); \
|
||||
temp_reg = COPY_REG(host_reg); \
|
||||
STORE_REG_TARGET_L_RELEASE(eax_reg, REG_##reg); \
|
||||
STORE_REG_TARGET_L_RELEASE(temp_reg, REG_EAX); \
|
||||
\
|
||||
return op_pc; \
|
||||
}
|
||||
|
||||
OP_XCHG_EAX_(EBX)
|
||||
|
||||
@@ -11,8 +11,11 @@
|
||||
# include "x86.h"
|
||||
# include "x86_flags.h"
|
||||
# include "x86_ops.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
# include "x87.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "386_common.h"
|
||||
|
||||
@@ -29,7 +32,8 @@
|
||||
# include <windows.h>
|
||||
# endif
|
||||
|
||||
int codegen_flat_ds, codegen_flat_ss;
|
||||
int codegen_flat_ds;
|
||||
int codegen_flat_ss;
|
||||
int codegen_flags_changed = 0;
|
||||
int codegen_fpu_entered = 0;
|
||||
int codegen_fpu_loaded_iq[8];
|
||||
@@ -63,8 +67,6 @@ static int last_ssegs;
|
||||
void
|
||||
codegen_init(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
# if _WIN64
|
||||
codeblock = VirtualAlloc(NULL, BLOCK_SIZE * sizeof(codeblock_t), MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
# elif defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)
|
||||
@@ -77,26 +79,25 @@ codegen_init(void)
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
for (c = 0; c < BLOCK_SIZE; c++)
|
||||
for (int c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].valid = 0;
|
||||
}
|
||||
|
||||
void
|
||||
codegen_reset(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
mem_reset_page_blocks();
|
||||
|
||||
for (c = 0; c < BLOCK_SIZE; c++)
|
||||
for (int c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].valid = 0;
|
||||
}
|
||||
|
||||
void
|
||||
dump_block(void)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -534,6 +535,7 @@ int opcode_0f_modrm[256] = {
|
||||
void
|
||||
codegen_debug(void)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static x86seg *
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
# include "x86.h"
|
||||
# include "x86_flags.h"
|
||||
# include "x86_ops.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
# include "x87.h"
|
||||
/*ex*/
|
||||
# include <86box/nmi.h>
|
||||
@@ -1256,7 +1258,7 @@ codegen_init(void)
|
||||
# else
|
||||
__asm
|
||||
{
|
||||
fstcw cpu_state.old_npxc
|
||||
fstcw cpu_state.old_npxc
|
||||
}
|
||||
# endif
|
||||
}
|
||||
@@ -1677,6 +1679,7 @@ int opcode_0f_modrm[256] = {
|
||||
void
|
||||
codegen_debug(void)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
static x86seg *
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86_ops.h"
|
||||
#include "codegen.h"
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
|
||||
#include "386_common.h"
|
||||
|
||||
@@ -90,7 +93,7 @@ codegen_generate_reset(void)
|
||||
}
|
||||
|
||||
void
|
||||
codegen_check_seg_read(codeblock_t *block, ir_data_t *ir, x86seg *seg)
|
||||
codegen_check_seg_read(UNUSED(codeblock_t *block), ir_data_t *ir, x86seg *seg)
|
||||
{
|
||||
/*Segments always valid in real/V86 mode*/
|
||||
if (!(cr0 & 1) || (cpu_state.eflags & VM_FLAG))
|
||||
@@ -108,7 +111,7 @@ codegen_check_seg_read(codeblock_t *block, ir_data_t *ir, x86seg *seg)
|
||||
seg->checked = 1;
|
||||
}
|
||||
void
|
||||
codegen_check_seg_write(codeblock_t *block, ir_data_t *ir, x86seg *seg)
|
||||
codegen_check_seg_write(UNUSED(codeblock_t *block), ir_data_t *ir, x86seg *seg)
|
||||
{
|
||||
/*Segments always valid in real/V86 mode*/
|
||||
if (!(cr0 & 1) || (cpu_state.eflags & VM_FLAG))
|
||||
@@ -140,10 +143,10 @@ codegen_generate_ea_16_long(ir_data_t *ir, x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
int offset;
|
||||
|
||||
switch (cpu_rm & 7) {
|
||||
default:
|
||||
case 0:
|
||||
case 1:
|
||||
case 7:
|
||||
default:
|
||||
base_reg = IREG_EBX;
|
||||
break;
|
||||
case 2:
|
||||
@@ -180,6 +183,9 @@ codegen_generate_ea_16_long(ir_data_t *ir, x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
uop_ADD_IMM(ir, IREG_eaaddr, IREG_eaaddr, offset);
|
||||
(*op_pc) += 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uop_AND_IMM(ir, IREG_eaaddr, IREG_eaaddr, 0xffff);
|
||||
@@ -241,12 +247,16 @@ codegen_generate_ea_32_long(ir_data_t *ir, x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
(*op_pc) += 4;
|
||||
uop_ADD(ir, IREG_eaaddr, IREG_eaaddr, sib & 7);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (stack_offset && (sib & 7) == 4 && (cpu_mod || (sib & 7) != 5)) /*ESP*/
|
||||
{
|
||||
if (stack_offset && (sib & 7) == 4 && (cpu_mod || (sib & 7) != 5)) { /*ESP*/
|
||||
uop_ADD_IMM(ir, IREG_eaaddr, IREG_eaaddr, stack_offset);
|
||||
// addbyte(0x05);
|
||||
// addlong(stack_offset);
|
||||
#if 0
|
||||
addbyte(0x05);
|
||||
addlong(stack_offset);
|
||||
#endif
|
||||
}
|
||||
if (((sib & 7) == 4 || (cpu_mod && (sib & 7) == 5)) && !op_ssegs)
|
||||
op_ea_seg = &cpu_state.seg_ss;
|
||||
@@ -264,6 +274,9 @@ codegen_generate_ea_32_long(ir_data_t *ir, x86seg *op_ea_seg, uint32_t fetchdat,
|
||||
case 3:
|
||||
uop_ADD_LSHIFT(ir, IREG_eaaddr, IREG_eaaddr, (sib >> 3) & 7, 3);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -374,7 +387,7 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p
|
||||
codeblock_t *block = &codeblock[block_current];
|
||||
ir_data_t *ir = codegen_get_ir_data();
|
||||
uint32_t op_pc = new_pc;
|
||||
const OpFn *op_table = (OpFn *) x86_dynarec_opcodes;
|
||||
const OpFn *op_table = x86_dynarec_opcodes;
|
||||
RecompOpFn *recomp_op_table = recomp_opcodes;
|
||||
int opcode_shift = 0;
|
||||
int opcode_mask = 0x3ff;
|
||||
@@ -637,7 +650,7 @@ generate_call:
|
||||
if (!fpu_softfloat && recomp_opcodes_3DNOW[opcode_3dnow]) {
|
||||
next_pc = opcode_pc + 1;
|
||||
|
||||
op_table = (OpFn *) x86_dynarec_opcodes_3DNOW;
|
||||
op_table = x86_dynarec_opcodes_3DNOW;
|
||||
recomp_op_table = fpu_softfloat ? NULL : recomp_opcodes_3DNOW;
|
||||
opcode = opcode_3dnow;
|
||||
recomp_opcode_mask = 0xff;
|
||||
@@ -646,8 +659,10 @@ generate_call:
|
||||
}
|
||||
codegen_mark_code_present(block, cs + old_pc, (op_pc - old_pc) - pc_off);
|
||||
/* It is apparently a prefixed instruction. */
|
||||
// if ((recomp_op_table == recomp_opcodes) && (opcode == 0x48))
|
||||
// goto codegen_skip;
|
||||
#if 0
|
||||
if ((recomp_op_table == recomp_opcodes) && (opcode == 0x48))
|
||||
goto codegen_skip;
|
||||
#endif
|
||||
|
||||
if (recomp_op_table && recomp_op_table[(opcode | op_32) & recomp_opcode_mask]) {
|
||||
uint32_t new_pc = recomp_op_table[(opcode | op_32) & recomp_opcode_mask](block, ir, opcode, fetchdat, op_32, op_pc);
|
||||
@@ -668,7 +683,7 @@ generate_call:
|
||||
|
||||
// codegen_skip:
|
||||
if ((op_table == x86_dynarec_opcodes_REPNE || op_table == x86_dynarec_opcodes_REPE) && !op_table[opcode | op_32]) {
|
||||
op_table = (OpFn *) x86_dynarec_opcodes;
|
||||
op_table = x86_dynarec_opcodes;
|
||||
recomp_op_table = recomp_opcodes;
|
||||
}
|
||||
|
||||
@@ -719,7 +734,9 @@ generate_call:
|
||||
last_op_32 = op_32;
|
||||
last_op_ea_seg = op_ea_seg;
|
||||
last_op_ssegs = op_ssegs;
|
||||
// codegen_block_ins++;
|
||||
#if 0
|
||||
codegen_block_ins++;
|
||||
#endif
|
||||
|
||||
block->ins++;
|
||||
|
||||
@@ -728,6 +745,8 @@ generate_call:
|
||||
|
||||
codegen_endpc = (cs + cpu_state.pc) + 8;
|
||||
|
||||
// if (has_ea)
|
||||
// fatal("Has EA\n");
|
||||
#if 0
|
||||
if (has_ea)
|
||||
fatal("Has EA\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -16,7 +17,7 @@ static struct
|
||||
};
|
||||
|
||||
void
|
||||
codegen_accumulate(ir_data_t *ir, int acc_reg, int delta)
|
||||
codegen_accumulate(UNUSED(ir_data_t *ir), int acc_reg, int delta)
|
||||
{
|
||||
acc_regs[acc_reg].count += delta;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "codegen.h"
|
||||
#include "codegen_allocator.h"
|
||||
@@ -112,7 +113,7 @@ codeblock_allocator_get_ptr(mem_block_t *block)
|
||||
}
|
||||
|
||||
void
|
||||
codegen_allocator_clean_blocks(struct mem_block_t *block)
|
||||
codegen_allocator_clean_blocks(UNUSED(struct mem_block_t *block))
|
||||
{
|
||||
#if defined __ARM_EABI__ || defined _ARM_ || defined __aarch64__ || defined _M_ARM || defined _M_ARM64
|
||||
while (1) {
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
# include "codegen_backend_arm_ops.h"
|
||||
# include "codegen_reg.h"
|
||||
# include "x86.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
# include "x87.h"
|
||||
|
||||
# if defined(__linux__) || defined(__APPLE__)
|
||||
@@ -44,7 +46,7 @@ void *codegen_gpf_rout;
|
||||
void *codegen_exit_rout;
|
||||
|
||||
host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
|
||||
{REG_R4, 0},
|
||||
{ REG_R4, 0},
|
||||
{ REG_R5, 0},
|
||||
{ REG_R6, 0},
|
||||
{ REG_R7, 0},
|
||||
@@ -54,7 +56,7 @@ host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
|
||||
};
|
||||
|
||||
host_reg_def_t codegen_host_fp_reg_list[CODEGEN_HOST_FP_REGS] = {
|
||||
{REG_D8, 0},
|
||||
{ REG_D8, 0},
|
||||
{ REG_D9, 0},
|
||||
{ REG_D10, 0},
|
||||
{ REG_D11, 0},
|
||||
@@ -288,7 +290,6 @@ void
|
||||
codegen_backend_init(void)
|
||||
{
|
||||
codeblock_t *block;
|
||||
int c;
|
||||
|
||||
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
|
||||
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
|
||||
@@ -296,7 +297,7 @@ codegen_backend_init(void)
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
for (c = 0; c < BLOCK_SIZE; c++)
|
||||
for (int c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].pc = BLOCK_PC_INVALID;
|
||||
|
||||
block_current = 0;
|
||||
@@ -306,7 +307,9 @@ codegen_backend_init(void)
|
||||
block->data = codeblock_allocator_get_ptr(block->head_mem_block);
|
||||
block_write_data = block->data;
|
||||
build_loadstore_routines(&codeblock[block_current]);
|
||||
// pclog("block_pos=%i\n", block_pos);
|
||||
# if 0
|
||||
pclog("block_pos=%i\n", block_pos);
|
||||
# endif
|
||||
|
||||
codegen_fp_round = &block_write_data[block_pos];
|
||||
build_fp_round_routine(&codeblock[block_current]);
|
||||
@@ -322,7 +325,9 @@ codegen_backend_init(void)
|
||||
host_arm_LDMIA_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_PC);
|
||||
|
||||
block_write_data = NULL;
|
||||
// fatal("block_pos=%i\n", block_pos);
|
||||
# if 0
|
||||
fatal("block_pos=%i\n", block_pos);
|
||||
# endif
|
||||
asm("vmrs %0, fpscr\n"
|
||||
: "=r"(cpu_state.old_fp_control));
|
||||
if ((cpu_state.old_fp_control >> 22) & 3)
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
# include "codegen_backend_arm64_ops.h"
|
||||
# include "codegen_reg.h"
|
||||
# include "x86.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
# include "x87.h"
|
||||
|
||||
# if defined(__linux__) || defined(__APPLE__)
|
||||
@@ -45,7 +47,7 @@ void *codegen_gpf_rout;
|
||||
void *codegen_exit_rout;
|
||||
|
||||
host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
|
||||
{REG_X19, 0},
|
||||
{ REG_X19, 0},
|
||||
{ REG_X20, 0},
|
||||
{ REG_X21, 0},
|
||||
{ REG_X22, 0},
|
||||
@@ -58,7 +60,7 @@ host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
|
||||
};
|
||||
|
||||
host_reg_def_t codegen_host_fp_reg_list[CODEGEN_HOST_FP_REGS] = {
|
||||
{REG_V8, 0},
|
||||
{ REG_V8, 0},
|
||||
{ REG_V9, 0},
|
||||
{ REG_V10, 0},
|
||||
{ REG_V11, 0},
|
||||
@@ -281,7 +283,6 @@ void
|
||||
codegen_backend_init(void)
|
||||
{
|
||||
codeblock_t *block;
|
||||
int c;
|
||||
|
||||
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
|
||||
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
|
||||
@@ -289,7 +290,7 @@ codegen_backend_init(void)
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
for (c = 0; c < BLOCK_SIZE; c++) {
|
||||
for (int c = 0; c < BLOCK_SIZE; c++) {
|
||||
codeblock[c].pc = BLOCK_PC_INVALID;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
search over*/
|
||||
#define IMM_NR 1302
|
||||
static uint32_t imm_table[][2] = {
|
||||
{0x800, 0x00000001},
|
||||
{ 0x800, 0x00000001},
|
||||
{ 0xfc0, 0x00000002},
|
||||
{ 0x801, 0x00000003},
|
||||
{ 0xf80, 0x00000004},
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
@@ -297,7 +298,9 @@ in_range(void *addr, void *base)
|
||||
void host_arm_ADD_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
void host_arm_AND_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
void host_arm_EOR_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
// void host_arm_ORR_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
# if 0
|
||||
void host_arm_ORR_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
# endif
|
||||
void host_arm_SUB_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,8 @@
|
||||
# include "codegen_backend_x86-64_ops_sse.h"
|
||||
# include "codegen_reg.h"
|
||||
# include "x86.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
|
||||
# if defined(__linux__) || defined(__APPLE__)
|
||||
# include <sys/mman.h>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
@@ -585,7 +586,7 @@ host_x86_MOV16_ABS_REG(codeblock_t *block, void *p, int src_reg)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x89, 0x45 | ((src_reg & 7) << 3), offset); /*MOV offset[RBP], src_reg*/
|
||||
} else if (offset < (1ull << 32)) {
|
||||
} else if (offset < (1ULL << 32)) {
|
||||
codegen_alloc_bytes(block, 7);
|
||||
codegen_addbyte3(block, 0x66, 0x89, 0x85 | ((src_reg & 7) << 3)); /*MOV offset[RBP], src_reg*/
|
||||
codegen_addlong(block, offset);
|
||||
@@ -605,7 +606,7 @@ host_x86_MOV32_ABS_REG(codeblock_t *block, void *p, int src_reg)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x89, 0x45 | ((src_reg & 7) << 3), offset); /*MOV offset[RBP], src_reg*/
|
||||
} else if (offset < (1ull << 32)) {
|
||||
} else if (offset < (1ULL << 32)) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte2(block, 0x89, 0x85 | ((src_reg & 7) << 3)); /*MOV offset[RBP], src_reg*/
|
||||
codegen_addlong(block, offset);
|
||||
@@ -690,11 +691,11 @@ host_x86_MOV8_REG_ABS(codeblock_t *block, int dst_reg, void *p)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x8a, 0x45 | ((dst_reg & 7) << 3), offset); /*MOV dst_reg, offset[RBP]*/
|
||||
} else if (offset < (1ull << 32)) {
|
||||
} else if (offset < (1ULL << 32)) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte2(block, 0x8a, 0x85 | ((dst_reg & 7) << 3)); /*MOV dst_reg, offset[RBP]*/
|
||||
codegen_addlong(block, offset);
|
||||
} else if ((ram_offset < (1ull << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
} else if ((ram_offset < (1ULL << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
codegen_alloc_bytes(block, 8);
|
||||
codegen_addbyte4(block, 0x41, 0x8a, 0x84 | ((dst_reg & 7) << 3), 0x24); /*MOV dst_reg, ram_offset[R12]*/
|
||||
codegen_addlong(block, ram_offset);
|
||||
@@ -714,11 +715,11 @@ host_x86_MOV16_REG_ABS(codeblock_t *block, int dst_reg, void *p)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x8b, 0x45 | ((dst_reg & 7) << 3), offset); /*MOV dst_reg, offset[RBP]*/
|
||||
} else if (offset < (1ull << 32)) {
|
||||
} else if (offset < (1ULL << 32)) {
|
||||
codegen_alloc_bytes(block, 7);
|
||||
codegen_addbyte3(block, 0x66, 0x8b, 0x85 | ((dst_reg & 7) << 3)); /*MOV dst_reg, offset[RBP]*/
|
||||
codegen_addlong(block, offset);
|
||||
} else if ((ram_offset < (1ull << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
} else if ((ram_offset < (1ULL << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte4(block, 0x66, 0x41, 0x8b, 0x84 | ((dst_reg & 7) << 3)); /*MOV dst_reg, ram_offset[R12]*/
|
||||
codegen_addbyte(block, 0x24);
|
||||
@@ -744,11 +745,11 @@ host_x86_MOV32_REG_ABS(codeblock_t *block, int dst_reg, void *p)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x8b, 0x45 | ((dst_reg & 7) << 3), offset); /*MOV dst_reg, offset[RBP]*/
|
||||
} else if (offset < (1ull << 32)) {
|
||||
} else if (offset < (1ULL << 32)) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte2(block, 0x8b, 0x85 | ((dst_reg & 7) << 3)); /*MOV dst_reg, offset[RBP]*/
|
||||
codegen_addlong(block, offset);
|
||||
} else if ((ram_offset < (1ull << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
} else if ((ram_offset < (1ULL << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
codegen_alloc_bytes(block, 8);
|
||||
codegen_addbyte4(block, 0x41, 0x8b, 0x84 | ((dst_reg & 7) << 3), 0x24); /*MOV dst_reg, ram_offset[R12]*/
|
||||
codegen_addlong(block, ram_offset);
|
||||
@@ -771,7 +772,7 @@ host_x86_MOV64_REG_ABS(codeblock_t *block, int dst_reg, void *p)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x48, 0x8b, 0x45 | ((dst_reg & 7) << 3), offset); /*MOV dst_reg, offset[RBP]*/
|
||||
} else if (offset < (1ull << 32)) {
|
||||
} else if (offset < (1ULL << 32)) {
|
||||
codegen_alloc_bytes(block, 7);
|
||||
codegen_addbyte3(block, 0x48, 0x8b, 0x85 | ((dst_reg & 7) << 3)); /*MOV dst_reg, offset[RBP]*/
|
||||
codegen_addlong(block, offset);
|
||||
@@ -1092,7 +1093,7 @@ host_x86_MOVZX_REG_ABS_16_8(codeblock_t *block, int dst_reg, void *p)
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte(block, 0x66);
|
||||
codegen_addbyte4(block, 0x0f, 0xb6, 0x45 | ((dst_reg & 7) << 3), offset); /*MOVZX dst_reg, offset[RBP]*/
|
||||
} else if ((ram_offset < (1ull << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
} else if ((ram_offset < (1ULL << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
codegen_alloc_bytes(block, 10);
|
||||
codegen_addbyte2(block, 0x66, 0x41);
|
||||
codegen_addbyte4(block, 0x0f, 0xb6, 0x84 | ((dst_reg & 7) << 3), 0x24); /*MOVZX dst_reg, ram_offset[R12]*/
|
||||
@@ -1112,8 +1113,10 @@ host_x86_MOVZX_REG_ABS_32_8(codeblock_t *block, int dst_reg, void *p)
|
||||
int64_t offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
|
||||
int64_t ram_offset = (uintptr_t) p - (uintptr_t) ram;
|
||||
|
||||
// if (dst_reg & 8)
|
||||
// fatal("host_x86_MOVZX_REG_ABS_32_8 - bad reg\n");
|
||||
#if 0
|
||||
if (dst_reg & 8)
|
||||
fatal("host_x86_MOVZX_REG_ABS_32_8 - bad reg\n");
|
||||
#endif
|
||||
|
||||
if (offset >= -128 && offset < 127) {
|
||||
if (dst_reg & 8) {
|
||||
@@ -1124,7 +1127,7 @@ host_x86_MOVZX_REG_ABS_32_8(codeblock_t *block, int dst_reg, void *p)
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x0f, 0xb6, 0x45 | ((dst_reg & 7) << 3), offset); /*MOVZX dst_reg, offset[RBP]*/
|
||||
}
|
||||
} else if ((ram_offset < (1ull << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
} else if ((ram_offset < (1ULL << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
if (dst_reg & 8)
|
||||
fatal("host_x86_MOVZX_REG_ABS_32_8 - bad reg\n");
|
||||
|
||||
@@ -1155,7 +1158,7 @@ host_x86_MOVZX_REG_ABS_32_16(codeblock_t *block, int dst_reg, void *p)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x0f, 0xb7, 0x45 | ((dst_reg & 7) << 3), offset); /*MOVZX dst_reg, offset[RBP]*/
|
||||
} else if ((ram_offset < (1ull << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
} else if ((ram_offset < (1ULL << 32)) && (block->flags & CODEBLOCK_NO_IMMEDIATES)) {
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte(block, 0x41);
|
||||
codegen_addbyte4(block, 0x0f, 0xb7, 0x84 | ((dst_reg & 7) << 3), 0x24); /*MOVZX dst_reg, ram_offset[R12]*/
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
#define JMP_LEN_BYTES 5
|
||||
|
||||
static inline void
|
||||
codegen_addbyte(codeblock_t *block, uint8_t val)
|
||||
codegen_addbyte(UNUSED(codeblock_t *block), uint8_t val)
|
||||
{
|
||||
if (block_pos >= BLOCK_MAX) {
|
||||
fatal("codegen_addbyte over! %i\n", block_pos);
|
||||
// CPU_BLOCK_END();
|
||||
#if 0
|
||||
CPU_BLOCK_END();
|
||||
#endif
|
||||
}
|
||||
block_write_data[block_pos++] = val;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte2(codeblock_t *block, uint8_t vala, uint8_t valb)
|
||||
codegen_addbyte2(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 2)) {
|
||||
fatal("codegen_addbyte2 over! %i\n", block_pos);
|
||||
@@ -20,7 +22,7 @@ codegen_addbyte2(codeblock_t *block, uint8_t vala, uint8_t valb)
|
||||
block_write_data[block_pos++] = valb;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte3(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc)
|
||||
codegen_addbyte3(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 3)) {
|
||||
fatal("codegen_addbyte3 over! %i\n", block_pos);
|
||||
@@ -31,7 +33,7 @@ codegen_addbyte3(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc)
|
||||
block_write_data[block_pos++] = valc;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte4(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc, uint8_t vald)
|
||||
codegen_addbyte4(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc, uint8_t vald)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 4)) {
|
||||
fatal("codegen_addbyte4 over! %i\n", block_pos);
|
||||
@@ -44,7 +46,7 @@ codegen_addbyte4(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc, u
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addword(codeblock_t *block, uint16_t val)
|
||||
codegen_addword(UNUSED(codeblock_t *block), uint16_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 2)) {
|
||||
fatal("codegen_addword over! %i\n", block_pos);
|
||||
@@ -55,7 +57,7 @@ codegen_addword(codeblock_t *block, uint16_t val)
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addlong(codeblock_t *block, uint32_t val)
|
||||
codegen_addlong(UNUSED(codeblock_t *block), uint32_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 4)) {
|
||||
fatal("codegen_addlong over! %i\n", block_pos);
|
||||
@@ -66,7 +68,7 @@ codegen_addlong(codeblock_t *block, uint32_t val)
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addquad(codeblock_t *block, uint64_t val)
|
||||
codegen_addquad(UNUSED(codeblock_t *block), uint64_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 8)) {
|
||||
fatal("codegen_addquad over! %i\n", block_pos);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
@@ -127,7 +128,7 @@ host_x86_LDMXCSR(codeblock_t *block, void *p)
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x0f, 0xae, 0x50 | REG_EBP, offset); /*LDMXCSR offset[EBP]*/
|
||||
} else if (offset < (1ull << 32)) {
|
||||
} else if (offset < (1ULL << 32)) {
|
||||
codegen_alloc_bytes(block, 7);
|
||||
codegen_addbyte3(block, 0x0f, 0xae, 0x90 | REG_EBP); /*LDMXCSR offset[EBP]*/
|
||||
codegen_addlong(block, offset);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,8 @@
|
||||
# include "codegen_backend_x86_ops_sse.h"
|
||||
# include "codegen_reg.h"
|
||||
# include "x86.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
|
||||
# if defined(__linux__) || defined(__APPLE__)
|
||||
# include <sys/mman.h>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#define JMP_LEN_BYTES 5
|
||||
|
||||
static inline void
|
||||
codegen_addbyte(codeblock_t *block, uint8_t val)
|
||||
codegen_addbyte(UNUSED(codeblock_t *block), uint8_t val)
|
||||
{
|
||||
if (block_pos >= BLOCK_MAX)
|
||||
fatal("codegen_addbyte over! %i\n", block_pos);
|
||||
block_write_data[block_pos++] = val;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte2(codeblock_t *block, uint8_t vala, uint8_t valb)
|
||||
codegen_addbyte2(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 2))
|
||||
fatal("codegen_addbyte2 over! %i\n", block_pos);
|
||||
@@ -16,7 +16,7 @@ codegen_addbyte2(codeblock_t *block, uint8_t vala, uint8_t valb)
|
||||
block_write_data[block_pos++] = valb;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte3(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc)
|
||||
codegen_addbyte3(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 3))
|
||||
fatal("codegen_addbyte3 over! %i\n", block_pos);
|
||||
@@ -25,7 +25,7 @@ codegen_addbyte3(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc)
|
||||
block_write_data[block_pos++] = valc;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte4(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc, uint8_t vald)
|
||||
codegen_addbyte4(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc, uint8_t vald)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 4))
|
||||
fatal("codegen_addbyte4 over! %i\n", block_pos);
|
||||
@@ -36,7 +36,7 @@ codegen_addbyte4(codeblock_t *block, uint8_t vala, uint8_t valb, uint8_t valc, u
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addword(codeblock_t *block, uint16_t val)
|
||||
codegen_addword(UNUSED(codeblock_t *block), uint16_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 2))
|
||||
fatal("codegen_addword over! %i\n", block_pos);
|
||||
@@ -45,7 +45,7 @@ codegen_addword(codeblock_t *block, uint16_t val)
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addlong(codeblock_t *block, uint32_t val)
|
||||
codegen_addlong(UNUSED(codeblock_t *block), uint32_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 4))
|
||||
fatal("codegen_addlong over! %i\n", block_pos);
|
||||
@@ -54,7 +54,7 @@ codegen_addlong(codeblock_t *block, uint32_t val)
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addquad(codeblock_t *block, uint64_t val)
|
||||
codegen_addquad(UNUSED(codeblock_t *block), uint64_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 8))
|
||||
fatal("codegen_addquad over! %i\n", block_pos);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,10 +5,13 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "x87.h"
|
||||
|
||||
#include "386_common.h"
|
||||
@@ -282,20 +285,24 @@ codegen_reset(void)
|
||||
void
|
||||
dump_block(void)
|
||||
{
|
||||
/* codeblock_t *block = pages[0x119000 >> 12].block;
|
||||
#if 0
|
||||
codeblock_t *block = pages[0x119000 >> 12].block;
|
||||
|
||||
pclog("dump_block:\n");
|
||||
while (block)
|
||||
{
|
||||
uint32_t start_pc = (block->pc & 0xffc) | (block->phys & ~0xfff);
|
||||
uint32_t end_pc = (block->endpc & 0xffc) | (block->phys & ~0xfff);
|
||||
pclog(" %p : %08x-%08x %08x-%08x %p %p\n", (void *)block, start_pc, end_pc, block->pc, block->endpc, (void *)block->prev, (void *)block->next);
|
||||
if (!block->pc)
|
||||
fatal("Dead PC=0\n");
|
||||
pclog("dump_block:\n");
|
||||
while (block) {
|
||||
uint32_t start_pc = (block->pc & 0xffc) | (block->phys & ~0xfff);
|
||||
uint32_t end_pc = (block->endpc & 0xffc) | (block->phys & ~0xfff);
|
||||
|
||||
block = block->next;
|
||||
}
|
||||
pclog("dump_block done\n");*/
|
||||
pclog(" %p : %08x-%08x %08x-%08x %p %p\n", (void *)block, start_pc, end_pc, block->pc, block->endpc, (void *)block->prev, (void *)block->next);
|
||||
|
||||
if (!block->pc)
|
||||
fatal("Dead PC=0\n");
|
||||
|
||||
block = block->next;
|
||||
}
|
||||
|
||||
pclog("dump_block done\n");*/
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -342,7 +349,7 @@ add_to_block_list(codeblock_t *block)
|
||||
}
|
||||
|
||||
static void
|
||||
remove_from_block_list(codeblock_t *block, uint32_t pc)
|
||||
remove_from_block_list(codeblock_t *block, UNUSED(uint32_t pc))
|
||||
{
|
||||
if (!block->page_mask)
|
||||
return;
|
||||
@@ -469,7 +476,7 @@ codegen_delete_random_block(int required_mem_block)
|
||||
}
|
||||
|
||||
void
|
||||
codegen_check_flush(page_t *page, uint64_t mask, uint32_t phys_addr)
|
||||
codegen_check_flush(page_t *page, UNUSED(uint64_t mask), UNUSED(uint32_t phys_addr))
|
||||
{
|
||||
uint16_t block_nr = page->block;
|
||||
int remove_from_evict_list = 0;
|
||||
|
||||
@@ -189,6 +189,8 @@ codegen_ir_compile(ir_data_t *ir, codeblock_t *block)
|
||||
|
||||
codegen_backend_epilogue(block);
|
||||
block_write_data = NULL;
|
||||
// if (has_ea)
|
||||
// fatal("IR compilation complete\n");
|
||||
#if 0
|
||||
if (has_ea)
|
||||
fatal("IR compilation complete\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -604,4 +604,3 @@ RecompOpFn recomp_opcodes_df[512] = {
|
||||
/*f0*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@ extern RecompOpFn recomp_opcodes_dc[512];
|
||||
extern RecompOpFn recomp_opcodes_dd[512];
|
||||
extern RecompOpFn recomp_opcodes_de[512];
|
||||
extern RecompOpFn recomp_opcodes_df[512];
|
||||
/*extern RecompOpFn recomp_opcodes_REPE[512];
|
||||
extern RecompOpFn recomp_opcodes_REPNE[512];*/
|
||||
#if 0
|
||||
extern RecompOpFn recomp_opcodes_REPE[512];
|
||||
extern RecompOpFn recomp_opcodes_REPNE[512];
|
||||
#endif
|
||||
|
||||
#define REG_EAX 0
|
||||
#define REG_ECX 1
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -46,9 +49,9 @@ ropParith(PFMAX)
|
||||
ropParith(PFMIN)
|
||||
ropParith(PFMUL)
|
||||
ropParith(PFSUB)
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
uint32_t ropPF2ID(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
uint32_t ropPF2ID(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -72,7 +75,7 @@ uint32_t ropPF2ID(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fe
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPFSUBR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPFSUBR(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -96,7 +99,7 @@ ropPFSUBR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPI2FD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPI2FD(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -120,7 +123,7 @@ ropPI2FD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPFRCPIT(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPFRCPIT(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -142,7 +145,7 @@ ropPFRCPIT(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropPFRCP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPFRCP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -165,7 +168,7 @@ ropPFRCP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropPFRSQRT(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPFRSQRT(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -189,7 +192,7 @@ ropPFRSQRT(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPFRSQIT1(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPFRSQIT1(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MMX_ENTER(ir);
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_ir.h"
|
||||
@@ -19,7 +22,7 @@ get_cf(ir_data_t *ir, int dest_reg)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropADC_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -36,7 +39,7 @@ ropADC_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -53,7 +56,7 @@ ropADC_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
fetchdat = fastreadl(cs + op_pc);
|
||||
|
||||
@@ -70,7 +73,7 @@ ropADC_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -102,7 +105,7 @@ ropADC_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -137,7 +140,7 @@ ropADC_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -169,7 +172,7 @@ ropADC_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -204,7 +207,7 @@ ropADC_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -235,7 +238,7 @@ ropADC_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADC_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADC_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -271,7 +274,7 @@ ropADC_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropADD_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -286,7 +289,7 @@ ropADD_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -301,7 +304,7 @@ ropADD_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOV(ir, IREG_flags_op1, IREG_EAX);
|
||||
|
||||
@@ -322,7 +325,7 @@ ropADD_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -352,7 +355,7 @@ ropADD_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -384,7 +387,7 @@ ropADD_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -414,7 +417,7 @@ ropADD_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -446,7 +449,7 @@ ropADD_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -475,7 +478,7 @@ ropADD_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropADD_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropADD_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -508,7 +511,7 @@ ropADD_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropCMP_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -523,7 +526,7 @@ ropCMP_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -538,7 +541,7 @@ ropCMP_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
fetchdat = fastreadl(cs + op_pc);
|
||||
|
||||
@@ -552,7 +555,7 @@ ropCMP_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -582,7 +585,7 @@ ropCMP_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -612,7 +615,7 @@ ropCMP_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -642,7 +645,7 @@ ropCMP_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -672,7 +675,7 @@ ropCMP_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -701,7 +704,7 @@ ropCMP_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropCMP_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMP_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -731,7 +734,7 @@ ropCMP_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropSBB_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -748,7 +751,7 @@ ropSBB_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -765,7 +768,7 @@ ropSBB_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
fetchdat = fastreadl(cs + op_pc);
|
||||
|
||||
@@ -782,7 +785,7 @@ ropSBB_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -814,7 +817,7 @@ ropSBB_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -849,7 +852,7 @@ ropSBB_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -881,7 +884,7 @@ ropSBB_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -917,7 +920,7 @@ ropSBB_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -948,7 +951,7 @@ ropSBB_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSBB_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSBB_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -985,7 +988,7 @@ ropSBB_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropSUB_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -1000,7 +1003,7 @@ ropSUB_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -1015,7 +1018,7 @@ ropSUB_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOV(ir, IREG_flags_op1, IREG_EAX);
|
||||
|
||||
@@ -1037,7 +1040,7 @@ ropSUB_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -1067,7 +1070,7 @@ ropSUB_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -1099,7 +1102,7 @@ ropSUB_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -1129,7 +1132,7 @@ ropSUB_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -1162,7 +1165,7 @@ ropSUB_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -1191,7 +1194,7 @@ ropSUB_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropSUB_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSUB_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -1225,7 +1228,7 @@ ropSUB_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
rop80(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
rop80(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int skip_immediate = 0;
|
||||
|
||||
@@ -1433,7 +1436,7 @@ rop80(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
rop81_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
rop81_w(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int skip_immediate = 0;
|
||||
|
||||
@@ -1683,7 +1686,7 @@ rop81_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 3;
|
||||
}
|
||||
uint32_t
|
||||
rop81_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
rop81_l(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int skip_immediate = 0;
|
||||
|
||||
@@ -1933,7 +1936,7 @@ rop81_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
uint32_t
|
||||
rop83_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
rop83_w(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
codegen_mark_code_present(block, cs + op_pc, 1);
|
||||
if ((fetchdat & 0xc0) == 0xc0) {
|
||||
@@ -2099,7 +2102,7 @@ rop83_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
rop83_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
rop83_l(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
codegen_mark_code_present(block, cs + op_pc, 1);
|
||||
if ((fetchdat & 0xc0) == 0xc0) {
|
||||
@@ -2278,6 +2281,9 @@ rebuild_c(ir_data_t *ir)
|
||||
case FLAGS_DEC32:
|
||||
needs_rebuild = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2287,7 +2293,7 @@ rebuild_c(ir_data_t *ir)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropINC_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropINC_r16(UNUSED(UNUSED(codeblock_t *block)), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
rebuild_c(ir);
|
||||
|
||||
@@ -2301,7 +2307,7 @@ ropINC_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropINC_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropINC_r32(UNUSED(UNUSED(codeblock_t *block)), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
rebuild_c(ir);
|
||||
|
||||
@@ -2316,7 +2322,7 @@ ropINC_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropDEC_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropDEC_r16(UNUSED(codeblock_t *block), ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
rebuild_c(ir);
|
||||
|
||||
@@ -2330,7 +2336,7 @@ ropDEC_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropDEC_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropDEC_r32(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
rebuild_c(ir);
|
||||
|
||||
@@ -2345,7 +2351,7 @@ ropDEC_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropINCDEC(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropINCDEC(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
codegen_mark_code_present(block, cs + op_pc, 1);
|
||||
rebuild_c(ir);
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "x86_flags.h"
|
||||
#include "codegen.h"
|
||||
@@ -25,7 +28,7 @@ VF_SET_01(void)
|
||||
}
|
||||
|
||||
static int
|
||||
ropJO_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
|
||||
ropJO_common(UNUSED(codeblock_t *block), ir_data_t *ir, uint32_t dest_addr, UNUSED(uint32_t next_pc))
|
||||
{
|
||||
int jump_uop;
|
||||
|
||||
@@ -63,7 +66,7 @@ ropJO_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t nex
|
||||
return 0;
|
||||
}
|
||||
static int
|
||||
ropJNO_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
|
||||
ropJNO_common(UNUSED(codeblock_t *block), ir_data_t *ir, uint32_t dest_addr, UNUSED(uint32_t next_pc))
|
||||
{
|
||||
int jump_uop;
|
||||
|
||||
@@ -526,7 +529,7 @@ ropJNS_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t ne
|
||||
}
|
||||
|
||||
static int
|
||||
ropJP_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
|
||||
ropJP_common(UNUSED(codeblock_t *block), ir_data_t *ir, uint32_t dest_addr, UNUSED(uint32_t next_pc))
|
||||
{
|
||||
int jump_uop;
|
||||
|
||||
@@ -538,7 +541,7 @@ ropJP_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t nex
|
||||
return 0;
|
||||
}
|
||||
static int
|
||||
ropJNP_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t next_pc)
|
||||
ropJNP_common(UNUSED(codeblock_t *block), ir_data_t *ir, uint32_t dest_addr, UNUSED(uint32_t next_pc))
|
||||
{
|
||||
int jump_uop;
|
||||
|
||||
@@ -850,23 +853,24 @@ ropJNLE_common(codeblock_t *block, ir_data_t *ir, uint32_t dest_addr, uint32_t n
|
||||
}
|
||||
|
||||
ropJ(O)
|
||||
ropJ(NO)
|
||||
ropJ(B)
|
||||
ropJ(NB)
|
||||
ropJ(E)
|
||||
ropJ(NE)
|
||||
ropJ(BE)
|
||||
ropJ(NBE)
|
||||
ropJ(S)
|
||||
ropJ(NS)
|
||||
ropJ(P)
|
||||
ropJ(NP)
|
||||
ropJ(L)
|
||||
ropJ(NL)
|
||||
ropJ(LE)
|
||||
ropJ(NLE)
|
||||
ropJ(NO)
|
||||
ropJ(B)
|
||||
ropJ(NB)
|
||||
ropJ(E)
|
||||
ropJ(NE)
|
||||
ropJ(BE)
|
||||
ropJ(NBE)
|
||||
ropJ(S)
|
||||
ropJ(NS)
|
||||
ropJ(P)
|
||||
ropJ(NP)
|
||||
ropJ(L)
|
||||
ropJ(NL)
|
||||
ropJ(LE)
|
||||
ropJ(NLE)
|
||||
|
||||
uint32_t ropJCXZ(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
uint32_t
|
||||
ropJCXZ(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = (int32_t) (int8_t) fastreadb(cs + op_pc);
|
||||
uint32_t dest_addr = op_pc + 1 + offset;
|
||||
@@ -888,7 +892,7 @@ ropJ(O)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropLOOP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropLOOP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = (int32_t) (int8_t) fastreadb(cs + op_pc);
|
||||
uint32_t dest_addr = op_pc + 1 + offset;
|
||||
@@ -928,7 +932,7 @@ ropLOOP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropLOOPE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropLOOPE(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = (int32_t) (int8_t) fastreadb(cs + op_pc);
|
||||
uint32_t dest_addr = op_pc + 1 + offset;
|
||||
@@ -961,7 +965,7 @@ ropLOOPE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropLOOPNE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropLOOPNE(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = (int32_t) (int8_t) fastreadb(cs + op_pc);
|
||||
uint32_t dest_addr = op_pc + 1 + offset;
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "x87.h"
|
||||
#include "codegen.h"
|
||||
@@ -15,7 +18,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
uint32_t
|
||||
ropFADD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFADD(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -26,7 +29,7 @@ ropFADD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFADDr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFADDr(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -37,7 +40,7 @@ ropFADDr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFADDP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFADDP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -50,7 +53,7 @@ ropFADDP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFCOM(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFCOM(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -62,7 +65,7 @@ ropFCOM(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFCOMP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFCOMP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -75,7 +78,7 @@ ropFCOMP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFCOMPP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFCOMPP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_FCOM(ir, IREG_temp0_W, IREG_ST(0), IREG_ST(1));
|
||||
@@ -87,7 +90,7 @@ ropFCOMPP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFDIV(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFDIV(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -98,7 +101,7 @@ ropFDIV(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFDIVR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFDIVR(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -109,7 +112,7 @@ ropFDIVR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFDIVr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFDIVr(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -120,7 +123,7 @@ ropFDIVr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFDIVRr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFDIVRr(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -131,7 +134,7 @@ ropFDIVRr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFDIVP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFDIVP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -143,7 +146,7 @@ ropFDIVP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFDIVRP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFDIVRP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -156,7 +159,7 @@ ropFDIVRP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFMUL(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFMUL(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -167,7 +170,7 @@ ropFMUL(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFMULr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFMULr(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -178,7 +181,7 @@ ropFMULr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFMULP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFMULP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -191,7 +194,7 @@ ropFMULP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFSUB(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSUB(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -202,7 +205,7 @@ ropFSUB(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFSUBR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSUBR(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -213,7 +216,7 @@ ropFSUBR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFSUBr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSUBr(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -224,7 +227,7 @@ ropFSUBr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFSUBRr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSUBRr(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -235,7 +238,7 @@ ropFSUBRr(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFSUBP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSUBP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -247,7 +250,7 @@ ropFSUBP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFSUBRP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSUBRP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -260,7 +263,7 @@ ropFSUBRP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFUCOM(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFUCOM(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -272,7 +275,7 @@ ropFUCOM(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFUCOMP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFUCOMP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -285,7 +288,7 @@ ropFUCOMP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFUCOMPP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFUCOMPP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_FCOM(ir, IREG_temp0_W, IREG_ST(0), IREG_ST(1));
|
||||
@@ -561,10 +564,11 @@ ropF_arith_mem(d, uop_MEM_LOAD_DOUBLE)
|
||||
return op_pc + 1; \
|
||||
}
|
||||
|
||||
ropFI_arith_mem(l, IREG_temp0)
|
||||
ropFI_arith_mem(w, IREG_temp0_W)
|
||||
ropFI_arith_mem(l, IREG_temp0)
|
||||
ropFI_arith_mem(w, IREG_temp0_W)
|
||||
|
||||
uint32_t ropFABS(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
uint32_t
|
||||
ropFABS(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_FABS(ir, IREG_ST(0), IREG_ST(0));
|
||||
@@ -574,7 +578,7 @@ ropF_arith_mem(d, uop_MEM_LOAD_DOUBLE)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFCHS(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFCHS(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_FCHS(ir, IREG_ST(0), IREG_ST(0));
|
||||
@@ -583,7 +587,7 @@ ropFCHS(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFSQRT(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSQRT(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_FSQRT(ir, IREG_ST(0), IREG_ST(0));
|
||||
@@ -592,7 +596,7 @@ ropFSQRT(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFTST(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFTST(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_FTST(ir, IREG_temp0_W, IREG_ST(0));
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "x87.h"
|
||||
#include "codegen.h"
|
||||
@@ -15,7 +18,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
uint32_t
|
||||
ropFLD1(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFLD1(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_MOV_IMM(ir, IREG_temp0, 1);
|
||||
@@ -26,7 +29,7 @@ ropFLD1(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFLDZ(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFLDZ(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_MOV_IMM(ir, IREG_temp0, 0);
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "x87.h"
|
||||
#include "codegen.h"
|
||||
@@ -15,7 +18,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
uint32_t
|
||||
ropFLDs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFLDs(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -31,7 +34,7 @@ ropFLDs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFLDd(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFLDd(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -48,7 +51,7 @@ ropFLDd(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFSTs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTs(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -62,7 +65,7 @@ ropFSTs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFSTPs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTPs(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -78,7 +81,7 @@ ropFSTPs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFSTd(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTd(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -93,7 +96,7 @@ ropFSTd(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFSTPd(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTPd(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -111,7 +114,7 @@ ropFSTPd(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFILDw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFILDw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -128,7 +131,7 @@ ropFILDw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFILDl(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFILDl(codeblock_t *block, ir_data_t *ir, uint8_t UNUSED(opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -145,7 +148,7 @@ ropFILDl(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFILDq(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFILDq(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -163,7 +166,7 @@ ropFILDq(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFISTw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFISTw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -179,7 +182,7 @@ ropFISTw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFISTPw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFISTPw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -196,7 +199,7 @@ ropFISTPw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFISTl(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFISTl(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -212,7 +215,7 @@ ropFISTl(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFISTPl(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFISTPl(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -229,7 +232,7 @@ ropFISTPl(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFISTPq(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFISTPq(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "x87.h"
|
||||
#include "codegen.h"
|
||||
@@ -15,7 +18,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
uint32_t
|
||||
ropFFREE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFFREE(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -26,7 +29,7 @@ ropFFREE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFLD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFLD(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int src_reg = fetchdat & 7;
|
||||
|
||||
@@ -40,7 +43,7 @@ ropFLD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uin
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFST(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFST(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -52,7 +55,7 @@ ropFST(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uin
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropFSTP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTP(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
@@ -66,7 +69,7 @@ ropFSTP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFSTCW(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTCW(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -80,7 +83,7 @@ ropFSTCW(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFSTSW(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTSW(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
|
||||
@@ -94,7 +97,7 @@ ropFSTSW(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropFSTSW_AX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFSTSW_AX(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_FP_ENTER(ir);
|
||||
uop_MOV(ir, IREG_AX, IREG_NPXS);
|
||||
@@ -103,7 +106,7 @@ ropFSTSW_AX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFXCH(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFXCH(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = fetchdat & 7;
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_ir.h"
|
||||
@@ -12,7 +15,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
void
|
||||
LOAD_IMMEDIATE_FROM_RAM_16_unaligned(codeblock_t *block, ir_data_t *ir, int dest_reg, uint32_t addr)
|
||||
LOAD_IMMEDIATE_FROM_RAM_16_unaligned(UNUSED(codeblock_t *block), ir_data_t *ir, int dest_reg, uint32_t addr)
|
||||
{
|
||||
/*Word access that crosses two pages. Perform reads from both pages, shift and combine*/
|
||||
uop_MOVZX_REG_PTR_8(ir, IREG_temp3_W, get_ram_ptr(addr));
|
||||
@@ -22,7 +25,7 @@ LOAD_IMMEDIATE_FROM_RAM_16_unaligned(codeblock_t *block, ir_data_t *ir, int dest
|
||||
}
|
||||
|
||||
void
|
||||
LOAD_IMMEDIATE_FROM_RAM_32_unaligned(codeblock_t *block, ir_data_t *ir, int dest_reg, uint32_t addr)
|
||||
LOAD_IMMEDIATE_FROM_RAM_32_unaligned(UNUSED(codeblock_t *block), ir_data_t *ir, int dest_reg, uint32_t addr)
|
||||
{
|
||||
/*Dword access that crosses two pages. Perform reads from both pages, shift and combine*/
|
||||
uop_MOV_REG_PTR(ir, dest_reg, get_ram_ptr(addr & ~3));
|
||||
@@ -36,7 +39,7 @@ LOAD_IMMEDIATE_FROM_RAM_32_unaligned(codeblock_t *block, ir_data_t *ir, int dest
|
||||
#define UNROLL_MAX_UOPS 1000
|
||||
#define UNROLL_MAX_COUNT 10
|
||||
int
|
||||
codegen_can_unroll_full(codeblock_t *block, ir_data_t *ir, uint32_t next_pc, uint32_t dest_addr)
|
||||
codegen_can_unroll_full(codeblock_t *block, ir_data_t *ir, UNUSED(uint32_t next_pc), uint32_t dest_addr)
|
||||
{
|
||||
int start;
|
||||
int max_unroll;
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_ir.h"
|
||||
@@ -12,7 +15,7 @@
|
||||
#include "codegen_ops_mov.h"
|
||||
|
||||
uint32_t
|
||||
ropJMP_r8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropJMP_r8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = (int32_t) (int8_t) fastreadb(cs + op_pc);
|
||||
uint32_t dest_addr = op_pc + 1 + offset;
|
||||
@@ -26,7 +29,7 @@ ropJMP_r8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return dest_addr;
|
||||
}
|
||||
uint32_t
|
||||
ropJMP_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropJMP_r16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = (int32_t) (int16_t) fastreadw(cs + op_pc);
|
||||
uint32_t dest_addr = op_pc + 2 + offset;
|
||||
@@ -39,7 +42,7 @@ ropJMP_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return dest_addr;
|
||||
}
|
||||
uint32_t
|
||||
ropJMP_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropJMP_r32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = fastreadl(cs + op_pc);
|
||||
uint32_t dest_addr = op_pc + 4 + offset;
|
||||
@@ -51,7 +54,7 @@ ropJMP_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropJMP_far_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropJMP_far_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t new_pc = fastreadw(cs + op_pc);
|
||||
uint16_t new_cs = fastreadw(cs + op_pc + 2);
|
||||
@@ -66,7 +69,7 @@ ropJMP_far_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return -1;
|
||||
}
|
||||
uint32_t
|
||||
ropJMP_far_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropJMP_far_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint32_t new_pc = fastreadl(cs + op_pc);
|
||||
uint16_t new_cs = fastreadw(cs + op_pc + 4);
|
||||
@@ -82,7 +85,7 @@ ropJMP_far_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropCALL_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCALL_r16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = (int32_t) (int16_t) fastreadw(cs + op_pc);
|
||||
uint16_t ret_addr = op_pc + 2;
|
||||
@@ -101,7 +104,7 @@ ropCALL_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return -1;
|
||||
}
|
||||
uint32_t
|
||||
ropCALL_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCALL_r32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint32_t offset = fastreadl(cs + op_pc);
|
||||
uint32_t ret_addr = op_pc + 4;
|
||||
@@ -119,7 +122,7 @@ ropCALL_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropRET_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRET_16(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), UNUSED(uint32_t op_pc))
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -135,7 +138,7 @@ ropRET_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return -1;
|
||||
}
|
||||
uint32_t
|
||||
ropRET_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRET_32(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), UNUSED(uint32_t op_pc))
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -151,7 +154,7 @@ ropRET_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropRET_imm_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRET_imm_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t offset = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -170,7 +173,7 @@ ropRET_imm_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return -1;
|
||||
}
|
||||
uint32_t
|
||||
ropRET_imm_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRET_imm_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t offset = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -189,7 +192,7 @@ ropRET_imm_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropRETF_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRETF_16(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), UNUSED(uint32_t op_pc))
|
||||
{
|
||||
if ((msw & 1) && !(cpu_state.eflags & VM_FLAG))
|
||||
return 0;
|
||||
@@ -212,7 +215,7 @@ ropRETF_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return -1;
|
||||
}
|
||||
uint32_t
|
||||
ropRETF_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRETF_32(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), UNUSED(uint32_t op_pc))
|
||||
{
|
||||
if ((msw & 1) && !(cpu_state.eflags & VM_FLAG))
|
||||
return 0;
|
||||
@@ -236,7 +239,7 @@ ropRETF_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropRETF_imm_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRETF_imm_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t offset;
|
||||
|
||||
@@ -263,7 +266,7 @@ ropRETF_imm_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return -1;
|
||||
}
|
||||
uint32_t
|
||||
ropRETF_imm_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropRETF_imm_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t offset;
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_ir.h"
|
||||
@@ -13,7 +16,7 @@
|
||||
#include "codegen_ops_logic.h"
|
||||
|
||||
uint32_t
|
||||
ropAND_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -26,7 +29,7 @@ ropAND_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -39,7 +42,7 @@ ropAND_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
if (block->flags & CODEBLOCK_NO_IMMEDIATES) {
|
||||
LOAD_IMMEDIATE_FROM_RAM_32(block, ir, IREG_temp0, cs + op_pc);
|
||||
@@ -57,7 +60,7 @@ ropAND_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -83,7 +86,7 @@ ropAND_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -112,7 +115,7 @@ ropAND_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -138,7 +141,7 @@ ropAND_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -167,7 +170,7 @@ ropAND_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -193,7 +196,7 @@ ropAND_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropAND_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropAND_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -223,7 +226,7 @@ ropAND_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropOR_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -236,7 +239,7 @@ ropOR_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -249,7 +252,7 @@ ropOR_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
if (block->flags & CODEBLOCK_NO_IMMEDIATES) {
|
||||
LOAD_IMMEDIATE_FROM_RAM_32(block, ir, IREG_temp0, cs + op_pc);
|
||||
@@ -268,7 +271,7 @@ ropOR_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -294,7 +297,7 @@ ropOR_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -323,7 +326,7 @@ ropOR_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -349,7 +352,7 @@ ropOR_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -378,7 +381,7 @@ ropOR_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -404,7 +407,7 @@ ropOR_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropOR_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropOR_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -434,7 +437,7 @@ ropOR_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropTEST_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropTEST_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -446,7 +449,7 @@ ropTEST_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropTEST_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropTEST_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -458,7 +461,7 @@ ropTEST_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropTEST_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropTEST_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
if (block->flags & CODEBLOCK_NO_IMMEDIATES) {
|
||||
LOAD_IMMEDIATE_FROM_RAM_32(block, ir, IREG_temp0, cs + op_pc);
|
||||
@@ -476,7 +479,7 @@ ropTEST_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetc
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropTEST_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropTEST_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -502,7 +505,7 @@ ropTEST_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropTEST_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropTEST_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -528,7 +531,7 @@ ropTEST_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropTEST_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropTEST_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -554,7 +557,7 @@ ropTEST_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropXOR_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_AL_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm_data = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -567,7 +570,7 @@ ropXOR_AL_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_AX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm_data = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -580,7 +583,7 @@ ropXOR_AX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_EAX_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
if (block->flags & CODEBLOCK_NO_IMMEDIATES) {
|
||||
LOAD_IMMEDIATE_FROM_RAM_32(block, ir, IREG_temp0, cs + op_pc);
|
||||
@@ -599,7 +602,7 @@ ropXOR_EAX_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 4;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_b_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -625,7 +628,7 @@ ropXOR_b_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_b_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -654,7 +657,7 @@ ropXOR_b_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_w_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -680,7 +683,7 @@ ropXOR_w_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_w_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -709,7 +712,7 @@ ropXOR_w_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_l_rm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -735,7 +738,7 @@ ropXOR_l_rm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXOR_l_rmw(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXOR_l_rmw(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_ir.h"
|
||||
@@ -13,7 +16,7 @@
|
||||
#include "codegen_ops_misc.h"
|
||||
|
||||
uint32_t
|
||||
ropLEA_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropLEA_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -27,7 +30,7 @@ ropLEA_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropLEA_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropLEA_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -42,7 +45,7 @@ ropLEA_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropF6(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropF6(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
uint8_t imm_data;
|
||||
@@ -105,11 +108,14 @@ ropF6(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint
|
||||
|
||||
codegen_flags_changed = 1;
|
||||
return op_pc + 1;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint32_t
|
||||
ropF7_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropF7_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
uint16_t imm_data;
|
||||
@@ -172,11 +178,14 @@ ropF7_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
|
||||
codegen_flags_changed = 1;
|
||||
return op_pc + 1;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
uint32_t
|
||||
ropF7_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropF7_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
uint32_t imm_data;
|
||||
@@ -238,6 +247,9 @@ ropF7_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
|
||||
codegen_flags_changed = 1;
|
||||
return op_pc + 1;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -257,6 +269,9 @@ rebuild_c(ir_data_t *ir)
|
||||
case FLAGS_DEC32:
|
||||
needs_rebuild = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +281,7 @@ rebuild_c(ir_data_t *ir)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFF_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFF_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
int src_reg;
|
||||
@@ -360,12 +375,15 @@ ropFF_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
uop_MEM_STORE_REG(ir, IREG_SS_base, sp_reg, src_reg);
|
||||
SUB_SP(ir, 2);
|
||||
return op_pc + 1;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropFF_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropFF_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
int src_reg;
|
||||
@@ -459,39 +477,42 @@ ropFF_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
uop_MEM_STORE_REG(ir, IREG_SS_base, sp_reg, src_reg);
|
||||
SUB_SP(ir, 4);
|
||||
return op_pc + 1;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropNOP(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropNOP(UNUSED(codeblock_t *block), UNUSED(ir_data_t *ir), UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
return op_pc;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropCBW(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCBW(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOVSX(ir, IREG_AX, IREG_AL);
|
||||
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropCDQ(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCDQ(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_SAR_IMM(ir, IREG_EDX, IREG_EAX, 31);
|
||||
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropCWD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCWD(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_SAR_IMM(ir, IREG_DX, IREG_AX, 15);
|
||||
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropCWDE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCWDE(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOVSX(ir, IREG_EAX, IREG_AX);
|
||||
|
||||
@@ -545,26 +566,27 @@ ropCWDE(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
ropLxS(LDS, &cpu_state.seg_ds)
|
||||
ropLxS(LES, &cpu_state.seg_es)
|
||||
ropLxS(LFS, &cpu_state.seg_fs)
|
||||
ropLxS(LGS, &cpu_state.seg_gs)
|
||||
ropLxS(LSS, &cpu_state.seg_ss)
|
||||
ropLxS(LES, &cpu_state.seg_es)
|
||||
ropLxS(LFS, &cpu_state.seg_fs)
|
||||
ropLxS(LGS, &cpu_state.seg_gs)
|
||||
ropLxS(LSS, &cpu_state.seg_ss)
|
||||
|
||||
uint32_t ropCLC(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
uint32_t
|
||||
ropCLC(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_CALL_FUNC(ir, flags_rebuild);
|
||||
uop_AND_IMM(ir, IREG_flags, IREG_flags, ~C_FLAG);
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropCMC(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCMC(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_CALL_FUNC(ir, flags_rebuild);
|
||||
uop_XOR_IMM(ir, IREG_flags, IREG_flags, C_FLAG);
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropSTC(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSTC(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_CALL_FUNC(ir, flags_rebuild);
|
||||
uop_OR_IMM(ir, IREG_flags, IREG_flags, C_FLAG);
|
||||
@@ -572,20 +594,20 @@ ropSTC(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uin
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropCLD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCLD(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_AND_IMM(ir, IREG_flags, IREG_flags, ~D_FLAG);
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropSTD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSTD(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_OR_IMM(ir, IREG_flags, IREG_flags, D_FLAG);
|
||||
return op_pc;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropCLI(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropCLI(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
if (!IOPLp && (cr4 & (CR4_VME | CR4_PVI)))
|
||||
return 0;
|
||||
@@ -594,7 +616,7 @@ ropCLI(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uin
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropSTI(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSTI(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
if (!IOPLp && (cr4 & (CR4_VME | CR4_PVI)))
|
||||
return 0;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -56,4 +58,4 @@ ropParith(PSUBUSW)
|
||||
ropParith(PMADDWD)
|
||||
ropParith(PMULHW)
|
||||
ropParith(PMULLW)
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -43,4 +45,4 @@ ropPcmp(PCMPEQD)
|
||||
ropPcmp(PCMPGTB)
|
||||
ropPcmp(PCMPGTW)
|
||||
ropPcmp(PCMPGTD)
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -14,7 +17,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
uint32_t
|
||||
ropMOVD_r_d(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVD_r_d(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -36,7 +39,7 @@ ropMOVD_r_d(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOVD_d_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVD_d_r(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -63,7 +66,7 @@ ropMOVD_d_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOVQ_r_q(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVQ_r_q(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -85,7 +88,7 @@ ropMOVQ_r_q(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOVQ_q_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVQ_q_r(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -14,7 +17,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
uint32_t
|
||||
ropPAND(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPAND(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -36,7 +39,7 @@ ropPAND(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropPANDN(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPANDN(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -58,7 +61,7 @@ ropPANDN(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropPOR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPOR(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -80,7 +83,7 @@ ropPOR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uin
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropPXOR(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPXOR(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -46,4 +48,4 @@ ropPpack(PUNPCKLDQ)
|
||||
ropPpack(PUNPCKHBW)
|
||||
ropPpack(PUNPCKHWD)
|
||||
ropPpack(PUNPCKHDQ)
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
@@ -14,7 +17,7 @@
|
||||
#include "codegen_ops_helpers.h"
|
||||
|
||||
uint32_t
|
||||
ropPSxxW_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPSxxW_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int reg = fetchdat & 7;
|
||||
int op = fetchdat & 0x38;
|
||||
@@ -40,7 +43,7 @@ ropPSxxW_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropPSxxD_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPSxxD_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int reg = fetchdat & 7;
|
||||
int op = fetchdat & 0x38;
|
||||
@@ -66,7 +69,7 @@ ropPSxxD_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropPSxxQ_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPSxxQ_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int reg = fetchdat & 7;
|
||||
int op = fetchdat & 0x38;
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_ir.h"
|
||||
@@ -12,7 +15,7 @@
|
||||
#include "codegen_ops_mov.h"
|
||||
|
||||
uint32_t
|
||||
ropMOV_rb_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_rb_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint8_t imm = fastreadb(cs + op_pc);
|
||||
|
||||
@@ -22,7 +25,7 @@ ropMOV_rb_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_rw_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_rw_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm = fastreadw(cs + op_pc);
|
||||
|
||||
@@ -32,7 +35,7 @@ ropMOV_rw_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_rl_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_rl_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
if (block->flags & CODEBLOCK_NO_IMMEDIATES) {
|
||||
LOAD_IMMEDIATE_FROM_RAM_32(block, ir, IREG_32(opcode & 7), cs + op_pc);
|
||||
@@ -45,7 +48,7 @@ ropMOV_rl_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOV_b_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_b_r(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -66,7 +69,7 @@ ropMOV_b_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_w_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_w_r(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -87,7 +90,7 @@ ropMOV_w_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_l_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_l_r(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -108,7 +111,7 @@ ropMOV_l_r(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_r_b(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_r_b(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -128,7 +131,7 @@ ropMOV_r_b(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_r_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_r_w(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -148,7 +151,7 @@ ropMOV_r_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_r_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_r_l(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -169,7 +172,7 @@ ropMOV_r_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOV_AL_abs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_AL_abs(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t addr;
|
||||
|
||||
@@ -186,7 +189,7 @@ ropMOV_AL_abs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + ((op_32 & 0x200) ? 4 : 2);
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_AX_abs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_AX_abs(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t addr;
|
||||
|
||||
@@ -203,7 +206,7 @@ ropMOV_AX_abs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + ((op_32 & 0x200) ? 4 : 2);
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_EAX_abs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_EAX_abs(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t addr = 0;
|
||||
|
||||
@@ -230,7 +233,7 @@ ropMOV_EAX_abs(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOV_abs_AL(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_abs_AL(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t addr;
|
||||
|
||||
@@ -247,7 +250,7 @@ ropMOV_abs_AL(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + ((op_32 & 0x200) ? 4 : 2);
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_abs_AX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_abs_AX(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t addr;
|
||||
|
||||
@@ -264,7 +267,7 @@ ropMOV_abs_AX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + ((op_32 & 0x200) ? 4 : 2);
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_abs_EAX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_abs_EAX(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uint32_t addr;
|
||||
|
||||
@@ -282,7 +285,7 @@ ropMOV_abs_EAX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOV_b_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_b_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
uint8_t imm;
|
||||
@@ -305,7 +308,7 @@ ropMOV_b_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_w_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_w_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
uint16_t imm;
|
||||
@@ -328,7 +331,7 @@ ropMOV_w_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 3;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_l_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_l_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg;
|
||||
uint32_t imm;
|
||||
@@ -352,7 +355,7 @@ ropMOV_l_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOV_w_seg(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_w_seg(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg;
|
||||
|
||||
@@ -396,7 +399,7 @@ ropMOV_w_seg(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOV_l_seg(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_l_seg(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg;
|
||||
|
||||
@@ -440,7 +443,7 @@ ropMOV_l_seg(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOV_seg_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOV_seg_w(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int src_reg;
|
||||
x86seg *rseg;
|
||||
@@ -483,7 +486,7 @@ ropMOV_seg_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchda
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOVSX_16_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVSX_16_8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -504,7 +507,7 @@ ropMOVSX_16_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOVSX_32_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVSX_32_8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -525,7 +528,7 @@ ropMOVSX_32_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOVSX_32_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVSX_32_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -547,7 +550,7 @@ ropMOVSX_32_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropMOVZX_16_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVZX_16_8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -568,7 +571,7 @@ ropMOVZX_16_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOVZX_32_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVZX_32_8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -589,7 +592,7 @@ ropMOVZX_32_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchd
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropMOVZX_32_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropMOVZX_32_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int dest_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -611,7 +614,7 @@ ropMOVZX_32_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropXCHG_AX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXCHG_AX(UNUSED(codeblock_t *block), ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int reg2 = IREG_16(opcode & 7);
|
||||
|
||||
@@ -622,7 +625,7 @@ ropXCHG_AX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropXCHG_EAX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXCHG_EAX(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int reg2 = IREG_32(opcode & 7);
|
||||
|
||||
@@ -634,7 +637,7 @@ ropXCHG_EAX(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropXCHG_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXCHG_8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int reg1 = IREG_8((fetchdat >> 3) & 7);
|
||||
|
||||
@@ -660,7 +663,7 @@ ropXCHG_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXCHG_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXCHG_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int reg1 = IREG_16((fetchdat >> 3) & 7);
|
||||
|
||||
@@ -686,7 +689,7 @@ ropXCHG_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropXCHG_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXCHG_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
int reg1 = IREG_32((fetchdat >> 3) & 7);
|
||||
|
||||
@@ -713,7 +716,7 @@ ropXCHG_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropXLAT(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropXLAT(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "x86_flags.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
@@ -429,7 +432,7 @@ shift_common_variable_32(ir_data_t *ir, uint32_t fetchdat, uint32_t op_pc, x86se
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropC0(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropC0(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
uint8_t imm;
|
||||
@@ -452,7 +455,7 @@ ropC0(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropC1_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropC1_w(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
uint8_t imm;
|
||||
@@ -475,7 +478,7 @@ ropC1_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropC1_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropC1_l(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
|
||||
@@ -512,7 +515,7 @@ ropC1_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropD0(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropD0(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
|
||||
@@ -530,7 +533,7 @@ ropD0(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint
|
||||
return shift_common_8(ir, fetchdat, op_pc, target_seg, 1);
|
||||
}
|
||||
uint32_t
|
||||
ropD1_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropD1_w(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
|
||||
@@ -548,7 +551,7 @@ ropD1_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return shift_common_16(ir, fetchdat, op_pc, target_seg, 1);
|
||||
}
|
||||
uint32_t
|
||||
ropD1_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropD1_l(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
|
||||
@@ -567,7 +570,7 @@ ropD1_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropD2(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropD2(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
if ((fetchdat & 0x30) == 0x10) /*RCL/RCR*/
|
||||
return 0;
|
||||
@@ -687,7 +690,7 @@ ropD2(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropD3_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropD3_w(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
if ((fetchdat & 0x30) == 0x10) /*RCL/RCR*/
|
||||
return 0;
|
||||
@@ -807,7 +810,7 @@ ropD3_w(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropD3_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropD3_l(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
if ((fetchdat & 0x30) == 0x10) /*RCL/RCR*/
|
||||
return 0;
|
||||
@@ -928,7 +931,7 @@ ropD3_l(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, ui
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropSHLD_16_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSHLD_16_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
@@ -973,7 +976,7 @@ ropSHLD_16_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropSHLD_32_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSHLD_32_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
@@ -1018,7 +1021,7 @@ ropSHLD_32_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropSHRD_16_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSHRD_16_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
@@ -1063,7 +1066,7 @@ ropSHRD_16_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropSHRD_32_imm(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropSHRD_32_imm(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
x86seg *target_seg = NULL;
|
||||
int src_reg = (fetchdat >> 3) & 7;
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "x86_flags.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
@@ -13,7 +16,7 @@
|
||||
#include "codegen_ops_misc.h"
|
||||
|
||||
uint32_t
|
||||
ropPUSH_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSH_r16(UNUSED(codeblock_t *block), ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
@@ -25,7 +28,7 @@ ropPUSH_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropPUSH_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSH_r32(UNUSED(codeblock_t *block), ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
@@ -38,7 +41,7 @@ ropPUSH_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPOP_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPOP_r16(UNUSED(codeblock_t *block), ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -54,7 +57,7 @@ ropPOP_r16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropPOP_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPOP_r32(UNUSED(codeblock_t *block), ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -71,7 +74,7 @@ ropPOP_r32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPUSH_imm_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSH_imm_16(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm = fastreadw(cs + op_pc);
|
||||
int sp_reg;
|
||||
@@ -85,7 +88,7 @@ ropPUSH_imm_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
return op_pc + 2;
|
||||
}
|
||||
uint32_t
|
||||
ropPUSH_imm_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSH_imm_32(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint32_t imm = fastreadl(cs + op_pc);
|
||||
int sp_reg;
|
||||
@@ -100,7 +103,7 @@ ropPUSH_imm_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetch
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPUSH_imm_16_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSH_imm_16_8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint16_t imm = (int16_t) (int8_t) fastreadb(cs + op_pc);
|
||||
int sp_reg;
|
||||
@@ -114,7 +117,7 @@ ropPUSH_imm_16_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fet
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropPUSH_imm_32_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSH_imm_32_8(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uint32_t imm = (int32_t) (int8_t) fastreadb(cs + op_pc);
|
||||
int sp_reg;
|
||||
@@ -129,7 +132,7 @@ ropPUSH_imm_32_8(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fet
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPOP_W(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPOP_W(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -161,7 +164,7 @@ ropPOP_W(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc + 1;
|
||||
}
|
||||
uint32_t
|
||||
ropPOP_L(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPOP_L(codeblock_t *block, ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -262,7 +265,7 @@ ROP_POP_SEG(FS, cpu_state.seg_fs)
|
||||
ROP_POP_SEG(GS, cpu_state.seg_gs)
|
||||
|
||||
uint32_t
|
||||
ropLEAVE_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropLEAVE_16(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -278,7 +281,7 @@ ropLEAVE_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropLEAVE_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropLEAVE_32(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
uop_MOV_IMM(ir, IREG_oldpc, cpu_state.oldpc);
|
||||
|
||||
@@ -295,7 +298,7 @@ ropLEAVE_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPUSHA_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSHA_16(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
@@ -314,7 +317,7 @@ ropPUSHA_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropPUSHA_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSHA_32(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
@@ -334,7 +337,7 @@ ropPUSHA_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPOPA_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPOPA_16(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
@@ -352,7 +355,7 @@ ropPOPA_16(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropPOPA_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPOPA_32(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
@@ -371,7 +374,7 @@ ropPOPA_32(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ropPUSHF(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSHF(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
@@ -387,7 +390,7 @@ ropPUSHF(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, u
|
||||
return op_pc;
|
||||
}
|
||||
uint32_t
|
||||
ropPUSHFD(codeblock_t *block, ir_data_t *ir, uint8_t opcode, uint32_t fetchdat, uint32_t op_32, uint32_t op_pc)
|
||||
ropPUSHFD(UNUSED(codeblock_t *block), ir_data_t *ir, UNUSED(uint8_t opcode), uint32_t fetchdat, UNUSED(uint32_t op_32), uint32_t op_pc)
|
||||
{
|
||||
int sp_reg;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#include "codegen.h"
|
||||
#include "codegen_backend.h"
|
||||
@@ -561,7 +562,7 @@ alloc_dest_reg(ir_reg_t ir_reg, int dest_reference)
|
||||
last valid version*/
|
||||
int prev_version = ir_reg.version - 1;
|
||||
while (prev_version >= 0) {
|
||||
reg_version_t *regv = ®_version[IREG_GET_REG(reg_set->regs[c].reg)][prev_version];
|
||||
const reg_version_t *regv = ®_version[IREG_GET_REG(reg_set->regs[c].reg)][prev_version];
|
||||
|
||||
if (!(regv->flags & REG_FLAGS_DEAD) && regv->refcount == dest_reference) {
|
||||
reg_set->locked |= (1 << c);
|
||||
@@ -733,7 +734,7 @@ codegen_reg_alloc_write_reg(codeblock_t *block, ir_reg_t ir_reg)
|
||||
int
|
||||
codegen_reg_is_loaded(ir_reg_t ir_reg)
|
||||
{
|
||||
host_reg_set_t *reg_set = get_reg_set(ir_reg);
|
||||
const host_reg_set_t *reg_set = get_reg_set(ir_reg);
|
||||
|
||||
/*Search for previous version in host register*/
|
||||
for (int c = 0; c < reg_set->nr_regs; c++) {
|
||||
@@ -758,7 +759,10 @@ codegen_reg_rename(codeblock_t *block, ir_reg_t src, ir_reg_t dst)
|
||||
int c;
|
||||
int target;
|
||||
|
||||
// pclog("rename: %i.%i -> %i.%i\n", src.reg,src.version, dst.reg, dst.version);
|
||||
#if 0
|
||||
pclog("rename: %i.%i -> %i.%i\n", src.reg,src.version, dst.reg, dst.version);
|
||||
#endif
|
||||
|
||||
/*Search for required register*/
|
||||
for (c = 0; c < reg_set->nr_regs; c++) {
|
||||
if (!ir_reg_is_invalid(reg_set->regs[c]) && IREG_GET_REG(reg_set->regs[c].reg) == IREG_GET_REG(src.reg) && reg_set->regs[c].version == src.version)
|
||||
@@ -773,7 +777,9 @@ codegen_reg_rename(codeblock_t *block, ir_reg_t src, ir_reg_t dst)
|
||||
codegen_reg_writeback(reg_set, block, target, 0);
|
||||
reg_set->regs[target] = dst;
|
||||
reg_set->dirty[target] = 1;
|
||||
// pclog("renamed reg %i dest=%i.%i\n", target, dst.reg, dst.version);
|
||||
#if 0
|
||||
pclog("renamed reg %i dest=%i.%i\n", target, dst.reg, dst.version);
|
||||
#endif
|
||||
|
||||
/*Invalidate any stale copies of the dest register*/
|
||||
for (c = 0; c < reg_set->nr_regs; c++) {
|
||||
@@ -787,7 +793,7 @@ codegen_reg_rename(codeblock_t *block, ir_reg_t src, ir_reg_t dst)
|
||||
}
|
||||
|
||||
void
|
||||
codegen_reg_flush(ir_data_t *ir, codeblock_t *block)
|
||||
codegen_reg_flush(UNUSED(ir_data_t *ir), codeblock_t *block)
|
||||
{
|
||||
host_reg_set_t *reg_set;
|
||||
int c;
|
||||
@@ -816,7 +822,7 @@ codegen_reg_flush(ir_data_t *ir, codeblock_t *block)
|
||||
}
|
||||
|
||||
void
|
||||
codegen_reg_flush_invalidate(ir_data_t *ir, codeblock_t *block)
|
||||
codegen_reg_flush_invalidate(UNUSED(ir_data_t *ir), codeblock_t *block)
|
||||
{
|
||||
host_reg_set_t *reg_set;
|
||||
int c;
|
||||
|
||||
@@ -283,8 +283,7 @@ extern uint8_t reg_last_version[IREG_COUNT];
|
||||
/*This register and the parent uOP have been optimised out.*/
|
||||
#define REG_FLAGS_DEAD (1 << 1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
/*Refcount of pending reads on this register version*/
|
||||
uint8_t refcount;
|
||||
/*Flags*/
|
||||
@@ -308,8 +307,7 @@ add_to_dead_list(reg_version_t *regv, int reg, int version)
|
||||
reg_dead_list = version | (reg << 8);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint16_t reg;
|
||||
uint16_t version;
|
||||
} ir_reg_t;
|
||||
@@ -347,7 +345,9 @@ codegen_reg_read(int reg)
|
||||
CPU_BLOCK_END();
|
||||
if (version->refcount > max_version_refcount)
|
||||
max_version_refcount = version->refcount;
|
||||
// pclog("codegen_reg_read: %i %i %i\n", reg & IREG_REG_MASK, ireg.version, reg_version_refcount[IREG_GET_REG(ireg.reg)][ireg.version]);
|
||||
#if 0
|
||||
pclog("codegen_reg_read: %i %i %i\n", reg & IREG_REG_MASK, ireg.version, reg_version_refcount[IREG_GET_REG(ireg.reg)][ireg.version]);
|
||||
#endif
|
||||
return ireg;
|
||||
}
|
||||
|
||||
@@ -387,7 +387,9 @@ codegen_reg_write(int reg, int uop_nr)
|
||||
version->refcount = 0;
|
||||
version->flags = 0;
|
||||
version->parent_uop = uop_nr;
|
||||
// pclog("codegen_reg_write: %i\n", reg & IREG_REG_MASK);
|
||||
#if 0
|
||||
pclog("codegen_reg_write: %i\n", reg & IREG_REG_MASK);
|
||||
#endif
|
||||
return ireg;
|
||||
}
|
||||
|
||||
|
||||
201
src/config.c
201
src/config.c
@@ -255,7 +255,7 @@ static void
|
||||
load_machine(void)
|
||||
{
|
||||
ini_section_t cat = ini_find_section(config, "Machine");
|
||||
char *p;
|
||||
const char *p;
|
||||
const char *migrate_from = NULL;
|
||||
int c;
|
||||
int i;
|
||||
@@ -510,6 +510,7 @@ load_machine(void)
|
||||
|
||||
cpu_use_dynarec = !!ini_section_get_int(cat, "cpu_use_dynarec", 0);
|
||||
fpu_softfloat = !!ini_section_get_int(cat, "fpu_softfloat", 0);
|
||||
if ((fpu_type != FPU_NONE) && machine_has_flags(machine, MACHINE_SOFTFLOAT_ONLY))
|
||||
if (machine_has_flags(machine, MACHINE_SOFTFLOAT_ONLY))
|
||||
fpu_softfloat = 1;
|
||||
|
||||
@@ -564,9 +565,16 @@ load_video(void)
|
||||
free(p);
|
||||
}
|
||||
|
||||
if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_8514A)) || video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_8514)
|
||||
ini_section_delete_var(cat, "8514a");
|
||||
if (((gfxcard[0] == VID_INTERNAL) && machine_has_flags(machine, MACHINE_VIDEO_XGA)) || video_card_get_flags(gfxcard[0]) == VIDEO_FLAG_TYPE_XGA)
|
||||
ini_section_delete_var(cat, "xga");
|
||||
|
||||
voodoo_enabled = !!ini_section_get_int(cat, "voodoo", 0);
|
||||
ibm8514_enabled = !!ini_section_get_int(cat, "8514a", 0);
|
||||
xga_enabled = !!ini_section_get_int(cat, "xga", 0);
|
||||
ibm8514_standalone_enabled = !!ini_section_get_int(cat, "8514a", 0);
|
||||
ibm8514_active = ibm8514_standalone_enabled;
|
||||
xga_standalone_enabled = !!ini_section_get_int(cat, "xga", 0);
|
||||
xga_active = xga_standalone_enabled;
|
||||
show_second_monitors = !!ini_section_get_int(cat, "show_second_monitors", 1);
|
||||
video_fullscreen_scale_maximized = !!ini_section_get_int(cat, "video_fullscreen_scale_maximized", 0);
|
||||
|
||||
@@ -1016,14 +1024,19 @@ load_storage_controllers(void)
|
||||
sprintf(temp, "cartridge_%02i_fn", c + 1);
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_storage_controllers(): strlen(p) > 511 (cart_fns[%i])\n", c);
|
||||
else
|
||||
strncpy(cart_fns[c], p, 511);
|
||||
} else
|
||||
path_append_filename(cart_fns[c], usr_path, p);
|
||||
path_normalize(cart_fns[c]);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_storage_controllers(): strlen(p) > 511 (cart_fns[%i])\n", c);
|
||||
else
|
||||
strncpy(cart_fns[c], p, 511);
|
||||
} else
|
||||
path_append_filename(cart_fns[c], usr_path, p);
|
||||
path_normalize(cart_fns[c]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1179,14 +1192,19 @@ load_hard_disks(void)
|
||||
* When loading differencing VHDs, the absolute path is required.
|
||||
* So we should not convert absolute paths to relative. -sards
|
||||
*/
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_hard_disks(): strlen(p) > 511 (hdd[%i].fn)\n", c);
|
||||
else
|
||||
strncpy(hdd[c].fn, p, 511);
|
||||
} else
|
||||
path_append_filename(hdd[c].fn, usr_path, p);
|
||||
path_normalize(hdd[c].fn);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_hard_disks(): strlen(p) > 511 (hdd[%i].fn)\n", c);
|
||||
else
|
||||
strncpy(hdd[c].fn, p, 511);
|
||||
} else
|
||||
path_append_filename(hdd[c].fn, usr_path, p);
|
||||
path_normalize(hdd[c].fn);
|
||||
}
|
||||
|
||||
sprintf(temp, "hdd_%02i_vhd_blocksize", c + 1);
|
||||
hdd[c].vhd_blocksize = ini_section_get_int(cat, temp, 0);
|
||||
@@ -1245,14 +1263,19 @@ load_floppy_drives(void)
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_floppy_drives(): strlen(p) > 511 (floppyfns[%i])\n", c);
|
||||
else
|
||||
strncpy(floppyfns[c], p, 511);
|
||||
} else
|
||||
path_append_filename(floppyfns[c], usr_path, p);
|
||||
path_normalize(floppyfns[c]);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_floppy_drives(): strlen(p) > 511 (floppyfns[%i])\n", c);
|
||||
else
|
||||
strncpy(floppyfns[c], p, 511);
|
||||
} else
|
||||
path_append_filename(floppyfns[c], usr_path, p);
|
||||
path_normalize(floppyfns[c]);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2)
|
||||
if (*p != '\0')
|
||||
@@ -1300,14 +1323,19 @@ load_floppy_and_cdrom_drives(void)
|
||||
sprintf(temp, "fdd_%02i_fn", c + 1);
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 511 (floppyfns[%i])\n", c);
|
||||
else
|
||||
strncpy(floppyfns[c], p, 511);
|
||||
} else
|
||||
path_append_filename(floppyfns[c], usr_path, p);
|
||||
path_normalize(floppyfns[c]);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 511 (floppyfns[%i])\n", c);
|
||||
else
|
||||
strncpy(floppyfns[c], p, 511);
|
||||
} else
|
||||
path_append_filename(floppyfns[c], usr_path, p);
|
||||
path_normalize(floppyfns[c]);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_CONFIG_LOG) && (ENABLE_CONFIG_LOG == 2)
|
||||
if (*p != '\0')
|
||||
@@ -1354,7 +1382,7 @@ load_floppy_and_cdrom_drives(void)
|
||||
else
|
||||
snprintf(fdd_image_history[c][i], 255, "%s", p);
|
||||
} else
|
||||
snprintf(fdd_image_history[c][i], 255, "%s%$s%s", usr_path,
|
||||
snprintf(fdd_image_history[c][i], 255, "%s%s%s", usr_path,
|
||||
path_get_slash(usr_path), p);
|
||||
path_normalize(fdd_image_history[c][i]);
|
||||
}
|
||||
@@ -1438,14 +1466,19 @@ load_floppy_and_cdrom_drives(void)
|
||||
sprintf(temp, "cdrom_%02i_image_path", c + 1);
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 511 (cdrom[%i].image_path)\n", c);
|
||||
else
|
||||
strncpy(cdrom[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(cdrom[c].image_path, usr_path, p);
|
||||
path_normalize(cdrom[c].image_path);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 511 (cdrom[%i].image_path)\n", c);
|
||||
else
|
||||
strncpy(cdrom[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(cdrom[c].image_path, usr_path, p);
|
||||
path_normalize(cdrom[c].image_path);
|
||||
}
|
||||
|
||||
if (cdrom[c].host_drive && (cdrom[c].host_drive != 200))
|
||||
cdrom[c].host_drive = 0;
|
||||
@@ -1465,7 +1498,7 @@ load_floppy_and_cdrom_drives(void)
|
||||
else
|
||||
snprintf(cdrom[c].image_history[i], 511, "%s", p);
|
||||
} else
|
||||
snprintf(cdrom[c].image_history[i], 511, "%s%$s%s", usr_path,
|
||||
snprintf(cdrom[c].image_history[i], 511, "%s%s%s", usr_path,
|
||||
path_get_slash(usr_path), p);
|
||||
path_normalize(cdrom[c].image_history[i]);
|
||||
}
|
||||
@@ -1567,14 +1600,20 @@ load_other_removable_devices(void)
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
ini_section_delete_var(cat, temp);
|
||||
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_other_removable_devices(): strlen(p) > 511 (cdrom[%i].image_path)\n", c);
|
||||
else
|
||||
strncpy(cdrom[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(cdrom[c].image_path, usr_path, p);
|
||||
path_normalize(cdrom[c].image_path);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_other_removable_devices(): strlen(p) > 511 (cdrom[%i].image_path)\n",
|
||||
c);
|
||||
else
|
||||
strncpy(cdrom[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(cdrom[c].image_path, usr_path, p);
|
||||
path_normalize(cdrom[c].image_path);
|
||||
}
|
||||
|
||||
if (cdrom[c].host_drive && (cdrom[c].host_drive != 200))
|
||||
cdrom[c].host_drive = 0;
|
||||
@@ -1644,14 +1683,20 @@ load_other_removable_devices(void)
|
||||
sprintf(temp, "zip_%02i_image_path", c + 1);
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_other_removable_devices(): strlen(p) > 511 (zip_drives[%i].image_path)\n", c);
|
||||
else
|
||||
strncpy(zip_drives[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(zip_drives[c].image_path, usr_path, p);
|
||||
path_normalize(zip_drives[c].image_path);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_other_removable_devices(): strlen(p) > 511 (zip_drives[%i].image_path)\n",
|
||||
c);
|
||||
else
|
||||
strncpy(zip_drives[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(zip_drives[c].image_path, usr_path, p);
|
||||
path_normalize(zip_drives[c].image_path);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
||||
zip_drives[c].image_history[i] = (char *) calloc(MAX_IMAGE_PATH_LEN + 1, sizeof(char));
|
||||
@@ -1665,7 +1710,7 @@ load_other_removable_devices(void)
|
||||
else
|
||||
snprintf(zip_drives[c].image_history[i], 511, "%s", p);
|
||||
} else
|
||||
snprintf(zip_drives[c].image_history[i], 511, "%s%$s%s", usr_path,
|
||||
snprintf(zip_drives[c].image_history[i], 511, "%s%s%s", usr_path,
|
||||
path_get_slash(usr_path), p);
|
||||
path_normalize(zip_drives[c].image_history[i]);
|
||||
}
|
||||
@@ -1754,14 +1799,20 @@ load_other_removable_devices(void)
|
||||
sprintf(temp, "mo_%02i_image_path", c + 1);
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_other_removable_devices(): strlen(p) > 511 (mo_drives[%i].image_path)\n", c);
|
||||
else
|
||||
strncpy(mo_drives[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(mo_drives[c].image_path, usr_path, p);
|
||||
path_normalize(mo_drives[c].image_path);
|
||||
if (!strcmp(p, usr_path))
|
||||
p[0] = 0x00;
|
||||
|
||||
if (p[0] != 0x00) {
|
||||
if (path_abs(p)) {
|
||||
if (strlen(p) > 511)
|
||||
fatal("load_other_removable_devices(): strlen(p) > 511 (mo_drives[%i].image_path)\n",
|
||||
c);
|
||||
else
|
||||
strncpy(mo_drives[c].image_path, p, 511);
|
||||
} else
|
||||
path_append_filename(mo_drives[c].image_path, usr_path, p);
|
||||
path_normalize(mo_drives[c].image_path);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_PREV_IMAGES; i++) {
|
||||
mo_drives[c].image_history[i] = (char *) calloc(MAX_IMAGE_PATH_LEN + 1, sizeof(char));
|
||||
@@ -1775,7 +1826,7 @@ load_other_removable_devices(void)
|
||||
else
|
||||
snprintf(mo_drives[c].image_history[i], 511, "%s", p);
|
||||
} else
|
||||
snprintf(mo_drives[c].image_history[i], 511, "%s%$s%s", usr_path,
|
||||
snprintf(mo_drives[c].image_history[i], 511, "%s%s%s", usr_path,
|
||||
path_get_slash(usr_path), p);
|
||||
path_normalize(mo_drives[c].image_history[i]);
|
||||
}
|
||||
@@ -2309,15 +2360,15 @@ save_video(void)
|
||||
else
|
||||
ini_section_set_int(cat, "voodoo", voodoo_enabled);
|
||||
|
||||
if (ibm8514_enabled == 0)
|
||||
if (ibm8514_standalone_enabled == 0)
|
||||
ini_section_delete_var(cat, "8514a");
|
||||
else
|
||||
ini_section_set_int(cat, "8514a", ibm8514_enabled);
|
||||
ini_section_set_int(cat, "8514a", ibm8514_standalone_enabled);
|
||||
|
||||
if (xga_enabled == 0)
|
||||
if (xga_standalone_enabled == 0)
|
||||
ini_section_delete_var(cat, "xga");
|
||||
else
|
||||
ini_section_set_int(cat, "xga", xga_enabled);
|
||||
ini_section_set_int(cat, "xga", xga_standalone_enabled);
|
||||
|
||||
if (gfxcard[1] == 0)
|
||||
ini_section_delete_var(cat, "gfxcard_2");
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "cpu.h"
|
||||
#include "x86.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x87.h"
|
||||
#include <86box/io.h>
|
||||
#include <86box/nmi.h>
|
||||
@@ -28,6 +29,7 @@
|
||||
#ifndef OPS_286_386
|
||||
# define OPS_286_386
|
||||
#endif
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
# include "codegen.h"
|
||||
@@ -38,8 +40,6 @@
|
||||
|
||||
extern int codegen_flags_changed;
|
||||
|
||||
static int fpu_cycles = 0;
|
||||
|
||||
#ifdef ENABLE_386_LOG
|
||||
int x386_do_log = ENABLE_386_LOG;
|
||||
|
||||
@@ -291,7 +291,7 @@ exec386_2386(int cycs)
|
||||
flags_rebuild();
|
||||
tempi = cpu_state.abrt & ABRT_MASK;
|
||||
cpu_state.abrt = 0;
|
||||
x86_doabrt(tempi);
|
||||
x86_doabrt_2386(tempi);
|
||||
if (cpu_state.abrt) {
|
||||
cpu_state.abrt = 0;
|
||||
#ifndef USE_NEW_DYNAREC
|
||||
@@ -299,7 +299,7 @@ exec386_2386(int cycs)
|
||||
#endif
|
||||
cpu_state.pc = cpu_state.oldpc;
|
||||
x386_log("Double fault\n");
|
||||
pmodeint(8, 0);
|
||||
pmodeint_2386(8, 0);
|
||||
if (cpu_state.abrt) {
|
||||
cpu_state.abrt = 0;
|
||||
softresetx86();
|
||||
@@ -342,7 +342,7 @@ exec386_2386(int cycs)
|
||||
if (vector != -1) {
|
||||
flags_rebuild();
|
||||
if (msw & 1)
|
||||
pmodeint(vector, 0);
|
||||
pmodeint_2386(vector, 0);
|
||||
else {
|
||||
writememw(ss, (SP - 2) & 0xFFFF, cpu_state.flags);
|
||||
writememw(ss, (SP - 4) & 0xFFFF, CS);
|
||||
@@ -352,7 +352,7 @@ exec386_2386(int cycs)
|
||||
cpu_state.flags &= ~I_FLAG;
|
||||
cpu_state.flags &= ~T_FLAG;
|
||||
cpu_state.pc = readmemw(0, addr);
|
||||
loadcs(readmemw(0, addr + 2));
|
||||
loadcs_2386(readmemw(0, addr + 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "cpu.h"
|
||||
#include <86box/timer.h>
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x87.h"
|
||||
#include <86box/nmi.h>
|
||||
#include <86box/mem.h>
|
||||
@@ -23,9 +24,10 @@
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/timer.h>
|
||||
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg.h"
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#ifdef USE_DYNAREC
|
||||
@@ -1184,7 +1186,10 @@ enter_smm(int in_hlt)
|
||||
if (is_cxsmm) {
|
||||
cpu_state.pc = 0x0000;
|
||||
cpl_override = 1;
|
||||
cyrix_write_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs);
|
||||
if (is486)
|
||||
cyrix_write_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs);
|
||||
else
|
||||
cyrix_write_seg_descriptor_2386(smram_state - 0x20, &cpu_state.seg_cs);
|
||||
cpl_override = 0;
|
||||
cpu_state.seg_cs.seg = (cyrix.arr[3].base >> 4);
|
||||
cpu_state.seg_cs.base = cyrix.arr[3].base;
|
||||
@@ -1317,7 +1322,10 @@ leave_smm(void)
|
||||
saved_state[3] = readmeml(0, smram_state - 0x10);
|
||||
saved_state[4] = readmeml(0, smram_state - 0x14);
|
||||
saved_state[5] = readmeml(0, smram_state - 0x18);
|
||||
cyrix_load_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs);
|
||||
if (is486)
|
||||
cyrix_load_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs);
|
||||
else
|
||||
cyrix_load_seg_descriptor_2386(smram_state - 0x20, &cpu_state.seg_cs);
|
||||
saved_state[6] = readmeml(0, smram_state - 0x24);
|
||||
} else {
|
||||
for (uint8_t n = 0; n < SMM_SAVE_STATE_MAP_SIZE; n++) {
|
||||
@@ -1403,7 +1411,7 @@ x86_int(int num)
|
||||
cpu_state.pc = cpu_state.oldpc;
|
||||
|
||||
if (msw & 1)
|
||||
pmodeint(num, 0);
|
||||
is486 ? pmodeint(num, 0) : pmodeint_2386(num, 0);
|
||||
else {
|
||||
addr = (num << 2) + idt.base;
|
||||
|
||||
@@ -1436,7 +1444,7 @@ x86_int(int num)
|
||||
oxpc = cpu_state.pc;
|
||||
#endif
|
||||
cpu_state.pc = readmemw(0, addr);
|
||||
loadcs(readmemw(0, addr + 2));
|
||||
is486 ? loadcs(readmemw(0, addr + 2)) : loadcs_2386(readmemw(0, addr + 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1453,7 +1461,7 @@ x86_int_sw(int num)
|
||||
cycles -= timing_int;
|
||||
|
||||
if (msw & 1)
|
||||
pmodeint(num, 1);
|
||||
is486 ? pmodeint(num, 1) : pmodeint_2386(num, 1);
|
||||
else {
|
||||
addr = (num << 2) + idt.base;
|
||||
|
||||
@@ -1478,7 +1486,7 @@ x86_int_sw(int num)
|
||||
oxpc = cpu_state.pc;
|
||||
#endif
|
||||
cpu_state.pc = readmemw(0, addr);
|
||||
loadcs(readmemw(0, addr + 2));
|
||||
is486 ? loadcs(readmemw(0, addr + 2)) : loadcs_2386(readmemw(0, addr + 2));
|
||||
cycles -= timing_int_rm;
|
||||
}
|
||||
}
|
||||
@@ -1520,7 +1528,7 @@ x86_int_sw_rm(int num)
|
||||
cpu_state.eflags &= ~VIF_FLAG;
|
||||
cpu_state.flags &= ~T_FLAG;
|
||||
cpu_state.pc = new_pc;
|
||||
loadcs(new_cs);
|
||||
is486 ? loadcs(new_cs) : loadcs_2386(new_cs);
|
||||
#ifndef USE_NEW_DYNAREC
|
||||
oxpc = cpu_state.pc;
|
||||
#endif
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "cpu.h"
|
||||
#include "x86.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "x87.h"
|
||||
#include <86box/io.h>
|
||||
#include <86box/mem.h>
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <86box/timer.h>
|
||||
#include "x86.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "x87.h"
|
||||
#include "x86_flags.h"
|
||||
#include <86box/io.h>
|
||||
|
||||
@@ -173,7 +173,6 @@ extern void x386_dynarec_log(const char *fmt, ...);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "x86seg.h"
|
||||
#include "x86_ops_arith.h"
|
||||
#include "x86_ops_atomic.h"
|
||||
#include "x86_ops_bcd.h"
|
||||
|
||||
1107
src/cpu/808x.c
1107
src/cpu/808x.c
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,8 @@
|
||||
#
|
||||
|
||||
add_library(cpu OBJECT cpu.c cpu_table.c fpu.c x86.c 808x.c 386.c 386_common.c
|
||||
386_dynarec.c x86_ops_mmx.c x86seg.c x87.c x87_timings.c 8080.c)
|
||||
386_dynarec.c x86_ops_mmx.c x86seg_common.c x86seg.c x86seg_2386.c x87.c
|
||||
x87_timings.c 8080.c)
|
||||
|
||||
if(AMD_K5)
|
||||
target_compile_definitions(cpu PRIVATE USE_AMD_K5)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x87.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_ops.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x87.h"
|
||||
#include "386_common.h"
|
||||
#include "codegen.h"
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <86box/machine.h>
|
||||
#include <86box/io.h>
|
||||
#include "x86_ops.h"
|
||||
#include "x86seg_common.h"
|
||||
#include <86box/mem.h>
|
||||
#include <86box/nmi.h>
|
||||
#include <86box/pic.h>
|
||||
|
||||
@@ -590,7 +590,6 @@ extern uint64_t cpu_CR4_mask;
|
||||
extern uint64_t tsc;
|
||||
extern msr_t msr;
|
||||
extern uint8_t opcode;
|
||||
extern int cgate16;
|
||||
extern int cpl_override;
|
||||
extern int CPUID;
|
||||
extern uint64_t xt_cpu_multi;
|
||||
@@ -721,15 +720,6 @@ extern uint32_t cpu_fast_off_flags;
|
||||
/* Functions. */
|
||||
extern int cpu_has_feature(int feature);
|
||||
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
extern void loadseg_dynarec(uint16_t seg, x86seg *s);
|
||||
extern int loadseg(uint16_t seg, x86seg *s);
|
||||
extern void loadcs(uint16_t seg);
|
||||
#else
|
||||
extern void loadseg(uint16_t seg, x86seg *s);
|
||||
extern void loadcs(uint16_t seg);
|
||||
#endif
|
||||
|
||||
extern char *cpu_current_pc(char *bufp);
|
||||
|
||||
extern void cpu_update_waitstates(void);
|
||||
@@ -757,19 +747,6 @@ extern void exec386_2386(int cycs);
|
||||
extern void exec386(int cycs);
|
||||
extern void exec386_dynarec(int cycs);
|
||||
extern int idivl(int32_t val);
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
extern void loadcscall(uint16_t seg, uint32_t old_pc);
|
||||
extern void loadcsjmp(uint16_t seg, uint32_t old_pc);
|
||||
extern void pmodeint(int num, int soft);
|
||||
extern void pmoderetf(int is32, uint16_t off);
|
||||
extern void pmodeiret(int is32);
|
||||
#else
|
||||
extern void loadcscall(uint16_t seg);
|
||||
extern void loadcsjmp(uint16_t seg, uint32_t old_pc);
|
||||
extern void pmodeint(int num, int soft);
|
||||
extern void pmoderetf(int is32, uint16_t off);
|
||||
extern void pmodeiret(int is32);
|
||||
#endif
|
||||
extern void resetmcr(void);
|
||||
extern void resetx86(void);
|
||||
extern void refreshread(void);
|
||||
@@ -779,11 +756,6 @@ extern void hardresetx86(void);
|
||||
extern void x86_int(int num);
|
||||
extern void x86_int_sw(int num);
|
||||
extern int x86_int_sw_rm(int num);
|
||||
extern void x86de(char *s, uint16_t error);
|
||||
extern void x86gpf(char *s, uint16_t error);
|
||||
extern void x86np(char *s, uint16_t error);
|
||||
extern void x86ss(char *s, uint16_t error);
|
||||
extern void x86ts(char *s, uint16_t error);
|
||||
|
||||
#ifdef ENABLE_808X_LOG
|
||||
extern void dumpregs(int __force);
|
||||
|
||||
@@ -378,7 +378,7 @@ const cpu_family_t cpu_families[] = {
|
||||
}, {
|
||||
.package = CPU_PKG_SOCKET1,
|
||||
.manufacturer = "Intel",
|
||||
.name = "i486SX (SL-Enhanced)",
|
||||
.name = "i486SX-S",
|
||||
.internal_name = "i486sx_slenh",
|
||||
.cpus = (const CPU[]) {
|
||||
{"25", CPU_i486SX_SLENH, fpus_486sx, 25000000, 1, 5000, 0x423, 0x423, 0, CPU_SUPPORTS_DYNAREC, 4, 4,3,3, 3},
|
||||
@@ -409,7 +409,7 @@ const cpu_family_t cpu_families[] = {
|
||||
}, {
|
||||
.package = CPU_PKG_SOCKET1,
|
||||
.manufacturer = "Intel",
|
||||
.name = "i486DX (SL-Enhanced)",
|
||||
.name = "i486DX-S",
|
||||
.internal_name = "i486dx_slenh",
|
||||
.cpus = (const CPU[]) {
|
||||
{"33", CPU_i486DX_SLENH, fpus_internal, 33333333, 1, 5000, 0x414, 0x414, 0, CPU_SUPPORTS_DYNAREC, 6, 6,3,3, 4},
|
||||
@@ -430,7 +430,7 @@ const cpu_family_t cpu_families[] = {
|
||||
}, {
|
||||
.package = CPU_PKG_SOCKET1,
|
||||
.manufacturer = "Intel",
|
||||
.name = "i486DX2 (SL-Enhanced)",
|
||||
.name = "i486DX2-S",
|
||||
.internal_name = "i486dx2_slenh",
|
||||
.cpus = (const CPU[]) {
|
||||
{"40", CPU_i486DX_SLENH, fpus_internal, 40000000, 2, 5000, 0x435, 0x435, 0, CPU_SUPPORTS_DYNAREC, 7, 7,6,6, 5},
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef EMU_SF_CONFIG_H
|
||||
#define EMU_SF_CONFIG_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int8_t flag;
|
||||
@@ -44,3 +47,5 @@ typedef int64_t Bit64s;
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define BX_CONST64(a) a##LL
|
||||
#define BX_CPP_INLINE static __inline
|
||||
|
||||
#endif /*EMU_SF_CONFIG_H*/
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include "x86.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include <86box/machine.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/dma.h>
|
||||
@@ -76,6 +78,8 @@ uint32_t easeg;
|
||||
int reset_on_hlt;
|
||||
int hlt_reset_pending;
|
||||
|
||||
int fpu_cycles = 0;
|
||||
|
||||
#ifdef ENABLE_X86_LOG
|
||||
void dumpregs(int);
|
||||
|
||||
@@ -83,7 +87,7 @@ int x86_do_log = ENABLE_X86_LOG;
|
||||
int indump = 0;
|
||||
|
||||
static void
|
||||
x808x_log(const char *fmt, ...)
|
||||
x86_log(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
@@ -104,40 +108,42 @@ dumpregs(int force)
|
||||
if (indump || (!force && !dump_on_exit))
|
||||
return;
|
||||
|
||||
x808x_log("EIP=%08X CS=%04X DS=%04X ES=%04X SS=%04X FLAGS=%04X\n",
|
||||
cpu_state.pc, CS, DS, ES, SS, cpu_state.flags);
|
||||
x808x_log("Old CS:EIP: %04X:%08X; %i ins\n", oldcs, cpu_state.oldpc, ins);
|
||||
x86_log("EIP=%08X CS=%04X DS=%04X ES=%04X SS=%04X FLAGS=%04X\n",
|
||||
cpu_state.pc, CS, DS, ES, SS, cpu_state.flags);
|
||||
x85_log("Old CS:EIP: %04X:%08X; %i ins\n", oldcs, cpu_state.oldpc, ins);
|
||||
for (c = 0; c < 4; c++) {
|
||||
x808x_log("%s : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",
|
||||
seg_names[c], _opseg[c]->base, _opseg[c]->limit,
|
||||
_opseg[c]->access, _opseg[c]->limit_low, _opseg[c]->limit_high);
|
||||
x86_log("%s : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",
|
||||
seg_names[c], _opseg[c]->base, _opseg[c]->limit,
|
||||
_opseg[c]->access, _opseg[c]->limit_low, _opseg[c]->limit_high);
|
||||
}
|
||||
if (is386) {
|
||||
x808x_log("FS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",
|
||||
seg_fs, cpu_state.seg_fs.limit, cpu_state.seg_fs.access, cpu_state.seg_fs.limit_low, cpu_state.seg_fs.limit_high);
|
||||
x808x_log("GS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",
|
||||
gs, cpu_state.seg_gs.limit, cpu_state.seg_gs.access, cpu_state.seg_gs.limit_low, cpu_state.seg_gs.limit_high);
|
||||
x808x_log("GDT : base=%06X limit=%04X\n", gdt.base, gdt.limit);
|
||||
x808x_log("LDT : base=%06X limit=%04X\n", ldt.base, ldt.limit);
|
||||
x808x_log("IDT : base=%06X limit=%04X\n", idt.base, idt.limit);
|
||||
x808x_log("TR : base=%06X limit=%04X\n", tr.base, tr.limit);
|
||||
x808x_log("386 in %s mode: %i-bit data, %-i-bit stack\n",
|
||||
(msw & 1) ? ((cpu_state.eflags & VM_FLAG) ? "V86" : "protected") : "real",
|
||||
(use32) ? 32 : 16, (stack32) ? 32 : 16);
|
||||
x808x_log("CR0=%08X CR2=%08X CR3=%08X CR4=%08x\n", cr0, cr2, cr3, cr4);
|
||||
x808x_log("EAX=%08X EBX=%08X ECX=%08X EDX=%08X\nEDI=%08X ESI=%08X EBP=%08X ESP=%08X\n",
|
||||
EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP);
|
||||
x86_log("FS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",
|
||||
seg_fs, cpu_state.seg_fs.limit, cpu_state.seg_fs.access, cpu_state.seg_fs.limit_low,
|
||||
cpu_state.seg_fs.limit_high);
|
||||
x86_log("GS : base=%06X limit=%08X access=%02X limit_low=%08X limit_high=%08X\n",
|
||||
gs, cpu_state.seg_gs.limit, cpu_state.seg_gs.access, cpu_state.seg_gs.limit_low,
|
||||
cpu_state.seg_gs.limit_high);
|
||||
x86_log("GDT : base=%06X limit=%04X\n", gdt.base, gdt.limit);
|
||||
x86_log("LDT : base=%06X limit=%04X\n", ldt.base, ldt.limit);
|
||||
x86_log("IDT : base=%06X limit=%04X\n", idt.base, idt.limit);
|
||||
x86_log("TR : base=%06X limit=%04X\n", tr.base, tr.limit);
|
||||
x86_log("386 in %s mode: %i-bit data, %-i-bit stack\n",
|
||||
(msw & 1) ? ((cpu_state.eflags & VM_FLAG) ? "V86" : "protected") : "real",
|
||||
(use32) ? 32 : 16, (stack32) ? 32 : 16);
|
||||
x86_log("CR0=%08X CR2=%08X CR3=%08X CR4=%08x\n", cr0, cr2, cr3, cr4);
|
||||
x86_log("EAX=%08X EBX=%08X ECX=%08X EDX=%08X\nEDI=%08X ESI=%08X EBP=%08X ESP=%08X\n",
|
||||
EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP);
|
||||
} else {
|
||||
x808x_log("808x/286 in %s mode\n", (msw & 1) ? "protected" : "real");
|
||||
x808x_log("AX=%04X BX=%04X CX=%04X DX=%04X DI=%04X SI=%04X BP=%04X SP=%04X\n",
|
||||
AX, BX, CX, DX, DI, SI, BP, SP);
|
||||
x86_log("808x/286 in %s mode\n", (msw & 1) ? "protected" : "real");
|
||||
x86_log("AX=%04X BX=%04X CX=%04X DX=%04X DI=%04X SI=%04X BP=%04X SP=%04X\n",
|
||||
AX, BX, CX, DX, DI, SI, BP, SP);
|
||||
}
|
||||
x808x_log("Entries in readlookup : %i writelookup : %i\n", readlnum, writelnum);
|
||||
x86_log("Entries in readlookup : %i writelookup : %i\n", readlnum, writelnum);
|
||||
x87_dumpregs();
|
||||
indump = 0;
|
||||
}
|
||||
#else
|
||||
# define x808x_log(fmt, ...)
|
||||
# define x86_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
/* Preparation of the various arrays needed to speed up the MOD and R/M work. */
|
||||
@@ -188,9 +194,9 @@ makeznptable(void)
|
||||
znptable8[c] = 0;
|
||||
else
|
||||
znptable8[c] = P_FLAG;
|
||||
#ifdef ENABLE_808X_LOG
|
||||
#ifdef ENABLE_X86_LOG
|
||||
if (c == 0xb1)
|
||||
x808x_log("znp8 b1 = %i %02X\n", d, znptable8[c]);
|
||||
x86_log("znp8 b1 = %i %02X\n", d, znptable8[c]);
|
||||
#endif
|
||||
if (!c)
|
||||
znptable8[c] |= Z_FLAG;
|
||||
@@ -208,11 +214,11 @@ makeznptable(void)
|
||||
znptable16[c] = 0;
|
||||
else
|
||||
znptable16[c] = P_FLAG;
|
||||
#ifdef ENABLE_808X_LOG
|
||||
#ifdef ENABLE_X86_LOG
|
||||
if (c == 0xb1)
|
||||
x808x_log("znp16 b1 = %i %02X\n", d, znptable16[c]);
|
||||
x86_log("znp16 b1 = %i %02X\n", d, znptable16[c]);
|
||||
if (c == 0x65b1)
|
||||
x808x_log("znp16 65b1 = %i %02X\n", d, znptable16[c]);
|
||||
x86_log("znp16 65b1 = %i %02X\n", d, znptable16[c]);
|
||||
#endif
|
||||
if (!c)
|
||||
znptable16[c] |= Z_FLAG;
|
||||
@@ -225,9 +231,9 @@ makeznptable(void)
|
||||
static void
|
||||
reset_common(int hard)
|
||||
{
|
||||
#ifdef ENABLE_808X_LOG
|
||||
#ifdef ENABLE_X86_LOG
|
||||
if (hard)
|
||||
x808x_log("x86 reset\n");
|
||||
x86_log("x86 reset\n");
|
||||
#endif
|
||||
|
||||
if (!hard && reset_on_hlt) {
|
||||
@@ -270,7 +276,10 @@ reset_common(int hard)
|
||||
cpu_state.eflags = 0;
|
||||
cgate32 = 0;
|
||||
if (is286) {
|
||||
loadcs(0xF000);
|
||||
if (is486)
|
||||
loadcs(0xF000);
|
||||
else
|
||||
loadcs_2386(0xF000);
|
||||
cpu_state.pc = 0xFFF0;
|
||||
if (hard) {
|
||||
rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF;
|
||||
@@ -351,7 +360,7 @@ softresetx86(void)
|
||||
if (soft_reset_mask)
|
||||
return;
|
||||
|
||||
if (ibm8514_enabled || xga_enabled)
|
||||
if (ibm8514_active || xga_active)
|
||||
vga_on = 1;
|
||||
|
||||
reset_common(0);
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Second CPU header.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* leilei,
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2018 leilei.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_X86_H
|
||||
#define EMU_X86_H
|
||||
|
||||
#define ABRT_MASK 0x3f
|
||||
/*An 'expected' exception is one that would be expected to occur on every execution
|
||||
of this code path; eg a GPF due to being in v86 mode. An 'unexpected' exception is
|
||||
@@ -10,7 +33,7 @@
|
||||
#define ABRT_EXPECTED 0x80
|
||||
|
||||
extern uint8_t opcode;
|
||||
extern uint8_t opcode2;
|
||||
|
||||
extern uint8_t flags_p;
|
||||
extern uint8_t znptable8[256];
|
||||
|
||||
@@ -31,7 +54,6 @@ extern int trap;
|
||||
extern int optype;
|
||||
extern int stack32;
|
||||
extern int oldcpl;
|
||||
extern int cgate32;
|
||||
extern int cpl_override;
|
||||
extern int nmi_enable;
|
||||
extern int oddeven;
|
||||
@@ -48,6 +70,8 @@ extern uint32_t *mod1seg[8];
|
||||
extern uint32_t *eal_r;
|
||||
extern uint32_t *eal_w;
|
||||
|
||||
extern int fpu_cycles;
|
||||
|
||||
#define fetchdat rmdat
|
||||
|
||||
#define setznp168 setznp16
|
||||
@@ -75,24 +99,6 @@ extern uint32_t *eal_w;
|
||||
fetcheal(); \
|
||||
}
|
||||
|
||||
#define JMP 1
|
||||
#define CALL 2
|
||||
#define IRET 3
|
||||
#define OPTYPE_INT 4
|
||||
|
||||
enum {
|
||||
ABRT_NONE = 0,
|
||||
ABRT_GEN = 1,
|
||||
ABRT_TS = 0xA,
|
||||
ABRT_NP = 0xB,
|
||||
ABRT_SS = 0xC,
|
||||
ABRT_GPF = 0xD,
|
||||
ABRT_PF = 0xE,
|
||||
ABRT_DE = 0x40 /* INT 0, but we have to distinguish it from ABRT_NONE. */
|
||||
};
|
||||
|
||||
extern void x86_doabrt(int x86_abrt);
|
||||
extern void x86illegal(void);
|
||||
extern void x86seg_reset(void);
|
||||
extern void x86gpf(char *s, uint16_t error);
|
||||
extern void x86gpf_expected(char *s, uint16_t error);
|
||||
|
||||
#endif /*EMU_X86_H*/
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
optype = CALL; \
|
||||
cgate16 = cgate32 = 0; \
|
||||
if (msw & 1) \
|
||||
loadcscall(new_seg, old_pc); \
|
||||
op_loadcscall(new_seg, old_pc); \
|
||||
else { \
|
||||
loadcs(new_seg); \
|
||||
op_loadcs(new_seg); \
|
||||
cycles -= timing_call_rm; \
|
||||
} \
|
||||
optype = 0; \
|
||||
@@ -54,9 +54,9 @@
|
||||
optype = CALL; \
|
||||
cgate16 = cgate32 = 0; \
|
||||
if (msw & 1) \
|
||||
loadcscall(new_seg, old_pc); \
|
||||
op_loadcscall(new_seg, old_pc); \
|
||||
else { \
|
||||
loadcs(new_seg); \
|
||||
op_loadcs(new_seg); \
|
||||
cycles -= timing_call_rm; \
|
||||
} \
|
||||
optype = 0; \
|
||||
@@ -103,9 +103,9 @@
|
||||
optype = CALL; \
|
||||
cgate16 = cgate32 = 0; \
|
||||
if (msw & 1) \
|
||||
loadcscall(new_seg); \
|
||||
op_loadcscall(new_seg); \
|
||||
else { \
|
||||
loadcs(new_seg); \
|
||||
op_loadcs(new_seg); \
|
||||
cycles -= timing_call_rm; \
|
||||
} \
|
||||
optype = 0; \
|
||||
@@ -148,9 +148,9 @@
|
||||
optype = CALL; \
|
||||
cgate16 = cgate32 = 0; \
|
||||
if (msw & 1) \
|
||||
loadcscall(new_seg); \
|
||||
op_loadcscall(new_seg); \
|
||||
else { \
|
||||
loadcs(new_seg); \
|
||||
op_loadcs(new_seg); \
|
||||
cycles -= timing_call_rm; \
|
||||
} \
|
||||
optype = 0; \
|
||||
@@ -362,14 +362,12 @@ opFF_w_a16(uint32_t fetchdat)
|
||||
return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
loadcsjmp(new_cs, old_pc);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
op_loadcsjmp(new_cs, old_pc);
|
||||
#else
|
||||
loadcsjmp(new_cs, oxpc);
|
||||
op_loadcsjmp(new_cs, oxpc);
|
||||
#endif
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
#endif
|
||||
CPU_BLOCK_END();
|
||||
PREFETCH_RUN(cycles_old - cycles, 2, rmdat, 2, 0, 0, 0, 0);
|
||||
PREFETCH_FLUSH();
|
||||
@@ -526,14 +524,12 @@ opFF_w_a32(uint32_t fetchdat)
|
||||
return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
loadcsjmp(new_cs, old_pc);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
op_loadcsjmp(new_cs, old_pc);
|
||||
#else
|
||||
loadcsjmp(new_cs, oxpc);
|
||||
op_loadcsjmp(new_cs, oxpc);
|
||||
#endif
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
#endif
|
||||
CPU_BLOCK_END();
|
||||
PREFETCH_RUN(cycles_old - cycles, 2, rmdat, 2, 0, 0, 0, 1);
|
||||
PREFETCH_FLUSH();
|
||||
@@ -691,14 +687,12 @@ opFF_l_a16(uint32_t fetchdat)
|
||||
return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
loadcsjmp(new_cs, old_pc);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
op_loadcsjmp(new_cs, old_pc);
|
||||
#else
|
||||
loadcsjmp(new_cs, oxpc);
|
||||
op_loadcsjmp(new_cs, oxpc);
|
||||
#endif
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
#endif
|
||||
CPU_BLOCK_END();
|
||||
PREFETCH_RUN(cycles_old - cycles, 2, rmdat, 1, 1, 0, 0, 0);
|
||||
PREFETCH_FLUSH();
|
||||
@@ -857,14 +851,12 @@ opFF_l_a32(uint32_t fetchdat)
|
||||
return 1;
|
||||
cpu_state.pc = new_pc;
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
loadcsjmp(new_cs, old_pc);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
op_loadcsjmp(new_cs, old_pc);
|
||||
#else
|
||||
loadcsjmp(new_cs, oxpc);
|
||||
op_loadcsjmp(new_cs, oxpc);
|
||||
#endif
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
#endif
|
||||
CPU_BLOCK_END();
|
||||
PREFETCH_RUN(cycles_old - cycles, 2, rmdat, 1, 1, 0, 0, 1);
|
||||
PREFETCH_FLUSH();
|
||||
|
||||
@@ -282,7 +282,7 @@ opJMP_far_a16(uint32_t fetchdat)
|
||||
return 1;
|
||||
old_pc = cpu_state.pc;
|
||||
cpu_state.pc = addr;
|
||||
loadcsjmp(seg, old_pc);
|
||||
op_loadcsjmp(seg, old_pc);
|
||||
CPU_BLOCK_END();
|
||||
PREFETCH_RUN(11, 5, -1, 0, 0, 0, 0, 0);
|
||||
PREFETCH_FLUSH();
|
||||
@@ -301,7 +301,7 @@ opJMP_far_a32(uint32_t fetchdat)
|
||||
return 1;
|
||||
old_pc = cpu_state.pc;
|
||||
cpu_state.pc = addr;
|
||||
loadcsjmp(seg, old_pc);
|
||||
op_loadcsjmp(seg, old_pc);
|
||||
CPU_BLOCK_END();
|
||||
PREFETCH_RUN(11, 7, -1, 0, 0, 0, 0, 0);
|
||||
PREFETCH_FLUSH();
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/timer.h>
|
||||
#include "x86seg_common.h"
|
||||
#include "x86seg.h"
|
||||
#include "386_common.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg.h"
|
||||
|
||||
MMX_REG *MMP[8];
|
||||
uint16_t *MMEP[8];
|
||||
|
||||
@@ -178,13 +178,13 @@ opMOV_seg_w_a16(uint32_t fetchdat)
|
||||
|
||||
switch (rmdat & 0x38) {
|
||||
case 0x00: /*ES*/
|
||||
loadseg(new_seg, &cpu_state.seg_es);
|
||||
op_loadseg(new_seg, &cpu_state.seg_es);
|
||||
break;
|
||||
case 0x18: /*DS*/
|
||||
loadseg(new_seg, &cpu_state.seg_ds);
|
||||
op_loadseg(new_seg, &cpu_state.seg_ds);
|
||||
break;
|
||||
case 0x10: /*SS*/
|
||||
loadseg(new_seg, &cpu_state.seg_ss);
|
||||
op_loadseg(new_seg, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.oldpc = cpu_state.pc;
|
||||
@@ -198,10 +198,10 @@ opMOV_seg_w_a16(uint32_t fetchdat)
|
||||
x86_opcodes[(fetchdat & 0xff) | cpu_state.op32](fetchdat >> 8);
|
||||
return 1;
|
||||
case 0x20: /*FS*/
|
||||
loadseg(new_seg, &cpu_state.seg_fs);
|
||||
op_loadseg(new_seg, &cpu_state.seg_fs);
|
||||
break;
|
||||
case 0x28: /*GS*/
|
||||
loadseg(new_seg, &cpu_state.seg_gs);
|
||||
op_loadseg(new_seg, &cpu_state.seg_gs);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -223,13 +223,13 @@ opMOV_seg_w_a32(uint32_t fetchdat)
|
||||
|
||||
switch (rmdat & 0x38) {
|
||||
case 0x00: /*ES*/
|
||||
loadseg(new_seg, &cpu_state.seg_es);
|
||||
op_loadseg(new_seg, &cpu_state.seg_es);
|
||||
break;
|
||||
case 0x18: /*DS*/
|
||||
loadseg(new_seg, &cpu_state.seg_ds);
|
||||
op_loadseg(new_seg, &cpu_state.seg_ds);
|
||||
break;
|
||||
case 0x10: /*SS*/
|
||||
loadseg(new_seg, &cpu_state.seg_ss);
|
||||
op_loadseg(new_seg, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.oldpc = cpu_state.pc;
|
||||
@@ -243,10 +243,10 @@ opMOV_seg_w_a32(uint32_t fetchdat)
|
||||
x86_opcodes[(fetchdat & 0xff) | cpu_state.op32](fetchdat >> 8);
|
||||
return 1;
|
||||
case 0x20: /*FS*/
|
||||
loadseg(new_seg, &cpu_state.seg_fs);
|
||||
op_loadseg(new_seg, &cpu_state.seg_fs);
|
||||
break;
|
||||
case 0x28: /*GS*/
|
||||
loadseg(new_seg, &cpu_state.seg_gs);
|
||||
op_loadseg(new_seg, &cpu_state.seg_gs);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ opLDS_w_a16(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 2);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ds);
|
||||
op_loadseg(seg, &cpu_state.seg_ds);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].w = addr;
|
||||
@@ -292,7 +292,7 @@ opLDS_w_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 2);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ds);
|
||||
op_loadseg(seg, &cpu_state.seg_ds);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].w = addr;
|
||||
@@ -315,7 +315,7 @@ opLDS_l_a16(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 4);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ds);
|
||||
op_loadseg(seg, &cpu_state.seg_ds);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].l = addr;
|
||||
@@ -338,7 +338,7 @@ opLDS_l_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 4);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ds);
|
||||
op_loadseg(seg, &cpu_state.seg_ds);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].l = addr;
|
||||
@@ -362,7 +362,7 @@ opLSS_w_a16(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 2);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ss);
|
||||
op_loadseg(seg, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].w = addr;
|
||||
@@ -385,7 +385,7 @@ opLSS_w_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 2);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ss);
|
||||
op_loadseg(seg, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].w = addr;
|
||||
@@ -408,7 +408,7 @@ opLSS_l_a16(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 4);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ss);
|
||||
op_loadseg(seg, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].l = addr;
|
||||
@@ -431,7 +431,7 @@ opLSS_l_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 4);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(seg, &cpu_state.seg_ss);
|
||||
op_loadseg(seg, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
cpu_state.regs[cpu_reg].l = addr;
|
||||
@@ -454,7 +454,7 @@ opLSS_l_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 2); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
loadseg(seg, &sel); \
|
||||
op_loadseg(seg, &sel); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
cpu_state.regs[cpu_reg].w = addr; \
|
||||
@@ -476,7 +476,7 @@ opLSS_l_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 2); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
loadseg(seg, &sel); \
|
||||
op_loadseg(seg, &sel); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
cpu_state.regs[cpu_reg].w = addr; \
|
||||
@@ -499,7 +499,7 @@ opLSS_l_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 4); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
loadseg(seg, &sel); \
|
||||
op_loadseg(seg, &sel); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
cpu_state.regs[cpu_reg].l = addr; \
|
||||
@@ -522,7 +522,7 @@ opLSS_l_a32(uint32_t fetchdat)
|
||||
seg = readmemw(easeg, cpu_state.eaaddr + 4); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
loadseg(seg, &sel); \
|
||||
op_loadseg(seg, &sel); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
cpu_state.regs[cpu_reg].l = addr; \
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
|
||||
#define RETF_a16(stack_offset) \
|
||||
if ((msw & 1) && !(cpu_state.eflags & VM_FLAG)) { \
|
||||
pmoderetf(0, stack_offset); \
|
||||
op_pmoderetf(0, stack_offset); \
|
||||
return 1; \
|
||||
} \
|
||||
CPU_SET_OXPC \
|
||||
if (stack32) { \
|
||||
cpu_state.pc = readmemw(ss, ESP); \
|
||||
loadcs(readmemw(ss, ESP + 2)); \
|
||||
op_loadcs(readmemw(ss, ESP + 2)); \
|
||||
} else { \
|
||||
cpu_state.pc = readmemw(ss, SP); \
|
||||
loadcs(readmemw(ss, SP + 2)); \
|
||||
op_loadcs(readmemw(ss, SP + 2)); \
|
||||
} \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
@@ -27,16 +27,16 @@
|
||||
|
||||
#define RETF_a32(stack_offset) \
|
||||
if ((msw & 1) && !(cpu_state.eflags & VM_FLAG)) { \
|
||||
pmoderetf(1, stack_offset); \
|
||||
op_pmoderetf(1, stack_offset); \
|
||||
return 1; \
|
||||
} \
|
||||
CPU_SET_OXPC \
|
||||
if (stack32) { \
|
||||
cpu_state.pc = readmeml(ss, ESP); \
|
||||
loadcs(readmeml(ss, ESP + 4) & 0xffff); \
|
||||
op_loadcs(readmeml(ss, ESP + 4) & 0xffff); \
|
||||
} else { \
|
||||
cpu_state.pc = readmeml(ss, SP); \
|
||||
loadcs(readmeml(ss, SP + 4) & 0xffff); \
|
||||
op_loadcs(readmeml(ss, SP + 4) & 0xffff); \
|
||||
} \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
@@ -114,7 +114,7 @@ opIRET_186(uint32_t fetchdat)
|
||||
}
|
||||
if (msw & 1) {
|
||||
optype = IRET;
|
||||
pmodeiret(0);
|
||||
op_pmodeiret(0);
|
||||
optype = 0;
|
||||
} else {
|
||||
uint16_t new_cs;
|
||||
@@ -130,7 +130,7 @@ opIRET_186(uint32_t fetchdat)
|
||||
cpu_state.flags = (cpu_state.flags & 0x7000) | (readmemw(ss, ((SP + 4) & 0xffff)) & 0x0fd5) | 2;
|
||||
SP += 6;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
op_loadcs(new_cs);
|
||||
cycles -= timing_iret_rm;
|
||||
}
|
||||
flags_extract();
|
||||
@@ -154,7 +154,7 @@ opIRET_286(uint32_t fetchdat)
|
||||
}
|
||||
if (msw & 1) {
|
||||
optype = IRET;
|
||||
pmodeiret(0);
|
||||
op_pmodeiret(0);
|
||||
optype = 0;
|
||||
} else {
|
||||
uint16_t new_cs;
|
||||
@@ -170,7 +170,7 @@ opIRET_286(uint32_t fetchdat)
|
||||
cpu_state.flags = (cpu_state.flags & 0x7000) | (readmemw(ss, ((SP + 4) & 0xffff)) & 0x0fd5) | 2;
|
||||
SP += 6;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
op_loadcs(new_cs);
|
||||
cycles -= timing_iret_rm;
|
||||
}
|
||||
flags_extract();
|
||||
@@ -210,7 +210,7 @@ opIRET(uint32_t fetchdat)
|
||||
else
|
||||
cpu_state.eflags &= ~VIF_FLAG;
|
||||
cpu_state.flags = (cpu_state.flags & 0x3300) | (new_flags & 0x4cd5) | 2;
|
||||
loadcs(new_cs);
|
||||
op_loadcs(new_cs);
|
||||
cpu_state.pc = new_pc;
|
||||
|
||||
cycles -= timing_iret_rm;
|
||||
@@ -221,7 +221,7 @@ opIRET(uint32_t fetchdat)
|
||||
} else {
|
||||
if (msw & 1) {
|
||||
optype = IRET;
|
||||
pmodeiret(0);
|
||||
op_pmodeiret(0);
|
||||
optype = 0;
|
||||
} else {
|
||||
uint16_t new_cs;
|
||||
@@ -237,7 +237,7 @@ opIRET(uint32_t fetchdat)
|
||||
cpu_state.flags = (readmemw(ss, ((SP + 4) & 0xffff)) & 0xffd5) | 2;
|
||||
SP += 6;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
op_loadcs(new_cs);
|
||||
cycles -= timing_iret_rm;
|
||||
}
|
||||
}
|
||||
@@ -262,7 +262,7 @@ opIRETD(uint32_t fetchdat)
|
||||
}
|
||||
if (msw & 1) {
|
||||
optype = IRET;
|
||||
pmodeiret(1);
|
||||
op_pmodeiret(1);
|
||||
optype = 0;
|
||||
} else {
|
||||
uint16_t new_cs;
|
||||
@@ -280,7 +280,7 @@ opIRETD(uint32_t fetchdat)
|
||||
cpu_state.eflags = readmemw(ss, (SP + 10) & 0xffff);
|
||||
SP += 12;
|
||||
}
|
||||
loadcs(new_cs);
|
||||
op_loadcs(new_cs);
|
||||
cycles -= timing_iret_rm;
|
||||
}
|
||||
flags_extract();
|
||||
|
||||
@@ -610,7 +610,7 @@ opLEAVE_l(uint32_t fetchdat)
|
||||
temp_seg = POP_W(); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
loadseg(temp_seg, realseg); \
|
||||
op_loadseg(temp_seg, realseg); \
|
||||
if (cpu_state.abrt) \
|
||||
ESP = temp_esp; \
|
||||
CLOCK_CYCLES(is486 ? 3 : 7); \
|
||||
@@ -624,7 +624,7 @@ opLEAVE_l(uint32_t fetchdat)
|
||||
temp_seg = POP_L(); \
|
||||
if (cpu_state.abrt) \
|
||||
return 1; \
|
||||
loadseg(temp_seg & 0xffff, realseg); \
|
||||
op_loadseg(temp_seg & 0xffff, realseg); \
|
||||
if (cpu_state.abrt) \
|
||||
ESP = temp_esp; \
|
||||
CLOCK_CYCLES(is486 ? 3 : 7); \
|
||||
@@ -651,7 +651,7 @@ opPOP_SS_w(uint32_t fetchdat)
|
||||
temp_seg = POP_W();
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(temp_seg, &cpu_state.seg_ss);
|
||||
op_loadseg(temp_seg, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt) {
|
||||
ESP = temp_esp;
|
||||
return 1;
|
||||
@@ -679,7 +679,7 @@ opPOP_SS_l(uint32_t fetchdat)
|
||||
temp_seg = POP_L();
|
||||
if (cpu_state.abrt)
|
||||
return 1;
|
||||
loadseg(temp_seg & 0xffff, &cpu_state.seg_ss);
|
||||
op_loadseg(temp_seg & 0xffff, &cpu_state.seg_ss);
|
||||
if (cpu_state.abrt) {
|
||||
ESP = temp_esp;
|
||||
return 1;
|
||||
|
||||
221
src/cpu/x86seg.c
221
src/cpu/x86seg.c
@@ -36,17 +36,25 @@
|
||||
|
||||
#include "x86.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg.h"
|
||||
#include "x86seg_common.h"
|
||||
#include "386_common.h"
|
||||
|
||||
uint8_t opcode2;
|
||||
|
||||
int cgate16;
|
||||
int cgate32;
|
||||
int intgatesize;
|
||||
|
||||
void taskswitch286(uint16_t seg, uint16_t *segdat, int is32);
|
||||
|
||||
void pmodeint(int num, int soft);
|
||||
#ifdef OPS_286_386
|
||||
#define seg_readmembl readmembl_2386
|
||||
#define seg_readmemwl readmemwl_2386
|
||||
#define seg_readmemll readmemll_2386
|
||||
#define seg_writemembl writemembl_2386
|
||||
#define seg_writememwl writememwl_2386
|
||||
#define seg_writememll writememll_2386
|
||||
#else
|
||||
#define seg_readmembl readmembl_2386
|
||||
#define seg_readmemwl readmemwl_2386
|
||||
#define seg_readmemll readmemll_2386
|
||||
#define seg_writemembl writemembl_2386
|
||||
#define seg_writememwl writememwl_2386
|
||||
#define seg_writememll writememll_2386
|
||||
#endif
|
||||
|
||||
#define DPL ((segdat[2] >> 13) & 3)
|
||||
#define DPL2 ((segdat2[2] >> 13) & 3)
|
||||
@@ -70,41 +78,12 @@ x86seg_log(const char *fmt, ...)
|
||||
# define x86seg_log(fmt, ...)
|
||||
#endif
|
||||
|
||||
static void
|
||||
seg_reset(x86seg *s)
|
||||
{
|
||||
s->access = 0x82;
|
||||
s->ar_high = 0x10;
|
||||
s->limit = 0xffff;
|
||||
s->limit_low = 0;
|
||||
s->limit_high = 0xffff;
|
||||
if (s == &cpu_state.seg_cs) {
|
||||
if (!cpu_inited)
|
||||
fatal("seg_reset(&cpu_state.seg.cs) without an initialized CPU\n");
|
||||
if (is6117)
|
||||
s->base = 0x03ff0000;
|
||||
else
|
||||
s->base = is286 ? (cpu_16bitbus ? 0x00ff0000 : 0xffff0000) : 0x000ffff0;
|
||||
s->seg = is286 ? 0xf000 : 0xffff;
|
||||
} else {
|
||||
s->base = 0;
|
||||
s->seg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
x86seg_reset(void)
|
||||
{
|
||||
seg_reset(&cpu_state.seg_cs);
|
||||
seg_reset(&cpu_state.seg_ds);
|
||||
seg_reset(&cpu_state.seg_es);
|
||||
seg_reset(&cpu_state.seg_fs);
|
||||
seg_reset(&cpu_state.seg_gs);
|
||||
seg_reset(&cpu_state.seg_ss);
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
x86_doabrt_2386(int x86_abrt)
|
||||
#else
|
||||
x86_doabrt(int x86_abrt)
|
||||
#endif
|
||||
{
|
||||
#ifndef USE_NEW_DYNAREC
|
||||
CS = oldcs;
|
||||
@@ -114,7 +93,7 @@ x86_doabrt(int x86_abrt)
|
||||
cpu_state.seg_cs.ar_high = 0x10;
|
||||
|
||||
if (msw & 1)
|
||||
pmodeint(x86_abrt, 0);
|
||||
op_pmodeint(x86_abrt, 0);
|
||||
else {
|
||||
uint32_t addr = (x86_abrt << 2) + idt.base;
|
||||
if (stack32) {
|
||||
@@ -134,7 +113,7 @@ x86_doabrt(int x86_abrt)
|
||||
oxpc = cpu_state.pc;
|
||||
#endif
|
||||
cpu_state.pc = readmemw(0, addr);
|
||||
loadcs(readmemw(0, addr + 2));
|
||||
op_loadcs(readmemw(0, addr + 2));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,52 +139,6 @@ x86_doabrt(int x86_abrt)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
x86de(UNUSED(char *s), UNUSED(uint16_t error))
|
||||
{
|
||||
#ifdef BAD_CODE
|
||||
cpu_state.abrt = ABRT_DE;
|
||||
abrt_error = error;
|
||||
#else
|
||||
x86_int(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
x86gpf(UNUSED(char *s), uint16_t error)
|
||||
{
|
||||
cpu_state.abrt = ABRT_GPF;
|
||||
abrt_error = error;
|
||||
}
|
||||
|
||||
void
|
||||
x86gpf_expected(UNUSED(char *s), uint16_t error)
|
||||
{
|
||||
cpu_state.abrt = ABRT_GPF | ABRT_EXPECTED;
|
||||
abrt_error = error;
|
||||
}
|
||||
|
||||
void
|
||||
x86ss(UNUSED(char *s), uint16_t error)
|
||||
{
|
||||
cpu_state.abrt = ABRT_SS;
|
||||
abrt_error = error;
|
||||
}
|
||||
|
||||
void
|
||||
x86ts(UNUSED(char *s), uint16_t error)
|
||||
{
|
||||
cpu_state.abrt = ABRT_TS;
|
||||
abrt_error = error;
|
||||
}
|
||||
|
||||
void
|
||||
x86np(UNUSED(char *s), uint16_t error)
|
||||
{
|
||||
cpu_state.abrt = ABRT_NP;
|
||||
abrt_error = error;
|
||||
}
|
||||
|
||||
static void
|
||||
set_stack32(int s)
|
||||
{
|
||||
@@ -228,6 +161,7 @@ set_use32(int u)
|
||||
cpu_cur_status &= ~CPU_STATUS_USE32;
|
||||
}
|
||||
|
||||
#ifndef OPS_286_386
|
||||
void
|
||||
do_seg_load(x86seg *s, uint16_t *segdat)
|
||||
{
|
||||
@@ -262,6 +196,7 @@ do_seg_load(x86seg *s, uint16_t *segdat)
|
||||
cpu_cur_status |= CPU_STATUS_NOTFLATSS;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
do_seg_v86_init(x86seg *s)
|
||||
@@ -310,7 +245,7 @@ check_seg_valid(x86seg *s)
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
loadseg(0, s);
|
||||
op_loadseg(0, s);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -336,7 +271,11 @@ int
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
#ifdef OPS_286_386
|
||||
loadseg_2386(uint16_t seg, x86seg *s)
|
||||
#else
|
||||
loadseg(uint16_t seg, x86seg *s)
|
||||
#endif
|
||||
{
|
||||
uint16_t segdat[4];
|
||||
uint32_t addr;
|
||||
@@ -534,7 +473,11 @@ loadseg(uint16_t seg, x86seg *s)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
loadcs_2386(uint16_t seg)
|
||||
#else
|
||||
loadcs(uint16_t seg)
|
||||
#endif
|
||||
{
|
||||
uint16_t segdat[4];
|
||||
uint32_t addr;
|
||||
@@ -623,7 +566,11 @@ loadcs(uint16_t seg)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
loadcsjmp_2386(uint16_t seg, uint32_t old_pc)
|
||||
#else
|
||||
loadcsjmp(uint16_t seg, uint32_t old_pc)
|
||||
#endif
|
||||
{
|
||||
uint16_t type;
|
||||
uint16_t seg2;
|
||||
@@ -783,7 +730,7 @@ loadcsjmp(uint16_t seg, uint32_t old_pc)
|
||||
cpu_state.pc = old_pc;
|
||||
optype = JMP;
|
||||
cpl_override = 1;
|
||||
taskswitch286(seg, segdat, segdat[2] & 0x800);
|
||||
op_taskswitch286(seg, segdat, segdat[2] & 0x800);
|
||||
cpu_state.flags &= ~NT_FLAG;
|
||||
cpl_override = 0;
|
||||
return;
|
||||
@@ -810,7 +757,7 @@ loadcsjmp(uint16_t seg, uint32_t old_pc)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
PUSHW(uint16_t v)
|
||||
{
|
||||
if (stack32) {
|
||||
@@ -826,7 +773,7 @@ PUSHW(uint16_t v)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
PUSHL(uint32_t v)
|
||||
{
|
||||
if (cpu_16bitbus) {
|
||||
@@ -847,7 +794,7 @@ PUSHL(uint32_t v)
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t
|
||||
static uint16_t
|
||||
POPW(void)
|
||||
{
|
||||
uint16_t tempw;
|
||||
@@ -865,7 +812,7 @@ POPW(void)
|
||||
return tempw;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
static uint32_t
|
||||
POPL(void)
|
||||
{
|
||||
uint32_t templ;
|
||||
@@ -890,6 +837,15 @@ POPL(void)
|
||||
return templ;
|
||||
}
|
||||
|
||||
#ifdef OPS_286_386
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
void
|
||||
loadcscall_2386(uint16_t seg, uint32_t old_pc)
|
||||
#else
|
||||
void
|
||||
loadcscall_2386(uint16_t seg)
|
||||
#endif
|
||||
#else
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
void
|
||||
loadcscall(uint16_t seg, uint32_t old_pc)
|
||||
@@ -897,6 +853,7 @@ loadcscall(uint16_t seg, uint32_t old_pc)
|
||||
void
|
||||
loadcscall(uint16_t seg)
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
uint16_t seg2;
|
||||
uint16_t newss;
|
||||
@@ -1225,7 +1182,7 @@ loadcscall(uint16_t seg)
|
||||
cpu_state.pc = oxpc;
|
||||
#endif
|
||||
cpl_override = 1;
|
||||
taskswitch286(seg, segdat, segdat[2] & 0x0800);
|
||||
op_taskswitch286(seg, segdat, segdat[2] & 0x0800);
|
||||
cpl_override = 0;
|
||||
break;
|
||||
|
||||
@@ -1251,7 +1208,11 @@ loadcscall(uint16_t seg)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
pmoderetf_2386(int is32, uint16_t off)
|
||||
#else
|
||||
pmoderetf(int is32, uint16_t off)
|
||||
#endif
|
||||
{
|
||||
uint16_t segdat[4];
|
||||
uint16_t segdat2[4];
|
||||
@@ -1487,7 +1448,11 @@ pmoderetf(int is32, uint16_t off)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
pmodeint_2386(int num, int soft)
|
||||
#else
|
||||
pmodeint(int num, int soft)
|
||||
#endif
|
||||
{
|
||||
uint16_t segdat[4];
|
||||
uint16_t segdat2[4];
|
||||
@@ -1518,7 +1483,7 @@ pmodeint(int num, int soft)
|
||||
softresetx86();
|
||||
cpu_set_edx();
|
||||
} else if (num == 0x0d)
|
||||
pmodeint(8, 0);
|
||||
op_pmodeint(8, 0);
|
||||
else
|
||||
x86gpf("pmodeint(): Vector > IDT limit", (num << 3) + 2 + !soft);
|
||||
x86seg_log("addr >= IDT.limit\n");
|
||||
@@ -1659,10 +1624,10 @@ pmodeint(int num, int soft)
|
||||
PUSHL(ES);
|
||||
if (cpu_state.abrt)
|
||||
return;
|
||||
loadseg(0, &cpu_state.seg_ds);
|
||||
loadseg(0, &cpu_state.seg_es);
|
||||
loadseg(0, &cpu_state.seg_fs);
|
||||
loadseg(0, &cpu_state.seg_gs);
|
||||
op_loadseg(0, &cpu_state.seg_ds);
|
||||
op_loadseg(0, &cpu_state.seg_es);
|
||||
op_loadseg(0, &cpu_state.seg_fs);
|
||||
op_loadseg(0, &cpu_state.seg_gs);
|
||||
}
|
||||
PUSHL(oldss);
|
||||
PUSHL(oldsp);
|
||||
@@ -1764,7 +1729,7 @@ pmodeint(int num, int soft)
|
||||
}
|
||||
optype = OPTYPE_INT;
|
||||
cpl_override = 1;
|
||||
taskswitch286(seg, segdat2, segdat2[2] & 0x0800);
|
||||
op_taskswitch286(seg, segdat2, segdat2[2] & 0x0800);
|
||||
cpl_override = 0;
|
||||
break;
|
||||
|
||||
@@ -1775,7 +1740,11 @@ pmodeint(int num, int soft)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
pmodeiret_2386(int is32)
|
||||
#else
|
||||
pmodeiret(int is32)
|
||||
#endif
|
||||
{
|
||||
uint16_t newss;
|
||||
uint16_t seg = 0;
|
||||
@@ -1842,7 +1811,7 @@ pmodeiret(int is32)
|
||||
}
|
||||
cpl_override = 1;
|
||||
read_descriptor(addr, segdat, segdat32, 1);
|
||||
taskswitch286(seg, segdat, segdat[2] & 0x0800);
|
||||
op_taskswitch286(seg, segdat, segdat[2] & 0x0800);
|
||||
cpl_override = 0;
|
||||
return;
|
||||
}
|
||||
@@ -1876,14 +1845,14 @@ pmodeiret(int is32)
|
||||
}
|
||||
cpu_state.eflags = tempflags >> 16;
|
||||
cpu_cur_status |= CPU_STATUS_V86;
|
||||
loadseg(segs[0], &cpu_state.seg_es);
|
||||
op_loadseg(segs[0], &cpu_state.seg_es);
|
||||
do_seg_v86_init(&cpu_state.seg_es);
|
||||
loadseg(segs[1], &cpu_state.seg_ds);
|
||||
op_loadseg(segs[1], &cpu_state.seg_ds);
|
||||
do_seg_v86_init(&cpu_state.seg_ds);
|
||||
cpu_cur_status |= CPU_STATUS_NOTFLATDS;
|
||||
loadseg(segs[2], &cpu_state.seg_fs);
|
||||
op_loadseg(segs[2], &cpu_state.seg_fs);
|
||||
do_seg_v86_init(&cpu_state.seg_fs);
|
||||
loadseg(segs[3], &cpu_state.seg_gs);
|
||||
op_loadseg(segs[3], &cpu_state.seg_gs);
|
||||
do_seg_v86_init(&cpu_state.seg_gs);
|
||||
|
||||
cpu_state.pc = newpc & 0xffff;
|
||||
@@ -1901,7 +1870,7 @@ pmodeiret(int is32)
|
||||
#endif
|
||||
|
||||
ESP = newsp;
|
||||
loadseg(newss, &cpu_state.seg_ss);
|
||||
op_loadseg(newss, &cpu_state.seg_ss);
|
||||
do_seg_v86_init(&cpu_state.seg_ss);
|
||||
cpu_cur_status |= CPU_STATUS_NOTFLATSS;
|
||||
use32 = 0;
|
||||
@@ -2088,7 +2057,11 @@ pmodeiret(int is32)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
taskswitch286_2386(uint16_t seg, uint16_t *segdat, int is32)
|
||||
#else
|
||||
taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
|
||||
#endif
|
||||
{
|
||||
uint16_t tempw;
|
||||
uint16_t new_ldt;
|
||||
@@ -2235,7 +2208,7 @@ taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
|
||||
ldt.base = (readmemw(0, templ + 2)) | (readmemb(0, templ + 4) << 16) | (readmemb(0, templ + 7) << 24);
|
||||
|
||||
if (cpu_state.eflags & VM_FLAG) {
|
||||
loadcs(new_cs);
|
||||
op_loadcs(new_cs);
|
||||
set_use32(0);
|
||||
cpu_cur_status |= CPU_STATUS_V86;
|
||||
} else {
|
||||
@@ -2299,11 +2272,11 @@ taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
|
||||
ESI = new_esi;
|
||||
EDI = new_edi;
|
||||
|
||||
loadseg(new_es, &cpu_state.seg_es);
|
||||
loadseg(new_ss, &cpu_state.seg_ss);
|
||||
loadseg(new_ds, &cpu_state.seg_ds);
|
||||
loadseg(new_fs, &cpu_state.seg_fs);
|
||||
loadseg(new_gs, &cpu_state.seg_gs);
|
||||
op_loadseg(new_es, &cpu_state.seg_es);
|
||||
op_loadseg(new_ss, &cpu_state.seg_ss);
|
||||
op_loadseg(new_ds, &cpu_state.seg_ds);
|
||||
op_loadseg(new_fs, &cpu_state.seg_fs);
|
||||
op_loadseg(new_gs, &cpu_state.seg_gs);
|
||||
} else {
|
||||
if (limit < 43) {
|
||||
x86ts(NULL, seg);
|
||||
@@ -2465,12 +2438,12 @@ taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
|
||||
ESI = new_esi | 0xffff0000;
|
||||
EDI = new_edi | 0xffff0000;
|
||||
|
||||
loadseg(new_es, &cpu_state.seg_es);
|
||||
loadseg(new_ss, &cpu_state.seg_ss);
|
||||
loadseg(new_ds, &cpu_state.seg_ds);
|
||||
op_loadseg(new_es, &cpu_state.seg_es);
|
||||
op_loadseg(new_ss, &cpu_state.seg_ss);
|
||||
op_loadseg(new_ds, &cpu_state.seg_ds);
|
||||
if (is386) {
|
||||
loadseg(0, &cpu_state.seg_fs);
|
||||
loadseg(0, &cpu_state.seg_gs);
|
||||
op_loadseg(0, &cpu_state.seg_fs);
|
||||
op_loadseg(0, &cpu_state.seg_gs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2482,7 +2455,11 @@ taskswitch286(uint16_t seg, uint16_t *segdat, int is32)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
cyrix_write_seg_descriptor_2386(uint32_t addr, x86seg *seg)
|
||||
#else
|
||||
cyrix_write_seg_descriptor(uint32_t addr, x86seg *seg)
|
||||
#endif
|
||||
{
|
||||
uint32_t limit_raw = seg->limit;
|
||||
|
||||
@@ -2494,7 +2471,11 @@ cyrix_write_seg_descriptor(uint32_t addr, x86seg *seg)
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef OPS_286_386
|
||||
cyrix_load_seg_descriptor_2386(uint32_t addr, x86seg *seg)
|
||||
#else
|
||||
cyrix_load_seg_descriptor(uint32_t addr, x86seg *seg)
|
||||
#endif
|
||||
{
|
||||
uint16_t segdat[4];
|
||||
uint16_t selector;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* x86 CPU segment emulation.
|
||||
* x86 CPU segment emulation header.
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -14,8 +14,82 @@
|
||||
*
|
||||
* Copyright 2016-2017 Miran Grca.
|
||||
*/
|
||||
#ifndef EMU_X86SEG_H
|
||||
#define EMU_X86SEG_H
|
||||
|
||||
extern void do_seg_load(x86seg *s, uint16_t *segdat);
|
||||
#ifdef OPS_286_386
|
||||
|
||||
extern void x86_doabrt_2386(int x86_abrt);
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
extern int loadseg_2386(uint16_t seg, x86seg *s);
|
||||
#else
|
||||
extern void loadseg_2386(uint16_t seg, x86seg *s);
|
||||
#endif
|
||||
extern void loadcs_2386(uint16_t seg);
|
||||
extern void loadcsjmp_2386(uint16_t seg, uint32_t old_pc);
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
extern void loadcscall_2386(uint16_t seg, uint32_t old_pc);
|
||||
#else
|
||||
extern void loadcscall_2386(uint16_t seg);
|
||||
#endif
|
||||
extern void pmoderetf_2386(int is32, uint16_t off);
|
||||
extern void pmodeint_2386(int num, int soft);
|
||||
extern void pmodeiret_2386(int is32);
|
||||
extern void taskswitch286_2386(uint16_t seg, uint16_t *segdat, int is32);
|
||||
|
||||
/* #define's to avoid long #ifdef blocks in x86_ops_*.h. */
|
||||
#define op_doabrt x86_doabrt_2386
|
||||
#define op_loadseg loadseg_2386
|
||||
#define op_loadcs loadcs_2386
|
||||
#define op_loadcsjmp loadcsjmp_2386
|
||||
#define op_loadcscall loadcscall_2386
|
||||
#define op_pmoderetf pmoderetf_2386
|
||||
#define op_pmodeint pmodeint_2386
|
||||
#define op_pmodeiret pmodeiret_2386
|
||||
#define op_taskswitch taskswitch_2386
|
||||
#define op_taskswitch286 taskswitch286_2386
|
||||
|
||||
#else
|
||||
|
||||
extern void x86_doabrt(int x86_abrt);
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
extern int loadseg(uint16_t seg, x86seg *s);
|
||||
#else
|
||||
extern void loadseg(uint16_t seg, x86seg *s);
|
||||
#endif
|
||||
/* The prototype of loadcs_2386() is needed here for reset. */
|
||||
extern void loadcs_2386(uint16_t seg);
|
||||
extern void loadcs(uint16_t seg);
|
||||
extern void loadcsjmp(uint16_t seg, uint32_t old_pc);
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
extern void loadcscall(uint16_t seg, uint32_t old_pc);
|
||||
#else
|
||||
extern void loadcscall(uint16_t seg);
|
||||
#endif
|
||||
extern void pmoderetf(int is32, uint16_t off);
|
||||
/* The prototype of pmodeint_2386() is needed here for 386_common.c interrupts. */
|
||||
extern void pmodeint_2386(int num, int soft);
|
||||
extern void pmodeint(int num, int soft);
|
||||
extern void pmodeiret(int is32);
|
||||
extern void taskswitch286(uint16_t seg, uint16_t *segdat, int is32);
|
||||
|
||||
/* #define's to avoid long #ifdef blocks in x86_ops_*.h. */
|
||||
#define op_doabrt x86_doabrt
|
||||
#define op_loadseg loadseg
|
||||
#define op_loadcs loadcs
|
||||
#define op_loadcsjmp loadcsjmp
|
||||
#define op_loadcscall loadcscall
|
||||
#define op_pmoderetf pmoderetf
|
||||
#define op_pmodeint pmodeint
|
||||
#define op_pmodeiret pmodeiret
|
||||
#define op_taskswitch286 taskswitch286
|
||||
|
||||
#endif
|
||||
|
||||
extern void cyrix_write_seg_descriptor_2386(uint32_t addr, x86seg *seg);
|
||||
extern void cyrix_load_seg_descriptor_2386(uint32_t addr, x86seg *seg);
|
||||
|
||||
extern void cyrix_write_seg_descriptor(uint32_t addr, x86seg *seg);
|
||||
extern void cyrix_load_seg_descriptor(uint32_t addr, x86seg *seg);
|
||||
|
||||
#endif /*EMU_X86SEG_H*/
|
||||
|
||||
22
src/cpu/x86seg_2386.c
Normal file
22
src/cpu/x86seg_2386.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* x86 CPU segment emulation for the 286/386 interpreter.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2008-2018 Sarah Walker.
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*/
|
||||
#ifndef OPS_286_386
|
||||
# define OPS_286_386
|
||||
#endif
|
||||
#include "x86seg.c"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user