one afternoon I sat pondering over my options ( use' and')
Answers
Explanation:
With the advent of multiplatform support, which involves non-x86 platforms as well as peripheral chipsets across these multiple platforms, we don't want to have to write different versions of device drivers for each and every platform.
While some platform dependencies are unavoidable, let's talk about some of the things that you as a developer can do to minimize the impact. At QNX Software Systems, we've had to deal with these same issues -- for example, we support the 8250 serial chip on several different types of processors. Ethernet controllers, SCSI controllers, and others are no exception.
Let's look at these problems:
I/O space vs memory-mapped
Big-endian vs little-endian
alignment and structure packing
atomic operations
I/O space vs memory-mapped
The x86 architecture has two distinct address spaces:
16-address-line I/O space
32-address-line instruction and data space
The processor asserts a hardware line to the external bus to indicate which address space is being referenced. The x86 has special instructions to deal with I/O space (e.g. IN AL, DX vs MOV AL, address). Common hardware design on an x86 indicates that the control ports for peripherals live in the I/O address space. On non-x86 platforms, this requirement doesn't exist -- all peripheral devices are mapped into various locations within the same address space as the instruction and code memory.
Big-endian vs little-endian
Big-endian vs little-endian is another compatibility issue with various processor architectures. The issue stems from the byte ordering of multibyte constants. The x86 architecture is little-endian. For example, the hexadecimal number 0x12345678 is stored in memory as:
address contents
0 0x78
1 0x56
2 0x34
3 0x12
A big-endian processor would store the data in the following order:
address contents
0 0x12
1 0x34
2 0x56
3 0x78
This issue is worrisome on a number of fronts:
typecast mangling
hardware access
network transparency
The first and second points are closely related.
Answer:
And,one afternoon I sat pondering over my options