Skip to contentSkip to conversation

Report

Qemu-devel Nigel Horne 8 participants 22 messages Apr 15, 2007 – Apr 17, 2007

lore
Share & tools
lore
#0 lore raw

Folks,

Thanks for qemu. I thought you may like to know that from a Linux x86 host I have 3 linux guests: sparc, arm and mips. The first 2 work a treat, the mips keeps core dumping in libc6 when called from Perl, I don't know if the problem lies in libc6, perl or qemu.

Can qemu emulate 16-bit machines (286?)?

-Nigel

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#1 lore raw

[Qemu-devel] 16-bit (and 8-bit) emulation

Quoted 1 line · Nigel Horne

Can qemu emulate 16-bit machines (286?)?

None that I'm aware of. Is there any particular need for 286 emulation? OTOH, it might be interesting to see some m68k system emulation.

I've been working on an 8-bit machine, with some success. The one thing that I'm not really sure about is bank switching (although I think I can just call cpu_register_physical_memory()).

HTH,

Signature · 1 line
Stuart Brady
#2 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Quoted 9 lines · Stuart Brady
Quoted 1 line · Nigel Horne

Can qemu emulate 16-bit machines (286?)?

None that I'm aware of. Is there any particular need for 286 emulation? OTOH, it might be interesting to see some m68k system emulation.

I've been working on an 8-bit machine, with some success. The one thing that I'm not really sure about is bank switching (although I think I can just call cpu_register_physical_memory()).

It's probably easier to map all banks into a single large address space, and use the bank number as the high bits of the address. That way you can switch banks without having to flush everything.

gdb uses similar tricks to deal with multiple address spaces on DSPs.

Paul

#3 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Stuart Brady
Quoted 4 lines · Stuart Brady
Quoted 1 line · Nigel Horne

Can qemu emulate 16-bit machines (286?)?

None that I'm aware of. Is there any particular need for 286 emulation?

To test my code on machines where sizeof(int) == sizeof(short), and sizeof(int) != sizeof(long).

Quoted 1 line

OTOH, it might be interesting to see some m68k system emulation.

I can't remember now what sizeof(int) and sizeof(char *) were on m68k machines.

-Nigel

Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, Barnsley, UK.  ICQ#20252325
[email protected] http://www.bandsman.co.uk

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#4 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Quoted 8 lines · Nigel Horne
Quoted 4 lines · Stuart Brady
Quoted 1 line · Nigel Horne

Can qemu emulate 16-bit machines (286?)?

None that I'm aware of. Is there any particular need for 286 emulation?

To test my code on machines where sizeof(int) == sizeof(short), and sizeof(int) != sizeof(long).

Modern x86 are backwards compatible[*], so you should be able to do that anyway.

Paul

[*] There are a few corner cases, but these are only likely to effect hand-written asm doing evil things. There's probably more difference between qemu and real hardware than 286 and i386 real mode.

#15 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Nigel Horne
Quoted 1 line · Nigel Horne

I can't remember now what sizeof(int) and sizeof(char *) were on m68k machines.

It depends. Try -mshort.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#5 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Paul Brook
Quoted 9 lines · Paul Brook
Quoted 6 lines · Nigel Horne
Quoted 3 lines · Stuart Brady
Quoted 1 line · Nigel Horne

Can qemu emulate 16-bit machines (286?)?

None that I'm aware of. Is there any particular need for 286 emulation?

To test my code on machines where sizeof(int) == sizeof(short), and sizeof(int) != sizeof(long).

Modern x86 are backwards compatible[*], so you should be able to do that anyway.

Care to share with us how I do that? Is it an option to gcc?

Quoted 2 lines

Paul

Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, Barnsley, UK.  ICQ#20252325
[email protected] http://www.bandsman.co.uk

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#16 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Andreas Schwab
Quoted 5 lines · Andreas Schwab
Quoted 1 line · Nigel Horne

I can't remember now what sizeof(int) and sizeof(char *) were on m68k machines.

It depends. Try -mshort.

That's not much help, I'm sorry to say, because you need an m68k machine to use it on, and there's no qemu-system-m68k, only a qemu-m68k.

Quoted 3 lines

Andreas.

Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, Barnsley, UK.  ICQ#20252325
[email protected] http://www.bandsman.co.uk

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#19 lore raw
In reply to Nigel Horne
Quoted 6 lines · Nigel Horne

Folks,

