Einstein Roadmap
Einstein Roadmap
a presentation byPaul Guyot (pguyot@kallisys.net)
WWNC 2007 - 2007/7/8

Part I: Prologue

Many thanks to:Basuke
Simon BellMartin Buis
Andy Diller
Frank Gründel
Lars Immisch
Eckhart Köppen
Sean Luke
Matthias Melcher
Makoto Nukui

Sylvain Pilet
Victor Rehorst
Walter Smith
Adam Tow
Michael Vacík
David Watson
Larry Yaeger
Nicolas Zinovieff
You, and many others…
3

Einstein is NewtonOS 2.1
running on new hardware

4

Einstein is NewtonOS 2.1
running on new hardware- Mac (2004/9)

4

Einstein is NewtonOS 2.1
running on new hardware- Mac (2004/9)- Zaurus (2006/1)

4

Einstein is NewtonOS 2.1
running on new hardware- Mac (2004/9)- Zaurus (2006/1)- Nokia 770 (2006/1)

4

Einstein is NewtonOS 2.1
running on new hardware- Mac (2004/9)- Zaurus (2006/1)- Nokia 770 (2006/1)- MacIntel (2006/5)

4

Einstein is NewtonOS 2.1
running on new hardware- Mac (2004/9)- Zaurus (2006/1)- Nokia 770 (2006/1)- MacIntel (2006/5)- Linux x86 (2006/5)
4

Einstein is NewtonOS 2.1
running on new hardware- Mac (2004/9)- Zaurus (2006/1)- Nokia 770 (2006/1)- MacIntel (2006/5)- Linux x86 (2006/5)- Nokia 800 (2007/7)
4

Einstein is NewtonOS 2.1
running on new hardware- Windows (2007/7)

5

Einstein is NewtonOS 2.1
running on new hardware- Windows (2007/7)- iPhone (?)

5

Three goals in 2004
✓Get an emulator for NewtonOS
development (2005)✓Extend NewtonOS with moderntechnologies (2006)-Replace Newton MessagePads
with modern PDAs
6

Part II: Inside EinsteinHow Einstein was born

Newton 2.1
hardwareis based on
theVoyager
Chipset

ARM
Processor
MMUROMSerialNumberROM

SerialPorts

PCMCIAControllers

ScreenVoyager

RAMAnalog
Controller

Internal
Flash910

Voyager Chipset
ARM CPU10

We do notknow howtheVoyager
Chipsetworks

ARM
Processor
MMU

ROM?

SerialNumberROM

Screen?

Voyager

SerialPorts?

PCMCIA
Controllers

RAM?

AnalogController

Internal
Flash

11

The ARM Processor in
NewtonOS 2.1
mostly accesses the Voyager
Chipset through drivers
called “PClasses”
ROM

It accesses it directly for thetimer (interruptions)12Einsteinprovides its
own drivers
inside theEinstein REX(ROMExtension)
13

The Speed ChallengeIn 1997, Newtons werevery fast:
StrongARM 110 at 161.9MHz.

15

In 1997, Newtons werevery fast:
StrongARM 110 at 161.9MHz.
1997: Pentium II (233-266MHz)
1997: PowerPC G3 (366MHz)

15

In 1997, Newtons werevery fast:
StrongARM 110 at 161.9MHz.
1997: Pentium II (233-266MHz)
1997: PowerPC G3 (366MHz)
2007: MacPro: 3 GHz
2007: iPhone: 620 Mhz (ARM!)
15

The principle of emulation(the slow way, Einstein 2004)
1. Update the Program Counter (PC)
2. Get the physical address of the instruction
3. Read the instruction
4. Analyze it
5. Do what it should do
6. Determine if there is any interruption
7. Repeat
16

The Program Counter
The program counter is the (virtual) addressof the current instruction (+4). It is where thesoftware is currently executing.

PC=0001868C

BootOS:
00018688 mov
0001868C orr
00018690 mcr
00018694 mrc
00018698 bic
0001869C eor
000186A0 eor
000186A4 eors

r0, #0xB0
r0, r0, #0x00001000
15, 0, r0, cr1, cr1, {0}15, 0, r0, cr0, cr0, {0}r0, r0, #0xF
r0, r0, #0x44000000
r0, r0, #0x00010000
r0, r0, #0x0000A100
17

The Program Counter
The program counter is the (virtual) addressof the current instruction (+4). It is where thesoftware is currently executing.

PC=00018690

BootOS:
00018688 mov
0001868C orr
00018690 mcr
00018694 mrc
00018698 bic
0001869C eor
000186A0 eor
000186A4 eors

r0, #0xB0
r0, r0, #0x00001000
15, 0, r0, cr1, cr1, {0}15, 0, r0, cr0, cr0, {0}r0, r0, #0xF
r0, r0, #0x44000000
r0, r0, #0x00010000
r0, r0, #0x0000A100
18

The Program Counter
The program counter is the (virtual) addressof the current instruction (+4). It is where thesoftware is currently executing.

PC=00018694

