forked from crash-utility/crash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
x86_64.c
9542 lines (8247 loc) · 277 KB
/
x86_64.c
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
/* x86_64.c -- core analysis suite
*
* Copyright (C) 2004-2019 David Anderson
* Copyright (C) 2004-2019 Red Hat, Inc. All rights reserved.
*
* 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.
*/
#include "defs.h"
#include "xen_hyper_defs.h"
#ifdef X86_64
static int x86_64_kvtop(struct task_context *, ulong, physaddr_t *, int);
static int x86_64_kvtop_xen_wpt(struct task_context *, ulong, physaddr_t *, int);
static int x86_64_uvtop(struct task_context *, ulong, physaddr_t *, int);
static int x86_64_uvtop_level4(struct task_context *, ulong, physaddr_t *, int);
static int x86_64_uvtop_level4_xen_wpt(struct task_context *, ulong, physaddr_t *, int);
static int x86_64_uvtop_level4_rhel4_xen_wpt(struct task_context *, ulong, physaddr_t *, int);
static ulong x86_64_vmalloc_start(void);
static int x86_64_is_task_addr(ulong);
static int x86_64_verify_symbol(const char *, ulong, char);
static int x86_64_verify_line_number(ulong, ulong, ulong);
static ulong x86_64_get_task_pgd(ulong);
static int x86_64_translate_pte(ulong, void *, ulonglong);
static ulong x86_64_processor_speed(void);
static int is_vsyscall_addr(ulong);
struct syment *x86_64_value_to_symbol(ulong, ulong *);
static int x86_64_eframe_search(struct bt_info *);
static int x86_64_eframe_verify(struct bt_info *, long, long, long, long, long, long);
#define EFRAME_PRINT (0x1)
#define EFRAME_VERIFY (0x2)
#define EFRAME_CS (0x4)
#define EFRAME_SEARCH (0x8)
static int x86_64_print_eframe_location(ulong, int, FILE *);
static void x86_64_back_trace_cmd(struct bt_info *);
static ulong x86_64_in_exception_stack(struct bt_info *, int *);
static ulong x86_64_in_irqstack(struct bt_info *);
static int x86_64_in_alternate_stack(int, ulong);
static ulong x86_64_in_kpti_entry_stack(int, ulong);
static ulong __schedule_frame_adjust(ulong, struct bt_info *);
static void x86_64_low_budget_back_trace_cmd(struct bt_info *);
static void x86_64_dwarf_back_trace_cmd(struct bt_info *);
static void x86_64_get_dumpfile_stack_frame(struct bt_info *, ulong *, ulong *);
static struct syment *x86_64_function_called_by(ulong);
static int is_direct_call_target(struct bt_info *);
static void get_x86_64_frame(struct bt_info *, ulong *, ulong *);
static ulong text_lock_function(char *, struct bt_info *, ulong);
static int x86_64_print_stack_entry(struct bt_info *, FILE *, int, int, ulong);
static void x86_64_display_full_frame(struct bt_info *, ulong, FILE *);
static void x86_64_do_bt_reference_check(struct bt_info *, ulong,char *);
static void x86_64_dump_irq(int);
static void x86_64_get_irq_affinity(int);
static void x86_64_show_interrupts(int, ulong *);
static char *x86_64_extract_idt_function(ulong *, char *, ulong *);
static ulong x86_64_get_pc(struct bt_info *);
static ulong x86_64_get_sp(struct bt_info *);
static void x86_64_get_stack_frame(struct bt_info *, ulong *, ulong *);
static int x86_64_dis_filter(ulong, char *, unsigned int);
static void x86_64_cmd_mach(void);
static int x86_64_get_smp_cpus(void);
static void x86_64_display_machine_stats(void);
static void x86_64_display_cpu_data(unsigned int);
static void x86_64_display_memmap(void);
static void x86_64_dump_line_number(ulong);
static struct line_number_hook x86_64_line_number_hooks[];
static void x86_64_calc_phys_base(void);
static int x86_64_is_module_addr(ulong);
static int x86_64_is_kvaddr(ulong);
static int x86_64_is_uvaddr(ulong, struct task_context *);
static int x86_64_is_page_ptr(ulong, physaddr_t *);
static ulong *x86_64_kpgd_offset(ulong, int, int);
static ulong x86_64_upgd_offset(struct task_context *, ulong, int, int);
static ulong x86_64_upgd_offset_legacy(struct task_context *, ulong, int, int);
static ulong x86_64_p4d_offset(ulong, ulong, int, int);
static ulong x86_64_pud_offset(ulong, ulong, int, int);
static ulong x86_64_pmd_offset(ulong, ulong, int, int);
static ulong x86_64_pte_offset(ulong, ulong, int, int);
void x86_64_compiler_warning_stub(void);
static void x86_64_init_kernel_pgd(void);
static void x86_64_cpu_pda_init(void);
static void x86_64_per_cpu_init(void);
static void x86_64_ist_init(void);
static void x86_64_l1tf_init(void);
static void x86_64_irq_stack_gap_init(void);
static void x86_64_entry_trampoline_init(void);
static void x86_64_post_init(void);
static void parse_cmdline_args(void);
static void x86_64_clear_machdep_cache(void);
static void x86_64_irq_eframe_link_init(void);
static ulong x86_64_irq_eframe_link(ulong, struct bt_info *, FILE *);
static ulong search_for_switch_to(ulong, ulong);
static void x86_64_thread_return_init(void);
static void x86_64_framepointer_init(void);
static void x86_64_ORC_init(void);
static int x86_64_virt_phys_base(void);
static int x86_64_xendump_p2m_create(struct xendump_data *);
static int x86_64_pvops_xendump_p2m_create(struct xendump_data *);
static int x86_64_pvops_xendump_p2m_l2_create(struct xendump_data *);
static int x86_64_pvops_xendump_p2m_l3_create(struct xendump_data *);
static char *x86_64_xendump_load_page(ulong, struct xendump_data *);
static int x86_64_xendump_page_index(ulong, struct xendump_data *);
static int x86_64_xen_kdump_p2m_create(struct xen_kdump_data *);
static char *x86_64_xen_kdump_load_page(ulong, char *);
static ulong x86_64_xen_kdump_page_mfn(ulong);
static void x86_64_debug_dump_page(FILE *, char *, char *);
static void x86_64_get_xendump_regs(struct xendump_data *, struct bt_info *, ulong *, ulong *);
static ulong x86_64_xendump_panic_task(struct xendump_data *);
static void x86_64_init_hyper(int);
static ulong x86_64_get_stackbase_hyper(ulong);
static ulong x86_64_get_stacktop_hyper(ulong);
static int x86_64_framesize_cache_resize(void);
static int x86_64_do_not_cache_framesize(struct syment *, ulong);
static int x86_64_framesize_cache_func(int, ulong, int *, int, struct syment *);
static ulong x86_64_get_framepointer(struct bt_info *, ulong);
int search_for_eframe_target_caller(struct bt_info *, ulong, int *);
static int x86_64_get_framesize(struct bt_info *, ulong, ulong, char *);
static void x86_64_framesize_debug(struct bt_info *);
static void x86_64_get_active_set(void);
static int x86_64_get_kvaddr_ranges(struct vaddr_range *);
static int x86_64_get_cpu_reg(int, int, const char *, int, void *);
static int x86_64_verify_paddr(uint64_t);
static void GART_init(void);
static void x86_64_exception_stacks_init(void);
static int in_START_KERNEL_map(ulong);
static ulong orc_ip(ulong);
static orc_entry *__orc_find(ulong, ulong, uint, ulong);
static orc_entry *orc_find(ulong);
static orc_entry *orc_module_find(ulong);
static ulong ip_table_to_vaddr(ulong);
static void orc_dump(ulong);
struct machine_specific x86_64_machine_specific = { 0 };
static const char *exception_functions_orig[];
static const char *exception_functions_5_8[];
/*
* Do all necessary machine-specific setup here. This is called several
* times during initialization.
*/
void
x86_64_init(int when)
{
int len, dim;
char *string;
if (XEN_HYPER_MODE()) {
x86_64_init_hyper(when);
return;
}
switch (when)
{
case SETUP_ENV:
machdep->process_elf_notes = x86_process_elf_notes;
machdep->is_page_ptr = x86_64_is_page_ptr;
break;
case PRE_SYMTAB:
machdep->verify_symbol = x86_64_verify_symbol;
machdep->verify_line_number = x86_64_verify_line_number;
machdep->machspec = &x86_64_machine_specific;
if (pc->flags & KERNEL_DEBUG_QUERY)
return;
machdep->pagesize = memory_page_size();
machdep->pageshift = ffs(machdep->pagesize) - 1;
machdep->pageoffset = machdep->pagesize - 1;
machdep->pagemask = ~((ulonglong)machdep->pageoffset);
machdep->stacksize = machdep->pagesize * 2;
if ((machdep->pgd = (char *)malloc(PAGESIZE())) == NULL)
error(FATAL, "cannot malloc pgd space.");
if ((machdep->pud = (char *)malloc(PAGESIZE())) == NULL)
error(FATAL, "cannot malloc pud space.");
if ((machdep->pmd = (char *)malloc(PAGESIZE())) == NULL)
error(FATAL, "cannot malloc pmd space.");
if ((machdep->ptbl = (char *)malloc(PAGESIZE())) == NULL)
error(FATAL, "cannot malloc ptbl space.");
machdep->last_pgd_read = 0;
machdep->last_pud_read = 0;
machdep->last_pmd_read = 0;
machdep->last_ptbl_read = 0;
machdep->verify_paddr = x86_64_verify_paddr;
machdep->ptrs_per_pgd = PTRS_PER_PGD;
machdep->flags |= MACHDEP_BT_TEXT;
machdep->flags |= FRAMESIZE_DEBUG;
machdep->machspec->irq_eframe_link = UNINITIALIZED;
machdep->machspec->irq_stack_gap = UNINITIALIZED;
machdep->get_kvaddr_ranges = x86_64_get_kvaddr_ranges;
machdep->get_cpu_reg = x86_64_get_cpu_reg;
if (machdep->cmdline_args[0])
parse_cmdline_args();
if ((string = pc->read_vmcoreinfo("relocate"))) {
kt->relocate = htol(string, QUIET, NULL);
kt->flags |= RELOC_SET;
kt->flags2 |= KASLR;
free(string);
}
if ((string = pc->read_vmcoreinfo("NUMBER(KERNEL_IMAGE_SIZE)"))) {
machdep->machspec->kernel_image_size = dtol(string, QUIET, NULL);
free(string);
}
if ((string = pc->read_vmcoreinfo("NUMBER(sme_mask)"))) {
machdep->machspec->sme_mask = dtol(string, QUIET, NULL);
free(string);
}
if (SADUMP_DUMPFILE() || QEMU_MEM_DUMP_NO_VMCOREINFO() ||
VMSS_DUMPFILE())
/* Need for calculation of kaslr_offset and phys_base */
machdep->kvtop = x86_64_kvtop;
break;
case PRE_GDB:
if (!(machdep->flags & VM_FLAGS)) {
if (symbol_exists("xen_start_info")) {
if (PVOPS())
machdep->flags |= VM_2_6_11;
else if (symbol_exists("low_pml4") &&
symbol_exists("swap_low_mappings"))
machdep->flags |= VM_XEN_RHEL4;
else
machdep->flags |= VM_XEN;
} else if (symbol_exists("boot_vmalloc_pgt"))
machdep->flags |= VM_ORIG;
else
machdep->flags |= VM_2_6_11;
}
switch (machdep->flags & VM_FLAGS)
{
case VM_ORIG:
/* pre-2.6.11 layout */
machdep->machspec->userspace_top = USERSPACE_TOP_ORIG;
machdep->machspec->page_offset = PAGE_OFFSET_ORIG;
machdep->machspec->vmalloc_start_addr = VMALLOC_START_ADDR_ORIG;
machdep->machspec->vmalloc_end = VMALLOC_END_ORIG;
machdep->machspec->modules_vaddr = MODULES_VADDR_ORIG;
machdep->machspec->modules_end = MODULES_END_ORIG;
machdep->uvtop = x86_64_uvtop;
machdep->machspec->physical_mask_shift = __PHYSICAL_MASK_SHIFT_2_6;
machdep->machspec->pgdir_shift = PGDIR_SHIFT;
machdep->machspec->ptrs_per_pgd = PTRS_PER_PGD;
break;
case VM_2_6_11:
/* 2.6.11 layout */
machdep->machspec->userspace_top = USERSPACE_TOP_2_6_11;
machdep->machspec->vmalloc_start_addr = VMALLOC_START_ADDR_2_6_11;
machdep->machspec->vmalloc_end = VMALLOC_END_2_6_11;
machdep->machspec->modules_vaddr = MODULES_VADDR_2_6_11;
machdep->machspec->modules_end = MODULES_END_2_6_11;
/* 2.6.24 layout */
machdep->machspec->vmemmap_vaddr = VMEMMAP_VADDR_2_6_24;
machdep->machspec->vmemmap_end = VMEMMAP_END_2_6_24;
if (symbol_exists("vmemmap_populate"))
machdep->flags |= VMEMMAP;
if (kernel_symbol_exists("end_pfn"))
/* 2.6.11 layout */
machdep->machspec->page_offset = PAGE_OFFSET_2_6_11;
else
/* 2.6.27 layout */
machdep->machspec->page_offset = PAGE_OFFSET_2_6_27;
machdep->uvtop = x86_64_uvtop_level4;
machdep->machspec->physical_mask_shift = __PHYSICAL_MASK_SHIFT_2_6;
machdep->machspec->pgdir_shift = PGDIR_SHIFT;
machdep->machspec->ptrs_per_pgd = PTRS_PER_PGD;
break;
case VM_XEN:
/* Xen layout */
machdep->machspec->userspace_top = USERSPACE_TOP_XEN;
machdep->machspec->page_offset = PAGE_OFFSET_XEN;
machdep->machspec->vmalloc_start_addr = VMALLOC_START_ADDR_XEN;
machdep->machspec->vmalloc_end = VMALLOC_END_XEN;
machdep->machspec->modules_vaddr = MODULES_VADDR_XEN;
machdep->machspec->modules_end = MODULES_END_XEN;
machdep->machspec->physical_mask_shift = __PHYSICAL_MASK_SHIFT_XEN;
machdep->machspec->pgdir_shift = PGDIR_SHIFT;
machdep->machspec->ptrs_per_pgd = PTRS_PER_PGD;
break;
case VM_XEN_RHEL4:
/* RHEL4 Xen layout */
machdep->machspec->userspace_top = USERSPACE_TOP_XEN_RHEL4;
machdep->machspec->page_offset = PAGE_OFFSET_XEN_RHEL4;
machdep->machspec->vmalloc_start_addr = VMALLOC_START_ADDR_XEN_RHEL4;
machdep->machspec->vmalloc_end = VMALLOC_END_XEN_RHEL4;
machdep->machspec->modules_vaddr = MODULES_VADDR_XEN_RHEL4;
machdep->machspec->modules_end = MODULES_END_XEN_RHEL4;
machdep->machspec->physical_mask_shift = __PHYSICAL_MASK_SHIFT_XEN;
machdep->machspec->pgdir_shift = PGDIR_SHIFT;
machdep->machspec->ptrs_per_pgd = PTRS_PER_PGD;
break;
}
machdep->kvbase = (ulong)PAGE_OFFSET;
machdep->identity_map_base = (ulong)PAGE_OFFSET;
machdep->is_kvaddr = x86_64_is_kvaddr;
machdep->is_uvaddr = x86_64_is_uvaddr;
machdep->eframe_search = x86_64_eframe_search;
machdep->back_trace = x86_64_low_budget_back_trace_cmd;
machdep->processor_speed = x86_64_processor_speed;
machdep->kvtop = x86_64_kvtop;
machdep->get_task_pgd = x86_64_get_task_pgd;
machdep->get_stack_frame = x86_64_get_stack_frame;
machdep->get_stackbase = generic_get_stackbase;
machdep->get_stacktop = generic_get_stacktop;
machdep->translate_pte = x86_64_translate_pte;
machdep->memory_size = generic_memory_size;
machdep->is_task_addr = x86_64_is_task_addr;
machdep->dis_filter = x86_64_dis_filter;
machdep->cmd_mach = x86_64_cmd_mach;
machdep->get_smp_cpus = x86_64_get_smp_cpus;
machdep->value_to_symbol = x86_64_value_to_symbol;
machdep->init_kernel_pgd = x86_64_init_kernel_pgd;
machdep->clear_machdep_cache = x86_64_clear_machdep_cache;
machdep->xendump_p2m_create = x86_64_xendump_p2m_create;
machdep->get_xendump_regs = x86_64_get_xendump_regs;
machdep->xen_kdump_p2m_create = x86_64_xen_kdump_p2m_create;
machdep->xendump_panic_task = x86_64_xendump_panic_task;
if (symbol_exists("vgettimeofday"))
machdep->machspec->vsyscall_page =
PAGEBASE(symbol_value("vgettimeofday"));
x86_64_calc_phys_base();
break;
case POST_RELOC:
/* Check for 5-level paging */
if (!(machdep->flags & VM_5LEVEL)) {
int l5_enabled = 0;
if ((string = pc->read_vmcoreinfo("NUMBER(pgtable_l5_enabled)"))) {
l5_enabled = atoi(string);
free(string);
} else if (kernel_symbol_exists("__pgtable_l5_enabled"))
readmem(symbol_value("__pgtable_l5_enabled"), KVADDR,
&l5_enabled, sizeof(int), "__pgtable_l5_enabled",
QUIET|FAULT_ON_ERROR);
if (l5_enabled)
machdep->flags |= VM_5LEVEL;
}
if (machdep->flags & VM_5LEVEL) {
machdep->machspec->userspace_top = USERSPACE_TOP_5LEVEL;
machdep->machspec->page_offset = PAGE_OFFSET_5LEVEL;
machdep->machspec->vmalloc_start_addr = VMALLOC_START_ADDR_5LEVEL;
machdep->machspec->vmalloc_end = VMALLOC_END_5LEVEL;
machdep->machspec->modules_vaddr = MODULES_VADDR_5LEVEL;
machdep->machspec->modules_end = MODULES_END_5LEVEL;
machdep->machspec->vmemmap_vaddr = VMEMMAP_VADDR_5LEVEL;
machdep->machspec->vmemmap_end = VMEMMAP_END_5LEVEL;
if (symbol_exists("vmemmap_populate"))
machdep->flags |= VMEMMAP;
machdep->machspec->physical_mask_shift = __PHYSICAL_MASK_SHIFT_5LEVEL;
machdep->machspec->pgdir_shift = PGDIR_SHIFT_5LEVEL;
machdep->machspec->ptrs_per_pgd = PTRS_PER_PGD_5LEVEL;
if (!machdep->machspec->p4d) {
if ((machdep->machspec->p4d = (char *)malloc(PAGESIZE())) == NULL)
error(FATAL, "cannot malloc p4d space.");
machdep->machspec->last_p4d_read = 0;
}
machdep->uvtop = x86_64_uvtop_level4; /* 5-level is optional per-task */
machdep->kvbase = (ulong)PAGE_OFFSET;
machdep->identity_map_base = (ulong)PAGE_OFFSET;
}
/*
* Check for CONFIG_RANDOMIZE_MEMORY, and set page_offset and
* the virtual address ranges.
*/
if (kernel_symbol_exists("page_offset_base") &&
kernel_symbol_exists("vmalloc_base")) {
machdep->flags |= RANDOMIZED;
readmem(symbol_value("page_offset_base"), KVADDR,
&machdep->machspec->page_offset, sizeof(ulong),
"page_offset_base", QUIET|FAULT_ON_ERROR);
machdep->kvbase = machdep->machspec->page_offset;
machdep->identity_map_base = machdep->machspec->page_offset;
readmem(symbol_value("vmalloc_base"), KVADDR,
&machdep->machspec->vmalloc_start_addr,
sizeof(ulong), "vmalloc_base", FAULT_ON_ERROR);
if (machdep->flags & VM_5LEVEL)
machdep->machspec->vmalloc_end =
machdep->machspec->vmalloc_start_addr + TERABYTES(1280) - 1;
else
machdep->machspec->vmalloc_end =
machdep->machspec->vmalloc_start_addr + TERABYTES(32) - 1;
if (kernel_symbol_exists("vmemmap_base")) {
readmem(symbol_value("vmemmap_base"), KVADDR,
&machdep->machspec->vmemmap_vaddr, sizeof(ulong),
"vmemmap_base", FAULT_ON_ERROR);
machdep->machspec->vmemmap_end =
machdep->machspec->vmemmap_vaddr +
TERABYTES(1) - 1;
} else {
machdep->machspec->vmemmap_vaddr = VMEMMAP_VADDR_2_6_31;
machdep->machspec->vmemmap_end = VMEMMAP_END_2_6_31;
}
machdep->machspec->modules_vaddr = __START_KERNEL_map +
(machdep->machspec->kernel_image_size ?
machdep->machspec->kernel_image_size : GIGABYTES(1));
machdep->machspec->modules_end = MODULES_END_2_6_31;
}
break;
case POST_GDB:
if (!(machdep->flags & RANDOMIZED) &&
((THIS_KERNEL_VERSION >= LINUX(4,19,5)) ||
((THIS_KERNEL_VERSION >= LINUX(4,14,84)) &&
(THIS_KERNEL_VERSION < LINUX(4,15,0))))) {
machdep->machspec->page_offset = machdep->flags & VM_5LEVEL ?
PAGE_OFFSET_5LEVEL_4_20 : PAGE_OFFSET_4LEVEL_4_20;
machdep->kvbase = machdep->machspec->page_offset;
machdep->identity_map_base = machdep->machspec->page_offset;
}
/*
* --machdep page_offset forced override
*/
if (machdep->machspec->page_offset_force) {
machdep->machspec->page_offset = machdep->machspec->page_offset_force;
machdep->kvbase = machdep->machspec->page_offset;
machdep->identity_map_base = machdep->machspec->page_offset;
}
if (THIS_KERNEL_VERSION >= LINUX(2,6,26) &&
THIS_KERNEL_VERSION < LINUX(2,6,31)) {
machdep->machspec->modules_vaddr = MODULES_VADDR_2_6_26;
}
if (THIS_KERNEL_VERSION >= LINUX(2,6,27) &&
THIS_KERNEL_VERSION < LINUX(2,6,31)) {
machdep->machspec->modules_end = MODULES_END_2_6_27;
}
if (THIS_KERNEL_VERSION >= LINUX(2,6,31)) {
if (!(machdep->flags & RANDOMIZED)) {
machdep->machspec->vmalloc_start_addr = VMALLOC_START_ADDR_2_6_31;
machdep->machspec->vmalloc_end = VMALLOC_END_2_6_31;
machdep->machspec->vmemmap_vaddr = VMEMMAP_VADDR_2_6_31;
machdep->machspec->vmemmap_end = VMEMMAP_END_2_6_31;
if (kt->flags2 & KASLR)
machdep->machspec->modules_vaddr = __START_KERNEL_map +
(machdep->machspec->kernel_image_size ?
machdep->machspec->kernel_image_size : GIGABYTES(1));
else
machdep->machspec->modules_vaddr = MODULES_VADDR_2_6_31;
machdep->machspec->modules_end = MODULES_END_2_6_31;
}
}
if (STRUCT_EXISTS("cpu_entry_area")) {
machdep->machspec->cpu_entry_area_start = CPU_ENTRY_AREA_START;
machdep->machspec->cpu_entry_area_end = CPU_ENTRY_AREA_END;
}
STRUCT_SIZE_INIT(cpuinfo_x86, "cpuinfo_x86");
/*
* Before 2.6.25 the structure was called gate_struct
*/
if (STRUCT_EXISTS("gate_desc"))
STRUCT_SIZE_INIT(gate_struct, "gate_desc");
else
STRUCT_SIZE_INIT(gate_struct, "gate_struct");
if (STRUCT_EXISTS("e820map")) {
STRUCT_SIZE_INIT(e820map, "e820map");
MEMBER_OFFSET_INIT(e820map_nr_map, "e820map", "nr_map");
} else {
STRUCT_SIZE_INIT(e820map, "e820_table");
MEMBER_OFFSET_INIT(e820map_nr_map, "e820_table", "nr_entries");
}
if (STRUCT_EXISTS("e820entry")) {
STRUCT_SIZE_INIT(e820entry, "e820entry");
MEMBER_OFFSET_INIT(e820entry_addr, "e820entry", "addr");
MEMBER_OFFSET_INIT(e820entry_size, "e820entry", "size");
MEMBER_OFFSET_INIT(e820entry_type, "e820entry", "type");
} else {
STRUCT_SIZE_INIT(e820entry, "e820_entry");
MEMBER_OFFSET_INIT(e820entry_addr, "e820_entry", "addr");
MEMBER_OFFSET_INIT(e820entry_size, "e820_entry", "size");
MEMBER_OFFSET_INIT(e820entry_type, "e820_entry", "type");
}
if (KVMDUMP_DUMPFILE())
set_kvm_iohole(NULL);
MEMBER_OFFSET_INIT(thread_struct_rip, "thread_struct", "rip");
MEMBER_OFFSET_INIT(thread_struct_rsp, "thread_struct", "rsp");
MEMBER_OFFSET_INIT(thread_struct_rsp0, "thread_struct", "rsp0");
if (INVALID_MEMBER(thread_struct_rip))
MEMBER_OFFSET_INIT(thread_struct_rip, "thread_struct", "ip");
if (INVALID_MEMBER(thread_struct_rsp))
MEMBER_OFFSET_INIT(thread_struct_rsp, "thread_struct", "sp");
if (INVALID_MEMBER(thread_struct_rsp0))
MEMBER_OFFSET_INIT(thread_struct_rsp0, "thread_struct", "sp0");
STRUCT_SIZE_INIT(tss_struct, "tss_struct");
MEMBER_OFFSET_INIT(tss_struct_ist, "tss_struct", "ist");
if (INVALID_MEMBER(tss_struct_ist)) {
long x86_tss_offset, ist_offset;
x86_tss_offset = MEMBER_OFFSET("tss_struct", "x86_tss");
ist_offset = MEMBER_OFFSET("x86_hw_tss", "ist");
if ((x86_tss_offset != INVALID_OFFSET) &&
(ist_offset != INVALID_OFFSET))
ASSIGN_OFFSET(tss_struct_ist) = x86_tss_offset +
ist_offset;
}
MEMBER_OFFSET_INIT(user_regs_struct_rip,
"user_regs_struct", "rip");
if (INVALID_MEMBER(user_regs_struct_rip))
MEMBER_OFFSET_INIT(user_regs_struct_rip,
"user_regs_struct", "ip");
MEMBER_OFFSET_INIT(user_regs_struct_rsp,
"user_regs_struct", "rsp");
if (INVALID_MEMBER(user_regs_struct_rsp))
MEMBER_OFFSET_INIT(user_regs_struct_rsp,
"user_regs_struct", "sp");
MEMBER_OFFSET_INIT(user_regs_struct_eflags,
"user_regs_struct", "eflags");
if (INVALID_MEMBER(user_regs_struct_eflags))
MEMBER_OFFSET_INIT(user_regs_struct_eflags,
"user_regs_struct", "flags");
MEMBER_OFFSET_INIT(user_regs_struct_cs,
"user_regs_struct", "cs");
MEMBER_OFFSET_INIT(user_regs_struct_ss,
"user_regs_struct", "ss");
MEMBER_OFFSET_INIT(user_regs_struct_rax,
"user_regs_struct", "rax");
if (INVALID_MEMBER(user_regs_struct_rax))
MEMBER_OFFSET_INIT(user_regs_struct_rax,
"user_regs_struct", "ax");
MEMBER_OFFSET_INIT(user_regs_struct_rbx,
"user_regs_struct", "rbx");
if (INVALID_MEMBER(user_regs_struct_rbx))
MEMBER_OFFSET_INIT(user_regs_struct_rbx,
"user_regs_struct", "bx");
MEMBER_OFFSET_INIT(user_regs_struct_rcx,
"user_regs_struct", "rcx");
if (INVALID_MEMBER(user_regs_struct_rcx))
MEMBER_OFFSET_INIT(user_regs_struct_rcx,
"user_regs_struct", "cx");
MEMBER_OFFSET_INIT(user_regs_struct_rdx,
"user_regs_struct", "rdx");
if (INVALID_MEMBER(user_regs_struct_rdx))
MEMBER_OFFSET_INIT(user_regs_struct_rdx,
"user_regs_struct", "dx");
MEMBER_OFFSET_INIT(user_regs_struct_rsi,
"user_regs_struct", "rsi");
if (INVALID_MEMBER(user_regs_struct_rsi))
MEMBER_OFFSET_INIT(user_regs_struct_rsi,
"user_regs_struct", "si");
MEMBER_OFFSET_INIT(user_regs_struct_rdi,
"user_regs_struct", "rdi");
if (INVALID_MEMBER(user_regs_struct_rdi))
MEMBER_OFFSET_INIT(user_regs_struct_rdi,
"user_regs_struct", "di");
MEMBER_OFFSET_INIT(user_regs_struct_rbp,
"user_regs_struct", "rbp");
if (INVALID_MEMBER(user_regs_struct_rbp))
MEMBER_OFFSET_INIT(user_regs_struct_rbp,
"user_regs_struct", "bp");
MEMBER_OFFSET_INIT(user_regs_struct_r8,
"user_regs_struct", "r8");
MEMBER_OFFSET_INIT(user_regs_struct_r9,
"user_regs_struct", "r9");
MEMBER_OFFSET_INIT(user_regs_struct_r10,
"user_regs_struct", "r10");
MEMBER_OFFSET_INIT(user_regs_struct_r11,
"user_regs_struct", "r11");
MEMBER_OFFSET_INIT(user_regs_struct_r12,
"user_regs_struct", "r12");
MEMBER_OFFSET_INIT(user_regs_struct_r13,
"user_regs_struct", "r13");
MEMBER_OFFSET_INIT(user_regs_struct_r14,
"user_regs_struct", "r14");
MEMBER_OFFSET_INIT(user_regs_struct_r15,
"user_regs_struct", "r15");
STRUCT_SIZE_INIT(user_regs_struct, "user_regs_struct");
if (!VALID_STRUCT(user_regs_struct)) {
/* Use this hardwired version -- sometimes the
* debuginfo doesn't pick this up even though
* it exists in the kernel; it shouldn't change.
*/
struct x86_64_user_regs_struct {
unsigned long r15, r14, r13, r12, bp, bx;
unsigned long r11, r10, r9, r8, ax, cx, dx;
unsigned long si, di, orig_ax, ip, cs;
unsigned long flags, sp, ss, fs_base;
unsigned long gs_base, ds, es, fs, gs;
};
ASSIGN_SIZE(user_regs_struct) =
sizeof(struct x86_64_user_regs_struct);
ASSIGN_OFFSET(user_regs_struct_rip) =
offsetof(struct x86_64_user_regs_struct, ip);
ASSIGN_OFFSET(user_regs_struct_rsp) =
offsetof(struct x86_64_user_regs_struct, sp);
ASSIGN_OFFSET(user_regs_struct_eflags) =
offsetof(struct x86_64_user_regs_struct, flags);
ASSIGN_OFFSET(user_regs_struct_cs) =
offsetof(struct x86_64_user_regs_struct, cs);
ASSIGN_OFFSET(user_regs_struct_ss) =
offsetof(struct x86_64_user_regs_struct, ss);
ASSIGN_OFFSET(user_regs_struct_rax) =
offsetof(struct x86_64_user_regs_struct, ax);
ASSIGN_OFFSET(user_regs_struct_rbx) =
offsetof(struct x86_64_user_regs_struct, bx);
ASSIGN_OFFSET(user_regs_struct_rcx) =
offsetof(struct x86_64_user_regs_struct, cx);
ASSIGN_OFFSET(user_regs_struct_rdx) =
offsetof(struct x86_64_user_regs_struct, dx);
ASSIGN_OFFSET(user_regs_struct_rsi) =
offsetof(struct x86_64_user_regs_struct, si);
ASSIGN_OFFSET(user_regs_struct_rdi) =
offsetof(struct x86_64_user_regs_struct, di);
ASSIGN_OFFSET(user_regs_struct_rbp) =
offsetof(struct x86_64_user_regs_struct, bp);
ASSIGN_OFFSET(user_regs_struct_r8) =
offsetof(struct x86_64_user_regs_struct, r8);
ASSIGN_OFFSET(user_regs_struct_r9) =
offsetof(struct x86_64_user_regs_struct, r9);
ASSIGN_OFFSET(user_regs_struct_r10) =
offsetof(struct x86_64_user_regs_struct, r10);
ASSIGN_OFFSET(user_regs_struct_r11) =
offsetof(struct x86_64_user_regs_struct, r11);
ASSIGN_OFFSET(user_regs_struct_r12) =
offsetof(struct x86_64_user_regs_struct, r12);
ASSIGN_OFFSET(user_regs_struct_r13) =
offsetof(struct x86_64_user_regs_struct, r13);
ASSIGN_OFFSET(user_regs_struct_r14) =
offsetof(struct x86_64_user_regs_struct, r14);
ASSIGN_OFFSET(user_regs_struct_r15) =
offsetof(struct x86_64_user_regs_struct, r15);
}
machdep->vmalloc_start = x86_64_vmalloc_start;
vt->vmalloc_start = machdep->vmalloc_start();
machdep->init_kernel_pgd();
if (STRUCT_EXISTS("x8664_pda"))
x86_64_cpu_pda_init();
else
x86_64_per_cpu_init();
x86_64_ist_init();
if (symbol_exists("repeat_nmi"))
machdep->flags |= NESTED_NMI;
machdep->in_alternate_stack = x86_64_in_alternate_stack;
if ((machdep->machspec->irqstack = (char *)
malloc(machdep->machspec->stkinfo.isize)) == NULL)
error(FATAL, "cannot malloc irqstack space.");
if (symbol_exists("irq_desc")) {
if (LKCD_KERNTYPES())
ARRAY_LENGTH_INIT_ALT(machdep->nr_irqs,
"irq_desc", "kernel_stat.irqs", NULL, 0);
else
ARRAY_LENGTH_INIT(machdep->nr_irqs, irq_desc,
"irq_desc", NULL, 0);
} else if (kernel_symbol_exists("nr_irqs"))
get_symbol_data("nr_irqs", sizeof(unsigned int),
&machdep->nr_irqs);
else
machdep->nr_irqs = 224; /* NR_IRQS (at least) */
machdep->dump_irq = x86_64_dump_irq;
machdep->get_irq_affinity = x86_64_get_irq_affinity;
machdep->show_interrupts = x86_64_show_interrupts;
if (THIS_KERNEL_VERSION < LINUX(2,6,24))
machdep->line_number_hooks = x86_64_line_number_hooks;
if (!machdep->hz) {
machdep->hz = HZ;
if (THIS_KERNEL_VERSION >= LINUX(2,6,0))
machdep->hz = 1000;
}
machdep->section_size_bits = _SECTION_SIZE_BITS;
if (!machdep->max_physmem_bits) {
if ((string = pc->read_vmcoreinfo("NUMBER(MAX_PHYSMEM_BITS)"))) {
machdep->max_physmem_bits = atol(string);
free(string);
} else if (machdep->flags & VM_5LEVEL)
machdep->max_physmem_bits =
_MAX_PHYSMEM_BITS_5LEVEL;
else if (THIS_KERNEL_VERSION >= LINUX(2,6,31))
machdep->max_physmem_bits =
_MAX_PHYSMEM_BITS_2_6_31;
else if (THIS_KERNEL_VERSION >= LINUX(2,6,26))
machdep->max_physmem_bits =
_MAX_PHYSMEM_BITS_2_6_26;
else {
machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
len = get_array_length("mem_section", &dim, 0);
/*
* Check for patched MAX_PHYSMEM_BITS.
*/
if (((len > 32) && !dim) ||
((len > 8192) && (dim == 1)))
machdep->max_physmem_bits =
_MAX_PHYSMEM_BITS_2_6_26;
}
}
if (XEN()) {
if (kt->xen_flags & WRITABLE_PAGE_TABLES) {
switch (machdep->flags & VM_FLAGS)
{
case VM_XEN:
case VM_2_6_11:
machdep->uvtop = x86_64_uvtop_level4_xen_wpt;
break;
case VM_XEN_RHEL4:
machdep->uvtop = x86_64_uvtop_level4_rhel4_xen_wpt;
break;
}
machdep->machspec->physical_mask_shift = __PHYSICAL_MASK_SHIFT_XEN;
} else {
machdep->uvtop = x86_64_uvtop_level4;
}
MEMBER_OFFSET_INIT(vcpu_guest_context_user_regs,
"vcpu_guest_context", "user_regs");
ASSIGN_OFFSET(cpu_user_regs_rsp) =
MEMBER_OFFSET("cpu_user_regs", "ss") - sizeof(ulong);
ASSIGN_OFFSET(cpu_user_regs_rip) =
MEMBER_OFFSET("cpu_user_regs", "cs") - sizeof(ulong);
}
x86_64_irq_eframe_link_init();
x86_64_irq_stack_gap_init();
x86_64_entry_trampoline_init();
x86_64_framepointer_init();
x86_64_ORC_init();
x86_64_thread_return_init();
x86_64_l1tf_init();
if (THIS_KERNEL_VERSION >= LINUX(2,6,28))
machdep->machspec->page_protnone = _PAGE_GLOBAL;
else
machdep->machspec->page_protnone = _PAGE_PSE;
STRUCT_SIZE_INIT(note_buf, "note_buf_t");
STRUCT_SIZE_INIT(elf_prstatus, "elf_prstatus");
MEMBER_OFFSET_INIT(elf_prstatus_pr_reg, "elf_prstatus",
"pr_reg");
STRUCT_SIZE_INIT(percpu_data, "percpu_data");
GART_init();
if (kernel_symbol_exists("asm_exc_divide_error"))
machdep->machspec->exception_functions = (char **)exception_functions_5_8;
else
machdep->machspec->exception_functions = (char **)exception_functions_orig;
break;
case POST_VM:
init_unwind_table();
break;
case POST_INIT:
x86_64_post_init();
x86_64_get_active_set();
break;
case LOG_ONLY:
machdep->machspec = &x86_64_machine_specific;
x86_64_calc_phys_base();
break;
}
}
void
x86_64_dump_machdep_table(ulong arg)
{
int c, i, cpus;
int others;
struct machine_specific *ms;
ms = machdep->machspec;
others = 0;
fprintf(fp, " flags: %lx (", machdep->flags);
if (machdep->flags & KSYMS_START)
fprintf(fp, "%sKSYMS_START", others++ ? "|" : "");
if (machdep->flags & PT_REGS_INIT)
fprintf(fp, "%sPT_REGS_INIT", others++ ? "|" : "");
if (machdep->flags & MACHDEP_BT_TEXT)
fprintf(fp, "%sMACHDEP_BT_TEXT", others++ ? "|" : "");
if (machdep->flags & VM_ORIG)
fprintf(fp, "%sVM_ORIG", others++ ? "|" : "");
if (machdep->flags & VM_2_6_11)
fprintf(fp, "%sVM_2_6_11", others++ ? "|" : "");
if (machdep->flags & VM_XEN)
fprintf(fp, "%sVM_XEN", others++ ? "|" : "");
if (machdep->flags & VM_XEN_RHEL4)
fprintf(fp, "%sVM_XEN_RHEL4", others++ ? "|" : "");
if (machdep->flags & VM_5LEVEL)
fprintf(fp, "%sVM_5LEVEL", others++ ? "|" : "");
if (machdep->flags & VMEMMAP)
fprintf(fp, "%sVMEMMAP", others++ ? "|" : "");
if (machdep->flags & NO_TSS)
fprintf(fp, "%sNO_TSS", others++ ? "|" : "");
if (machdep->flags & SCHED_TEXT)
fprintf(fp, "%sSCHED_TEXT", others++ ? "|" : "");
if (machdep->flags & PHYS_BASE)
fprintf(fp, "%sPHYS_BASE", others++ ? "|" : "");
if (machdep->flags & FRAMESIZE_DEBUG)
fprintf(fp, "%sFRAMESIZE_DEBUG", others++ ? "|" : "");
if (machdep->flags & ORC)
fprintf(fp, "%sORC", others++ ? "|" : "");
if (machdep->flags & ORC_6_4)
fprintf(fp, "%sORC_6_4", others++ ? "|" : "");
if (machdep->flags & FRAMEPOINTER)
fprintf(fp, "%sFRAMEPOINTER", others++ ? "|" : "");
if (machdep->flags & GART_REGION)
fprintf(fp, "%sGART_REGION", others++ ? "|" : "");
if (machdep->flags & NESTED_NMI)
fprintf(fp, "%sNESTED_NMI", others++ ? "|" : "");
if (machdep->flags & RANDOMIZED)
fprintf(fp, "%sRANDOMIZED", others++ ? "|" : "");
if (machdep->flags & KPTI)
fprintf(fp, "%sKPTI", others++ ? "|" : "");
if (machdep->flags & L1TF)
fprintf(fp, "%sL1TF", others++ ? "|" : "");
fprintf(fp, ")\n");
fprintf(fp, " kvbase: %lx\n", machdep->kvbase);
fprintf(fp, " identity_map_base: %lx\n", machdep->kvbase);
fprintf(fp, " pagesize: %d\n", machdep->pagesize);
fprintf(fp, " pageshift: %d\n", machdep->pageshift);
fprintf(fp, " pagemask: %llx\n", machdep->pagemask);
fprintf(fp, " pageoffset: %lx\n", machdep->pageoffset);
fprintf(fp, " stacksize: %ld\n", machdep->stacksize);
fprintf(fp, " hz: %d\n", machdep->hz);
fprintf(fp, " mhz: %ld\n", machdep->mhz);
fprintf(fp, " memsize: %llu (0x%llx)\n",
(ulonglong)machdep->memsize, (ulonglong)machdep->memsize);
fprintf(fp, " bits: %d\n", machdep->bits);
fprintf(fp, " nr_irqs: %d\n", machdep->nr_irqs);
fprintf(fp, " eframe_search: x86_64_eframe_search()\n");
if (machdep->back_trace == x86_64_back_trace_cmd)
fprintf(fp, " back_trace: x86_64_back_trace_cmd()\n");
else if (machdep->back_trace == x86_64_low_budget_back_trace_cmd)
fprintf(fp,
" back_trace: x86_64_low_budget_back_trace_cmd() %s\n",
kt->flags & DWARF_UNWIND ?
"-> x86_64_dwarf_back_trace_cmd()" : "");
else if (machdep->back_trace == x86_64_dwarf_back_trace_cmd)
fprintf(fp,
" back_trace: x86_64_dwarf_back_trace_cmd() %s\n",
kt->flags & DWARF_UNWIND ?
"" : "->x86_64_low_budget_back_trace_cmd()");
else
fprintf(fp, " back_trace: %lx\n",
(ulong)machdep->back_trace);
fprintf(fp, " processor_speed: x86_64_processor_speed()\n");
if (machdep->uvtop == x86_64_uvtop)
fprintf(fp, " uvtop: x86_64_uvtop()\n");
else if (machdep->uvtop == x86_64_uvtop_level4) {
fprintf(fp, " uvtop: x86_64_uvtop_level4()");
if (machdep->flags & VM_5LEVEL)
fprintf(fp, " (uses 5-level page tables)");
fprintf(fp, "\n");
} else if (machdep->uvtop == x86_64_uvtop_level4_xen_wpt)
fprintf(fp, " uvtop: x86_64_uvtop_level4_xen_wpt()\n");
else if (machdep->uvtop == x86_64_uvtop_level4_rhel4_xen_wpt)
fprintf(fp, " uvtop: x86_64_uvtop_level4_rhel4_xen_wpt()\n");
else
fprintf(fp, " uvtop: %lx\n", (ulong)machdep->uvtop);
fprintf(fp, " kvtop: x86_64_kvtop()");
if (machdep->flags & VM_5LEVEL)
fprintf(fp, " -> x86_64_kvtop_5level()");
else if (XEN() && (kt->xen_flags & WRITABLE_PAGE_TABLES))
fprintf(fp, " -> x86_64_kvtop_xen_wpt()");
fprintf(fp, "\n");
fprintf(fp, " get_task_pgd: x86_64_get_task_pgd()\n");
fprintf(fp, " dump_irq: x86_64_dump_irq()\n");
fprintf(fp, " get_irq_affinity: x86_64_get_irq_affinity()\n");
fprintf(fp, " show_interrupts: x86_64_show_interrupts()\n");
fprintf(fp, " get_stack_frame: x86_64_get_stack_frame()\n");
fprintf(fp, " get_stackbase: generic_get_stackbase()\n");
fprintf(fp, " get_stacktop: generic_get_stacktop()\n");
fprintf(fp, " translate_pte: x86_64_translate_pte()\n");
fprintf(fp, " memory_size: generic_memory_size()\n");
fprintf(fp, " vmalloc_start: x86_64_vmalloc_start()\n");
fprintf(fp, " is_task_addr: x86_64_is_task_addr()\n");
fprintf(fp, " verify_symbol: x86_64_verify_symbol()\n");
fprintf(fp, " dis_filter: x86_64_dis_filter()\n");
fprintf(fp, " cmd_mach: x86_64_cmd_mach()\n");
fprintf(fp, " get_smp_cpus: x86_64_get_smp_cpus()\n");
fprintf(fp, " is_kvaddr: x86_64_is_kvaddr()\n");
fprintf(fp, " is_uvaddr: x86_64_is_uvaddr()\n");
fprintf(fp, " is_page_ptr: x86_64_is_page_ptr()\n");
fprintf(fp, " verify_paddr: x86_64_verify_paddr()\n");
fprintf(fp, " get_kvaddr_ranges: x86_64_get_kvaddr_ranges()\n");
fprintf(fp, " get_cpu_reg: x86_64_get_cpu_reg()\n");
fprintf(fp, " init_kernel_pgd: x86_64_init_kernel_pgd()\n");
fprintf(fp, "clear_machdep_cache: x86_64_clear_machdep_cache()\n");
fprintf(fp, " xendump_p2m_create: %s\n", PVOPS_XEN() ?
"x86_64_pvops_xendump_p2m_create()" :
"x86_64_xendump_p2m_create()");
fprintf(fp, " get_xendump_regs: x86_64_get_xendump_regs()\n");
fprintf(fp, " xendump_panic_task: x86_64_xendump_panic_task()\n");
fprintf(fp, "xen_kdump_p2m_create: x86_64_xen_kdump_p2m_create()\n");
fprintf(fp, " line_number_hooks: %s\n", machdep->line_number_hooks ?
"x86_64_line_number_hooks" : "(unused)");
fprintf(fp, " verify_line_number: x86_64_verify_line_number()\n");
fprintf(fp, " value_to_symbol: x86_64_value_to_symbol()\n");
fprintf(fp, " in_alternate_stack: x86_64_in_alternate_stack()\n");
fprintf(fp, " last_pgd_read: %lx\n", machdep->last_pgd_read);
fprintf(fp, " last_pud_read: %lx\n", machdep->last_pud_read);
fprintf(fp, " last_pmd_read: %lx\n", machdep->last_pmd_read);
fprintf(fp, " last_ptbl_read: %lx\n", machdep->last_ptbl_read);
fprintf(fp, " pgd: %lx\n", (ulong)machdep->pgd);
fprintf(fp, " pud: %lx\n", (ulong)machdep->pud);
fprintf(fp, " pmd: %lx\n", (ulong)machdep->pmd);
fprintf(fp, " ptbl: %lx\n", (ulong)machdep->ptbl);
fprintf(fp, " ptrs_per_pgd: %d\n", machdep->ptrs_per_pgd);
fprintf(fp, " section_size_bits: %ld\n", machdep->section_size_bits);
fprintf(fp, " max_physmem_bits: %ld\n", machdep->max_physmem_bits);
fprintf(fp, " sections_per_root: %ld\n", machdep->sections_per_root);
for (i = 0; i < MAX_MACHDEP_ARGS; i++) {
fprintf(fp, " cmdline_args[%d]: %s\n",
i, machdep->cmdline_args[i] ?
machdep->cmdline_args[i] : "(unused)");
}
fprintf(fp, " machspec: %016lx\n", (ulong)machdep->machspec);
fprintf(fp, " userspace_top: %016lx\n", (ulong)ms->userspace_top);
fprintf(fp, " page_offset: %016lx\n", (ulong)ms->page_offset);
fprintf(fp, " page_offset_force: ");
if (ms->page_offset_force)
fprintf(fp, "%016lx\n", (ulong)ms->page_offset_force);
else
fprintf(fp, "(unused)\n");
fprintf(fp, " vmalloc_start_addr: %016lx\n", (ulong)ms->vmalloc_start_addr);
fprintf(fp, " vmalloc_end: %016lx\n", (ulong)ms->vmalloc_end);
fprintf(fp, " modules_vaddr: %016lx\n", (ulong)ms->modules_vaddr);
fprintf(fp, " modules_end: %016lx\n", (ulong)ms->modules_end);
fprintf(fp, " vmemmap_vaddr: %016lx %s\n", (ulong)ms->vmemmap_vaddr,
machdep->flags & VMEMMAP ? "" : "(unused)");
fprintf(fp, " vmemmap_end: %016lx %s\n", (ulong)ms->vmemmap_end,
machdep->flags & VMEMMAP ? "" : "(unused)");
fprintf(fp, " phys_base: %lx\n", (ulong)ms->phys_base);
fprintf(fp, " kernel_image_size: ");
if (ms->kernel_image_size)
fprintf(fp, "%lx (%ldMB)\n", ms->kernel_image_size,
ms->kernel_image_size/MEGABYTES(1));
else
fprintf(fp, "(uninitialized)\n");
fprintf(fp, " sme_mask: %lx\n", ms->sme_mask);
fprintf(fp, " physical_mask_shift: %ld\n", ms->physical_mask_shift);
fprintf(fp, " pgdir_shift: %ld\n", ms->pgdir_shift);
fprintf(fp, " GART_start: %lx\n", ms->GART_start);
fprintf(fp, " GART_end: %lx\n", ms->GART_end);
/* pml4 and upml is legacy for extension modules */
if (ms->pml4) {
fprintf(fp, " pml4: %lx\n", (ulong)ms->pml4);
fprintf(fp, " last_pml4_read: %lx\n", (ulong)ms->last_pml4_read);
} else {
fprintf(fp, " pml4: (unused)\n");
fprintf(fp, " last_pml4_read: (unused)\n");
}
if (ms->upml) {
fprintf(fp, " upml: %lx\n", (ulong)ms->upml);
fprintf(fp, " last_upml_read: %lx\n", (ulong)ms->last_upml_read);
} else {
fprintf(fp, " GART_end: %lx\n", ms->GART_end);
fprintf(fp, " upml: (unused)\n");
fprintf(fp, " last_upml_read: (unused)\n");
}
if (ms->p4d) {
fprintf(fp, " p4d: %lx\n", (ulong)ms->p4d);
fprintf(fp, " last_p4d_read: %lx\n", (ulong)ms->last_p4d_read);
} else {
fprintf(fp, " p4d: (unused)\n");
fprintf(fp, " last_p4d_read: (unused)\n");
}
fprintf(fp, " ORC_data: %s", machdep->flags & ORC ? "\n" : "(unused)\n");
if (machdep->flags & ORC) {
fprintf(fp, " module_ORC: %s\n", ms->orc.module_ORC ? "TRUE" : "FALSE");
fprintf(fp, " has_signal: %s\n", ms->orc.has_signal ? "TRUE" : "FALSE");
fprintf(fp, " has_end: %s\n", ms->orc.has_end ? "TRUE" : "FALSE");
fprintf(fp, " lookup_num_blocks: %d\n", ms->orc.lookup_num_blocks);
fprintf(fp, " __start_orc_unwind_ip: %lx\n", ms->orc.__start_orc_unwind_ip);
fprintf(fp, " __stop_orc_unwind_ip: %lx\n", ms->orc.__stop_orc_unwind_ip);
fprintf(fp, " __start_orc_unwind: %lx\n", ms->orc.__start_orc_unwind);
fprintf(fp, " __stop_orc_unwind: %lx\n", ms->orc.__stop_orc_unwind);
fprintf(fp, " orc_lookup: %lx\n", ms->orc.orc_lookup);
fprintf(fp, " ip_entry: %lx\n", ms->orc.ip_entry);
fprintf(fp, " orc_entry: %lx\n", ms->orc.orc_entry);
fprintf(fp, " orc_entry_data:\n");
fprintf(fp, " sp_offset: %d\n", ms->orc.orc_entry_data.sp_offset);
fprintf(fp, " bp_offset: %d\n", ms->orc.orc_entry_data.bp_offset);
fprintf(fp, " sp_reg: %d\n", ms->orc.orc_entry_data.sp_reg);
fprintf(fp, " bp_reg: %d\n", ms->orc.orc_entry_data.bp_reg);
fprintf(fp, " type: %d\n", ms->orc.orc_entry_data.type);