Chinaunix首页 | 论坛 | 博客
  • 博客访问: 22146
  • 博文数量: 10
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 140
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-05 00:47
文章分类

全部博文(10)

文章存档

2015年(1)

2014年(9)

我的朋友

分类: 虚拟化

2014-12-29 23:34:03


  1. ## Booting kernel from Legacy Image at 50000000 ...
  2. Image Name:
  3. Image Type: ARM Linux Kernel Image (uncompressed)
  4. Data Size: 656144 Bytes = 640.8 KiB
  5. Load Address: 80200000
  6. Entry Point: 80200000
  7. Verifying Checksum ... OK
  8. ## Flattened Device Tree blob at 42000000
  9. Booting using the fdt blob at 0x42000000
  10. Loading Kernel Image ... OK
  11. OK
  12. reserving fdt memory region: addr=42000000 size=9000
  13. Using Device Tree in place at 42000000, end 4200bfff
  14. Starting kernel ...
  15. Xen 4.4-rc2
  16. (XEN) Xen version 4.4-rc2 (uty@localdomain) (arm-unknown-linux-gnueabi-gcc (GCC) 4.6.3) debug=y Tue Dec 16 22:03:20 CST 2014
  17. (XEN) Latest ChangeSet: Thu Feb 6 12:20:48 2014 +0100 git:fee6163-dirty
  18. (XEN) Console output is synchronous.
  19. (XEN) Processor: 410fc0f4: "ARM Limited", variant: 0x0, part 0xc0f, rev 0x4
  20. (XEN) 32-bit Execution:
  21. (XEN) Processor Features: 00001031:00011011
  22. (XEN) Instruction Sets: AArch32 Thumb Thumb-2 ThumbEE Jazelle
  23. (XEN) Extensions: GenericTimer Security
  24. (XEN) Debug Features: 02010555
  25. (XEN) Auxiliary Features: 00000000
  26. (XEN) Memory Model Features: 10201105 20000000 01240000 02102211
  27. (XEN) ISA Features: 02101110 13112111 21232041 11112131 10011142 00000000
  28. (XEN) Platform: SAMSUNG EXYNOS5
  29. (XEN) Set SYSRAM to 00000000bfe0004c (0020004c)
  30. (XEN) Generic Timer IRQ: phys=30 hyp=26 virt=27
  31. (XEN) uty: in exynos5_init_time() !!!!!!!!!!!
  32. (XEN) Using generic timer at 24000 KHz
  33. (XEN) GIC initialization:
  34. (XEN) gic_dist_addr=0000000010481000
  35. (XEN) gic_cpu_addr=0000000010482000
  36. (XEN) gic_hyp_addr=0000000010484000
  37. (XEN) gic_vcpu_addr=0000000010486000
  38. (XEN) gic_maintenance_irq=25
  39. (XEN) GIC: 160 lines, 2 cpus, secure (IID 0200043b).
  40. (XEN) Using scheduler: SMP Credit Scheduler (credit)
  41. (XEN) Allocated console ring of 16 KiB.
  42. (XEN) VFP implementer 0x41 architecture 4 part 0x30 variant 0xf rev 0x0
  43. (XEN) Bringing up CPU1
  44. (XEN) CPU 1 booted.
  45. (XEN) Brought up 2 CPUs
  46. (XEN) *** LOADING DOMAIN 0 ***
  47. (XEN) Populate P2M 0x80000000->0xa0000000 (1:1 mapping for dom0)
  48. (XEN) uty: early_info.modules.nr_mods 2, MOD_KERNEL 2
  49. (XEN) Loading kernel from boot module 2
  50. (XEN) Loading zImage from 0000000060000000 to 0000000087c00000-0000000087fb95c4
  51. (XEN) Loading dom0 DTB to 0x0000000088000000-0x0000000088008428
  52. (XEN) Scrubbing Free RAM: ...............done.
  53. (XEN) Initial low memory virq threshold set at 0x4000 pages.
  54. (XEN) Std. Loglevel: All
  55. (XEN) Guest Loglevel: All
  56. (XEN) **********************************************
  57. (XEN) ******* WARNING: CONSOLE OUTPUT IS SYNCHRONOUS
  58. (XEN) ******* This option is intended to aid debugging of Xen by ensuring
  59. (XEN) ******* that all output is synchronously delivered on the serial line.
  60. (XEN) ******* However it can introduce SIGNIFICANT latencies and affect
  61. (XEN) ******* timekeeping. It is NOT recommended for production use!
  62. (XEN) **********************************************
  63. (XEN) 3... 2... 1...
  64. (XEN) *** Serial input -> DOM0 (type 'CTRL-a' three times to switch input to Xen)
  65. (XEN) Freed 264kB init memory.
  66. (XEN) DOM0: Uncompressing Linux... done, booting the kernel.
  67. (XEN) DOM0: <6>Initializing cgroup subsys cpu
  68. (XEN) DOM0: <5>Linux version 3.0.31-g3370a7c-dirty (uty@localhost.localdomain) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #25
  69. (XEN) DOM0: SMP PREEMPT Wed Dec 24 22:40:07 CST 2014
  70. (XEN) DOM0: CPU: ARMv7 Processor [410fc0f4] revision 4 (ARMv7), cr=10c5387d
  71. (XEN) DOM0: CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
  72. (XEN) DOM0: <6>Machine: ARNDALE, model: Insignal Arndale evaluation board based on EXYNOS5250
  73. (XEN) DOM0: uty: arm_add_memory start 0x80000000 size 0x20000000
  74. (XEN) DOM0: <6>debug: ignoring loglevel setting.
  75. (XEN) DOM0: Memory policy: ECC disabled, Data cache writealloc
  76. (XEN) DOM0: uty: build_mem_type_table end
  77. (XEN) DOM0: uty: build_mem_type_table end
  78. (XEN) DOM0: uty: prepare_page_table end
  79. (XEN) DOM0: uty: prepare_page_table end
  80. (XEN) DOM0: uty: map_lowmem end
  81. (XEN) DOM0: uty: map_lowmem end
  82. (XEN) DOM0: uty:in devicemaps_init
  83. (XEN) DOM0: uty:in devicemaps_init 2
  84. (XEN) DOM0: uty: early_alloc for vectors_page OK
  85. (XEN) DOM0: uty: addr=0xf6000000
  86. (XEN) DOM0: uty: pmd=0xc0007d80
  87. (XEN) DOM0: uty: addr=0xf6200000
  88. (XEN) DOM0: uty: pmd=0xc0007d88
  89. (XEN) DOM0: uty: addr=0xf6400000
  90. (XEN) DOM0: uty: pmd=0xc0007d90
  91. (XEN) DOM0: uty: addr=0xf6600000
  92. (XEN) DOM0: uty: pmd=0xc0007d98
  93. (XEN) DOM0: uty: addr=0xf6800000
  94. (XEN) DOM0: uty: pmd=0xc0007da0
  95. (XEN) DOM0: uty: addr=0xf6a00000
  96. (XEN) DOM0: uty: pmd=0xc0007da8
  97. (XEN) DOM0: uty: addr=0xf6c00000
  98. (XEN) DOM0: uty: pmd=0xc0007db0
  99. (XEN) DOM0: uty: addr=0xf6e00000
  100. (XEN) DOM0: uty: pmd=0xc0007db8
  101. (XEN) DOM0: uty: addr=0xf7000000
  102. (XEN) DOM0: uty: pmd=0xc0007dc0