Thanks for qemu. I thought you may like to know that from a Linux x86 host I have 3 linux guests: sparc, arm and mips. The first 2 work a treat, the mips keeps core dumping in libc6 when called from Perl, I don't know if the problem lies in libc6, perl or qemu.

I assume you are using full system emulation for mips. I currently see some instability when running specific perl scripts which is apparently triggered by the FPU emulator in the Linux/MIPS kernel. As a workaround, use -cpu 24Kf.

Thiemo

#6 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Nigel Horne
Quoted 4 lines
Quoted 2 lines

Modern x86 are backwards compatible[*], so you should be able to do that anyway.

Care to share with us how I do that? Is it an option to gcc?

gcc does not support 16-bit mode.

My point is that pretty much anything that runs on a 286 should also run on any subsequent x86 processor. If you want to test 16-bit x86 software/systems you don't need an actual 286. A 386 is just as good for almost all purposes.

Paul

#7 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Quoted 7 lines · Paul Brook
Quoted 3 lines
Quoted 2 lines

Modern x86 are backwards compatible[*], so you should be able to do that anyway.

Care to share with us how I do that? Is it an option to gcc?

gcc does not support 16-bit mode.

My point is that pretty much anything that runs on a 286 should also run on any subsequent x86 processor. If you want to test 16-bit x86 software/systems you don't need an actual 286. A 386 is just as good for almost all purposes.

How does that address my issue?

Quoted 1 line

Paul

-Nigel

Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, Barnsley, UK.  ICQ#20252325
[email protected] http://www.bandsman.co.uk

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#17 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Nigel Horne
Quoted 9 lines · Nigel Horne
Quoted 5 lines · Andreas Schwab
Quoted 1 line · Nigel Horne

I can't remember now what sizeof(int) and sizeof(char *) were on m68k machines.

It depends. Try -mshort.

That's not much help, I'm sorry to say, because you need an m68k machine to use it on, and there's no qemu-system-m68k, only a qemu-m68k.

Why do you need a full emulation? The choice of sizeof(int) has no influence on the cpu.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#8 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Nigel Horne
Quoted 6 lines
Quoted 4 lines

My point is that pretty much anything that runs on a 286 should also run on any subsequent x86 processor. If you want to test 16-bit x86 software/systems you don't need an actual 286. A 386 is just as good for almost all purposes.

How does that address my issue?

You wanted a 286 so that you could test 16-bit x86 code. You can already do that with current qemu. How you generate that 16-bit x86 code is a completely unrelated (and offtopic) problem.

Paul

#9 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Let me approach this in a different way in the hope that I'll get an answer to my
question: will Qemu run a 286 guest O/S?

-Nige

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#10 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Quoted 2 lines · Nigel Horne

Let me approach this in a different way in the hope that I'll get an answer to my question: will Qemu run a 286 guest O/S?

Yes.

Paul

#11 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Quoted 5 lines · Paul Brook
Quoted 2 lines · Nigel Horne

Let me approach this in a different way in the hope that I'll get an answer to my question: will Qemu run a 286 guest O/S?

Yes.

Good.

