mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
consolidate do_bug_frame() / bug_fn_t
The type not being used in do_bug_frame() is suspicious. Apparently that's solely because the type uses a pointer-to-const parameter, when so far run_in_exception_handler() wanted functions taking pointer- to-non-const. Expand use of const, in turn requiring common code's do_bug_frame() as well as [gs]et_irq_regs() to also gain const. This then brings the former function also closer to the common one, with Arm's use of vaddr_t remaining as a difference. While there also replace the bogus use of hard tabs in [gs]et_irq_regs() (I clearly didn't mean to put it in like this). Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
1 parent
f75b051f78
commit
8c5e4ce145
13 files changed
+25
-36
No files matched your search
+1
-1
@@ -220,7 +220,7 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq)
|
||||
{
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
struct irqaction *action;
|
||||
struct cpu_user_regs *old_regs = set_irq_regs(regs);
|
||||
const struct cpu_user_regs *old_regs = set_irq_regs(regs);
|
||||
|
||||
perfc_incr(irqs);
|
||||
|
||||
|
||||
@@ -409,8 +409,7 @@ static always_inline void rep_nop(void)
|
||||
void show_code(const struct cpu_user_regs *regs);
|
||||
void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs);
|
||||
void show_registers(const struct cpu_user_regs *regs);
|
||||
#define dump_execution_state() \
|
||||
run_in_exception_handler(show_execution_state_nonconst)
|
||||
#define dump_execution_state() run_in_exception_handler(show_execution_state)
|
||||
void show_page_walk(unsigned long addr);
|
||||
void noreturn fatal_trap(const struct cpu_user_regs *regs, bool show_remote);
|
||||
|
||||
|
||||
+1
-1
@@ -1896,7 +1896,7 @@ void do_IRQ(struct cpu_user_regs *regs)
|
||||
struct irq_desc *desc;
|
||||
unsigned int vector = (uint8_t)regs->entry_vector;
|
||||
int irq = this_cpu(vector_irq)[vector];
|
||||
struct cpu_user_regs *old_regs = set_irq_regs(regs);
|
||||
const struct cpu_user_regs *old_regs = set_irq_regs(regs);
|
||||
|
||||
perfc_incr(irqs);
|
||||
this_cpu(irq_count)++;
|
||||
|
||||
@@ -643,7 +643,7 @@ void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs)
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
void show_execution_state(const struct cpu_user_regs *regs)
|
||||
void cf_check show_execution_state(const struct cpu_user_regs *regs)
|
||||
{
|
||||
/* Prevent interleaving of output. */
|
||||
unsigned long flags = console_lock_recursive_irqsave();
|
||||
@@ -655,11 +655,6 @@ void show_execution_state(const struct cpu_user_regs *regs)
|
||||
console_unlock_recursive_irqrestore(flags);
|
||||
}
|
||||
|
||||
void cf_check show_execution_state_nonconst(struct cpu_user_regs *regs)
|
||||
{
|
||||
show_execution_state(regs);
|
||||
}
|
||||
|
||||
void vcpu_show_execution_state(struct vcpu *v)
|
||||
{
|
||||
unsigned long flags = 0;
|
||||
|
||||
+2
-6
@@ -10,7 +10,7 @@
|
||||
* Returns a negative value in case of an error otherwise
|
||||
* BUGFRAME_{run_fn, warn, bug, assert}
|
||||
*/
|
||||
int do_bug_frame(struct cpu_user_regs *regs, unsigned long pc)
|
||||
int do_bug_frame(const struct cpu_user_regs *regs, unsigned long pc)
|
||||
{
|
||||
const struct bug_frame *bug = NULL;
|
||||
const struct virtual_region *region;
|
||||
@@ -44,14 +44,10 @@ int do_bug_frame(struct cpu_user_regs *regs, unsigned long pc)
|
||||
|
||||
if ( id == BUGFRAME_run_fn )
|
||||
{
|
||||
void (*fn)(struct cpu_user_regs *) = bug_ptr(bug);
|
||||
bug_fn_t *fn = bug_ptr(bug);
|
||||
|
||||
fn(regs);
|
||||
|
||||
/* Re-enforce consistent types, because of the casts involved. */
|
||||
if ( false )
|
||||
run_in_exception_handler(fn);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#include <xen/irq.h>
|
||||
#include <xen/errno.h>
|
||||
|
||||
DEFINE_PER_CPU(struct cpu_user_regs *, irq_regs);
|
||||
DEFINE_PER_CPU(const struct cpu_user_regs *, irq_regs);
|
||||
|
||||
int init_one_irq_desc(struct irq_desc *desc)
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ static void cf_check show_handlers(unsigned char key)
|
||||
|
||||
static cpumask_t dump_execstate_mask;
|
||||
|
||||
void cf_check dump_execstate(struct cpu_user_regs *regs)
|
||||
void cf_check dump_execstate(const struct cpu_user_regs *regs)
|
||||
{
|
||||
unsigned int cpu = smp_processor_id();
|
||||
|
||||
|
||||
@@ -1246,14 +1246,14 @@ static int cf_check ehci_dbgp_getc(struct serial_port *port, char *pc)
|
||||
/* Safe: ehci_dbgp_poll() runs as timer handler, so not reentrant. */
|
||||
static struct serial_port *poll_port;
|
||||
|
||||
static void cf_check _ehci_dbgp_poll(struct cpu_user_regs *regs)
|
||||
static void cf_check _ehci_dbgp_poll(const struct cpu_user_regs *regs)
|
||||
{
|
||||
struct serial_port *port = poll_port;
|
||||
struct ehci_dbgp *dbgp = port->uart;
|
||||
unsigned long flags;
|
||||
unsigned int timeout = MICROSECS(DBGP_CHECK_INTERVAL);
|
||||
bool empty = false;
|
||||
struct cpu_user_regs *old_regs;
|
||||
const struct cpu_user_regs *old_regs;
|
||||
|
||||
if ( !dbgp->ehci_debug )
|
||||
return;
|
||||
|
||||
@@ -206,11 +206,11 @@ static void cf_check ns16550_interrupt(int irq, void *dev_id)
|
||||
/* Safe: ns16550_poll() runs as softirq so not reentrant on a given CPU. */
|
||||
static DEFINE_PER_CPU(struct serial_port *, poll_port);
|
||||
|
||||
static void cf_check __ns16550_poll(struct cpu_user_regs *regs)
|
||||
static void cf_check __ns16550_poll(const struct cpu_user_regs *regs)
|
||||
{
|
||||
struct serial_port *port = this_cpu(poll_port);
|
||||
struct ns16550 *uart = port->uart;
|
||||
struct cpu_user_regs *old_regs;
|
||||
const struct cpu_user_regs *old_regs;
|
||||
|
||||
if ( uart->intr_works )
|
||||
return; /* Interrupts work - no more polling */
|
||||
|
||||
@@ -101,8 +101,7 @@ typedef void bug_fn_t(const struct cpu_user_regs *regs);
|
||||
|
||||
#ifndef run_in_exception_handler
|
||||
|
||||
static void always_inline run_in_exception_handler(
|
||||
void (*fn)(struct cpu_user_regs *regs))
|
||||
static void always_inline run_in_exception_handler(bug_fn_t *fn)
|
||||
{
|
||||
BUG_FRAME(BUGFRAME_run_fn, 0, fn, 0, NULL);
|
||||
}
|
||||
@@ -133,7 +132,7 @@ static void always_inline run_in_exception_handler(
|
||||
* Returns a negative value in case of an error otherwise
|
||||
* BUGFRAME_{run_fn, warn, bug, assert}
|
||||
*/
|
||||
int do_bug_frame(struct cpu_user_regs *regs, unsigned long pc);
|
||||
int do_bug_frame(const struct cpu_user_regs *regs, unsigned long pc);
|
||||
|
||||
#endif /* CONFIG_GENERIC_BUG_FRAME */
|
||||
|
||||
|
||||
@@ -134,21 +134,22 @@ void cf_check irq_actor_none(struct irq_desc *desc);
|
||||
* Per-cpu interrupted context register state - the inner-most interrupt frame
|
||||
* on the stack.
|
||||
*/
|
||||
DECLARE_PER_CPU(struct cpu_user_regs *, irq_regs);
|
||||
DECLARE_PER_CPU(const struct cpu_user_regs *, irq_regs);
|
||||
|
||||
static inline struct cpu_user_regs *get_irq_regs(void)
|
||||
static inline const struct cpu_user_regs *get_irq_regs(void)
|
||||
{
|
||||
return this_cpu(irq_regs);
|
||||
return this_cpu(irq_regs);
|
||||
}
|
||||
|
||||
static inline struct cpu_user_regs *set_irq_regs(struct cpu_user_regs *new_regs)
|
||||
static inline const struct cpu_user_regs *set_irq_regs(
|
||||
const struct cpu_user_regs *new_regs)
|
||||
{
|
||||
struct cpu_user_regs *old_regs, **pp_regs = &this_cpu(irq_regs);
|
||||
const struct cpu_user_regs *old_regs, **pp_regs = &this_cpu(irq_regs);
|
||||
|
||||
old_regs = *pp_regs;
|
||||
*pp_regs = new_regs;
|
||||
old_regs = *pp_regs;
|
||||
*pp_regs = new_regs;
|
||||
|
||||
return old_regs;
|
||||
return old_regs;
|
||||
}
|
||||
|
||||
struct domain;
|
||||
|
||||
@@ -110,8 +110,7 @@ extern const unsigned int xen_config_data_size;
|
||||
struct cpu_user_regs;
|
||||
struct vcpu;
|
||||
|
||||
void show_execution_state(const struct cpu_user_regs *regs);
|
||||
void cf_check show_execution_state_nonconst(struct cpu_user_regs *regs);
|
||||
void cf_check show_execution_state(const struct cpu_user_regs *regs);
|
||||
void vcpu_show_execution_state(struct vcpu *v);
|
||||
|
||||
#endif /* _LINUX_KERNEL_H */
|
||||
|
||||
@@ -173,7 +173,7 @@ extern char *print_tainted(char *str);
|
||||
extern void add_taint(unsigned int taint);
|
||||
|
||||
struct cpu_user_regs;
|
||||
void cf_check dump_execstate(struct cpu_user_regs *regs);
|
||||
void cf_check dump_execstate(const struct cpu_user_regs *regs);
|
||||
|
||||
void init_constructors(void);
|
||||
|
||||
|
||||