Was told malicious code can be written to Processor.

For discussions about security.
Message
Author
User avatar
drongo
Posts: 374
Joined: Sat 10 Dec 2005, 23:35
Location: UK

Microcode exists!

#21 Post by drongo »

There is such a thing as microcode. If you look at assembly instructions you'll soon realise that there aren't enough clock cycles to update all the registers and perform whatever function is requested.

The CPU clock is actually multiplied up and these clocks are used to time the microcode.

Funny thing is, nobody seems to be aware of it. Only printed reference I ever found was in Rodney Zack's (spelling?) book on the Z80 processor from about 1980.

You can't update/modify it though!

User avatar
drongo
Posts: 374
Joined: Sat 10 Dec 2005, 23:35
Location: UK

Clarification

#22 Post by drongo »

My comments apply only to microprocessors not other computer architectures.

PaulBx1
Posts: 2312
Joined: Sat 17 Jun 2006, 03:11
Location: Wyoming, USA

#23 Post by PaulBx1 »

There is such a thing as microcode. If you look at assembly instructions you'll soon realise that there aren't enough clock cycles to update all the registers and perform whatever function is requested.

The CPU clock is actually multiplied up and these clocks are used to time the microcode.
I doubt this very much. I think it is all done in hardware; that is, hard wired and not changeable.

User avatar
drongo
Posts: 374
Joined: Sat 10 Dec 2005, 23:35
Location: UK

Microcode exists

#24 Post by drongo »

Yes it is done in hardware, and in microprocessors it is probably always unmodifiable and unchangeable. In some other architectures microcode is modifiable.

I never said you could modify microcode in a microprocessor. All I said was that there was something called microcode in 8-bit chips such as the Z80. I assume it was also in chips like the 6502 and all of the Intel and AMD microprocessors which have come along since the 1980s.

Rather than denying this you can prove me wrong fairly easily.

Look up some old assembly code instructions or machine code instructions for something simple like addition in an 8-bit CPU. Find out how many clock cycles the instruction uses and then try and work out how you can load two registers with numbers, add them together and place them in another register. Each register load and operation takes at least a clock cycle, so you are looking at at least four clock cycles straight off with standard von Neuman architecture. Your machine code instruction will only take one or two cycles of the master clock.

What actually happens is the master clock is multiplied up. Microcode-instructions are clocked by this faster clock.

As I said, most people are unaware of this including a guy I used to share an office with who lectured on 8-bit microprocessors in the 1980s. He had actually looked at the clock cycles associated with various instructions and worked out that there weren't enough of them. So when he asked me, I told him about microcode.

There's no need to take my word for it, go and check it out for yourself, it won't take more than about fifteen minutes to convince yourself that there aren't enough clock cycles.

Don't be a microcode denialist!

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#25 Post by jamesbond »

Microcode definitely exist in today's modern CPUs.

http://www.urbanmyth.org/microcode/
http://kerneltrap.org/node/2678
http://lwn.net/Articles/98029/

And this one straight from the CPU vendor itself:
http://www.amd64.org/support/microcode.html

And if you read the AMD64 CPU datasheet, you'll find instructions on how to upload such microcode updates to the CPU.

However I was wrong in saying that microcode updates are permanent. Indeed, they are not permanent as of today - a cold reboot and the update will be undone.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#26 Post by nooby »

Sorry. How does one find out about it?
I use Google Search on Puppy Forum
not an ideal solution though

PaulBx1
Posts: 2312
Joined: Sat 17 Jun 2006, 03:11
Location: Wyoming, USA

#27 Post by PaulBx1 »

Rather than denying this you can prove me wrong fairly easily.

Look up some old assembly code instructions or machine code instructions for something simple like addition in an 8-bit CPU. Find out how many clock cycles the instruction uses and then try and work out how you can load two registers with numbers, add them together and place them in another register. Each register load and operation takes at least a clock cycle, so you are looking at at least four clock cycles straight off with standard von Neuman architecture. Your machine code instruction will only take one or two cycles of the master clock.

What actually happens is the master clock is multiplied up. Microcode-instructions are clocked by this faster clock.
Everything you just said here, can also be done in unmodifiable hardware, so it's not a proof that microcode is being used. Multiplying clocks per se has nothing to do with microcode. Pipelining is another technique for the same end, and it also has nothing per se to do with microcode. Oh, and "von Neuman" just means stored program and data are in the same memory, also irrelevant where microcode is concerned.

To me, microcode means you can either modify the internal architecture via downloaded data (can't really call it "instructions"), or you can modify the sequence and control of the underlying hardware, with downloaded instructions. It doesn't mean there is some iterative or multiple cycle process going on, although that also could be the case in some processors. You can iterate with pure hardware too.

I spent a lot of time working with the early AMD 2901 bit-slice processors. There was no microcode to download. Also worked with the 68000 processors; never heard of any microcode.

jamesbond's links are convincing, so I defer to him on this.

User avatar
drongo
Posts: 374
Joined: Sat 10 Dec 2005, 23:35
Location: UK

Deference

#28 Post by drongo »

As you wish.

I shall defer to Rodnay Zaks' "Programming the Z80" page 86 and the ever-reliable (!) Wikipedia.

http://en.wikipedia.org/wiki/Microcode

N.B. Note that microcode can be run from read-only memory or loaded into memory. My initial posts merely asserted that it did, in fact, exist - which was the point at dispute, if a little off-topic.

cthisbear
Posts: 4422
Joined: Sun 29 Jan 2006, 22:07
Location: Sydney Australia

#29 Post by cthisbear »

Super-secret' debugger discovered in AMD CPUs

http://www.theregister.co.uk/2010/11/15 ... _debugger/

Chris.

Post Reply