1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
#
# These are diffs on my machine currently,
# Not all of the patches are necessary,
# some need to be determined if they are to be commited
# or not.
#
Index: src/sbin/Makefile
# powerpc and arc use fdisk.
===================================================================
RCS file: /cvs/src/sbin/Makefile,v
retrieving revision 1.21
diff -r1.21 Makefile
35c35
< .elif ${MACHINE} == "arc"
---
> .elif (${MACHINE} == "arc") || (${MACHINE} == "powerpc")
Index: src/sbin/fdisk/fdisk.c
# powerpc uses fdisk.
# these changes make bigendian system able to use fdisk.
# the 0xA6 Needs to be resolved before checking this in.
===================================================================
RCS file: /cvs/src/sbin/fdisk/fdisk.c,v
retrieving revision 1.9
diff -r1.9 fdisk.c
124c124
< { 0xA6, "OpenBSD"},
---
> { 0xA6, "OpenBSD or BSD Big Endian"},
267a268,310
> static inline unsigned short
> getshort(p)
> void *p;
> {
> unsigned char *cp = p;
>
> return cp[0] | (cp[1] << 8);
> }
>
> static inline void
> putshort(p, l)
> void *p;
> unsigned short l;
> {
> unsigned char *cp = p;
>
> *cp++ = l;
> *cp++ = l >> 8;
> }
>
> static inline unsigned long
> getlong(p)
> void *p;
> {
> unsigned char *cp = p;
>
> return cp[0] | (cp[1] << 8) | (cp[2] << 16) | (cp[3] << 24);
> }
>
> static inline void
> putlong(p, l)
> void *p;
> unsigned long l;
> {
> unsigned char *cp = p;
>
> *cp++ = l;
> *cp++ = l >> 8;
> *cp++ = l >> 16;
> *cp++ = l >> 24;
> }
>
>
283,284c326,327
< partp->dp_start, partp->dp_size,
< partp->dp_size * 512 / (1024 * 1024), partp->dp_flag);
---
> getlong(&partp->dp_start), getlong(&partp->dp_size),
> getlong(&partp->dp_size) * 512 / (1024 * 1024), partp->dp_flag);
308c351
< mboot.signature = BOOT_MAGIC;
---
> putshort(&mboot.signature, BOOT_MAGIC);
313,314c356,357
< partp->dp_start = start;
< partp->dp_size = disksectors - start;
---
> putlong(&partp->dp_start, start);
> putlong(&partp->dp_size,disksectors - start);
316c359
< dos(partp->dp_start,
---
> dos(getlong(&partp->dp_start),
318c361
< dos(partp->dp_start + partp->dp_size - 1,
---
> dos(getlong(&partp->dp_start) + getlong(&partp->dp_size) - 1,
424c467
< *absolute = part->dp_start;
---
> *absolute = getlong(&part->dp_start);
429c472,473
< *absolute = part->dp_start + part->dp_size - 1;
---
> *absolute = getlong(&part->dp_start)
> + getlong(&part->dp_size) - 1;
456,457c500,501
< start = partp->dp_start,
< size = partp->dp_size;
---
> start = getlong(&partp->dp_start),
> size = getlong(&partp->dp_size);
462,463c506,507
< partp->dp_start = start;
< partp->dp_size = size;
---
> putlong(&partp->dp_start, start);
> putlong(&partp->dp_size, size);
488c532
< dos(partp->dp_start,
---
> dos(getlong(&partp->dp_start),
490c534,535
< dos(partp->dp_start + partp->dp_size - 1,
---
> dos(getlong(&partp->dp_start)
> + getlong(&partp->dp_size) - 1,
650,652c695,696
< if (mboot.signature != BOOT_MAGIC) {
< fprintf(stderr,
< "warning: invalid fdisk partition table found!\n");
---
> if (getshort(&mboot.signature) != BOOT_MAGIC) {
> warnx("invalid fdisk partition table found!\n");
|