上次跑到这里
想看下xen的输出看看是不是内存访问时出错了,不过后来想0xc0007dc0这样的地址不是新页开始的地址,怎么会突然不能访问呢。然后想到0xf7000000这个地址还是有点特别的,会不会是这段地址里map了什么,导致early_printk不能输出了?
一开始觉得early_printk用的时板上UART的物理地址,不会受影响,但又一想,在kernel解压代码执行的时候没有开启分页,是用的物理内存访问,已经执行到现在这里了,怎样用物理内存访问啊,一定得把这段物理内存map了再用。所以又去看了下early_printk的流程,确实和想的一样。
在arch\arm\kernel\early_printk.c里实现的early_printk()

  1.  39 asmlinkage void early_printk(const char *fmt, ...)
  2.  40 {
  3.  41    char buf[512];
  4.  42    int n;
  5.  43    va_list ap;
  6.  44
  7.  45    va_start(ap, fmt);
  8.  46    n = vscnprintf(buf, sizeof(buf), fmt, ap);
  9.  47    early_write(buf, n);
  10.  48    va_end(ap);
  11.  49 }
  1.  17 static void early_write(const char *s, unsigned n)
  2.  18 {
  3.  19    while (n-- > 0) {
  4.  20        if (*s == '\n')
  5.  21            printch('\r');
  6.  22        printch(*s);
  7.  23        s++;
  8.  24    }
  9.  25 }
