|
|
1.1 root 1: /*
2: * fakeff.h
3: * Include file to simulate all the far memory calls from COH 286.
4: * Far pointers are simulated with virtual addresses.
5: */
6: #ifndef FAKEFF_H /* Rest of file. */
7: #define FAKEFF_H
8:
9: typedef unsigned long faddr_t;
10:
11: /*
12: * Read a byte from far address 'fp'. Note that if an address fault
13: * occurs, the system will panic.
14: */
15: #define ffbyte(fp) (*((unsigned char *) (fp)))
16:
17: /*
18: * Read a word from far address 'fp'. Note that if an address fault
19: * occurs, the system will panic.
20: */
21: #define ffword(fp) (*((unsigned short *) (fp)))
22:
23: /*
24: * Copy 'n' bytes from far address 'fp' to address 'k' in the kernel
25: * data segment. Returns the number of bytes copied.
26: * Note that if an address fault occurs, the system will panic.
27: */
28: #define fkcopy(fp, k, n) kkcopy(fp, k, n)
29:
30: /*
31: * Copy 'count' bytes from 'from_fp' to 'to_fp'.
32: * Note that if an address fault occurs, the system will panic.
33: */
34: #define ffcopy(from_fp, to_fp, count) (void) kkcopy(from_fp, to_fp, count)
35:
36: /*
37: * Write byte 'b' to address 'fp'. Note that if an address
38: * fault occurs, the system will panic.
39: */
40: #define sfbyte(fp, b) {*(unsigned char *)(fp) = (unsigned char)(b);}
41:
42: /*
43: * Write word 'w' to address 'fp'. Note that if an address
44: * fault occurs, the system will panic.
45: */
46: #define sfword(fp, w) {*((unsigned short *)(fp)) = (unsigned short)(w);}
47:
48: faddr_t ptov();
49: void vrelse();
50:
51: #endif /* FAKEFF_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.