Hi all, I'm interested to understand the processor architecture in depth. So i decided on emulating the processor itself (as my project). The best one to start would be 386. So i wud require some documents which explains on how to emulate any processor or devices. ( Apart from the Intel Architecture documents available). How to emulate a 386 processor. I want to kno how usually this is done. I wonder how bochs has been developed so elegantly...the resource they've used. It wud be appreciable if someone can guide me on any documents or reference books avaliable on Emulating processors and devices. . Wht are the resources I should have in hand to start up up this project. Thanks, Gromer
Emulating a processor
Started by ●November 22, 2005
Reply by ●November 22, 20052005-11-22
why not take a look at the Bochs source code? Of course, it emulates an entire PC system, not just the processor...
Reply by ●November 22, 20052005-11-22
basically you have two choices: full emulation: you read a byte from (emulated) ram and interpret/execute it (use a huge switch-statement). then advance to the next byte and interpret/execute it, ... the virtualpc/qemu-with-accelerator/vmware/...-way: run the code as ring3-process. catch every exception and emulate the thing that caused the exception (i/o ports, mmu-stuff, ...) but i suggest starting with something similar to dosbox (http://dosbox.sf.net/). create a real-mode-only-emulator first. messing around with page-tables and exceptions makes emulation quite difficult to get right... regards, simon Gromer wrote:> Hi all, > > I'm interested to understand the processor architecture in depth. So i > decided on emulating the processor itself (as my project). The best one > to start would be 386. > > So i wud require some documents which explains on how to emulate any > processor or devices. ( Apart from the Intel Architecture documents > available). > How to emulate a 386 processor. I want to kno how usually this is done. > I wonder how bochs has been developed so elegantly...the resource > they've used. > > It wud be appreciable if someone can guide me on any documents or > reference books avaliable on Emulating processors and devices. > > . > Wht are the resources I should have in hand to start up up this > project. > > Thanks, > Gromer >
Reply by ●November 22, 20052005-11-22
[F'up2 cut down --- OP neglected doing it.] In comp.arch.embedded Gromer <osIndgy@gmail.com> wrote:> I'm interested to understand the processor architecture in depth. So > i decided on emulating the processor itself (as my project). The > best one to start would be 386.I really wonder by what strange criteria the 386 could possibly come out as "the best". Actually, the x86 is almost certainly the single worst possible CPU line to do any theoretical work on. It's just too plagued with silly exceptions due to its long history of compatibility kept at almost any cost. If you really want to learn something about CPU emulation, I'd recommend Professor Knuth's work on the MIX and MMIX platforms --- those are CPUs designed purely for educational purpose, and they only ever existed as emulators, the original ones written by his Knuth-ness in person. -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
Reply by ●November 22, 20052005-11-22
Hi Gromer Why not to take an approach to vhdl. Instead of emulating you can simulate and even synthesize. If your aim is to better understand how a processor work this may give you a deeper understanding. Also there are numerous processor cores available as open source in vhdl, mainly microcontrollers. "Gromer" <osIndgy@gmail.com> ha scritto nel messaggio news:1132639105.148321.60240@o13g2000cwo.googlegroups.com...> Hi all, > > I'm interested to understand the processor architecture in depth. So i > decided on emulating the processor itself (as my project). The best one > to start would be 386. > > So i wud require some documents which explains on how to emulate any > processor or devices. ( Apart from the Intel Architecture documents > available). > How to emulate a 386 processor. I want to kno how usually this is done. > I wonder how bochs has been developed so elegantly...the resource > they've used. > > It wud be appreciable if someone can guide me on any documents or > reference books avaliable on Emulating processors and devices. > > . > Wht are the resources I should have in hand to start up up this > project. > > Thanks, > Gromer >
Reply by ●November 22, 20052005-11-22
["Followup-To:" nach comp.arch.embedded gesetzt.] Simon Felix <de@royalinc.ath.cx> schrieb:> the virtualpc/qemu-with-accelerator/vmware/...-way: run the code as > ring3-process. catch every exception and emulate the thing that caused > the exception (i/o ports, mmu-stuff, ...)VMWare does not work this way. Markus
Reply by ●November 22, 20052005-11-22
On 2005-11-22, Gromer <osIndgy@gmail.com> wrote:> I'm interested to understand the processor architecture in depth. So i > decided on emulating the processor itself (as my project). The best one > to start would be 386.Yikes. Since you've never written an emulator, I would have recommended starting with a decent architecture. Something like a PDP-11 or 6809 or Z80. The '386 is a really nasty bit of work. It's 3 or 4 badly designed processors rolled into one.> So i wud require some documents which explains on how to > emulate any processor or devices. ( Apart from the Intel > Architecture documents available). How to emulate a 386 > processor. I want to kno how usually this is done. I wonder > how bochs has been developed so elegantly...the resource > they've used.Well, if you want to know how bochs as done, then look at the bochs source code and documentation.> It wud be appreciable if someone can guide me on any documents or > reference books avaliable on Emulating processors and devices. > > Wht are the resources I should have in hand to start up up this > project.-- Grant Edwards grante Yow! Yow! Are we in the at perfect mood? visi.com
Reply by ●November 22, 20052005-11-22
Markus Becker wrote:> ["Followup-To:" nach comp.arch.embedded gesetzt.] > > Simon Felix <de@royalinc.ath.cx> schrieb: > > >>the virtualpc/qemu-with-accelerator/vmware/...-way: run the code as >>ring3-process. catch every exception and emulate the thing that caused >>the exception (i/o ports, mmu-stuff, ...) > > VMWare does not work this way.no? how does it work?
Reply by ●November 22, 20052005-11-22
Simon Felix <de@royalinc.ath.cx> schrieb:>> VMWare does not work this way. > > no? how does it work?It does not emulate the processor, it just uses it. Markus
Reply by ●November 22, 20052005-11-22
Markus Becker <yetispamb@web.de> wrote:> Simon Felix <de@royalinc.ath.cx> schrieb: > >>> VMWare does not work this way. >> >> no? how does it work? > > It does not emulate the processor, it just uses it.Which is what he said. It does emulate the IO (or a lot of it, anyway) though, and provides emulated hardware like video cards, network cards and the like. Which is also what he said. -- Nobby