Followup question, if the guest O/S is multi-architecture, will it run in 386 mode (which I don't want for this particular scenario) or can I force it to only "see" a 286 so that it doesn't boot up in 386 mode?

Quoted 2 lines

Paul

-Nigel

Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, Barnsley, UK.  ICQ#20252325
[email protected] http://www.bandsman.co.uk

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#20 lore raw
In reply to Thiemo Seufer
Quoted 8 lines · Thiemo Seufer
Quoted 6 lines · Nigel Horne

Folks,

Thanks for qemu. I thought you may like to know that from a Linux x86 host I have 3 linux guests: sparc, arm and mips. The first 2 work a treat, the mips keeps core dumping in libc6 when called from Perl, I don't know if the problem lies in libc6, perl or qemu.

Quoted 4 lines

I assume you are using full system emulation for mips. I currently see some instability when running specific perl scripts which is apparently triggered by the FPU emulator in the Linux/MIPS kernel. As a workaround, use -cpu 24Kf.

Yes, that works a treat, thanks. I wonder if it's worth reporting as a kernel bug.

Quoted 1 line

Thiemo

-Nigel

Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, Barnsley, UK.  ICQ#20252325
[email protected] http://www.bandsman.co.uk

begin:vcard
fn:Nigel Horne
n:Horne;Nigel
org:NJH Music
email;internet:[email protected]
tel;fax:+44 870 705 9334
note:Skype: nigelhorne
x-mozilla-html:FALSE
version:2.1
end:vcard

#21 lore raw
Quoted 9 lines · Nigel Horne
Quoted 8 lines · Thiemo Seufer
Quoted 6 lines · Nigel Horne

Folks,

Thanks for qemu. I thought you may like to know that from a Linux x86 host I have 3 linux guests: sparc, arm and mips. The first 2 work a treat, the mips keeps core dumping in libc6 when called from Perl, I don't know if the problem lies in libc6, perl or qemu.

Quoted 7 lines
Quoted 4 lines

I assume you are using full system emulation for mips. I currently see some instability when running specific perl scripts which is apparently triggered by the FPU emulator in the Linux/MIPS kernel. As a workaround, use -cpu 24Kf.

Yes, that works a treat, thanks. I wonder if it's worth reporting as a kernel bug.

It is a Qemu bug. On real hardware it works fine.

Thiemo

#12 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Nigel Horne

Yes but...

Currently no protected mode 286 guest OS runs under qemu.

Quoted 4 lines · Nigel Horne

Let me approach this in a different way in the hope that I'll get an answer to my
question: will Qemu run a 286 guest O/S?

-Nige

#13 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Quoted 3 lines · Natalia Portillo

Yes but...

Currently no protected mode 286 guest OS runs under qemu.

Windows 3.1 Standard mode? (Delete / Rename KRNL386.EXE)

DF

Quoted 7 lines · Nigel Horne
Quoted 4 lines

Let me approach this in a different way in the hope that I'll get an answer to my
question: will Qemu run a 286 guest O/S?

-Nige

#14 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

Windows 3.1 is not an OS.

And there is no Windows for 286 protected mode.

There is OS/2 and UNIXen but none works (OS/2 2.0 and later UNIXen works but they are 386 protected mode)

Quoted 19 lines · Derek Fawcus
Quoted 3 lines · Natalia Portillo

Yes but...

Currently no protected mode 286 guest OS runs under qemu.

Windows 3.1 Standard mode? (Delete / Rename KRNL386.EXE)

DF

Quoted 7 lines · Nigel Horne
Quoted 4 lines

Let me approach this in a different way in the hope that I'll get an answer to my
question: will Qemu run a 286 guest O/S?

-Nige

#18 lore raw

Re: [Qemu-devel] 16-bit (and 8-bit) emulation

In reply to Nigel Horne

todd@cloud/p1 ~/src/c/todd/test�100$ ./sizeof
sizeof(char) = 1
sizeof(short) = 2
sizeof(int) = 4
sizeof(char *) = 4
sizeof(long) = 4
sizeof(long long) = 8
todd@cloud/p1 ~/src/c/todd/test�101$ uname -a
OpenBSD cloud.fries.net 4.1 GENERIC#7 mac68k
todd@cloud/p1 ~/src/c/todd/test�102$

FWIW.

Signature · 14 lines
Todd Fries .. [email protected]

 _____________________________________________
|                                             \  1.636.410.0632 (voice)
| Free Daemon Consulting, LLC                 \  1.405.227.9094 (voice)
| http://FreeDaemonConsulting.com             \  1.866.792.3418 (FAX)
| "..in support of free software solutions."  \          250797 (FWD)
|                                             \
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
                                                 
              37E7 D3EB 74D0 8D66 A68D  B866 0326 204E 3F42 004A
                        http://todd.fries.net/pgp.txt

Penned by Nigel Horne on 20070415 13:08.57, we have:
| Stuart Brady wrote:
| >On Sun, Apr 15, 2007 at 11:08:56AM +0100, Nigel Horne wrote:
| >>Can qemu emulate 16-bit machines (286?)?
| >
| >None that I'm aware of.  Is there any particular need for 286 emulation?
| 
| To test my code on machines where sizeof(int) == sizeof(short), and
| sizeof(int) != sizeof(long).
| 
| >OTOH, it might be interesting to see some m68k system emulation.
| 
| I can't remember now what sizeof(int) and sizeof(char *) were on m68k 
| machines.
| 
| -Nigel
| 
| -- 
| Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, 
| Typesetter.
| NJH Music, Barnsley, UK.  ICQ#20252325
| [email protected] http://www.bandsman.co.uk
| begin:vcard
| fn:Nigel Horne
| n:Horne;Nigel
| org:NJH Music
| email;internet:[email protected]
| tel;fax:+44 870 705 9334
| note:Skype: nigelhorne
| x-mozilla-html:FALSE
| version:2.1
| end:vcard
|