More u_intXX_t -> uintXX_t Same code before and after.diff -r1.7 -r1.8 src/sys/arch/hp700/stand/mkboot/mkboot.c
(skrll)
--- src/sys/arch/hp700/stand/mkboot/Attic/mkboot.c 2009/03/18 16:00:11 1.7
+++ src/sys/arch/hp700/stand/mkboot/Attic/mkboot.c 2012/02/24 18:45:20 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: mkboot.c,v 1.7 2009/03/18 16:00:11 cegger Exp $ */ | 1 | /* $NetBSD: mkboot.c,v 1.8 2012/02/24 18:45:20 skrll Exp $ */ | |
2 | 2 | |||
3 | /* $OpenBSD: mkboot.c,v 1.9 2001/05/17 00:57:55 pvalchev Exp $ */ | 3 | /* $OpenBSD: mkboot.c,v 1.9 2001/05/17 00:57:55 pvalchev Exp $ */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (c) 1990, 1993 | 6 | * Copyright (c) 1990, 1993 | |
7 | * The Regents of the University of California. All rights reserved. | 7 | * The Regents of the University of California. All rights reserved. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -91,27 +91,27 @@ struct exec { | @@ -91,27 +91,27 @@ struct exec { | |||
91 | u_long a_entry; /* entry point */ | 91 | u_long a_entry; /* entry point */ | |
92 | u_long a_trsize; /* text relocation size */ | 92 | u_long a_trsize; /* text relocation size */ | |
93 | u_long a_drsize; /* data relocation size */ | 93 | u_long a_drsize; /* data relocation size */ | |
94 | }; | 94 | }; | |
95 | 95 | |||
96 | /* a_magic */ | 96 | /* a_magic */ | |
97 | #define OMAGIC 0407 /* old impure format */ | 97 | #define OMAGIC 0407 /* old impure format */ | |
98 | #define NMAGIC 0410 /* read-only text */ | 98 | #define NMAGIC 0410 /* read-only text */ | |
99 | #define ZMAGIC 0413 /* demand load format */ | 99 | #define ZMAGIC 0413 /* demand load format */ | |
100 | #define QMAGIC 0314 /* "compact" demand load format; deprecated */ | 100 | #define QMAGIC 0314 /* "compact" demand load format; deprecated */ | |
101 | 101 | |||
102 | #define N_GETMAGIC(ex) \ | 102 | #define N_GETMAGIC(ex) \ | |
103 | ((((ex).a_midmag)&0xffff0000) ? \ | 103 | ((((ex).a_midmag)&0xffff0000) ? \ | |
104 | (ntohl((u_int32_t)((ex).a_midmag))&0xffff) : ((ex).a_midmag)) | 104 | (ntohl((uint32_t)((ex).a_midmag))&0xffff) : ((ex).a_midmag)) | |
105 | 105 | |||
106 | #include <stdio.h> | 106 | #include <stdio.h> | |
107 | #include <ctype.h> | 107 | #include <ctype.h> | |
108 | 108 | |||
109 | int putfile(char *, int); | 109 | int putfile(char *, int); | |
110 | void __dead usage(void); | 110 | void __dead usage(void); | |
111 | void bcddate(char *, char *); | 111 | void bcddate(char *, char *); | |
112 | char *lifname(char *); | 112 | char *lifname(char *); | |
113 | int cksum(int, int *, int); | 113 | int cksum(int, int *, int); | |
114 | 114 | |||
115 | char *to_file; | 115 | char *to_file; | |
116 | int loadpoint, verbose; | 116 | int loadpoint, verbose; | |
117 | u_long entry; | 117 | u_long entry; |
--- src/sys/arch/hp700/stand/xxboot/Attic/iplsum.c 2011/02/21 02:31:57 1.5
+++ src/sys/arch/hp700/stand/xxboot/Attic/iplsum.c 2012/02/24 18:45:20 1.6
@@ -1,108 +1,108 @@ | @@ -1,108 +1,108 @@ | |||
1 | /* $NetBSD: iplsum.c,v 1.5 2011/02/21 02:31:57 itohy Exp $ */ | 1 | /* $NetBSD: iplsum.c,v 1.6 2012/02/24 18:45:20 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Calculate 32bit checksum of IPL and store in a certain location | 4 | * Calculate 32bit checksum of IPL and store in a certain location | |
5 | * | 5 | * | |
6 | * Written in 2003 by ITOH Yasufumi. | 6 | * Written in 2003 by ITOH Yasufumi. | |
7 | * Public domain | 7 | * Public domain | |
8 | */ | 8 | */ | |
9 | 9 | |||
10 | #include <sys/types.h> | 10 | #include <sys/types.h> | |
11 | #include <stdio.h> | 11 | #include <stdio.h> | |
12 | #include <string.h> | 12 | #include <string.h> | |
13 | #include <netinet/in.h> | 13 | #include <netinet/in.h> | |
14 | 14 | |||
15 | #ifndef __BIT_TYPES_DEFINED__ | 15 | #ifndef __BIT_TYPES_DEFINED__ | |
16 | typedef unsigned int u_int32_t; | 16 | typedef unsigned int uint32_t; | |
17 | #endif | 17 | #endif | |
18 | 18 | |||
19 | /* see README.ipl */ | 19 | /* see README.ipl */ | |
20 | #define IPLOFF (4*1024) /* 4KB */ | 20 | #define IPLOFF (4*1024) /* 4KB */ | |
21 | #define IPL1SIZE (4*1024) /* 4KB */ | 21 | #define IPL1SIZE (4*1024) /* 4KB */ | |
22 | #define IPL2SIZE (1*1024) /* 1KB */ | 22 | #define IPL2SIZE (1*1024) /* 1KB */ | |
23 | #define IPL2ONDISK 0x0400 | 23 | #define IPL2ONDISK 0x0400 | |
24 | #define IPL3SIZE (3*512) /* 1.5KB */ | 24 | #define IPL3SIZE (3*512) /* 1.5KB */ | |
25 | #define IPL3ONDISK 0x0A00 | 25 | #define IPL3ONDISK 0x0A00 | |
26 | #define IPLSIZE (IPL1SIZE + IPL2SIZE + IPL3SIZE) | 26 | #define IPLSIZE (IPL1SIZE + IPL2SIZE + IPL3SIZE) | |
27 | #define BOOTSIZE (IPLOFF + IPLSIZE) | 27 | #define BOOTSIZE (IPLOFF + IPLSIZE) | |
28 | #define BOOTBLOCKSIZE 8192 | 28 | #define BOOTBLOCKSIZE 8192 | |
29 | 29 | |||
30 | u_int32_t bootblk[BOOTSIZE / sizeof(u_int32_t) + 1]; | 30 | uint32_t bootblk[BOOTSIZE / sizeof(uint32_t) + 1]; | |
31 | 31 | |||
32 | #define SUMOFF ((IPLOFF + 4) / sizeof(u_int32_t)) | 32 | #define SUMOFF ((IPLOFF + 4) / sizeof(uint32_t)) | |
33 | 33 | |||
34 | #ifdef __STDC__ | 34 | #ifdef __STDC__ | |
35 | int main(int, char *[]); | 35 | int main(int, char *[]); | |
36 | #endif | 36 | #endif | |
37 | 37 | |||
38 | int | 38 | int | |
39 | main(int argc, char *argv[]) | 39 | main(int argc, char *argv[]) | |
40 | { | 40 | { | |
41 | FILE *fp; | 41 | FILE *fp; | |
42 | int len; | 42 | int len; | |
43 | u_int32_t sum, *p; | 43 | uint32_t sum, *p; | |
44 | int iploff, iplsumsize; | 44 | int iploff, iplsumsize; | |
45 | 45 | |||
46 | if (argc != 3) { | 46 | if (argc != 3) { | |
47 | fprintf(stderr, "usage: %s <input> <output>\n", argv[0]); | 47 | fprintf(stderr, "usage: %s <input> <output>\n", argv[0]); | |
48 | return 1; | 48 | return 1; | |
49 | } | 49 | } | |
50 | 50 | |||
51 | /* read file */ | 51 | /* read file */ | |
52 | if ((fp = fopen(argv[1], "rb")) == NULL) { | 52 | if ((fp = fopen(argv[1], "rb")) == NULL) { | |
53 | perror(argv[1]); | 53 | perror(argv[1]); | |
54 | return 1; | 54 | return 1; | |
55 | } | 55 | } | |
56 | if ((len = fread(bootblk, 1, sizeof bootblk, fp)) <= IPLOFF) { | 56 | if ((len = fread(bootblk, 1, sizeof bootblk, fp)) <= IPLOFF) { | |
57 | fprintf(stderr, "%s: too short\n", argv[1]); | 57 | fprintf(stderr, "%s: too short\n", argv[1]); | |
58 | return 1; | 58 | return 1; | |
59 | } else if (len > BOOTSIZE) { | 59 | } else if (len > BOOTSIZE) { | |
60 | fprintf(stderr, "%s: too long\n", argv[1]); | 60 | fprintf(stderr, "%s: too long\n", argv[1]); | |
61 | return 1; | 61 | return 1; | |
62 | } | 62 | } | |
63 | (void) fclose(fp); | 63 | (void) fclose(fp); | |
64 | 64 | |||
65 | /* sanity check */ | 65 | /* sanity check */ | |
66 | if ((ntohl(bootblk[0]) & 0xffff0000) != 0x80000000) { | 66 | if ((ntohl(bootblk[0]) & 0xffff0000) != 0x80000000) { | |
67 | fprintf(stderr, "%s: bad LIF magic\n", argv[1]); | 67 | fprintf(stderr, "%s: bad LIF magic\n", argv[1]); | |
68 | return 1; | 68 | return 1; | |
69 | } | 69 | } | |
70 | iploff = ntohl(bootblk[0xf0 / sizeof(u_int32_t)]); | 70 | iploff = ntohl(bootblk[0xf0 / sizeof(uint32_t)]); | |
71 | iplsumsize = ntohl(bootblk[0xf4 / sizeof(u_int32_t)]); | 71 | iplsumsize = ntohl(bootblk[0xf4 / sizeof(uint32_t)]); | |
72 | printf("%d bytes free, ipl offset = %d, ipl sum size = %d\n", | 72 | printf("%d bytes free, ipl offset = %d, ipl sum size = %d\n", | |
73 | BOOTSIZE - len, iploff, iplsumsize); | 73 | BOOTSIZE - len, iploff, iplsumsize); | |
74 | if (iploff != IPLOFF || iplsumsize <= 0 || iplsumsize % 2048 || | 74 | if (iploff != IPLOFF || iplsumsize <= 0 || iplsumsize % 2048 || | |
75 | iploff + iplsumsize > BOOTBLOCKSIZE) { | 75 | iploff + iplsumsize > BOOTBLOCKSIZE) { | |
76 | fprintf(stderr, "%s: bad ipl offset / size\n", argv[1]); | 76 | fprintf(stderr, "%s: bad ipl offset / size\n", argv[1]); | |
77 | return 1; | 77 | return 1; | |
78 | } | 78 | } | |
79 | 79 | |||
80 | /* checksum */ | 80 | /* checksum */ | |
81 | sum = 0; | 81 | sum = 0; | |
82 | for (p = bootblk + IPLOFF / sizeof(u_int32_t); | 82 | for (p = bootblk + IPLOFF / sizeof(uint32_t); | |
83 | p < bootblk + (IPLOFF + IPL1SIZE) / sizeof(u_int32_t); p++) | 83 | p < bootblk + (IPLOFF + IPL1SIZE) / sizeof(uint32_t); p++) | |
84 | sum += ntohl(*p); | 84 | sum += ntohl(*p); | |
85 | 85 | |||
86 | bootblk[SUMOFF] = htonl(ntohl(bootblk[SUMOFF]) - sum); | 86 | bootblk[SUMOFF] = htonl(ntohl(bootblk[SUMOFF]) - sum); | |
87 | 87 | |||
88 | /* transfer ipl part 2 */ | 88 | /* transfer ipl part 2 */ | |
89 | memcpy(bootblk + IPL2ONDISK / sizeof(u_int32_t), | 89 | memcpy(bootblk + IPL2ONDISK / sizeof(uint32_t), | |
90 | bootblk + (IPLOFF + IPL1SIZE) / sizeof(u_int32_t), | 90 | bootblk + (IPLOFF + IPL1SIZE) / sizeof(uint32_t), | |
91 | IPL2SIZE); | 91 | IPL2SIZE); | |
92 | 92 | |||
93 | /* transfer ipl part 3 */ | 93 | /* transfer ipl part 3 */ | |
94 | memcpy(bootblk + IPL3ONDISK / sizeof(u_int32_t), | 94 | memcpy(bootblk + IPL3ONDISK / sizeof(uint32_t), | |
95 | bootblk + (IPLOFF + IPL1SIZE + IPL2SIZE) / sizeof(u_int32_t), | 95 | bootblk + (IPLOFF + IPL1SIZE + IPL2SIZE) / sizeof(uint32_t), | |
96 | IPL3SIZE); | 96 | IPL3SIZE); | |
97 | 97 | |||
98 | /* write file */ | 98 | /* write file */ | |
99 | if ((fp = fopen(argv[2], "wb")) == NULL) { | 99 | if ((fp = fopen(argv[2], "wb")) == NULL) { | |
100 | perror(argv[2]); | 100 | perror(argv[2]); | |
101 | return 1; | 101 | return 1; | |
102 | } | 102 | } | |
103 | if ((len = fwrite(bootblk, 1, BOOTBLOCKSIZE, fp)) != BOOTBLOCKSIZE) { | 103 | if ((len = fwrite(bootblk, 1, BOOTBLOCKSIZE, fp)) != BOOTBLOCKSIZE) { | |
104 | if (len < 0) | 104 | if (len < 0) | |
105 | perror(argv[2]); | 105 | perror(argv[2]); | |
106 | else | 106 | else | |
107 | fprintf(stderr, "%s: short write\n", argv[2]); | 107 | fprintf(stderr, "%s: short write\n", argv[2]); | |
108 | fclose(fp); | 108 | fclose(fp); |
--- src/sys/arch/hp700/stand/xxboot/Attic/readufs.h 2011/02/21 02:31:57 1.5
+++ src/sys/arch/hp700/stand/xxboot/Attic/readufs.h 2012/02/24 18:45:20 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: readufs.h,v 1.5 2011/02/21 02:31:57 itohy Exp $ */ | 1 | /* $NetBSD: readufs.h,v 1.6 2012/02/24 18:45:20 skrll Exp $ */ | |
2 | /* from Id: readufs.h,v 1.10 2003/12/16 13:54:11 itohy Exp */ | 2 | /* from Id: readufs.h,v 1.10 2003/12/16 13:54:11 itohy Exp */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Written in 1999, 2002, 2003 by ITOH Yasufumi. | 5 | * Written in 1999, 2002, 2003 by ITOH Yasufumi. | |
6 | * Public domain. | 6 | * Public domain. | |
7 | */ | 7 | */ | |
8 | 8 | |||
9 | #include <sys/types.h> | 9 | #include <sys/types.h> | |
10 | #include <sys/param.h> | 10 | #include <sys/param.h> | |
11 | #include <ufs/ufs/dinode.h> | 11 | #include <ufs/ufs/dinode.h> | |
12 | #include <ufs/ufs/dir.h> | 12 | #include <ufs/ufs/dir.h> | |
13 | 13 | |||
14 | /* | 14 | /* | |
@@ -66,52 +66,52 @@ struct ufs_info { | @@ -66,52 +66,52 @@ struct ufs_info { | |||
66 | , UFSTYPE_LFS | 66 | , UFSTYPE_LFS | |
67 | #endif | 67 | #endif | |
68 | } fstype; | 68 | } fstype; | |
69 | #if defined(USE_UFS1) && defined(USE_UFS2) | 69 | #if defined(USE_UFS1) && defined(USE_UFS2) | |
70 | enum ufs_ufstype { | 70 | enum ufs_ufstype { | |
71 | UFSTYPE_UFS1, UFSTYPE_UFS2 | 71 | UFSTYPE_UFS1, UFSTYPE_UFS2 | |
72 | } ufstype; | 72 | } ufstype; | |
73 | #endif | 73 | #endif | |
74 | #if 0 | 74 | #if 0 | |
75 | int (*get_inode)(ino32_t ino, union ufs_dinode *dibuf); | 75 | int (*get_inode)(ino32_t ino, union ufs_dinode *dibuf); | |
76 | #endif | 76 | #endif | |
77 | 77 | |||
78 | /* superblock information */ | 78 | /* superblock information */ | |
79 | u_int32_t bsize; /* fs block size */ | 79 | uint32_t bsize; /* fs block size */ | |
80 | u_int32_t nindir; /* # indirect per block */ | 80 | uint32_t nindir; /* # indirect per block */ | |
81 | u_int32_t fsbtodb; /* block -> sector shift count */ | 81 | uint32_t fsbtodb; /* block -> sector shift count */ | |
82 | union { | 82 | union { | |
83 | #ifdef USE_FFS | 83 | #ifdef USE_FFS | |
84 | struct { | 84 | struct { | |
85 | daddr_t iblkno; /* inode-block offset */ | 85 | daddr_t iblkno; /* inode-block offset */ | |
86 | int32_t old_cgoffset; /* cylinder group offset */ | 86 | int32_t old_cgoffset; /* cylinder group offset */ | |
87 | int32_t old_cgmask; /* cylinder group mask */ | 87 | int32_t old_cgmask; /* cylinder group mask */ | |
88 | int32_t fragshift; /* block to fragmentation */ | 88 | int32_t fragshift; /* block to fragmentation */ | |
89 | int32_t inopb; /* # inodes per block */ | 89 | int32_t inopb; /* # inodes per block */ | |
90 | int32_t ipg; /* # inodes per group */ | 90 | int32_t ipg; /* # inodes per group */ | |
91 | int32_t fpg; /* # inodes per group * frag */ | 91 | int32_t fpg; /* # inodes per group * frag */ | |
92 | int32_t magic; /* FS_UFSx_MAGIC */ | 92 | int32_t magic; /* FS_UFSx_MAGIC */ | |
93 | } u_ffs; | 93 | } u_ffs; | |
94 | #endif | 94 | #endif | |
95 | #ifdef USE_LFS | 95 | #ifdef USE_LFS | |
96 | struct { | 96 | struct { | |
97 | u_int32_t version; /* LFS version # */ | 97 | uint32_t version; /* LFS version # */ | |
98 | daddr_t idaddr; /* ifile inode disk address */ | 98 | daddr_t idaddr; /* ifile inode disk address */ | |
99 | u_int32_t inopb; /* inodes per block (v1) */ | 99 | uint32_t inopb; /* inodes per block (v1) */ | |
100 | /* inodes per frag (v2) */ | 100 | /* inodes per frag (v2) */ | |
101 | u_int32_t ifpb; /* inode addrs / ifile block */ | 101 | uint32_t ifpb; /* inode addrs / ifile block */ | |
102 | u_int32_t ioffset; /* start of inode in ifile */ | 102 | uint32_t ioffset; /* start of inode in ifile */ | |
103 | /* (in sector) */ | 103 | /* (in sector) */ | |
104 | u_int32_t ibsize; /* size of inode block */ | 104 | uint32_t ibsize; /* size of inode block */ | |
105 | } u_lfs; | 105 | } u_lfs; | |
106 | #endif | 106 | #endif | |
107 | } fs_u; | 107 | } fs_u; | |
108 | }; | 108 | }; | |
109 | 109 | |||
110 | extern struct ufs_info ufs_info; | 110 | extern struct ufs_info ufs_info; | |
111 | 111 | |||
112 | int get_ffs_inode(ino32_t ino, union ufs_dinode *dibuf); | 112 | int get_ffs_inode(ino32_t ino, union ufs_dinode *dibuf); | |
113 | int get_lfs_inode(ino32_t ino, union ufs_dinode *dibuf); | 113 | int get_lfs_inode(ino32_t ino, union ufs_dinode *dibuf); | |
114 | #if defined(USE_FFS) && defined(USE_LFS) | 114 | #if defined(USE_FFS) && defined(USE_LFS) | |
115 | #define ufs_get_inode(ino, di) ((ufs_info.fstype == UFSTYPE_FFS) ? \ | 115 | #define ufs_get_inode(ino, di) ((ufs_info.fstype == UFSTYPE_FFS) ? \ | |
116 | get_ffs_inode((ino), (di)) : get_lfs_inode((ino), (di))) | 116 | get_ffs_inode((ino), (di)) : get_lfs_inode((ino), (di))) | |
117 | #else | 117 | #else |
--- src/sys/arch/hp700/stand/xxboot/Attic/main.c 2009/03/18 16:00:11 1.9
+++ src/sys/arch/hp700/stand/xxboot/Attic/main.c 2012/02/24 18:45:20 1.10
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: main.c,v 1.9 2009/03/18 16:00:11 cegger Exp $ */ | 1 | /* $NetBSD: main.c,v 1.10 2012/02/24 18:45:20 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2003 ITOH Yasufumi. | 4 | * Copyright (c) 2003 ITOH Yasufumi. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary forms are unlimited. | 12 | * 2. Redistributions in binary forms are unlimited. | |
13 | * | 13 | * | |
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' | 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' | |
@@ -376,43 +376,43 @@ xi_elf64(struct loadinfo *inf, Elf64_Ehd | @@ -376,43 +376,43 @@ xi_elf64(struct loadinfo *inf, Elf64_Ehd | |||
376 | inf->sec_size = (unsigned) ph->p_filesz; | 376 | inf->sec_size = (unsigned) ph->p_filesz; | |
377 | #if 0 | 377 | #if 0 | |
378 | inf->sec_pad = (unsigned) ph->p_memsz - (unsigned) ph->p_filesz; | 378 | inf->sec_pad = (unsigned) ph->p_memsz - (unsigned) ph->p_filesz; | |
379 | #endif | 379 | #endif | |
380 | /* entry */ | 380 | /* entry */ | |
381 | inf->entry_offset = (unsigned) hdr->e_entry - (unsigned) ph->p_vaddr; | 381 | inf->entry_offset = (unsigned) hdr->e_entry - (unsigned) ph->p_vaddr; | |
382 | } | 382 | } | |
383 | 383 | |||
384 | int | 384 | int | |
385 | xi_load(struct loadinfo *inf, void *buf) | 385 | xi_load(struct loadinfo *inf, void *buf) | |
386 | { | 386 | { | |
387 | Elf32_Ehdr *e32hdr = buf; | 387 | Elf32_Ehdr *e32hdr = buf; | |
388 | Elf64_Ehdr *e64hdr = buf; | 388 | Elf64_Ehdr *e64hdr = buf; | |
389 | u_int16_t class_data; | 389 | uint16_t class_data; | |
390 | 390 | |||
391 | /* | 391 | /* | |
392 | * check ELF header | 392 | * check ELF header | |
393 | * (optimized assuming big endian byte order) | 393 | * (optimized assuming big endian byte order) | |
394 | */ | 394 | */ | |
395 | /* ELF magic */ | 395 | /* ELF magic */ | |
396 | if (*(u_int32_t *)&e32hdr->e_ident[EI_MAG0] != | 396 | if (*(uint32_t *)&e32hdr->e_ident[EI_MAG0] != | |
397 | (ELFMAG0 << 24 | ELFMAG1 << 16 | ELFMAG2 << 8 | ELFMAG3) || | 397 | (ELFMAG0 << 24 | ELFMAG1 << 16 | ELFMAG2 << 8 | ELFMAG3) || | |
398 | e32hdr->e_ident[EI_VERSION] != EV_CURRENT) | 398 | e32hdr->e_ident[EI_VERSION] != EV_CURRENT) | |
399 | return 1; /* Not an ELF */ | 399 | return 1; /* Not an ELF */ | |
400 | 400 | |||
401 | /* file and machine type */ | 401 | /* file and machine type */ | |
402 | if (*(u_int32_t *)&e32hdr->e_type != (ET_EXEC << 16 | EM_PARISC)) | 402 | if (*(uint32_t *)&e32hdr->e_type != (ET_EXEC << 16 | EM_PARISC)) | |
403 | return 1; /* Not an executable / Wrong architecture */ | 403 | return 1; /* Not an executable / Wrong architecture */ | |
404 | 404 | |||
405 | if ((class_data = *(u_int16_t *)&e32hdr->e_ident[EI_CLASS]) == | 405 | if ((class_data = *(uint16_t *)&e32hdr->e_ident[EI_CLASS]) == | |
406 | (ELFCLASS32 << 8 | ELFDATA2MSB)) { | 406 | (ELFCLASS32 << 8 | ELFDATA2MSB)) { | |
407 | 407 | |||
408 | /* support one section executable (ld -N) only */ | 408 | /* support one section executable (ld -N) only */ | |
409 | if (e32hdr->e_phnum != 1) | 409 | if (e32hdr->e_phnum != 1) | |
410 | return 1; /* Wrong number of loading sections */ | 410 | return 1; /* Wrong number of loading sections */ | |
411 | 411 | |||
412 | /* fill in loading information */ | 412 | /* fill in loading information */ | |
413 | xi_elf32(inf, e32hdr); | 413 | xi_elf32(inf, e32hdr); | |
414 | 414 | |||
415 | } else if (class_data == (ELFCLASS64 << 8 | ELFDATA2MSB)) { | 415 | } else if (class_data == (ELFCLASS64 << 8 | ELFDATA2MSB)) { | |
416 | 416 | |||
417 | /* support one section executable (ld -N) only */ | 417 | /* support one section executable (ld -N) only */ | |
418 | if (e64hdr->e_phnum != 1) | 418 | if (e64hdr->e_phnum != 1) |