-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedumpfile.h
2387 lines (2115 loc) · 66.5 KB
/
makedumpfile.h
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* makedumpfile.h
*
* Copyright (C) 2006, 2007, 2008, 2009, 2011 NEC Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _MAKEDUMPFILE_H
#define _MAKEDUMPFILE_H
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <gelf.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <zlib.h>
#include <libelf.h>
#include <byteswap.h>
#include <getopt.h>
#include <sys/mman.h>
#ifdef USELZO
#include <lzo/lzo1x.h>
#endif
#ifdef USESNAPPY
#include <snappy-c.h>
#endif
#include "common.h"
#include "dwarf_info.h"
#include "diskdump_mod.h"
#include "print_info.h"
#include "sadump_mod.h"
#include <pthread.h>
#include <semaphore.h>
#include <inttypes.h>
#define VMEMMAPSTART 0xffffea0000000000UL
#define BITS_PER_WORD 64
/*
* Result of command
*/
#define COMPLETED (0)
#define FAILED (1)
#define WRONG_RELEASE (2) /* utsname.release does not match. */
/*
* Type of memory management
*/
enum {
NOT_FOUND_MEMTYPE,
SPARSEMEM,
SPARSEMEM_EX,
DISCONTIGMEM,
FLATMEM
};
int get_mem_type(void);
/*
* Page flags
*
* The flag values of page.flags have been defined by enum since linux-2.6.26.
* The following values are for linux-2.6.25 or former.
*/
#define PG_lru_ORIGINAL (5)
#define PG_slab_ORIGINAL (7)
#define PG_private_ORIGINAL (11) /* Has something at ->private */
#define PG_compound_ORIGINAL (14) /* Is part of a compound page */
#define PG_swapcache_ORIGINAL (15) /* Swap page: swp_entry_t in private */
#define PAGE_BUDDY_MAPCOUNT_VALUE_v2_6_38 (-2)
#define PAGE_BUDDY_MAPCOUNT_VALUE_v2_6_39_to_latest_version (-128)
#define PAGE_FLAGS_SIZE_v2_6_27_to_latest_version (4)
#define PAGE_MAPPING_ANON (1)
#define LSEEKED_BITMAP (1)
#define LSEEKED_PDESC (2)
#define LSEEKED_PDATA (3)
/*
* Xen page flags
*/
#define BITS_PER_LONG (BITPERBYTE * sizeof(long))
#define PG_shift(idx) (BITS_PER_LONG - (idx))
#define PG_mask(x, idx) (x ## UL << PG_shift(idx))
/* Cleared when the owning guest 'frees' this page. */
#define PGC_allocated PG_mask(1, 1)
/* Page is Xen heap? */
#define PGC_xen_heap PG_mask(1, 2)
/* Page is broken? */
#define PGC_broken PG_mask(1, 7)
/* Mutually-exclusive page states: { inuse, offlining, offlined, free }. */
#define PGC_state PG_mask(3, 9)
#define PGC_state_inuse PG_mask(0, 9)
#define PGC_state_offlining PG_mask(1, 9)
#define PGC_state_offlined PG_mask(2, 9)
#define PGC_state_free PG_mask(3, 9)
#define page_state_is(ci, st) (((ci)&PGC_state) == PGC_state_##st)
/* Count of references to this frame. */
#define PGC_count_width PG_shift(9)
#define PGC_count_mask ((1UL<<PGC_count_width)-1)
/*
* Memory flags
*/
#define MEMORY_PAGETABLE_4L (1 << 0)
#define MEMORY_PAGETABLE_3L (1 << 1)
#define MEMORY_X86_PAE (1 << 2)
/*
* Type of address
*/
enum {
VADDR,
PADDR,
VADDR_XEN,
};
/*
* State of mmap(2)
*/
enum {
MMAP_DISABLE,
MMAP_TRY,
MMAP_ENABLE,
};
static inline int
test_bit(int nr, unsigned long addr)
{
int mask;
mask = 1 << (nr & 0x1f);
return ((mask & addr) != 0);
}
#define isLRU(flags) test_bit(NUMBER(PG_lru), flags)
#define isPrivate(flags) test_bit(NUMBER(PG_private), flags)
#define isCompoundHead(flags) (!!((flags) & NUMBER(PG_head_mask)))
#define isSwapCache(flags) test_bit(NUMBER(PG_swapcache), flags)
#define isSwapBacked(flags) test_bit(NUMBER(PG_swapbacked), flags)
#define isHWPOISON(flags) (test_bit(NUMBER(PG_hwpoison), flags) \
&& (NUMBER(PG_hwpoison) != NOT_FOUND_NUMBER))
static inline int
isAnon(unsigned long mapping)
{
return ((unsigned long)mapping & PAGE_MAPPING_ANON) != 0;
}
#define PTOB(X) (((unsigned long long)(X)) << PAGESHIFT())
#define BTOP(X) (((unsigned long long)(X)) >> PAGESHIFT())
#define PAGESIZE() (info->page_size)
#define PAGESHIFT() (info->page_shift)
#define PAGEOFFSET(X) (((unsigned long long)(X)) & (PAGESIZE() - 1))
#define PAGEBASE(X) (((unsigned long long)(X)) & ~(PAGESIZE() - 1))
/*
* for SPARSEMEM
*/
#define SECTION_SIZE_BITS() (info->section_size_bits)
#define MAX_PHYSMEM_BITS() (info->max_physmem_bits)
#define PFN_SECTION_SHIFT() (SECTION_SIZE_BITS() - PAGESHIFT())
#define PAGES_PER_SECTION() (1UL << PFN_SECTION_SHIFT())
#define _SECTIONS_PER_ROOT() (1)
#define _SECTIONS_PER_ROOT_EXTREME() (info->page_size / SIZE(mem_section))
#define SECTIONS_PER_ROOT() (info->sections_per_root)
#define SECTION_ROOT_MASK() (SECTIONS_PER_ROOT() - 1)
#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT())
#define SECTION_MARKED_PRESENT (1UL<<0)
#define SECTION_IS_ONLINE (1UL<<2)
/*
* SECTION_MAP_LAST_BIT was 1UL<<2 before Linux 4.13.0.
* However, we always use the higher value, because:
* 1. at least one distributor backported commit 2d070eab2e82 to kernel
* version 4.12,
* 2. it has been verified that (1UL<<2) was never set, so it is
* safe to mask that bit off even in old kernels.
*/
#define SECTION_MAP_LAST_BIT (1UL<<3)
#define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
#define NR_SECTION_ROOTS() divideup(num_section, SECTIONS_PER_ROOT())
#define SECTION_NR_TO_PFN(sec) ((sec) << PFN_SECTION_SHIFT())
#define SECTIONS_SHIFT() (MAX_PHYSMEM_BITS() - SECTION_SIZE_BITS())
#define NR_MEM_SECTIONS() (1UL << SECTIONS_SHIFT())
/*
* Dump Level
*/
#define MIN_DUMP_LEVEL (0)
#define MAX_DUMP_LEVEL (31)
#define NUM_ARRAY_DUMP_LEVEL (MAX_DUMP_LEVEL + 1) /* enough to allocate
all the dump_level */
#define DL_EXCLUDE_ZERO (0x001) /* Exclude Pages filled with Zeros */
#define DL_EXCLUDE_CACHE (0x002) /* Exclude Cache Pages
without Private Pages */
#define DL_EXCLUDE_CACHE_PRI (0x004) /* Exclude Cache Pages
with Private Pages */
#define DL_EXCLUDE_USER_DATA (0x008) /* Exclude UserProcessData Pages */
#define DL_EXCLUDE_FREE (0x010) /* Exclude Free Pages */
/*
* For parse_line()
*/
#define NULLCHAR ('\0')
#define MAXARGS (100) /* max number of arguments to one function */
#define LASTCHAR(s) (s[strlen(s)-1])
#define BITPERBYTE (8)
#define PGMM_CACHED (512)
#define PFN_EXCLUDED (256)
#define BUFSIZE (1024)
#define BUFSIZE_FGETS (1500)
#define BUFSIZE_BITMAP (4096)
#define PFN_BUFBITMAP (BITPERBYTE*BUFSIZE_BITMAP)
#define FILENAME_BITMAP "kdump_bitmapXXXXXX"
#define FILENAME_STDOUT "STDOUT"
#define MAP_REGION (4096*1024)
/*
* Minimam vmcore has 2 ProgramHeaderTables(PT_NOTE and PT_LOAD).
*/
#define MIN_ELF32_HEADER_SIZE \
sizeof(Elf32_Ehdr)+sizeof(Elf32_Phdr)+sizeof(Elf32_Phdr)
#define MIN_ELF64_HEADER_SIZE \
sizeof(Elf64_Ehdr)+sizeof(Elf64_Phdr)+sizeof(Elf64_Phdr)
#define MIN_ELF_HEADER_SIZE \
MAX(MIN_ELF32_HEADER_SIZE, MIN_ELF64_HEADER_SIZE)
static inline int string_exists(char *s) { return (s ? TRUE : FALSE); }
#define STREQ(A, B) (string_exists((char *)A) && \
string_exists((char *)B) && \
(strcmp((char *)(A), (char *)(B)) == 0))
#define STRNEQ(A, B)(string_exists((char *)(A)) && \
string_exists((char *)(B)) && \
(strncmp((char *)(A), (char *)(B), strlen((char *)(B))) == 0))
#define UCHAR(ADDR) *((unsigned char *)(ADDR))
#define USHORT(ADDR) *((unsigned short *)(ADDR))
#define UINT(ADDR) *((unsigned int *)(ADDR))
#define ULONG(ADDR) *((unsigned long *)(ADDR))
#define ULONGLONG(ADDR) *((unsigned long long *)(ADDR))
/*
* for symbol
*/
#define INVALID_SYMBOL_DATA (ULONG_MAX)
#define SYMBOL(X) (symbol_table.X)
#define SYMBOL_INIT(symbol, str_symbol) \
do { \
SYMBOL(symbol) = get_symbol_addr(str_symbol); \
if (SYMBOL(symbol) != NOT_FOUND_SYMBOL) \
SYMBOL(symbol) += info->kaslr_offset; \
} while (0)
#define SYMBOL_INIT_NEXT(symbol, str_symbol) \
do { \
SYMBOL(symbol) = get_next_symbol_addr(str_symbol); \
if (SYMBOL(symbol) != NOT_FOUND_SYMBOL) \
SYMBOL(symbol) += info->kaslr_offset; \
} while (0)
#define WRITE_SYMBOL(str_symbol, symbol) \
do { \
if (SYMBOL(symbol) != NOT_FOUND_SYMBOL) { \
fprintf(info->file_vmcoreinfo, "%s%llx\n", \
STR_SYMBOL(str_symbol), SYMBOL(symbol)); \
} \
} while (0)
#define READ_SYMBOL(str_symbol, symbol) \
do { \
if (SYMBOL(symbol) == NOT_FOUND_SYMBOL) { \
SYMBOL(symbol) = read_vmcoreinfo_symbol(STR_SYMBOL(str_symbol)); \
if (SYMBOL(symbol) == INVALID_SYMBOL_DATA) \
return FALSE; \
if (info->read_text_vmcoreinfo && \
(SYMBOL(symbol) != NOT_FOUND_SYMBOL) && \
(SYMBOL(symbol) != INVALID_SYMBOL_DATA)) \
SYMBOL(symbol) += info->kaslr_offset; \
} \
} while (0)
/*
* for structure
*/
#define SIZE(X) (size_table.X)
#define OFFSET(X) (offset_table.X)
#define ARRAY_LENGTH(X) (array_table.X)
#define SIZE_INIT(X, Y) \
do { \
if ((SIZE(X) = get_structure_size(Y, DWARF_INFO_GET_STRUCT_SIZE)) \
== FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define TYPEDEF_SIZE_INIT(X, Y) \
do { \
if ((SIZE(X) = get_structure_size(Y, DWARF_INFO_GET_TYPEDEF_SIZE)) \
== FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define ENUM_TYPE_SIZE_INIT(X, Y) \
do { \
if ((SIZE(X) = get_structure_size(Y, \
DWARF_INFO_GET_ENUMERATION_TYPE_SIZE)) \
== FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define OFFSET_INIT(X, Y, Z) \
do { \
if ((OFFSET(X) = get_member_offset(Y, Z, DWARF_INFO_GET_MEMBER_OFFSET)) \
== FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define SYMBOL_ARRAY_LENGTH_INIT(X, Y) \
do { \
if ((ARRAY_LENGTH(X) = get_array_length(Y, NULL, DWARF_INFO_GET_SYMBOL_ARRAY_LENGTH)) == FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define SYMBOL_ARRAY_TYPE_INIT(X, Y) \
do { \
if ((ARRAY_LENGTH(X) = get_array_length(Y, NULL, DWARF_INFO_CHECK_SYMBOL_ARRAY_TYPE)) == FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define MEMBER_ARRAY_LENGTH_INIT(X, Y, Z) \
do { \
if ((ARRAY_LENGTH(X) = get_array_length(Y, Z, DWARF_INFO_GET_MEMBER_ARRAY_LENGTH)) == FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define WRITE_STRUCTURE_SIZE(str_structure, structure) \
do { \
if (SIZE(structure) != NOT_FOUND_STRUCTURE) { \
fprintf(info->file_vmcoreinfo, "%s%ld\n", \
STR_SIZE(str_structure), SIZE(structure)); \
} \
} while (0)
#define WRITE_MEMBER_OFFSET(str_member, member) \
do { \
if (OFFSET(member) != NOT_FOUND_STRUCTURE) { \
fprintf(info->file_vmcoreinfo, "%s%ld\n", \
STR_OFFSET(str_member), OFFSET(member)); \
} \
} while (0)
#define WRITE_ARRAY_LENGTH(str_array, array) \
do { \
if (ARRAY_LENGTH(array) != NOT_FOUND_STRUCTURE) { \
fprintf(info->file_vmcoreinfo, "%s%ld\n", \
STR_LENGTH(str_array), ARRAY_LENGTH(array)); \
} \
} while (0)
#define READ_STRUCTURE_SIZE(str_structure, structure) \
do { \
if (SIZE(structure) == NOT_FOUND_STRUCTURE) { \
SIZE(structure) = read_vmcoreinfo_long(STR_SIZE(str_structure)); \
if (SIZE(structure) == INVALID_STRUCTURE_DATA) \
return FALSE; \
} \
} while (0)
#define READ_MEMBER_OFFSET(str_member, member) \
do { \
if (OFFSET(member) == NOT_FOUND_STRUCTURE) { \
OFFSET(member) = read_vmcoreinfo_long(STR_OFFSET(str_member)); \
if (OFFSET(member) == INVALID_STRUCTURE_DATA) \
return FALSE; \
} \
} while (0)
#define READ_ARRAY_LENGTH(str_array, array) \
do { \
if (ARRAY_LENGTH(array) == NOT_FOUND_STRUCTURE) { \
ARRAY_LENGTH(array) = read_vmcoreinfo_long(STR_LENGTH(str_array)); \
if (ARRAY_LENGTH(array) == INVALID_STRUCTURE_DATA) \
return FALSE; \
} \
} while (0)
/*
* for number
*/
#define NUMBER(X) (number_table.X)
#define ENUM_NUMBER_INIT(number, str_number) \
do {\
NUMBER(number) = get_enum_number(str_number); \
if (NUMBER(number) == FAILED_DWARFINFO) \
return FALSE; \
} while (0)
#define WRITE_NUMBER(str_number, number) \
do { \
if (NUMBER(number) != NOT_FOUND_NUMBER) { \
fprintf(info->file_vmcoreinfo, "%s%ld\n", \
STR_NUMBER(str_number), NUMBER(number)); \
} \
} while (0)
#define READ_NUMBER(str_number, number) \
do { \
if (NUMBER(number) == NOT_FOUND_NUMBER) { \
NUMBER(number) = read_vmcoreinfo_long(STR_NUMBER(str_number)); \
if (NUMBER(number) == INVALID_STRUCTURE_DATA) \
return FALSE; \
} \
} while (0)
#define WRITE_NUMBER_UNSIGNED(str_number, number) \
do { \
if (NUMBER(number) != NOT_FOUND_NUMBER) { \
fprintf(info->file_vmcoreinfo, "%s%lu\n", \
STR_NUMBER(str_number), NUMBER(number)); \
} \
} while (0)
#define READ_NUMBER_UNSIGNED(str_number, number) \
do { \
if (NUMBER(number) == NOT_FOUND_NUMBER) { \
NUMBER(number) = read_vmcoreinfo_ulong(STR_NUMBER(str_number)); \
if (NUMBER(number) == INVALID_STRUCTURE_DATA) \
return FALSE; \
} \
} while (0)
/*
* for source file name
*/
#define SRCFILE(X) (srcfile_table.X)
#define TYPEDEF_SRCFILE_INIT(decl_name, str_decl_name) \
do { \
get_source_filename(str_decl_name, SRCFILE(decl_name), DWARF_INFO_GET_TYPEDEF_SRCNAME); \
} while (0)
#define WRITE_SRCFILE(str_decl_name, decl_name) \
do { \
if (strlen(SRCFILE(decl_name))) { \
fprintf(info->file_vmcoreinfo, "%s%s\n", \
STR_SRCFILE(str_decl_name), SRCFILE(decl_name)); \
} \
} while (0)
#define READ_SRCFILE(str_decl_name, decl_name) \
do { \
if (strlen(SRCFILE(decl_name)) == 0) { \
if (!read_vmcoreinfo_string(STR_SRCFILE(str_decl_name), SRCFILE(decl_name))) \
return FALSE; \
} \
} while (0)
/*
* Macro for getting splitting info.
*/
#define SPLITTING_DUMPFILE(i) info->splitting_info[i].name_dumpfile
#define SPLITTING_FD_BITMAP(i) info->splitting_info[i].fd_bitmap
#define SPLITTING_START_PFN(i) info->splitting_info[i].start_pfn
#define SPLITTING_END_PFN(i) info->splitting_info[i].end_pfn
#define SPLITTING_OFFSET_EI(i) info->splitting_info[i].offset_eraseinfo
#define SPLITTING_SIZE_EI(i) info->splitting_info[i].size_eraseinfo
/*
* Macro for getting parallel info.
*/
#define FD_MEMORY_PARALLEL(i) info->parallel_info[i].fd_memory
#define FD_BITMAP_MEMORY_PARALLEL(i) info->parallel_info[i].fd_bitmap_memory
#define FD_BITMAP_PARALLEL(i) info->parallel_info[i].fd_bitmap
#define BUF_PARALLEL(i) info->parallel_info[i].buf
#define BUF_OUT_PARALLEL(i) info->parallel_info[i].buf_out
#define MMAP_CACHE_PARALLEL(i) info->parallel_info[i].mmap_cache
#define ZLIB_STREAM_PARALLEL(i) info->parallel_info[i].zlib_stream
#ifdef USELZO
#define WRKMEM_PARALLEL(i) info->parallel_info[i].wrkmem
#endif
/*
* kernel version
*
* NOTE: the format of kernel_version is as follows
* 8 bits major version
* 8 bits minor version
* 16 bits release
* so version 2.6.18 would be encoded as 0x02060012
* These macros will let us decode that easier
*/
#define KVER_MAJ_SHIFT 24
#define KVER_MIN_SHIFT 16
#define KERNEL_VERSION(x,y,z) (((x) << KVER_MAJ_SHIFT) | ((y) << KVER_MIN_SHIFT) | (z))
#define OLDEST_VERSION KERNEL_VERSION(2, 6, 15) /* linux-2.6.15 */
#define LATEST_VERSION KERNEL_VERSION(4, 19, 4) /* linux-4.19.4 */
/*
* vmcoreinfo in /proc/vmcore
*/
#define VMCOREINFO_BYTES (4096)
#define FILENAME_VMCOREINFO "/tmp/vmcoreinfoXXXXXX"
/*
* field name of vmcoreinfo file
*/
#define STR_OSRELEASE "OSRELEASE="
#define STR_PAGESIZE "PAGESIZE="
#define STR_CRASHTIME "CRASHTIME="
#define STR_SYMBOL(X) "SYMBOL("X")="
#define STR_SIZE(X) "SIZE("X")="
#define STR_OFFSET(X) "OFFSET("X")="
#define STR_LENGTH(X) "LENGTH("X")="
#define STR_NUMBER(X) "NUMBER("X")="
#define STR_SRCFILE(X) "SRCFILE("X")="
#define STR_CONFIG_X86_PAE "CONFIG_X86_PAE=y"
#define STR_CONFIG_PGTABLE_4 "CONFIG_PGTABLE_4=y"
#define STR_CONFIG_PGTABLE_3 "CONFIG_PGTABLE_3=y"
#define STR_KERNELOFFSET "KERNELOFFSET="
/*
* common value
*/
#define NOSPACE (-1) /* code of write-error due to nospace */
#define DEFAULT_ORDER (4)
#define TIMEOUT_STDIN (600)
#define SIZE_BUF_STDIN (4096)
#define STRLEN_OSRELEASE (65) /* same length as diskdump.h */
/*
* The value of dependence on machine
*/
#define PAGE_OFFSET (info->page_offset)
#define VMALLOC_START (info->vmalloc_start)
#define VMALLOC_END (info->vmalloc_end)
#define VMEMMAP_START (info->vmemmap_start)
#define VMEMMAP_END (info->vmemmap_end)
#define PMASK (0x7ffffffffffff000UL)
#ifdef __aarch64__
unsigned long get_kvbase_arm64(void);
#define KVBASE get_kvbase_arm64()
#define __START_KERNEL_map (0xffffffff80000000UL)
#endif /* aarch64 */
#ifdef __arm__
#define KVBASE_MASK (0xffff)
#define KVBASE (SYMBOL(_stext) & ~KVBASE_MASK)
#define _SECTION_SIZE_BITS (28)
#define _MAX_PHYSMEM_BITS (32)
#define ARCH_PFN_OFFSET (info->phys_base >> PAGESHIFT())
#define PTRS_PER_PTE (512)
#define PGDIR_SHIFT (21)
#define PMD_SHIFT (21)
#define PMD_SIZE (1UL << PMD_SHIFT)
#define PMD_MASK (~(PMD_SIZE - 1))
#define _PAGE_PRESENT (1 << 0)
#endif /* arm */
#ifdef __x86__
#define __PAGE_OFFSET (0xc0000000)
#define __VMALLOC_RESERVE (128 << 20)
#define MAXMEM (-PAGE_OFFSET-__VMALLOC_RESERVE)
#define KVBASE_MASK (0x7fffff)
#define KVBASE (SYMBOL(_stext) & ~KVBASE_MASK)
#define _SECTION_SIZE_BITS (26)
#define _SECTION_SIZE_BITS_PAE_ORIG (30)
#define _SECTION_SIZE_BITS_PAE_2_6_26 (29)
#define _MAX_PHYSMEM_BITS (32)
#define _MAX_PHYSMEM_BITS_PAE (36)
#define PGDIR_SHIFT_3LEVEL (30)
#define PTRS_PER_PTE_3LEVEL (512)
#define PTRS_PER_PGD_3LEVEL (4)
#define PMD_SHIFT (21) /* only used by PAE translators */
#define PTRS_PER_PMD (512) /* only used by PAE translators */
#define PTE_SHIFT (12) /* only used by PAE translators */
#define PTRS_PER_PTE (512) /* only used by PAE translators */
#define pgd_index_PAE(address) (((address) >> PGDIR_SHIFT_3LEVEL) & (PTRS_PER_PGD_3LEVEL - 1))
#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
#define pte_index(address) (((address) >> PTE_SHIFT) & (PTRS_PER_PTE - 1))
#define _PAGE_PRESENT (0x001)
#define _PAGE_PSE (0x080)
/* Physical addresses are up to 52 bits (AMD64).
* Mask off bits 52-62 (reserved) and bit 63 (NX).
*/
#define ENTRY_MASK (~0xfff0000000000fffULL)
#endif /* x86 */
#ifdef __x86_64__
#define __PAGE_OFFSET_ORIG (0xffff810000000000) /* 2.6.26, or former */
#define __PAGE_OFFSET_2_6_27 (0xffff880000000000) /* 2.6.27, or later */
#define __PAGE_OFFSET_5LEVEL (0xff10000000000000) /* 5-level page table */
#define VMALLOC_START_ORIG (0xffffc20000000000) /* 2.6.30, or former */
#define VMALLOC_START_2_6_31 (0xffffc90000000000) /* 2.6.31, or later */
#define VMALLOC_START_5LEVEL (0xffa0000000000000) /* 5-level page table */
#define VMALLOC_END_ORIG (0xffffe1ffffffffff) /* 2.6.30, or former */
#define VMALLOC_END_2_6_31 (0xffffe8ffffffffff) /* 2.6.31, or later */
#define VMALLOC_END_5LEVEL (0xffd1ffffffffffff) /* 5-level page table */
#define VMEMMAP_START_ORIG (0xffffe20000000000) /* 2.6.30, or former */
#define VMEMMAP_START_2_6_31 (0xffffea0000000000) /* 2.6.31, or later */
#define VMEMMAP_START_5LEVEL (0xffd4000000000000) /* 5-level page table */
#define VMEMMAP_END_ORIG (0xffffe2ffffffffff) /* 2.6.30, or former */
#define VMEMMAP_END_2_6_31 (0xffffeaffffffffff) /* 2.6.31, or later */
#define VMEMMAP_END_5LEVEL (0xffd5ffffffffffff) /* 5-level page table */
#define __START_KERNEL_map (0xffffffff80000000)
#define KVBASE PAGE_OFFSET
#define _SECTION_SIZE_BITS (27)
#define _MAX_PHYSMEM_BITS_ORIG (40)
#define _MAX_PHYSMEM_BITS_2_6_26 (44)
#define _MAX_PHYSMEM_BITS_2_6_31 (46)
#define _MAX_PHYSMEM_BITS_5LEVEL (52)
/*
* 4 Levels paging
*/
#define PGD_SHIFT (39)
#define PUD_SHIFT (30)
#define PMD_SHIFT (21)
#define PTE_SHIFT (12)
#define PTRS_PER_PGD (512)
#define PTRS_PER_PUD (512)
#define PTRS_PER_PMD (512)
#define PTRS_PER_PTE (512)
#define PUD_SIZE (1UL << PUD_SHIFT)
#define PUD_MASK (~(PUD_SIZE - 1))
#define PMD_SIZE (1UL << PMD_SHIFT)
#define PMD_MASK (~(PMD_SIZE - 1))
/*
* 5 Levels paging
*/
#define PGD_SHIFT_5LEVEL (48)
#define P4D_SHIFT (39)
#define PTRS_PER_PGD_5LEVEL (512)
#define PTRS_PER_P4D (512)
#define pgd5_index(address) (((address) >> PGD_SHIFT_5LEVEL) & (PTRS_PER_PGD_5LEVEL - 1))
#define pgd_index(address) (((address) >> PGD_SHIFT) & (PTRS_PER_PGD - 1))
#define p4d_index(address) (((address) >> P4D_SHIFT) & (PTRS_PER_P4D - 1))
#define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
#define pte_index(address) (((address) >> PTE_SHIFT) & (PTRS_PER_PTE - 1))
#define _PAGE_PRESENT (0x001)
#define _PAGE_PSE (0x080) /* 2MB or 1GB page */
#endif /* x86_64 */
#ifdef __powerpc64__
#define __PAGE_OFFSET (0xc000000000000000)
#define KERNELBASE PAGE_OFFSET
#define VMALLOCBASE (0xD000000000000000)
#define KVBASE (SYMBOL(_stext))
#define _SECTION_SIZE_BITS (24)
#define _MAX_PHYSMEM_BITS_ORIG (44)
#define _MAX_PHYSMEM_BITS_3_7 (46)
#define _MAX_PHYSMEM_BITS_4_19 (47)
#define REGION_SHIFT (60UL)
#define VMEMMAP_REGION_ID (0xfUL)
/* 4-level page table support */
/* 4K pagesize */
#define PTE_INDEX_SIZE_L4_4K 9
#define PMD_INDEX_SIZE_L4_4K 7
#define PUD_INDEX_SIZE_L4_4K 7
#define PGD_INDEX_SIZE_L4_4K 9
#define PUD_INDEX_SIZE_L4_4K_3_7 9
#define PTE_INDEX_SIZE_RADIX_4K 9
#define PMD_INDEX_SIZE_RADIX_4K 9
#define PUD_INDEX_SIZE_RADIX_4K 9
#define PGD_INDEX_SIZE_RADIX_4K 13
#define PTE_RPN_SHIFT_L4_4K 17
#define PTE_RPN_SHIFT_L4_4K_4_5 18
#define PGD_MASKED_BITS_4K 0
#define PUD_MASKED_BITS_4K 0
#define PMD_MASKED_BITS_4K 0
/* 64K pagesize */
#define PTE_INDEX_SIZE_L4_64K 12
#define PMD_INDEX_SIZE_L4_64K 12
#define PUD_INDEX_SIZE_L4_64K 0
#define PGD_INDEX_SIZE_L4_64K 4
#define PTE_INDEX_SIZE_L4_64K_3_10 8
#define PMD_INDEX_SIZE_L4_64K_3_10 10
#define PGD_INDEX_SIZE_L4_64K_3_10 12
#define PMD_INDEX_SIZE_L4_64K_4_6 5
#define PUD_INDEX_SIZE_L4_64K_4_6 5
#define PMD_INDEX_SIZE_L4_64K_4_12 10
#define PUD_INDEX_SIZE_L4_64K_4_12 7
#define PGD_INDEX_SIZE_L4_64K_4_12 8
#define PUD_INDEX_SIZE_L4_64K_4_17 10
#define PTE_INDEX_SIZE_RADIX_64K 5
#define PMD_INDEX_SIZE_RADIX_64K 9
#define PUD_INDEX_SIZE_RADIX_64K 9
#define PGD_INDEX_SIZE_RADIX_64K 13
#define PTE_RPN_SHIFT_L4_64K_V1 32
#define PTE_RPN_SHIFT_L4_64K_V2 30
#define PGD_MASKED_BITS_64K 0
#define PUD_MASKED_BITS_64K 0x1ff
#define PMD_MASKED_BITS_64K 0x1ff
#define PMD_MASKED_BITS_64K_3_11 0xfff
#define PGD_MASKED_BITS_64K_4_6 0xc0000000000000ffUL
#define PUD_MASKED_BITS_64K_4_6 0xc0000000000000ffUL
#define PMD_MASKED_BITS_64K_4_6 0xc0000000000000ffUL
#define PTE_RPN_MASK_DEFAULT 0xffffffffffffffffUL
#define PTE_RPN_SIZE_L4_4_6 (info->page_size == 65536 ? 41 : 45)
#define PTE_RPN_MASK_L4_4_6 (((1UL << PTE_RPN_SIZE_L4_4_6) - 1) << info->page_shift)
#define PTE_RPN_SHIFT_L4_4_6 info->page_shift
#define PGD_MASKED_BITS_4_7 0xc0000000000000ffUL
#define PUD_MASKED_BITS_4_7 0xc0000000000000ffUL
#define PMD_MASKED_BITS_4_7 0xc0000000000000ffUL
#define PTE_RPN_SIZE_L4_4_11 53
#define PTE_RPN_MASK_L4_4_11 \
(((1UL << PTE_RPN_SIZE_L4_4_11) - 1) & ~((1UL << info->page_shift) - 1))
#define PTE_RPN_SHIFT_L4_4_11 info->page_shift
/*
* Supported MMU types
*/
#define STD_MMU 0x0
/*
* The flag bit for radix MMU in cpu_spec.mmu_features
* in the kernel. Use the same flag here.
*/
#define RADIX_MMU 0x40
#define PGD_MASK_L4 \
(info->kernel_version >= KERNEL_VERSION(3, 10, 0) ? (info->ptrs_per_pgd - 1) : 0x1ff)
#define PGD_OFFSET_L4(vaddr) ((vaddr >> (info->l4_shift)) & PGD_MASK_L4)
#define PUD_OFFSET_L4(vaddr) \
((vaddr >> (info->l3_shift)) & (info->ptrs_per_l3 - 1))
#define PMD_OFFSET_L4(vaddr) \
((vaddr >> (info->l2_shift)) & (info->ptrs_per_l2 - 1))
#define _PAGE_PRESENT \
(info->kernel_version >= KERNEL_VERSION(4, 6, 0) ? \
(0x1UL << 63) : (info->kernel_version >= KERNEL_VERSION(4, 5, 0) ? \
0x2UL : 0x1UL))
#endif
#ifdef __powerpc32__
#define __PAGE_OFFSET (0xc0000000)
#define KERNELBASE PAGE_OFFSET
#define VMALL_START (info->vmalloc_start)
#define KVBASE (SYMBOL(_stext))
#define _SECTION_SIZE_BITS (24)
#define _MAX_PHYSMEM_BITS (44)
#endif
#ifdef __s390x__
#define __PAGE_OFFSET (info->page_size - 1)
#define KERNELBASE (0)
#define KVBASE KERNELBASE
#define _SECTION_SIZE_BITS (28)
#define _MAX_PHYSMEM_BITS_ORIG (42)
#define _MAX_PHYSMEM_BITS_3_3 (46)
/* Bits in the segment/region table address-space-control-element */
#define _ASCE_TYPE_MASK 0x0c
#define _ASCE_TABLE_LENGTH 0x03 /* region table length */
#define TABLE_LEVEL(x) (((x) & _ASCE_TYPE_MASK) >> 2)
#define TABLE_LENGTH(x) ((x) & _ASCE_TABLE_LENGTH)
/* Bits in the region table entry */
#define _REGION_ENTRY_ORIGIN ~0xfffUL /* region table origin*/
#define _REGION_ENTRY_TYPE_MASK 0x0c /* region table type mask */
#define _REGION_ENTRY_INVALID 0x20 /* invalid region table entry */
#define _REGION_ENTRY_LENGTH 0x03 /* region table length */
#define _REGION_ENTRY_LARGE 0x400
#define _REGION_OFFSET_MASK 0x7ffUL /* region/segment table offset mask */
#define RSG_TABLE_LEVEL(x) (((x) & _REGION_ENTRY_TYPE_MASK) >> 2)
#define RSG_TABLE_LENGTH(x) ((x) & _REGION_ENTRY_LENGTH)
/* Bits in the segment table entry */
#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL
#define _SEGMENT_ENTRY_LARGE 0x400
#define _SEGMENT_ENTRY_CO 0x100
#define _SEGMENT_PAGE_SHIFT 31
#define _SEGMENT_INDEX_SHIFT 20
/* Hardware bits in the page table entry */
#define _PAGE_ZERO 0x800 /* Bit pos 52 must conatin zero */
#define _PAGE_INVALID 0x400 /* HW invalid bit */
#define _PAGE_INDEX_SHIFT 12
#define _PAGE_OFFSET_MASK 0xffUL /* page table offset mask */
#endif /* __s390x__ */
#ifdef __ia64__ /* ia64 */
#define REGION_SHIFT (61)
#define KERNEL_CACHED_REGION (7)
#define KERNEL_UNCACHED_REGION (6)
#define KERNEL_VMALLOC_REGION (5)
#define USER_STACK_REGION (4)
#define USER_DATA_REGION (3)
#define USER_TEXT_REGION (2)
#define USER_SHMEM_REGION (1)
#define USER_IA32_EMUL_REGION (0)
#define KERNEL_CACHED_BASE ((unsigned long)KERNEL_CACHED_REGION << REGION_SHIFT)
#define KERNEL_UNCACHED_BASE ((unsigned long)KERNEL_UNCACHED_REGION << REGION_SHIFT)
#define KERNEL_VMALLOC_BASE ((unsigned long)KERNEL_VMALLOC_REGION << REGION_SHIFT)
#define KVBASE KERNEL_VMALLOC_BASE
#define _PAGE_SIZE_64M (26)
#define KERNEL_TR_PAGE_SIZE (1 << _PAGE_SIZE_64M)
#define KERNEL_TR_PAGE_MASK (~(KERNEL_TR_PAGE_SIZE - 1))
#define DEFAULT_PHYS_START (KERNEL_TR_PAGE_SIZE * 1)
#define _SECTION_SIZE_BITS (30)
#define _MAX_PHYSMEM_BITS (50)
/*
* 3 Levels paging
*/
#define _PAGE_PPN_MASK (((1UL << _MAX_PHYSMEM_BITS) - 1) & ~0xfffUL)
#define PTRS_PER_PTD_SHIFT (PAGESHIFT() - 3)
#define PMD_SHIFT (PAGESHIFT() + PTRS_PER_PTD_SHIFT)
#define PGDIR_SHIFT_3L (PMD_SHIFT + PTRS_PER_PTD_SHIFT)
#define MASK_POFFSET ((1UL << PAGESHIFT()) - 1)
#define MASK_PTE ((1UL << PMD_SHIFT) - 1) &~((1UL << PAGESHIFT()) - 1)
#define MASK_PMD ((1UL << PGDIR_SHIFT_3L) - 1) &~((1UL << PMD_SHIFT) - 1)
#define MASK_PGD_3L ((1UL << REGION_SHIFT) - 1) & (~((1UL << PGDIR_SHIFT_3L) - 1))
/*
* 4 Levels paging
*/
#define PUD_SHIFT (PMD_SHIFT + PTRS_PER_PTD_SHIFT)
#define PGDIR_SHIFT_4L (PUD_SHIFT + PTRS_PER_PTD_SHIFT)
#define MASK_PUD ((1UL << REGION_SHIFT) - 1) & (~((1UL << PUD_SHIFT) - 1))
#define MASK_PGD_4L ((1UL << REGION_SHIFT) - 1) & (~((1UL << PGDIR_SHIFT_4L) - 1))
/*
* Key for distinguishing PGTABLE_3L or PGTABLE_4L.
*/
#define STR_PUD_T_3L "include/asm-generic/pgtable-nopud.h"
#define STR_PUD_T_4L "include/asm/page.h"
#endif /* ia64 */
#ifdef __sparc64__
#define KVBASE (SYMBOL(_stext))
#define KVBASE_MASK (0xffff)
#define _SECTION_SIZE_BITS (30)
#define _MAX_PHYSMEM_BITS_L3 (49)
#define _MAX_PHYSMEM_BITS_L4 (53)
#define VMALLOC_START_SPARC64 (0x0000000100000000UL)
#define VMEMMAP_BASE_SPARC64 (0x0000010000000000UL)
#define VMEMMAP_CHUNK_SHIFT (22)
#define VMEMMAP_CHUNK (1UL << VMEMMAP_CHUNK_SHIFT)
#define VMEMMAP_CHUNK_MASK (~(VMEMMAP_CHUNK - 1UL))
#define PAGE_SHIFT 13
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE - 1))
#define MAX_PHYS_ADDRESS_LOBITS (41)
#define NR_CHUNKS_SHIFT (MAX_PHYS_ADDRESS_LOBITS - PAGE_SHIFT + 6)
#define NR_CHUNKS_MASK (~((1UL << NR_CHUNKS_SHIFT) - 1))
#define PMD_SHIFT (PAGE_SHIFT + (PAGE_SHIFT - 3))
#define PMD_SIZE (1UL << PMD_SHIFT)
#define PMD_MASK (~(PMD_SIZE - 1))
#define PMD_BITS (PAGE_SHIFT - 3)
#define PUD_SHIFT (PMD_SHIFT + PMD_BITS)
#define PUD_SIZE (1UL << PUD_SHIFT)
#define PUD_MASK (~(PUD_SIZE - 1))
#define PUD_BITS (PAGE_SHIFT - 3)
#define PGDIR_SHIFT_L4 (PUD_SHIFT + PUD_BITS)
#define PGDIR_SIZE_L4 (1UL << PGDIR_SHIFT_L4)
#define PGDIR_MASK_L4 (~(PGDIR_SIZE_L4 - 1))
#define PGDIR_SHIFT_L3 (PMD_SHIFT + PMD_BITS)
#define PGDIR_SIZE_L3 (1UL << PGDIR_SHIFT_L3)
#define PGDIR_MASK_L3 (~(PGDIR_SIZE_L3 - 1))
#define PGDIR_BITS (PAGE_SHIFT - 3)
#define PTRS_PER_PTE (1UL << (PAGE_SHIFT - 3))
#define PTRS_PER_PMD (1UL << PMD_BITS)
#define PTRS_PER_PUD (1UL << PUD_BITS)
#define PTRS_PER_PGD (1UL << PGDIR_BITS)
#define _PAGE_PMD_HUGE (0x0100000000000000UL)
#define _PAGE_PUD_HUGE _PAGE_PMD_HUGE
#define _PAGE_PADDR_4V (0x00FFFFFFFFFFE000UL)
#define _PAGE_PRESENT_4V (0x0000000000000010UL)
typedef unsigned long pte_t;
typedef unsigned long pmd_t;
typedef unsigned long pud_t;
typedef unsigned long pgd_t;
#define pud_none(pud) (!(pud))
#define pgd_none(pgd) (!(pgd))
#define pmd_none(pmd) (!(pmd))
#define pte_to_pa(pte) (pte & _PAGE_PADDR_4V)
#define pgd_index_l4(addr) (((addr) >> PGDIR_SHIFT_L4) & (PTRS_PER_PGD - 1))
#define pgd_offset_l4(pgdir,addr) ((unsigned long) \
((pgd_t *)pgdir + pgd_index_l4(addr)))
#define pgd_index_l3(addr) (((addr) >> PGDIR_SHIFT_L3) & (PTRS_PER_PGD - 1))
#define pgd_offset_l3(pgdir,addr) ((unsigned long) \
((pgd_t *)pgdir + pgd_index_l3(addr)))
#define pud_index(addr) (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
#define pud_offset(pgdp, addr) ((unsigned long) \
((pud_t *)pgdp + pud_index(addr)))
#define pud_large(pud) (pud & _PAGE_PUD_HUGE)
#define pmd_index(addr) (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))
#define pmd_offset(pudp, addr) ((unsigned long) \
((pmd_t *)pudp + pmd_index(addr)))
#define pmd_large(pmd) (pmd & _PAGE_PMD_HUGE)
#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
#define pte_offset(pmdp, addr) ((unsigned long) \
((pte_t *)(pte_to_pa(pmdp) + pte_index(addr))))
#define pte_present(pte) (pte & _PAGE_PRESENT_4V)
#endif /* sparc64 */
/*
* The function of dependence on machine
*/
static inline int stub_true() { return TRUE; }
static inline int stub_true_ul(unsigned long x) { return TRUE; }
static inline int stub_false() { return FALSE; }
#define paddr_to_vaddr_general(X) ((X) + PAGE_OFFSET)
#ifdef __aarch64__
int get_phys_base_arm64(void);
int get_machdep_info_arm64(void);
unsigned long long vaddr_to_paddr_arm64(unsigned long vaddr);
int get_versiondep_info_arm64(void);
int get_xen_basic_info_arm64(void);
int get_xen_info_arm64(void);
unsigned long get_kaslr_offset_arm64(unsigned long vaddr);
#define paddr_to_vaddr_arm64(X) (((X) - info->phys_base) | PAGE_OFFSET)
#define find_vmemmap() stub_false()
#define vaddr_to_paddr(X) vaddr_to_paddr_arm64(X)
#define paddr_to_vaddr(X) paddr_to_vaddr_arm64(X)
#define get_phys_base() get_phys_base_arm64()
#define get_machdep_info() get_machdep_info_arm64()
#define get_versiondep_info() get_versiondep_info_arm64()
#define get_kaslr_offset(X) get_kaslr_offset_arm64(X)
#define get_xen_basic_info_arch(X) get_xen_basic_info_arm64(X)
#define get_xen_info_arch(X) get_xen_info_arm64(X)
#define is_phys_addr(X) stub_true_ul(X)
#define arch_crashkernel_mem_size() stub_false()
#endif /* aarch64 */
#ifdef __arm__
int get_phys_base_arm(void);
int get_machdep_info_arm(void);
unsigned long long vaddr_to_paddr_arm(unsigned long vaddr);
#define find_vmemmap() stub_false()
#define get_phys_base() get_phys_base_arm()
#define get_machdep_info() get_machdep_info_arm()
#define get_versiondep_info() stub_true()
#define get_kaslr_offset(X) stub_false()
#define vaddr_to_paddr(X) vaddr_to_paddr_arm(X)