BootOS:
00018688 mov
0001868C orr
00018690 mcr
00018694 mrc
00018698 bic
0001869C eor
000186A0 eor
000186A4 eors

r0, #0xB0
r0, r0, #0x00001000
15, 0, r0, cr1, cr1, {0}15, 0, r0, cr0, cr0, {0}r0, r0, #0xF
r0, r0, #0x44000000
r0, r0, #0x00010000
r0, r0, #0x0000A100
19

The Program Counter
The program counter is the (virtual) addressof the current instruction (+4). It is where thesoftware is currently executing.

PC=00018698

BootOS:
00018688 mov
0001868C orr
00018690 mcr
00018694 mrc
00018698 bic
0001869C eor
000186A0 eor
000186A4 eors

r0, #0xB0
r0, r0, #0x00001000
15, 0, r0, cr1, cr1, {0}15, 0, r0, cr0, cr0, {0}r0, r0, #0xF
r0, r0, #0x44000000
r0, r0, #0x00010000
r0, r0, #0x0000A100
20

The Program Counter
The program counter is the (virtual) addressof the current instruction (+4). It is where thesoftware is currently executing.

PC=0001869C

BootOS:
00018688 mov
0001868C orr
00018690 mcr
00018694 mrc
00018698 bic
0001869C eor
000186A0 eor
000186A4 eors

r0, #0xB0
r0, r0, #0x00001000
15, 0, r0, cr1, cr1, {0}15, 0, r0, cr0, cr0, {0}r0, r0, #0xF
r0, r0, #0x44000000
r0, r0, #0x00010000
r0, r0, #0x0000A100
21

The Program Counter
The program counter is the (virtual) addressof the current instruction (+4). It is where thesoftware is currently executing.

PC=000186A0

BootOS:
00018688 mov
0001868C orr
00018690 mcr
00018694 mrc
00018698 bic
0001869C eor
000186A0 eor
000186A4 eors

r0, #0xB0
r0, r0, #0x00001000
15, 0, r0, cr1, cr1, {0}15, 0, r0, cr0, cr0, {0}r0, r0, #0xF
r0, r0, #0x44000000
r0, r0, #0x00010000
r0, r0, #0x0000A100
22

The Program Counter
The program counter is the (virtual) addressof the current instruction (+4). It is where thesoftware is currently executing.
Updating the PC is expensive.
Einstein 2007 only updates it when necessary.

23

Translating addresses: MMU
Modern computers have virtual and physicaladdresses
virtual: what the software sees
physical: what the hardware sees
NewtonOS makes a heavy use of MMU for
packages, virtual memory, memory
protection.
Einstein uses a cache for MMU since 200524

Analyzing instructions
Analyzing instructions takes a lot of time. Thiscan be done by translating at runtime into
references to native code (Just In Time, JIT).
Einstein uses threaded emulation since 2005
Einstein 2007 includes a new module todirectly translate ARM code into ARM code
(work in progress: only few instructions fornow)
25Interruptions
Interruptions are hardware signals sent to theprocessor to interrupt what it was doing anddo something else instead.
Examples:the alarm fires off -> show a dialog
you press on the screen -> do something
preemptive multithreading
Emulating interruptions is very expensive.
26

Interruptions
In the future, we can replace interruptions
with virtualizations:
When you press the screen on a Zaurus, theZaurus is interrupted.
— Fast interruptions (FIQ) can be virtualized
as they do not influence the main process.
— Regular interruptions (IRQ) are used forpreemptive multithreading. (難しい)27

Relativity

Relativity was introduced here:29

Relativity is the integration ofhost and Newton data andtechnologies
Einstein
Newton Data

Newton Package
Relativity
Host Technology

Host Program30

Examples:— Control host applications (iTunes)— Use other languages within Einstein(Python, Ruby, …)— Use Zaurus kanji handwriting recognition
within Einstein— Use Newton handwriting recognition inhost operating system— Share Einstein and Host address books
Relativity is only limited by your imagination.
31

Part III: EpilogueToday, Einstein becomes…

OpenEinstein

OpenEinstein
http://code.google.com/p/einstein/

OpenEinstein
It will always belong to the community
GNU General Public License v2
Sharing the effort:— Access to more hardware (Nokia 800, iPhone?,
recent Zaurus, Windows Mobile)— Ported on Windows yesterday with Matthias!
— Work can be distributed on different modules
35Together we can…

Work on speed…
— Make it much faster on the Zaurus/Nokia/
iPhone with direct translation of ARM
instructions— Virtualize fast interruptions, regularinterruptions, memory accesses,
NewtonScript bytecode interpreter (NEWT/0),
and more…

37

Work on host integration…
— Emulating serial ports— Sharing host internet access— Integrating soups (data exchange)— Emulating ATA cards to provide storage— Providing color (cf the VGA card)— Integrating NewtonOS windows and hostwindows (NewtView)
38

…and imagine the next

Einstein
39

…and imagine the next

OpenEinstein39

Thank you for your attention!