| .. | .. |
|---|
| 1229 | 1229 | return *ptr; |
|---|
| 1230 | 1230 | } |
|---|
| 1231 | 1231 | |
|---|
| 1232 | | -void add_interrupt_randomness(int irq, int irq_flags) |
|---|
| 1232 | +void add_interrupt_randomness(int irq, int irq_flags, __u64 ip) |
|---|
| 1233 | 1233 | { |
|---|
| 1234 | 1234 | struct entropy_store *r; |
|---|
| 1235 | 1235 | struct fast_pool *fast_pool = this_cpu_ptr(&irq_randomness); |
|---|
| 1236 | | - struct pt_regs *regs = get_irq_regs(); |
|---|
| 1237 | 1236 | unsigned long now = jiffies; |
|---|
| 1238 | 1237 | cycles_t cycles = random_get_entropy(); |
|---|
| 1239 | 1238 | __u32 c_high, j_high; |
|---|
| 1240 | | - __u64 ip; |
|---|
| 1241 | 1239 | unsigned long seed; |
|---|
| 1242 | 1240 | int credit = 0; |
|---|
| 1243 | 1241 | |
|---|
| 1244 | 1242 | if (cycles == 0) |
|---|
| 1245 | | - cycles = get_reg(fast_pool, regs); |
|---|
| 1243 | + cycles = get_reg(fast_pool, NULL); |
|---|
| 1246 | 1244 | c_high = (sizeof(cycles) > 4) ? cycles >> 32 : 0; |
|---|
| 1247 | 1245 | j_high = (sizeof(now) > 4) ? now >> 32 : 0; |
|---|
| 1248 | 1246 | fast_pool->pool[0] ^= cycles ^ j_high ^ irq; |
|---|
| 1249 | 1247 | fast_pool->pool[1] ^= now ^ c_high; |
|---|
| 1250 | | - ip = regs ? instruction_pointer(regs) : _RET_IP_; |
|---|
| 1248 | + if (!ip) |
|---|
| 1249 | + ip = _RET_IP_; |
|---|
| 1251 | 1250 | fast_pool->pool[2] ^= ip; |
|---|
| 1252 | 1251 | fast_pool->pool[3] ^= (sizeof(ip) > 4) ? ip >> 32 : |
|---|
| 1253 | | - get_reg(fast_pool, regs); |
|---|
| 1252 | + get_reg(fast_pool, NULL); |
|---|
| 1254 | 1253 | |
|---|
| 1255 | 1254 | fast_mix(fast_pool); |
|---|
| 1256 | 1255 | add_interrupt_bench(cycles); |
|---|