7 |
|
* Gwenole Beauchesne |
8 |
|
* |
9 |
|
* Basilisk II (C) 1997-2002 Christian Bauer |
10 |
+ |
* |
11 |
+ |
* Portions related to CPU detection come from linux/arch/i386/kernel/setup.c |
12 |
|
* |
13 |
|
* This program is free software; you can redistribute it and/or modify |
14 |
|
* it under the terms of the GNU General Public License as published by |
2057 |
|
emit_byte(0x90); |
2058 |
|
} |
2059 |
|
|
2060 |
+ |
static __inline__ void raw_emit_nop_filler(int nbytes) |
2061 |
+ |
{ |
2062 |
+ |
/* Source: GNU Binutils 2.12.90.0.15 */ |
2063 |
+ |
/* Various efficient no-op patterns for aligning code labels. |
2064 |
+ |
Note: Don't try to assemble the instructions in the comments. |
2065 |
+ |
0L and 0w are not legal. */ |
2066 |
+ |
static const uae_u8 f32_1[] = |
2067 |
+ |
{0x90}; /* nop */ |
2068 |
+ |
static const uae_u8 f32_2[] = |
2069 |
+ |
{0x89,0xf6}; /* movl %esi,%esi */ |
2070 |
+ |
static const uae_u8 f32_3[] = |
2071 |
+ |
{0x8d,0x76,0x00}; /* leal 0(%esi),%esi */ |
2072 |
+ |
static const uae_u8 f32_4[] = |
2073 |
+ |
{0x8d,0x74,0x26,0x00}; /* leal 0(%esi,1),%esi */ |
2074 |
+ |
static const uae_u8 f32_5[] = |
2075 |
+ |
{0x90, /* nop */ |
2076 |
+ |
0x8d,0x74,0x26,0x00}; /* leal 0(%esi,1),%esi */ |
2077 |
+ |
static const uae_u8 f32_6[] = |
2078 |
+ |
{0x8d,0xb6,0x00,0x00,0x00,0x00}; /* leal 0L(%esi),%esi */ |
2079 |
+ |
static const uae_u8 f32_7[] = |
2080 |
+ |
{0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; /* leal 0L(%esi,1),%esi */ |
2081 |
+ |
static const uae_u8 f32_8[] = |
2082 |
+ |
{0x90, /* nop */ |
2083 |
+ |
0x8d,0xb4,0x26,0x00,0x00,0x00,0x00}; /* leal 0L(%esi,1),%esi */ |
2084 |
+ |
static const uae_u8 f32_9[] = |
2085 |
+ |
{0x89,0xf6, /* movl %esi,%esi */ |
2086 |
+ |
0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ |
2087 |
+ |
static const uae_u8 f32_10[] = |
2088 |
+ |
{0x8d,0x76,0x00, /* leal 0(%esi),%esi */ |
2089 |
+ |
0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ |
2090 |
+ |
static const uae_u8 f32_11[] = |
2091 |
+ |
{0x8d,0x74,0x26,0x00, /* leal 0(%esi,1),%esi */ |
2092 |
+ |
0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ |
2093 |
+ |
static const uae_u8 f32_12[] = |
2094 |
+ |
{0x8d,0xb6,0x00,0x00,0x00,0x00, /* leal 0L(%esi),%esi */ |
2095 |
+ |
0x8d,0xbf,0x00,0x00,0x00,0x00}; /* leal 0L(%edi),%edi */ |
2096 |
+ |
static const uae_u8 f32_13[] = |
2097 |
+ |
{0x8d,0xb6,0x00,0x00,0x00,0x00, /* leal 0L(%esi),%esi */ |
2098 |
+ |
0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ |
2099 |
+ |
static const uae_u8 f32_14[] = |
2100 |
+ |
{0x8d,0xb4,0x26,0x00,0x00,0x00,0x00, /* leal 0L(%esi,1),%esi */ |
2101 |
+ |
0x8d,0xbc,0x27,0x00,0x00,0x00,0x00}; /* leal 0L(%edi,1),%edi */ |
2102 |
+ |
static const uae_u8 f32_15[] = |
2103 |
+ |
{0xeb,0x0d,0x90,0x90,0x90,0x90,0x90, /* jmp .+15; lotsa nops */ |
2104 |
+ |
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90}; |
2105 |
+ |
static const uae_u8 f32_16[] = |
2106 |
+ |
{0xeb,0x0d,0x90,0x90,0x90,0x90,0x90, /* jmp .+15; lotsa nops */ |
2107 |
+ |
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90}; |
2108 |
+ |
static const uae_u8 *const f32_patt[] = { |
2109 |
+ |
f32_1, f32_2, f32_3, f32_4, f32_5, f32_6, f32_7, f32_8, |
2110 |
+ |
f32_9, f32_10, f32_11, f32_12, f32_13, f32_14, f32_15 |
2111 |
+ |
}; |
2112 |
+ |
|
2113 |
+ |
int nloops = nbytes / 16; |
2114 |
+ |
while (nloops-- > 0) |
2115 |
+ |
emit_block(f32_16, sizeof(f32_16)); |
2116 |
+ |
|
2117 |
+ |
nbytes %= 16; |
2118 |
+ |
if (nbytes) |
2119 |
+ |
emit_block(f32_patt[nbytes - 1], nbytes); |
2120 |
+ |
} |
2121 |
+ |
|
2122 |
|
|
2123 |
|
/************************************************************************* |
2124 |
|
* Flag handling, to and fro UAE flag register * |