Commit 4f2ac237840677ffcb1b3ca30d04a4c2d360f7c7

Authored by bellard
1 parent f658b4db

amd64 port (Jocelyn Mayer)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@762 c046a42c-6fe2-441c-8c8c-71466251a162
amd64.ld
@@ -169,174 +169,3 @@ SECTIONS @@ -169,174 +169,3 @@ SECTIONS
169 .debug_typenames 0 : { *(.debug_typenames) } 169 .debug_typenames 0 : { *(.debug_typenames) }
170 .debug_varnames 0 : { *(.debug_varnames) } 170 .debug_varnames 0 : { *(.debug_varnames) }
171 } 171 }
172 -/* Default linker script, for normal executables */  
173 -OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")  
174 -OUTPUT_ARCH(i386:x86-64)  
175 -ENTRY(_start)  
176 -SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");  
177 -SECTIONS  
178 -{  
179 - /* Read-only sections, merged into text segment: */  
180 - . = 0x60000000 + SIZEOF_HEADERS;  
181 - .interp : { *(.interp) }  
182 - .hash : { *(.hash) }  
183 - .dynsym : { *(.dynsym) }  
184 - .dynstr : { *(.dynstr) }  
185 - .gnu.version : { *(.gnu.version) }  
186 - .gnu.version_d : { *(.gnu.version_d) }  
187 - .gnu.version_r : { *(.gnu.version_r) }  
188 - .rel.init : { *(.rel.init) }  
189 - .rela.init : { *(.rela.init) }  
190 - .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }  
191 - .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }  
192 - .rel.fini : { *(.rel.fini) }  
193 - .rela.fini : { *(.rela.fini) }  
194 - .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }  
195 - .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }  
196 - .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }  
197 - .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }  
198 - .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }  
199 - .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }  
200 - .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }  
201 - .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }  
202 - .rel.ctors : { *(.rel.ctors) }  
203 - .rela.ctors : { *(.rela.ctors) }  
204 - .rel.dtors : { *(.rel.dtors) }  
205 - .rela.dtors : { *(.rela.dtors) }  
206 - .rel.got : { *(.rel.got) }  
207 - .rela.got : { *(.rela.got) }  
208 - .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }  
209 - .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }  
210 - .rel.plt : { *(.rel.plt) }  
211 - .rela.plt : { *(.rela.plt) }  
212 - .init :  
213 - {  
214 - KEEP (*(.init))  
215 - } =0x90909090  
216 - .plt : { *(.plt) }  
217 - .text :  
218 - {  
219 - *(.text .stub .text.* .gnu.linkonce.t.*)  
220 - /* .gnu.warning sections are handled specially by elf32.em. */  
221 - *(.gnu.warning)  
222 - } =0x90909090  
223 - .fini :  
224 - {  
225 - KEEP (*(.fini))  
226 - } =0x90909090  
227 - PROVIDE (__etext = .);  
228 - PROVIDE (_etext = .);  
229 - PROVIDE (etext = .);  
230 - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }  
231 - .rodata1 : { *(.rodata1) }  
232 - .eh_frame_hdr : { *(.eh_frame_hdr) }  
233 - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }  
234 - .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) }  
235 - /* Adjust the address for the data segment. We want to adjust up to  
236 - the same address within the page on the next page up. */  
237 - . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);  
238 - /* Ensure the __preinit_array_start label is properly aligned. We  
239 - could instead move the label definition inside the section, but  
240 - the linker would then create the section even if it turns out to  
241 - be empty, which isn't pretty. */  
242 - . = ALIGN(64 / 8);  
243 - PROVIDE (__preinit_array_start = .);  
244 - .preinit_array : { *(.preinit_array) }  
245 - PROVIDE (__preinit_array_end = .);  
246 - PROVIDE (__init_array_start = .);  
247 - .init_array : { *(.init_array) }  
248 - PROVIDE (__init_array_end = .);  
249 - PROVIDE (__fini_array_start = .);  
250 - .fini_array : { *(.fini_array) }  
251 - PROVIDE (__fini_array_end = .);  
252 - .data :  
253 - {  
254 - *(.data .data.* .gnu.linkonce.d.*)  
255 - SORT(CONSTRUCTORS)  
256 - }  
257 - .data1 : { *(.data1) }  
258 - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }  
259 - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }  
260 - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }  
261 - .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) }  
262 - .dynamic : { *(.dynamic) }  
263 - .ctors :  
264 - {  
265 - /* gcc uses crtbegin.o to find the start of  
266 - the constructors, so we make sure it is  
267 - first. Because this is a wildcard, it  
268 - doesn't matter if the user does not  
269 - actually link against crtbegin.o; the  
270 - linker won't look for a file to match a  
271 - wildcard. The wildcard also means that it  
272 - doesn't matter which directory crtbegin.o  
273 - is in. */  
274 - KEEP (*crtbegin.o(.ctors))  
275 - /* We don't want to include the .ctor section from  
276 - from the crtend.o file until after the sorted ctors.  
277 - The .ctor section from the crtend file contains the  
278 - end of ctors marker and it must be last */  
279 - KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))  
280 - KEEP (*(SORT(.ctors.*)))  
281 - KEEP (*(.ctors))  
282 - }  
283 - .dtors :  
284 - {  
285 - KEEP (*crtbegin.o(.dtors))  
286 - KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))  
287 - KEEP (*(SORT(.dtors.*)))  
288 - KEEP (*(.dtors))  
289 - }  
290 - .jcr : { KEEP (*(.jcr)) }  
291 - .got : { *(.got.plt) *(.got) }  
292 - _edata = .;  
293 - PROVIDE (edata = .);  
294 - __bss_start = .;  
295 - .bss :  
296 - {  
297 - *(.dynbss)  
298 - *(.bss .bss.* .gnu.linkonce.b.*)  
299 - *(COMMON)  
300 - /* Align here to ensure that the .bss section occupies space up to  
301 - _end. Align after .bss to ensure correct alignment even if the  
302 - .bss section disappears because there are no input sections. */  
303 - . = ALIGN(64 / 8);  
304 - }  
305 - . = ALIGN(64 / 8);  
306 - _end = .;  
307 - PROVIDE (end = .);  
308 - . = DATA_SEGMENT_END (.);  
309 - /* Stabs debugging sections. */  
310 - .stab 0 : { *(.stab) }  
311 - .stabstr 0 : { *(.stabstr) }  
312 - .stab.excl 0 : { *(.stab.excl) }  
313 - .stab.exclstr 0 : { *(.stab.exclstr) }  
314 - .stab.index 0 : { *(.stab.index) }  
315 - .stab.indexstr 0 : { *(.stab.indexstr) }  
316 - .comment 0 : { *(.comment) }  
317 - /* DWARF debug sections.  
318 - Symbols in the DWARF debugging sections are relative to the beginning  
319 - of the section so we begin them at 0. */  
320 - /* DWARF 1 */  
321 - .debug 0 : { *(.debug) }  
322 - .line 0 : { *(.line) }  
323 - /* GNU DWARF 1 extensions */  
324 - .debug_srcinfo 0 : { *(.debug_srcinfo) }  
325 - .debug_sfnames 0 : { *(.debug_sfnames) }  
326 - /* DWARF 1.1 and DWARF 2 */  
327 - .debug_aranges 0 : { *(.debug_aranges) }  
328 - .debug_pubnames 0 : { *(.debug_pubnames) }  
329 - /* DWARF 2 */  
330 - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }  
331 - .debug_abbrev 0 : { *(.debug_abbrev) }  
332 - .debug_line 0 : { *(.debug_line) }  
333 - .debug_frame 0 : { *(.debug_frame) }  
334 - .debug_str 0 : { *(.debug_str) }  
335 - .debug_loc 0 : { *(.debug_loc) }  
336 - .debug_macinfo 0 : { *(.debug_macinfo) }  
337 - /* SGI/MIPS DWARF 2 extensions */  
338 - .debug_weaknames 0 : { *(.debug_weaknames) }  
339 - .debug_funcnames 0 : { *(.debug_funcnames) }  
340 - .debug_typenames 0 : { *(.debug_typenames) }  
341 - .debug_varnames 0 : { *(.debug_varnames) }  
342 -}  
cpu-all.h
@@ -335,7 +335,7 @@ static inline int ldsw_raw(void *ptr) @@ -335,7 +335,7 @@ static inline int ldsw_raw(void *ptr)
335 335
336 static inline int ldl_raw(void *ptr) 336 static inline int ldl_raw(void *ptr)
337 { 337 {
338 -#if defined(__i386__) 338 +#if defined(__i386__) || defined(__x86_64__)
339 int val; 339 int val;
340 asm volatile ("movl %1, %0\n" 340 asm volatile ("movl %1, %0\n"
341 "bswap %0\n" 341 "bswap %0\n"
@@ -372,7 +372,7 @@ static inline void stw_raw(void *ptr, int v) @@ -372,7 +372,7 @@ static inline void stw_raw(void *ptr, int v)
372 372
373 static inline void stl_raw(void *ptr, int v) 373 static inline void stl_raw(void *ptr, int v)
374 { 374 {
375 -#if defined(__i386__) 375 +#if defined(__i386__) || defined(__x86_64__)
376 asm volatile ("bswap %0\n" 376 asm volatile ("bswap %0\n"
377 "movl %0, %1\n" 377 "movl %0, %1\n"
378 : "=r" (v) 378 : "=r" (v)
cpu-defs.h
@@ -29,8 +29,18 @@ @@ -29,8 +29,18 @@
29 #error TARGET_LONG_BITS must be defined before including this header 29 #error TARGET_LONG_BITS must be defined before including this header
30 #endif 30 #endif
31 31
  32 +#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
  33 +#define HOST_LONG_BITS 64
  34 +#else
  35 +#define HOST_LONG_BITS 32
  36 +#endif
  37 +
32 #ifndef TARGET_PHYS_ADDR_BITS 38 #ifndef TARGET_PHYS_ADDR_BITS
  39 +#if TARGET_LONG_BITS >= HOST_LONG_BITS
33 #define TARGET_PHYS_ADDR_BITS TARGET_LONG_BITS 40 #define TARGET_PHYS_ADDR_BITS TARGET_LONG_BITS
  41 +#else
  42 +#define TARGET_PHYS_ADDR_BITS HOST_LONG_BITS
  43 +#endif
34 #endif 44 #endif
35 45
36 #define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8) 46 #define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8)
@@ -47,7 +57,11 @@ typedef uint64_t target_ulong; @@ -47,7 +57,11 @@ typedef uint64_t target_ulong;
47 #endif 57 #endif
48 58
49 /* target_phys_addr_t is the type of a physical address (its size can 59 /* target_phys_addr_t is the type of a physical address (its size can
50 - be different from 'target_ulong') */ 60 + be different from 'target_ulong'). We have sizeof(target_phys_addr)
  61 + = max(sizeof(unsigned long),
  62 + sizeof(size_of_target_physical_address)) because we must pass a
  63 + host pointer to memory operations in some cases */
  64 +
51 #if TARGET_PHYS_ADDR_BITS == 32 65 #if TARGET_PHYS_ADDR_BITS == 32
52 typedef uint32_t target_phys_addr_t; 66 typedef uint32_t target_phys_addr_t;
53 #elif TARGET_PHYS_ADDR_BITS == 64 67 #elif TARGET_PHYS_ADDR_BITS == 64
@@ -56,12 +70,6 @@ typedef uint64_t target_phys_addr_t; @@ -56,12 +70,6 @@ typedef uint64_t target_phys_addr_t;
56 #error TARGET_PHYS_ADDR_BITS undefined 70 #error TARGET_PHYS_ADDR_BITS undefined
57 #endif 71 #endif
58 72
59 -#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)  
60 -#define HOST_LONG_BITS 64  
61 -#else  
62 -#define HOST_LONG_BITS 32  
63 -#endif  
64 -  
65 #define HOST_LONG_SIZE (HOST_LONG_BITS / 8) 73 #define HOST_LONG_SIZE (HOST_LONG_BITS / 8)
66 74
67 #define EXCP_INTERRUPT 256 /* async interruption */ 75 #define EXCP_INTERRUPT 256 /* async interruption */
@@ -79,9 +87,9 @@ typedef struct CPUTLBEntry { @@ -79,9 +87,9 @@ typedef struct CPUTLBEntry {
79 bit 3 : indicates that the entry is invalid 87 bit 3 : indicates that the entry is invalid
80 bit 2..0 : zero 88 bit 2..0 : zero
81 */ 89 */
82 - uint32_t address; 90 + target_ulong address;
83 /* addend to virtual address to get physical address */ 91 /* addend to virtual address to get physical address */
84 - uint32_t addend; 92 + target_phys_addr_t addend;
85 } CPUTLBEntry; 93 } CPUTLBEntry;
86 94
87 #endif 95 #endif
dyngen-exec.h
@@ -25,12 +25,21 @@ @@ -25,12 +25,21 @@
25 typedef unsigned char uint8_t; 25 typedef unsigned char uint8_t;
26 typedef unsigned short uint16_t; 26 typedef unsigned short uint16_t;
27 typedef unsigned int uint32_t; 27 typedef unsigned int uint32_t;
  28 +/* XXX may be done for all 64 bits targets ? */
  29 +#if defined (__x86_64__)
  30 +typedef unsigned long uint64_t;
  31 +#else
28 typedef unsigned long long uint64_t; 32 typedef unsigned long long uint64_t;
  33 +#endif
29 34
30 typedef signed char int8_t; 35 typedef signed char int8_t;
31 typedef signed short int16_t; 36 typedef signed short int16_t;
32 typedef signed int int32_t; 37 typedef signed int int32_t;
  38 +#if defined (__x86_64__)
  39 +typedef signed long int64_t;
  40 +#else
33 typedef signed long long int64_t; 41 typedef signed long long int64_t;
  42 +#endif
34 43
35 #define INT8_MIN (-128) 44 #define INT8_MIN (-128)
36 #define INT16_MIN (-32767-1) 45 #define INT16_MIN (-32767-1)
@@ -167,8 +167,8 @@ static inline PageDesc *page_find(unsigned int index) @@ -167,8 +167,8 @@ static inline PageDesc *page_find(unsigned int index)
167 } 167 }
168 168
169 #if !defined(CONFIG_USER_ONLY) 169 #if !defined(CONFIG_USER_ONLY)
170 -static void tlb_protect_code(CPUState *env, uint32_t addr);  
171 -static void tlb_unprotect_code_phys(CPUState *env, uint32_t phys_addr, target_ulong vaddr); 170 +static void tlb_protect_code(CPUState *env, target_ulong addr);
  171 +static void tlb_unprotect_code_phys(CPUState *env, unsigned long phys_addr, target_ulong vaddr);
172 172
173 static inline VirtPageDesc *virt_page_find_alloc(unsigned int index) 173 static inline VirtPageDesc *virt_page_find_alloc(unsigned int index)
174 { 174 {
@@ -1270,7 +1270,7 @@ void tlb_flush_page(CPUState *env, target_ulong addr) @@ -1270,7 +1270,7 @@ void tlb_flush_page(CPUState *env, target_ulong addr)
1270 #endif 1270 #endif
1271 } 1271 }
1272 1272
1273 -static inline void tlb_protect_code1(CPUTLBEntry *tlb_entry, uint32_t addr) 1273 +static inline void tlb_protect_code1(CPUTLBEntry *tlb_entry, target_ulong addr)
1274 { 1274 {
1275 if (addr == (tlb_entry->address & 1275 if (addr == (tlb_entry->address &
1276 (TARGET_PAGE_MASK | TLB_INVALID_MASK)) && 1276 (TARGET_PAGE_MASK | TLB_INVALID_MASK)) &&
@@ -1282,7 +1282,7 @@ static inline void tlb_protect_code1(CPUTLBEntry *tlb_entry, uint32_t addr) @@ -1282,7 +1282,7 @@ static inline void tlb_protect_code1(CPUTLBEntry *tlb_entry, uint32_t addr)
1282 1282
1283 /* update the TLBs so that writes to code in the virtual page 'addr' 1283 /* update the TLBs so that writes to code in the virtual page 'addr'
1284 can be detected */ 1284 can be detected */
1285 -static void tlb_protect_code(CPUState *env, uint32_t addr) 1285 +static void tlb_protect_code(CPUState *env, target_ulong addr)
1286 { 1286 {
1287 int i; 1287 int i;
1288 1288
@@ -1299,7 +1299,7 @@ static void tlb_protect_code(CPUState *env, uint32_t addr) @@ -1299,7 +1299,7 @@ static void tlb_protect_code(CPUState *env, uint32_t addr)
1299 } 1299 }
1300 1300
1301 static inline void tlb_unprotect_code2(CPUTLBEntry *tlb_entry, 1301 static inline void tlb_unprotect_code2(CPUTLBEntry *tlb_entry,
1302 - uint32_t phys_addr) 1302 + unsigned long phys_addr)
1303 { 1303 {
1304 if ((tlb_entry->address & ~TARGET_PAGE_MASK) == IO_MEM_CODE && 1304 if ((tlb_entry->address & ~TARGET_PAGE_MASK) == IO_MEM_CODE &&
1305 ((tlb_entry->address & TARGET_PAGE_MASK) + tlb_entry->addend) == phys_addr) { 1305 ((tlb_entry->address & TARGET_PAGE_MASK) + tlb_entry->addend) == phys_addr) {
@@ -1309,7 +1309,7 @@ static inline void tlb_unprotect_code2(CPUTLBEntry *tlb_entry, @@ -1309,7 +1309,7 @@ static inline void tlb_unprotect_code2(CPUTLBEntry *tlb_entry,
1309 1309
1310 /* update the TLB so that writes in physical page 'phys_addr' are no longer 1310 /* update the TLB so that writes in physical page 'phys_addr' are no longer
1311 tested self modifying code */ 1311 tested self modifying code */
1312 -static void tlb_unprotect_code_phys(CPUState *env, uint32_t phys_addr, target_ulong vaddr) 1312 +static void tlb_unprotect_code_phys(CPUState *env, unsigned long phys_addr, target_ulong vaddr)
1313 { 1313 {
1314 int i; 1314 int i;
1315 1315
@@ -1335,7 +1335,7 @@ static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, @@ -1335,7 +1335,7 @@ static inline void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry,
1335 void cpu_physical_memory_reset_dirty(target_ulong start, target_ulong end) 1335 void cpu_physical_memory_reset_dirty(target_ulong start, target_ulong end)
1336 { 1336 {
1337 CPUState *env; 1337 CPUState *env;
1338 - target_ulong length, start1; 1338 + unsigned long length, start1;
1339 int i; 1339 int i;
1340 1340
1341 start &= TARGET_PAGE_MASK; 1341 start &= TARGET_PAGE_MASK;
@@ -1420,10 +1420,11 @@ int tlb_set_page(CPUState *env, target_ulong vaddr, @@ -1420,10 +1420,11 @@ int tlb_set_page(CPUState *env, target_ulong vaddr,
1420 int is_user, int is_softmmu) 1420 int is_user, int is_softmmu)
1421 { 1421 {
1422 PageDesc *p; 1422 PageDesc *p;
1423 - target_ulong pd; 1423 + unsigned long pd;
1424 TranslationBlock *first_tb; 1424 TranslationBlock *first_tb;
1425 unsigned int index; 1425 unsigned int index;
1426 - target_ulong address, addend; 1426 + target_ulong address;
  1427 + unsigned long addend;
1427 int ret; 1428 int ret;
1428 1429
1429 p = page_find(paddr >> TARGET_PAGE_BITS); 1430 p = page_find(paddr >> TARGET_PAGE_BITS);
@@ -1825,19 +1826,19 @@ static CPUWriteMemoryFunc *code_mem_write[3] = { @@ -1825,19 +1826,19 @@ static CPUWriteMemoryFunc *code_mem_write[3] = {
1825 code_mem_writel, 1826 code_mem_writel,
1826 }; 1827 };
1827 1828
1828 -static void notdirty_mem_writeb(uint32_t addr, uint32_t val) 1829 +static void notdirty_mem_writeb(target_phys_addr_t addr, uint32_t val)
1829 { 1830 {
1830 stb_raw((uint8_t *)addr, val); 1831 stb_raw((uint8_t *)addr, val);
1831 tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr); 1832 tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
1832 } 1833 }
1833 1834
1834 -static void notdirty_mem_writew(uint32_t addr, uint32_t val) 1835 +static void notdirty_mem_writew(target_phys_addr_t addr, uint32_t val)
1835 { 1836 {
1836 stw_raw((uint8_t *)addr, val); 1837 stw_raw((uint8_t *)addr, val);
1837 tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr); 1838 tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
1838 } 1839 }
1839 1840
1840 -static void notdirty_mem_writel(uint32_t addr, uint32_t val) 1841 +static void notdirty_mem_writel(target_phys_addr_t addr, uint32_t val)
1841 { 1842 {
1842 stl_raw((uint8_t *)addr, val); 1843 stl_raw((uint8_t *)addr, val);
1843 tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr); 1844 tlb_set_dirty(addr, cpu_single_env->mem_write_vaddr);
hw/vga.c
@@ -92,7 +92,7 @@ typedef struct VGAState { @@ -92,7 +92,7 @@ typedef struct VGAState {
92 uint8_t dac_write_index; 92 uint8_t dac_write_index;
93 uint8_t dac_cache[3]; /* used when writing */ 93 uint8_t dac_cache[3]; /* used when writing */
94 uint8_t palette[768]; 94 uint8_t palette[768];
95 - uint32_t bank_offset; 95 + int32_t bank_offset;
96 #ifdef CONFIG_BOCHS_VBE 96 #ifdef CONFIG_BOCHS_VBE
97 uint16_t vbe_index; 97 uint16_t vbe_index;
98 uint16_t vbe_regs[VBE_DISPI_INDEX_NB]; 98 uint16_t vbe_regs[VBE_DISPI_INDEX_NB];
linux-user/mmap.c
@@ -152,6 +152,9 @@ long target_mmap(unsigned long start, unsigned long len, int prot, @@ -152,6 +152,9 @@ long target_mmap(unsigned long start, unsigned long len, int prot,
152 int flags, int fd, unsigned long offset) 152 int flags, int fd, unsigned long offset)
153 { 153 {
154 unsigned long ret, end, host_start, host_end, retaddr, host_offset, host_len; 154 unsigned long ret, end, host_start, host_end, retaddr, host_offset, host_len;
  155 +#if defined(__alpha__) || defined(__sparc__) || defined(__x86_64__)
  156 + static unsigned long last_start = 0x40000000;
  157 +#endif
155 158
156 #ifdef DEBUG_MMAP 159 #ifdef DEBUG_MMAP
157 { 160 {
@@ -190,8 +193,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot, @@ -190,8 +193,10 @@ long target_mmap(unsigned long start, unsigned long len, int prot,
190 if (!(flags & MAP_FIXED)) { 193 if (!(flags & MAP_FIXED)) {
191 #if defined(__alpha__) || defined(__sparc__) || defined(__x86_64__) 194 #if defined(__alpha__) || defined(__sparc__) || defined(__x86_64__)
192 /* tell the kenel to search at the same place as i386 */ 195 /* tell the kenel to search at the same place as i386 */
193 - if (host_start == 0)  
194 - host_start = 0x40000000; 196 + if (host_start == 0) {
  197 + host_start = last_start;
  198 + last_start += HOST_PAGE_ALIGN(len);
  199 + }
195 #endif 200 #endif
196 if (host_page_size != real_host_page_size) { 201 if (host_page_size != real_host_page_size) {
197 /* NOTE: this code is only for debugging with '-p' option */ 202 /* NOTE: this code is only for debugging with '-p' option */
linux-user/syscall.c
@@ -2402,9 +2402,14 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, @@ -2402,9 +2402,14 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
2402 goto unimplemented; 2402 goto unimplemented;
2403 case TARGET_NR__llseek: 2403 case TARGET_NR__llseek:
2404 { 2404 {
  2405 +#if defined (__x86_64__)
  2406 + ret = get_errno(lseek(arg1, ((uint64_t )arg2 << 32) | arg3, arg5));
  2407 + *(int64_t *)arg4 = ret;
  2408 +#else
2405 int64_t res; 2409 int64_t res;
2406 ret = get_errno(_llseek(arg1, arg2, arg3, &res, arg5)); 2410 ret = get_errno(_llseek(arg1, arg2, arg3, &res, arg5));
2407 *(int64_t *)arg4 = tswap64(res); 2411 *(int64_t *)arg4 = tswap64(res);
  2412 +#endif
2408 } 2413 }
2409 break; 2414 break;
2410 case TARGET_NR_getdents: 2415 case TARGET_NR_getdents:
translate-all.c
@@ -194,7 +194,7 @@ int cpu_restore_state(TranslationBlock *tb, @@ -194,7 +194,7 @@ int cpu_restore_state(TranslationBlock *tb,
194 fprintf(logfile, "0x%04x: 0x%08x\n", i, gen_opc_pc[i]); 194 fprintf(logfile, "0x%04x: 0x%08x\n", i, gen_opc_pc[i]);
195 } 195 }
196 } 196 }
197 - fprintf(logfile, "spc=0x%08lx j=0x%x eip=0x%lx cs_base=%lx\n", 197 + fprintf(logfile, "spc=0x%08lx j=0x%x eip=0x%x cs_base=%x\n",
198 searched_pc, j, gen_opc_pc[j] - tb->cs_base, tb->cs_base); 198 searched_pc, j, gen_opc_pc[j] - tb->cs_base, tb->cs_base);
199 } 199 }
200 #endif 200 #endif