[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Darwin/Mac OS X Port

From: Daniel J . Guinan
Subject: Re: [Qemu-devel] Darwin/Mac OS X Port
Date: Thu, 19 Feb 2004 14:45:46 -0600

I have been looking and tinkering with your OS X port and was not able to get any translation working until I fudged with a couple of things. The most important of those is in vl.c -> search for valloc() -> you will see an attempt to allocate *page_size x all memory* change it to *all memory* and you will be on your way. Here is a log from my changes:

COMMAND LINE: qemu -d -L ../pc-bios -nographic --kernel bzImage --append "console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe" linux.img

Load kernel at 0x2908000 (0x00100000)
Setup sectors=6
Reading : 512
Reading : 512
Reading : 512
Reading : 512
Reading : 512
Reading : 512
Opened kernel, size=747983
calling gen_func 0x2071f0
entering gen_func 0x2071f0
returning gen_func 0x2071f0
pic_set_irq: irq=0 level=1
pic0: imr=0 irr=1 padd=0
pic1: imr=0 irr=0 padd=0
pic: cpu_interrupt req=0
pic_set_irq: irq=0 level=0
pic0: imr=0 irr=1 padd=0
pic1: imr=0 irr=0 padd=0
pic: cpu_interrupt req=0
calling gen_func 0x207230
entering gen_func 0x207230
Illegal instruction


EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000600
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
EIP=0000fff0 EFL=00000002 [-------]    CPL=0 II=0
ES =0000 00000000 0000ffff 00000000
CS =f000 000f0000 0000ffff 00000000
SS =0000 00000000 0000ffff 00000000
DS =0000 00000000 0000ffff 00000000
FS =0000 00000000 0000ffff 00000000
GS =0000 00000000 0000ffff 00000000
LDT=0000 00000000 0000ffff 00008000
TR =0000 00000000 0000ffff 00008000
GDT=     00000000 0000ffff
IDT=     00000000 0000ffff
CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000
CCS=00000000 CCD=00000000 CCO=EFLAGS
0x000ffff0:  ljmp   0xf000,0xe05b

0x0000: movl_T0_im 0xf000
0x0001: movl_T1_im 0xe05b
0x0002: movl_seg_T0_vm 0xb0
0x0003: movl_T0_T1
0x0004: jmp_T0
0x0005: movl_T0_0
0x0006: exit_tb
0x0007: end

OUT: [size=60]
0x002071f0:  lis        r2,184
0x002071f4:  lwz        r24,-28096(r2)
0x002071f8:  lis        r2,184
0x002071fc:  lwz        r25,-28096(r2)
0x00207200:  lis        r2,184
0x00207204:  clrlwi     r0,r24,16
0x00207208:  lwz        r2,-28096(r2)
0x0020720c:  mr r9,r27
0x00207210:  stwux      r0,r9,r2
0x00207214:  rlwinm     r0,r0,4,0,27
0x00207218:  stw        r0,4(r9)
0x0020721c:  mr r24,r25
0x00207220:  stw        r24,32(r27)
0x00207224:  li r24,0
0x00207228:  blr

Trace 0x002071f0 [0x000ffff0]
EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000600
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
EIP=00000000 EFL=00000002 [-------]    CPL=0 II=0
ES =0000 00000000 0000ffff 00000000
CS =f000 000f0000 0000ffff 00000000
SS =0000 00000000 0000ffff 00000000
DS =0000 00000000 0000ffff 00000000
FS =0000 00000000 0000ffff 00000000
GS =0000 00000000 0000ffff 00000000
LDT=0000 00000000 0000ffff 00008000
TR =0000 00000000 0000ffff 00008000
GDT=     00000000 0000ffff
IDT=     00000000 0000ffff
CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000
CCS=00000000 CCD=00000000 CCO=EFLAGS
0x000f0000:  pushw  %bp
0x000f0001:  movw   %sp,%bp
0x000f0003:  pushw  %ax
0x000f0004:  pushw  %cx
0x000f0005:  pushw  %es
0x000f0006:  pushw  %di
0x000f0007:  movw   0xa(bp),%cx
0x000f000a:  cmpw   $0x0,%cx
0x000f000d:  je     0xf001f

0x0000: movl_T0_EBP
0x0001: movl_A0_ESP
0x0002: subl_A0_2
0x0003: andl_A0_ffff
0x0004: movl_T1_A0
0x0005: addl_A0_SS
0x0006: stw_kernel_T0_A0
0x0007: movw_ESP_T1
0x0008: movl_T0_ESP
0x0009: movw_EBP_T0
0x000a: movl_T0_EAX
0x000b: movl_A0_ESP
0x000c: subl_A0_2
0x000d: andl_A0_ffff
0x000e: movl_T1_A0
0x000f: addl_A0_SS
0x0010: stw_kernel_T0_A0
0x0011: movw_ESP_T1
0x0012: movl_T0_ECX
0x0013: movl_A0_ESP
0x0014: subl_A0_2
0x0015: andl_A0_ffff
0x0016: movl_T1_A0
0x0017: addl_A0_SS
0x0018: stw_kernel_T0_A0
0x0019: movw_ESP_T1
0x001a: movl_T0_seg 0x0
0x001b: movl_A0_ESP
0x001c: subl_A0_2
0x001d: andl_A0_ffff
0x001e: movl_T1_A0
0x001f: addl_A0_SS
0x0020: stw_kernel_T0_A0
0x0021: movw_ESP_T1
0x0022: movl_T0_EDI
0x0023: movl_A0_ESP
0x0024: subl_A0_2
0x0025: andl_A0_ffff
0x0026: movl_T1_A0
0x0027: addl_A0_SS
0x0028: stw_kernel_T0_A0
0x0029: movw_ESP_T1
0x002a: movl_A0_EBP
0x002b: addl_A0_im 0xa
0x002c: andl_A0_ffff
0x002d: addl_A0_seg 0xc4
0x002e: lduw_kernel_T0_A0
0x002f: movw_ECX_T0
0x0030: movl_T1_im 0x0
0x0031: movl_T0_ECX
0x0032: cmpl_T0_T1_cc
0x0033: set_cc_op 0xc
0x0034: jz_subw 0x849274 0x1f 0xf
0x0035: end

OUT: [size=840]
0x00207230:  mr r24,r18
0x00207234:  mr r26,r17
0x00207238:  addi       r26,r26,-2
0x0020723c:  clrlwi     r26,r26,16
0x00207240:  mr r25,r26
0x00207244:  lwz        r0,196(r27)
0x00207248:  add        r26,r26,r0
0x0020724c:  mflr       r0
0x00207250:  mr r3,r26
0x00207254:  stw        r0,8(r1)
0x00207258:  rlwinm     r0,r26,23,21,28
0x0020725c:  add        r9,r0,r27
0x00207260:  stwu       r1,-64(r1)
0x00207264:  lwz        r2,5288(r9)
0x00207268:  rlwinm     r0,r26,0,31,19
0x0020726c:  cmpw       cr7,r2,r0
0x00207270:  beq        cr7,00207284
0x00207274:  clrlwi     r4,r24,16
0x00207278:  li r5,0
0x0020727c:  bl 00045388
0x00207280:  b  00207290
0x00207284:  lwz        r2,5292(r9)
0x00207288:  add        r0,r26,r2
0x0020728c:  sthbrx     r24,r0,r0
0x00207290:  lwz        r0,72(r1)
0x00207294:  addi       r1,r1,64
0x00207298:  mtlr       r0
0x0020729c:  clrlwi     r0,r25,16
0x002072a0:  rlwimi     r17,r0,0,16,31
0x002072a4:  mr r24,r17
0x002072a8:  clrlwi     r0,r24,16
0x002072ac:  rlwimi     r18,r0,0,16,31
0x002072b0:  mr r24,r16
0x002072b4:  mr r26,r17
0x002072b8:  addi       r26,r26,-2
0x002072bc:  clrlwi     r26,r26,16
0x002072c0:  mr r25,r26
0x002072c4:  lwz        r0,196(r27)
0x002072c8:  add        r26,r26,r0
0x002072cc:  mflr       r0
0x002072d0:  mr r3,r26
0x002072d4:  stw        r0,8(r1)
0x002072d8:  rlwinm     r0,r26,23,21,28
0x002072dc:  add        r9,r0,r27
0x002072e0:  stwu       r1,-64(r1)
0x002072e4:  lwz        r2,5288(r9)
0x002072e8:  rlwinm     r0,r26,0,31,19
0x002072ec:  cmpw       cr7,r2,r0
0x002072f0:  beq        cr7,00207304
0x002072f4:  clrlwi     r4,r24,16
0x002072f8:  li r5,0
0x002072fc:  bl 00045388
0x00207300:  b  00207310
0x00207304:  lwz        r2,5292(r9)
0x00207308:  add        r0,r26,r2
0x0020730c:  sthbrx     r24,r0,r0
0x00207310:  lwz        r0,72(r1)
0x00207314:  addi       r1,r1,64
0x00207318:  mtlr       r0
0x0020731c:  clrlwi     r0,r25,16
0x00207320:  rlwimi     r17,r0,0,16,31
0x00207324:  mr r24,r19
0x00207328:  mr r26,r17
0x0020732c:  addi       r26,r26,-2
0x00207330:  clrlwi     r26,r26,16
0x00207334:  mr r25,r26
0x00207338:  lwz        r0,196(r27)
0x0020733c:  add        r26,r26,r0
0x00207340:  mflr       r0
0x00207344:  mr r3,r26
0x00207348:  stw        r0,8(r1)
0x0020734c:  rlwinm     r0,r26,23,21,28
0x00207350:  add        r9,r0,r27
0x00207354:  stwu       r1,-64(r1)
0x00207358:  lwz        r2,5288(r9)
0x0020735c:  rlwinm     r0,r26,0,31,19
0x00207360:  cmpw       cr7,r2,r0
0x00207364:  beq        cr7,00207378
0x00207368:  clrlwi     r4,r24,16
0x0020736c:  li r5,0
0x00207370:  bl 00045388
0x00207374:  b  00207384
0x00207378:  lwz        r2,5292(r9)
0x0020737c:  add        r0,r26,r2
0x00207380:  sthbrx     r24,r0,r0
0x00207384:  lwz        r0,72(r1)
0x00207388:  addi       r1,r1,64
0x0020738c:  mtlr       r0
0x00207390:  clrlwi     r0,r25,16
0x00207394:  rlwimi     r17,r0,0,16,31
0x00207398:  lis        r2,184
0x0020739c:  lwz        r2,-28096(r2)
0x002073a0:  rlwinm     r2,r2,4,0,27
0x002073a4:  add        r2,r2,r27
0x002073a8:  lwz        r24,160(r2)
0x002073ac:  mr r26,r17
0x002073b0:  addi       r26,r26,-2
0x002073b4:  clrlwi     r26,r26,16
0x002073b8:  mr r25,r26
0x002073bc:  lwz        r0,196(r27)
0x002073c0:  add        r26,r26,r0
0x002073c4:  mflr       r0
0x002073c8:  mr r3,r26
0x002073cc:  stw        r0,8(r1)
0x002073d0:  rlwinm     r0,r26,23,21,28
0x002073d4:  add        r9,r0,r27
0x002073d8:  stwu       r1,-64(r1)
0x002073dc:  lwz        r2,5288(r9)
0x002073e0:  rlwinm     r0,r26,0,31,19
0x002073e4:  cmpw       cr7,r2,r0
0x002073e8:  beq        cr7,002073FC
0x002073ec:  clrlwi     r4,r24,16
0x002073f0:  li r5,0
0x002073f4:  bl 00045388
0x002073f8:  b  00207408
0x002073fc:  lwz        r2,5292(r9)
0x00207400:  add        r0,r26,r2
0x00207404:  sthbrx     r24,r0,r0
0x00207408:  lwz        r0,72(r1)
0x0020740c:  addi       r1,r1,64
0x00207410:  mtlr       r0
0x00207414:  clrlwi     r0,r25,16
0x00207418:  rlwimi     r17,r0,0,16,31
0x0020741c:  mr r24,r23
0x00207420:  mr r26,r17
0x00207424:  addi       r26,r26,-2
0x00207428:  clrlwi     r26,r26,16
0x0020742c:  mr r25,r26
0x00207430:  lwz        r0,196(r27)
0x00207434:  add        r26,r26,r0
0x00207438:  mflr       r0
0x0020743c:  mr r3,r26
0x00207440:  stw        r0,8(r1)
0x00207444:  rlwinm     r0,r26,23,21,28
0x00207448:  add        r9,r0,r27
0x0020744c:  stwu       r1,-64(r1)
0x00207450:  lwz        r2,5288(r9)
0x00207454:  rlwinm     r0,r26,0,31,19
0x00207458:  cmpw       cr7,r2,r0
0x0020745c:  beq        cr7,00207470
0x00207460:  clrlwi     r4,r24,16
0x00207464:  li r5,0
0x00207468:  bl 00045388
0x0020746c:  b  0020747C
0x00207470:  lwz        r2,5292(r9)
0x00207474:  add        r0,r26,r2
0x00207478:  sthbrx     r24,r0,r0
0x0020747c:  lwz        r0,72(r1)
0x00207480:  addi       r1,r1,64
0x00207484:  mtlr       r0
0x00207488:  clrlwi     r0,r25,16
0x0020748c:  rlwimi     r17,r0,0,16,31
0x00207490:  mr r26,r18
0x00207494:  lis        r2,184
0x00207498:  lwz        r2,-28096(r2)
0x0020749c:  add        r26,r26,r2
0x002074a0:  clrlwi     r26,r26,16
0x002074a4:  lis        r2,184
0x002074a8:  lwz        r2,-28096(r2)
0x002074ac:  lwzx       r0,r27,r2
0x002074b0:  add        r26,r26,r0
0x002074b4:  mflr       r0
0x002074b8:  mr r3,r26
0x002074bc:  stw        r0,8(r1)
0x002074c0:  rlwinm     r0,r26,23,21,28
0x002074c4:  add        r9,r0,r27
0x002074c8:  stwu       r1,-64(r1)
0x002074cc:  lwz        r2,1192(r9)
0x002074d0:  rlwinm     r0,r26,0,31,19
0x002074d4:  cmpw       cr7,r2,r0
0x002074d8:  beq        cr7,002074E8
0x002074dc:  li r4,0
0x002074e0:  bl 0004517C
0x002074e4:  b  002074F4
0x002074e8:  lwz        r0,1196(r9)
0x002074ec:  add        r0,r26,r0
0x002074f0:  lhbrx      r3,r0,r0
0x002074f4:  lwz        r0,72(r1)
0x002074f8:  mr r24,r3
0x002074fc:  addi       r1,r1,64
0x00207500:  mtlr       r0
0x00207504:  clrlwi     r0,r24,16
0x00207508:  rlwimi     r19,r0,0,16,31
0x0020750c:  lis        r2,184
0x00207510:  lwz        r25,-28096(r2)
0x00207514:  mr r24,r19
0x00207518:  subf       r0,r25,r24
0x0020751c:  stw        r25,40(r27)
0x00207520:  stw        r0,44(r27)
0x00207524:  lis        r2,184
0x00207528:  lwz        r2,-28096(r2)
0x0020752c:  stw        r2,48(r27)
0x00207530:  lhz        r0,46(r27)
0x00207534:  cmpwi      cr7,r0,0
0x00207538:  bne        cr7,00207558
0x0020753c:  b  00D49B10
0x00207540:  lis        r2,184
0x00207544:  lwz        r2,-28092(r2)
0x00207548:  lis        r9,184
0x0020754c:  lwz        r24,-28096(r9)
0x00207550:  stw        r2,32(r27)
0x00207554:  b  00207574
0x00207558:  b  00D49B14
0x0020755c:  lis        r2,184
0x00207560:  lis        r9,184
0x00207564:  lwz        r2,-28096(r2)
0x00207568:  lwz        r9,-28088(r9)
0x0020756c:  addi       r24,r2,1
0x00207570:  stw        r9,32(r27)
0x00207574:  blr

Trace 0x00207230 [0x000f0000]


I am still fiddling around with it and trying to wrap my head around what Fabrice has done, but will post a diff if anyone wants it.


On Feb 19, 2004, at 5:46 AM, Pierre d'Herbemont wrote:

Hi all!

I finally made the dyngen tool mach-o compatible. But it is still not working, when I do:
i386-softmmu/qemu /path/to/linux.img -d
I get two block of instructions translated, but it ends in a SIGBUS with the following backtrace:

#0 0x00013ba4 in cpu_x86_exec (env1=0x1d) at /Users/steg/Documents/Programmation/System/Wine/Related/qemu/exec- all.h:275 #1 0x00006050 in main_loop (opaque=0x1d) at /Users/steg/Documents/Programmation/System/Wine/Related/qemu/vl.c:3161 #2 0x00006050 in main_loop (opaque=0x1d) at /Users/steg/Documents/Programmation/System/Wine/Related/qemu/vl.c:3161 #3 0x00006f98 in main (argc=983040, argv=0x206140) at /Users/steg/Documents/Programmation/System/Wine/Related/qemu/vl.c:3760
(To this email is attached the log output)

I was wondering if the usage of qemu was correct. Can someone point me to the right direction on how to debug qemu and/or give me some help on this issue.

Here is a patch to make qemu build on Darwin. It is not cleaned enough to be integrated in CVS as is, but it will be soon. Also configure doesn't work properly so you'll have to edit configure output by hands on Darwin.


Qemu-devel mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]