53 |
next = now + muldiv64(compare - tmp, ticks_per_sec, 100 * 1000 * 1000); |
next = now + muldiv64(compare - tmp, ticks_per_sec, 100 * 1000 * 1000); |
54 |
if (next == now) |
if (next == now) |
55 |
next++; |
next++; |
56 |
#if 1 |
#if 0 |
57 |
if (logfile) { |
if (logfile) { |
58 |
fprintf(logfile, "%s: 0x%08llx %08x %08x => 0x%08llx\n", |
fprintf(logfile, "%s: 0x%08llx %08x %08x => 0x%08llx\n", |
59 |
__func__, now, count, compare, next - now); |
__func__, now, count, compare, next - now); |
84 |
CPUState *env; |
CPUState *env; |
85 |
|
|
86 |
env = opaque; |
env = opaque; |
87 |
#if 1 |
#if 0 |
88 |
if (logfile) { |
if (logfile) { |
89 |
fprintf(logfile, "%s\n", __func__); |
fprintf(logfile, "%s\n", __func__); |
90 |
} |
} |
103 |
|
|
104 |
static void io_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) |
static void io_writeb (void *opaque, target_phys_addr_t addr, uint32_t value) |
105 |
{ |
{ |
106 |
|
#if 0 |
107 |
if (logfile) |
if (logfile) |
108 |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, value); |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, value); |
109 |
|
#endif |
110 |
cpu_outb(NULL, addr & 0xffff, value); |
cpu_outb(NULL, addr & 0xffff, value); |
111 |
} |
} |
112 |
|
|
113 |
static uint32_t io_readb (void *opaque, target_phys_addr_t addr) |
static uint32_t io_readb (void *opaque, target_phys_addr_t addr) |
114 |
{ |
{ |
115 |
uint32_t ret = cpu_inb(NULL, addr & 0xffff); |
uint32_t ret = cpu_inb(NULL, addr & 0xffff); |
116 |
|
#if 0 |
117 |
if (logfile) |
if (logfile) |
118 |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, ret); |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, ret); |
119 |
|
#endif |
120 |
return ret; |
return ret; |
121 |
} |
} |
122 |
|
|
123 |
static void io_writew (void *opaque, target_phys_addr_t addr, uint32_t value) |
static void io_writew (void *opaque, target_phys_addr_t addr, uint32_t value) |
124 |
{ |
{ |
125 |
|
#if 0 |
126 |
if (logfile) |
if (logfile) |
127 |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, value); |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, value); |
128 |
|
#endif |
129 |
#ifdef TARGET_WORDS_BIGENDIAN |
#ifdef TARGET_WORDS_BIGENDIAN |
130 |
value = bswap16(value); |
value = bswap16(value); |
131 |
#endif |
#endif |
138 |
#ifdef TARGET_WORDS_BIGENDIAN |
#ifdef TARGET_WORDS_BIGENDIAN |
139 |
ret = bswap16(ret); |
ret = bswap16(ret); |
140 |
#endif |
#endif |
141 |
|
#if 0 |
142 |
if (logfile) |
if (logfile) |
143 |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, ret); |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, ret); |
144 |
|
#endif |
145 |
return ret; |
return ret; |
146 |
} |
} |
147 |
|
|
148 |
static void io_writel (void *opaque, target_phys_addr_t addr, uint32_t value) |
static void io_writel (void *opaque, target_phys_addr_t addr, uint32_t value) |
149 |
{ |
{ |
150 |
|
#if 0 |
151 |
if (logfile) |
if (logfile) |
152 |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, value); |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, value); |
153 |
|
#endif |
154 |
#ifdef TARGET_WORDS_BIGENDIAN |
#ifdef TARGET_WORDS_BIGENDIAN |
155 |
value = bswap32(value); |
value = bswap32(value); |
156 |
#endif |
#endif |
164 |
#ifdef TARGET_WORDS_BIGENDIAN |
#ifdef TARGET_WORDS_BIGENDIAN |
165 |
ret = bswap32(ret); |
ret = bswap32(ret); |
166 |
#endif |
#endif |
167 |
|
#if 0 |
168 |
if (logfile) |
if (logfile) |
169 |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, ret); |
fprintf(logfile, "%s: addr %08x val %08x\n", __func__, addr, ret); |
170 |
|
#endif |
171 |
return ret; |
return ret; |
172 |
} |
} |
173 |
|
|
245 |
initrd_size = 0; |
initrd_size = 0; |
246 |
} |
} |
247 |
env->PC = KERNEL_LOAD_ADDR; |
env->PC = KERNEL_LOAD_ADDR; |
248 |
|
/* Store command line. */ |
249 |
|
strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline); |
250 |
|
/* FIXME: little endian support */ |
251 |
|
*(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678); |
252 |
|
*(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size); |
253 |
} else { |
} else { |
254 |
kernel_base = 0; |
kernel_base = 0; |
255 |
kernel_size = 0; |
kernel_size = 0; |