@@ -3,6 +3,11 @@
#include "processor.h"
#include <setjmp.h>
+#ifndef __x86_64__
+__attribute__((regparm(1)))
+#endif
+void do_handle_exception(struct ex_regs *regs);
+
void set_idt_entry(int vec, void *addr, int dpl)
{
idt_entry_t *e = &boot_idt[vec];
@@ -35,7 +35,9 @@ struct mbi_module {
#define ENV_SIZE 16384
-extern void setup_env(char *env, int size);
+void setup_env(char *env, int size);
+void setup_multiboot(struct mbi_bootinfo *bootinfo);
+void setup_libcflat(void);
char *initrd;
u32 initrd_size;
@@ -14,17 +14,19 @@
# define R "e"
#endif
+void do_pf_tss(void);
+
static inline void io_delay(void)
{
}
-void apic_self_ipi(u8 v)
+static void apic_self_ipi(u8 v)
{
apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | APIC_DM_FIXED |
APIC_INT_ASSERT | v, 0);
}
-void apic_self_nmi(void)
+static void apic_self_nmi(void)
{
apic_icr_write(APIC_DEST_PHYSICAL | APIC_DM_NMI | APIC_INT_ASSERT, 0);
}
@@ -61,6 +61,7 @@ static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
__rem; \
})
#else
+u32 __attribute__((weak)) __div64_32(u64 *n, u32 base);
u32 __attribute__((weak)) __div64_32(u64 *n, u32 base)
{
u64 rem = *n;
@@ -121,7 +122,7 @@ u32 __attribute__((weak)) __div64_32(u64 *n, u32 base)
* 0 <= tv_nsec < NSEC_PER_SEC
* For negative values only the tv_sec field is negative !
*/
-void set_normalized_timespec(struct timespec *ts, long sec, s64 nsec)
+static void set_normalized_timespec(struct timespec *ts, long sec, s64 nsec)
{
while (nsec >= NSEC_PER_SEC) {
/*
@@ -179,7 +180,7 @@ cycle_t __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src)
return src->system_time + offset;
}
-cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
+static cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
{
unsigned version;
cycle_t ret;
@@ -246,9 +247,9 @@ void kvm_clock_clear(void *data)
wrmsr(MSR_KVM_SYSTEM_TIME_NEW, 0LL);
}
-void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
- struct pvclock_vcpu_time_info *vcpu_time,
- struct timespec *ts)
+static void pvclock_read_wallclock(struct pvclock_wall_clock *wall_clock,
+ struct pvclock_vcpu_time_info *vcpu_time,
+ struct timespec *ts)
{
u32 version;
u64 delta;
@@ -14,7 +14,7 @@ volatile int pf_count = 0;
volatile unsigned save;
volatile unsigned test;
-void set_cr0_wp(int wp)
+static void set_cr0_wp(int wp)
{
unsigned long cr0 = read_cr0();
@@ -24,6 +24,7 @@ void set_cr0_wp(int wp)
write_cr0(cr0);
}
+void do_pf_tss(unsigned long error_code);
void do_pf_tss(unsigned long error_code)
{
pf_count++;
@@ -9,6 +9,7 @@ volatile int pf_count = 0;
volatile int save;
volatile unsigned test;
+void do_pf_tss(unsigned long error_code);
// When doing ring 3 tests, page fault handlers will always run on a
// separate stack (the ring 0 stack). Seems easier to use the alt_stack
@@ -17,6 +17,8 @@ static volatile unsigned int test_divider;
static char *fault_addr;
static ulong fault_phys;
+void do_pf_tss(ulong *error_code);
+
static inline void io_delay(void)
{
}
@@ -115,7 +117,7 @@ start:
goto start;
}
-void test_kernel_mode_int()
+static void test_kernel_mode_int(void)
{
unsigned int res;
@@ -193,7 +195,7 @@ void test_kernel_mode_int()
report("PF exeption", test_count == 1);
}
-void test_gdt_task_gate(void)
+static void test_gdt_task_gate(void)
{
/* test that calling a task by lcall works */
test_count = 0;
@@ -219,7 +221,7 @@ void test_gdt_task_gate(void)
report("ljmp", test_count == 1);
}
-void test_vm86_switch(void)
+static void test_vm86_switch(void)
{
static tss32_t main_tss;
static tss32_t vm86_tss;
@@ -266,7 +268,7 @@ void test_vm86_switch(void)
#define IOPL_SHIFT 12
-void test_conforming_switch(void)
+static void test_conforming_switch(void)
{
/* test lcall with conforming segment, cs.dpl != cs.rpl */
test_count = 0;
@@ -281,7 +283,7 @@ void test_conforming_switch(void)
report("lcall with cs.rpl != cs.dpl", test_count == 1);
}
-int main()
+int main(void)
{
setup_vm();
setup_idt();
To be able to compile with -Wmissing-prototypes, we also need prototypes for functions that are called from assembler code. We put the prototypes into the .c files and not into header files here, since these functions are not called from other .c files. While we're at it, also mark some more functions as static in these files which are only used locally. Signed-off-by: Thomas Huth <thuth@redhat.com> --- lib/x86/desc.c | 5 +++++ lib/x86/setup.c | 4 +++- x86/eventinj.c | 6 ++++-- x86/kvmclock.c | 11 ++++++----- x86/pku.c | 3 ++- x86/smap.c | 1 + x86/taskswitch2.c | 12 +++++++----- 7 files changed, 28 insertions(+), 14 deletions(-)