Machine Architecture

Elective class. Strongly linked in content to Operating Systems

Textbooks

 * 1) Need physical copy of the book. "Sparc Architecture, Assembly Language Programming and C" by Richard Paul
 * 2) K&R the C Programming language. Helps with Operating Systems too

Most of the content isn't covered
Hardware security is not covered due to SPARC machine root access not being given

What is SPARC
SPARC architecture is one of the most common architecture. Especially v8

It is a RISC architecture

RISC

Reduced

Instruction

Set

Computing

It contrasts with CISC or complex instruction set computing

CISC to RISC transition occurred in the mid 1980s. Surprisingly late, so assembly language radically transformed.

x86 vs SPARC
x86 is cheaper to run. SPARC lasts longer and scales more

x86 was originally CISC but over time simplified to become more RISC like

windows generally uses x86

Apple is the only company to really advance with developing the Apple M1

M1 is a system on a chip, meaning you don't need a separate bus for io and some other stuff

Using a macroprocessor
text substitution.

TotalSalary - deductions = netSalary.

l1               l0            o1

define(TotalSalary, l1)

macroprocessor lets us use sensible names to refer to things in assembly.

Macroprocessor m4

Will learn how to use the GNU Debugger (gdb)

Compiler and Toy CPU
Basically the same as before

Writing code in m4
We are writing code in m4. Which is symbolic

M4 being more forgiving on Linux makes it bad, ideally compile on machine provided instead.

"define(N, 100) N define(N, 200) N"

cannot redefine N as 200, gives error on Solaris, gives nothing in Linux

"define(N, 100) N define(`N', 200) N"

gives 200 in both

Spaces are not allowed, if they are included in this then they are included in the variable name Trailing whitespace is preserved, leading whitespace is discarded7

Defining functions in m4
$ refers to the number of an argument

define(FOO, TWOARGS: $1 AND $2)