hc
2023-11-06 15ade055295d13f95d49e3d99b09f3bbfb4a43e7
kernel/drivers/char/random.c
....@@ -1229,28 +1229,27 @@
12291229 return *ptr;
12301230 }
12311231
1232
-void add_interrupt_randomness(int irq, int irq_flags)
1232
+void add_interrupt_randomness(int irq, int irq_flags, __u64 ip)
12331233 {
12341234 struct entropy_store *r;
12351235 struct fast_pool *fast_pool = this_cpu_ptr(&irq_randomness);
1236
- struct pt_regs *regs = get_irq_regs();
12371236 unsigned long now = jiffies;
12381237 cycles_t cycles = random_get_entropy();
12391238 __u32 c_high, j_high;
1240
- __u64 ip;
12411239 unsigned long seed;
12421240 int credit = 0;
12431241
12441242 if (cycles == 0)
1245
- cycles = get_reg(fast_pool, regs);
1243
+ cycles = get_reg(fast_pool, NULL);
12461244 c_high = (sizeof(cycles) > 4) ? cycles >> 32 : 0;
12471245 j_high = (sizeof(now) > 4) ? now >> 32 : 0;
12481246 fast_pool->pool[0] ^= cycles ^ j_high ^ irq;
12491247 fast_pool->pool[1] ^= now ^ c_high;
1250
- ip = regs ? instruction_pointer(regs) : _RET_IP_;
1248
+ if (!ip)
1249
+ ip = _RET_IP_;
12511250 fast_pool->pool[2] ^= ip;
12521251 fast_pool->pool[3] ^= (sizeof(ip) > 4) ? ip >> 32 :
1253
- get_reg(fast_pool, regs);
1252
+ get_reg(fast_pool, NULL);
12541253
12551254 fast_mix(fast_pool);
12561255 add_interrupt_bench(cycles);