然后搜printch,实现在arch/arm/kernel/debug.S
  1. 107 #ifdef CONFIG_MMU
  2. 108 .macro addruart_current, rx, tmp1, tmp2
  3. 109 addruart \tmp1, \tmp2, \rx
  4. 110 mrc p15, 0, \rx, c1, c0
  5. 111 tst \rx, #1
  6. 112 moveq \rx, \tmp1
  7. 113 movne \rx, \tmp2
  8. 114 .endm
  9. 115
  10. 116 #else /* !CONFIG_MMU */
  11. 117 .macro addruart_current, rx, tmp1, tmp2
  12. 118 addruart \rx, \tmp1
  13. 119 .endm
  14. 120
  15. 121 #endif /* CONFIG_MMU */
  16. 122
  17. 123 /*
  18. 124 * Useful debugging routines
  19. 125 */
  20. 126 ENTRY(printhex8)
  21. 127 mov r1, #8
  22. 128 b printhex
  23. 129 ENDPROC(printhex8)
  24. 130
  25. 131 ENTRY(printhex4)
  26. 132 mov r1, #4
  27. 133 b printhex
  28. 134 ENDPROC(printhex4)
  29. 135
  30. 136 ENTRY(printhex2)
  31. 137 mov r1, #2
  32. 138 printhex: adr r2, hexbuf
  33. 139 add r3, r2, r1
  34. 140 mov r1, #0
  35. 141 strb r1, [r3]
  36. 142 1: and r1, r0, #15
  37. 143 mov r0, r0, lsr #4
  38. 144 cmp r1, #10
  39. 145 addlt r1, r1, #'0'
  40. 146 addge r1, r1, #'a' - 10
  41. 147 strb r1, [r3, #-1]!
  42. 148 teq r3, r2
  43. 149 bne 1b
  44. 150 mov r0, r2
  45. 151 b printascii
  46. 152 ENDPROC(printhex2)
  47. 153
  48. 154 hexbuf: .space 16
  49. 155
  50. 156 .ltorg
  51. 157
  52. 158 ENTRY(printascii)
  53. 159 addruart_current r3, r1, r2
  54. 160 b 2f
  55. 161 1: waituart r2, r3
  56. 162 senduart r1, r3
  57. 163 busyuart r2, r3
  58. 164 teq r1, #'\n'
  59. 165 moveq r1, #'\r'
  60. 166 beq 1b
  61. 167 2: teq r0, #0
  62. 168 ldrneb r1, [r0], #1
  63. 169 teqne r1, #0
  64. 170 bne 1b
  65. 171 mov pc, lr
  66. 172 ENDPROC(printascii)
  67. 173
  68. 174 ENTRY(printch)
  69. 175 addruart_current r3, r1, r2
  70. 176 mov r1, r0
  71. 177 mov r0, #0
  72. 178 b 1b
  73. 179 ENDPROC(printch)
ChinaUnix你够了啊,贴个代码贴出翔
因为不是用的CONFIG_DEBUG_ICEDCC所以关键的addruart是实现在mach-xxx/debug-macro.S里,但在addruart_current这个宏里,是对当前是否是进入页模式有判断的,如果是就用虚拟地址,如果不是就用物理地址
在arch/arm/mach-exynos/include/mach/debug-macro.S里

  1.   1 /* linux/arch/arm/mach-exynos/include/mach/debug-macro.S
  2.   2 *
  3.   3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  4.   4 * http://www.samsung.com
  5.   5 *
  6.   6 * Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S
  7.   7 *
  8.   8 * This program is free software; you can redistribute it and/or modify
  9.   9 * it under the terms of the GNU General Public License version 2 as
  10.  10 * published by the Free Software Foundation.
  11.  11 */
  12.  12
  13.  13 /* pull in the relevant register and map files. */
  14.  14
  15.  15 #include <mach/map.h>
  16.  16
  17.  17 /* note, for the boot process to work we have to keep the UART
  18.  18 * virtual address aligned to an 1MiB boundary for the L1
  19.  19 * mapping the head code makes. We keep the UART virtual address
  20.  20 * aligned and add in the offset when we load the value here.
  21.  21 */
  22.  22
  23.  23 .macro addruart, rp, rv
  24.  24 ldr \rp, = S3C_PA_UART
  25.  25 ldr \rv, = S3C_VA_UART
  26.  26 #if CONFIG_DEBUG_S3C_UART != 0
  27.  27 add \rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART)
  28.  28 add \rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART)
  29.  29 #endif
  30.  30 .endm
  31.  31
  32.  32 #define fifo_full fifo_full_s5pv210
