diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.kgdb | 11 | ||||
-rw-r--r-- | lib/iommu-helper.c | 8 | ||||
-rw-r--r-- | lib/random32.c | 48 |
3 files changed, 34 insertions, 33 deletions
diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb index 2cfd2721f7ed..9b5d1d7f2ef7 100644 --- a/lib/Kconfig.kgdb +++ b/lib/Kconfig.kgdb | |||
@@ -4,14 +4,17 @@ config HAVE_ARCH_KGDB | |||
4 | 4 | ||
5 | menuconfig KGDB | 5 | menuconfig KGDB |
6 | bool "KGDB: kernel debugging with remote gdb" | 6 | bool "KGDB: kernel debugging with remote gdb" |
7 | select FRAME_POINTER | ||
8 | depends on HAVE_ARCH_KGDB | 7 | depends on HAVE_ARCH_KGDB |
9 | depends on DEBUG_KERNEL && EXPERIMENTAL | 8 | depends on DEBUG_KERNEL && EXPERIMENTAL |
10 | help | 9 | help |
11 | If you say Y here, it will be possible to remotely debug the | 10 | If you say Y here, it will be possible to remotely debug the |
12 | kernel using gdb. Documentation of kernel debugger is available | 11 | kernel using gdb. It is recommended but not required, that |
13 | at http://kgdb.sourceforge.net as well as in DocBook form | 12 | you also turn on the kernel config option |
14 | in Documentation/DocBook/. If unsure, say N. | 13 | CONFIG_FRAME_POINTER to aid in producing more reliable stack |
14 | backtraces in the external debugger. Documentation of | ||
15 | kernel debugger is available at http://kgdb.sourceforge.net | ||
16 | as well as in DocBook form in Documentation/DocBook/. If | ||
17 | unsure, say N. | ||
15 | 18 | ||
16 | if KGDB | 19 | if KGDB |
17 | 20 | ||
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index 889ddce2021e..a3b8d4c3f77a 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c | |||
@@ -80,11 +80,3 @@ void iommu_area_free(unsigned long *map, unsigned long start, unsigned int nr) | |||
80 | } | 80 | } |
81 | } | 81 | } |
82 | EXPORT_SYMBOL(iommu_area_free); | 82 | EXPORT_SYMBOL(iommu_area_free); |
83 | |||
84 | unsigned long iommu_num_pages(unsigned long addr, unsigned long len) | ||
85 | { | ||
86 | unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE); | ||
87 | |||
88 | return size >> PAGE_SHIFT; | ||
89 | } | ||
90 | EXPORT_SYMBOL(iommu_num_pages); | ||
diff --git a/lib/random32.c b/lib/random32.c index ca87d86992bd..217d5c4b666d 100644 --- a/lib/random32.c +++ b/lib/random32.c | |||
@@ -56,23 +56,12 @@ static u32 __random32(struct rnd_state *state) | |||
56 | return (state->s1 ^ state->s2 ^ state->s3); | 56 | return (state->s1 ^ state->s2 ^ state->s3); |
57 | } | 57 | } |
58 | 58 | ||
59 | static void __set_random32(struct rnd_state *state, unsigned long s) | 59 | /* |
60 | * Handle minimum values for seeds | ||
61 | */ | ||
62 | static inline u32 __seed(u32 x, u32 m) | ||
60 | { | 63 | { |
61 | if (s == 0) | 64 | return (x < m) ? x + m : x; |
62 | s = 1; /* default seed is 1 */ | ||
63 | |||
64 | #define LCG(n) (69069 * n) | ||
65 | state->s1 = LCG(s); | ||
66 | state->s2 = LCG(state->s1); | ||
67 | state->s3 = LCG(state->s2); | ||
68 | |||
69 | /* "warm it up" */ | ||
70 | __random32(state); | ||
71 | __random32(state); | ||
72 | __random32(state); | ||
73 | __random32(state); | ||
74 | __random32(state); | ||
75 | __random32(state); | ||
76 | } | 65 | } |
77 | 66 | ||
78 | /** | 67 | /** |
@@ -107,7 +96,7 @@ void srandom32(u32 entropy) | |||
107 | */ | 96 | */ |
108 | for_each_possible_cpu (i) { | 97 | for_each_possible_cpu (i) { |
109 | struct rnd_state *state = &per_cpu(net_rand_state, i); | 98 | struct rnd_state *state = &per_cpu(net_rand_state, i); |
110 | __set_random32(state, state->s1 ^ entropy); | 99 | state->s1 = __seed(state->s1 ^ entropy, 1); |
111 | } | 100 | } |
112 | } | 101 | } |
113 | EXPORT_SYMBOL(srandom32); | 102 | EXPORT_SYMBOL(srandom32); |
@@ -122,7 +111,19 @@ static int __init random32_init(void) | |||
122 | 111 | ||
123 | for_each_possible_cpu(i) { | 112 | for_each_possible_cpu(i) { |
124 | struct rnd_state *state = &per_cpu(net_rand_state,i); | 113 | struct rnd_state *state = &per_cpu(net_rand_state,i); |
125 | __set_random32(state, i + jiffies); | 114 | |
115 | #define LCG(x) ((x) * 69069) /* super-duper LCG */ | ||
116 | state->s1 = __seed(LCG(i + jiffies), 1); | ||
117 | state->s2 = __seed(LCG(state->s1), 7); | ||
118 | state->s3 = __seed(LCG(state->s2), 15); | ||
119 | |||
120 | /* "warm it up" */ | ||
121 | __random32(state); | ||
122 | __random32(state); | ||
123 | __random32(state); | ||
124 | __random32(state); | ||
125 | __random32(state); | ||
126 | __random32(state); | ||
126 | } | 127 | } |
127 | return 0; | 128 | return 0; |
128 | } | 129 | } |
@@ -135,13 +136,18 @@ core_initcall(random32_init); | |||
135 | static int __init random32_reseed(void) | 136 | static int __init random32_reseed(void) |
136 | { | 137 | { |
137 | int i; | 138 | int i; |
138 | unsigned long seed; | ||
139 | 139 | ||
140 | for_each_possible_cpu(i) { | 140 | for_each_possible_cpu(i) { |
141 | struct rnd_state *state = &per_cpu(net_rand_state,i); | 141 | struct rnd_state *state = &per_cpu(net_rand_state,i); |
142 | u32 seeds[3]; | ||
143 | |||
144 | get_random_bytes(&seeds, sizeof(seeds)); | ||
145 | state->s1 = __seed(seeds[0], 1); | ||
146 | state->s2 = __seed(seeds[1], 7); | ||
147 | state->s3 = __seed(seeds[2], 15); | ||
142 | 148 | ||
143 | get_random_bytes(&seed, sizeof(seed)); | 149 | /* mix it in */ |
144 | __set_random32(state, seed); | 150 | __random32(state); |
145 | } | 151 | } |
146 | return 0; | 152 | return 0; |
147 | } | 153 | } |