在arch/arm/mach-exynos/include/mach/map-exynos5.h中,找到了对应的定义。

286 #define S3C_PA_UART         EXYNOS5_PA_UART
113 #define EXYNOS5_PA_UART         0x12C00000

在arch/arm/plat-samsung/include/plat/map-base.h中定义的VA地址

  1.  17 /* Fit all our registers in at 0xF6000000 upwards, trying to use as
  2.  18 * little of the VA space as possible so vmalloc and friends have a
  3.  19 * better chance of getting memory.
  4.  20 *
  5.  21 * we try to ensure stuff like the IRQ registers are available for
  6.  22 * an single MOVS instruction (ie, only 8 bits of set data)
  7.  23 */
  8.  24
  9.  25 #define S3C_ADDR_BASE 0xF6000000
  10.  26
  11.  27 #ifndef __ASSEMBLY__
  12.  28 #define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE + (x))
  13.  29 #else
  14.  30 #define S3C_ADDR(x) (S3C_ADDR_BASE + (x))
  15.  31 #endif
  16.  32
  17.  33 #define S3C_VA_IRQ S3C_ADDR(0x00000000) /* irq controller(s) */
  18.  34 #define S3C_VA_SYS S3C_ADDR(0x00100000) /* system control */
  19.  35 #define S3C_VA_MEM S3C_ADDR(0x00200000) /* memory control */
  20.  36 #define S3C_VA_TIMER S3C_ADDR(0x00300000) /* timer block */
  21.  37 #define S3C_VA_WATCHDOG S3C_ADDR(0x00400000) /* watchdog */
  22.  38 #define S3C_VA_HSOTG S3C_ADDR(0x00E00000) /* OTG */
  23.  39 #define S3C_VA_HSPHY S3C_ADDR(0x00F00000) /* OTG PHY */
  24.  40 #define S3C_VA_UART S3C_ADDR(0x01000000) /* UART */
  25.  41
  26.  42 /* This is used for the CPU specific mappings that may be needed, so that
  27.  43 * they do not need to directly used S3C_ADDR() and thus make it easier to
  28.  44 * modify the space for mapping.
  29.  45 */
  30.  46 #define S3C_ADDR_CPU(x) S3C_ADDR(0x00500000 + (x))
  31.  47
  32.  48 #endif /* __ASM_PLAT_MAP_H */
可以看到S3C_VA_UART正是在0xf7000000的位置。现在用的是2号UART所以是0xf7020000,这个地址段的pmd被清0后,当然early_printk就不能用了,这也回答了我前几天的疑问。

所以代码卡在这的原因是early_printk不显示了,而后面的初始化device map没有再初始化对UART部分的映射?





阅读(598) | 评论(0) | 转发(0) |
0

上一篇:2012-12-24 接着调

下一篇:2014-12-30 接着调

给主人留下些什么吧!~~