retire PUBLIC, PRIVATE and FORWARD
This commit is contained in:
@@ -9,23 +9,23 @@ typedef int ((* acpi_read_t)(phys_bytes addr, void * buff, size_t size));
|
||||
|
||||
struct acpi_rsdp acpi_rsdp;
|
||||
|
||||
PRIVATE acpi_read_t read_func;
|
||||
static acpi_read_t read_func;
|
||||
|
||||
#define MAX_RSDT 35 /* ACPI defines 35 signatures */
|
||||
|
||||
PRIVATE struct acpi_rsdt {
|
||||
static struct acpi_rsdt {
|
||||
struct acpi_sdt_header hdr;
|
||||
u32_t data[MAX_RSDT];
|
||||
} rsdt;
|
||||
|
||||
PRIVATE struct {
|
||||
static struct {
|
||||
char signature [ACPI_SDT_SIGNATURE_LEN + 1];
|
||||
size_t length;
|
||||
} sdt_trans[MAX_RSDT];
|
||||
|
||||
PRIVATE int sdt_count;
|
||||
static int sdt_count;
|
||||
|
||||
PRIVATE int acpi_check_csum(struct acpi_sdt_header * tb, size_t size)
|
||||
static int acpi_check_csum(struct acpi_sdt_header * tb, size_t size)
|
||||
{
|
||||
u8_t total = 0;
|
||||
int i;
|
||||
@@ -34,12 +34,12 @@ PRIVATE int acpi_check_csum(struct acpi_sdt_header * tb, size_t size)
|
||||
return total == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
PRIVATE int acpi_check_signature(const char * orig, const char * match)
|
||||
static int acpi_check_signature(const char * orig, const char * match)
|
||||
{
|
||||
return strncmp(orig, match, ACPI_SDT_SIGNATURE_LEN);
|
||||
}
|
||||
|
||||
PRIVATE int acpi_read_sdt_at(phys_bytes addr,
|
||||
static int acpi_read_sdt_at(phys_bytes addr,
|
||||
struct acpi_sdt_header * tb,
|
||||
size_t size,
|
||||
const char * name)
|
||||
@@ -84,7 +84,7 @@ PRIVATE int acpi_read_sdt_at(phys_bytes addr,
|
||||
return tb->length;
|
||||
}
|
||||
|
||||
PUBLIC phys_bytes acpi_get_table_base(const char * name)
|
||||
phys_bytes acpi_get_table_base(const char * name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -97,7 +97,7 @@ PUBLIC phys_bytes acpi_get_table_base(const char * name)
|
||||
return (phys_bytes) NULL;
|
||||
}
|
||||
|
||||
PUBLIC size_t acpi_get_table_length(const char * name)
|
||||
size_t acpi_get_table_length(const char * name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -110,7 +110,7 @@ PUBLIC size_t acpi_get_table_length(const char * name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRIVATE void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
|
||||
static void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
|
||||
unsigned char type,
|
||||
unsigned idx)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ PRIVATE void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
|
||||
}
|
||||
|
||||
#if 0
|
||||
PRIVATE void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
|
||||
static void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
|
||||
unsigned idx)
|
||||
{
|
||||
u8_t * t, * end;
|
||||
@@ -154,7 +154,7 @@ PRIVATE void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
|
||||
}
|
||||
#endif
|
||||
|
||||
PRIVATE int acpi_rsdp_test(void * buff)
|
||||
static int acpi_rsdp_test(void * buff)
|
||||
{
|
||||
struct acpi_rsdp * rsdp = (struct acpi_rsdp *) buff;
|
||||
|
||||
@@ -166,7 +166,7 @@ PRIVATE int acpi_rsdp_test(void * buff)
|
||||
return 1;
|
||||
}
|
||||
|
||||
PRIVATE int get_acpi_rsdp(void)
|
||||
static int get_acpi_rsdp(void)
|
||||
{
|
||||
u16_t ebda;
|
||||
/*
|
||||
@@ -192,13 +192,13 @@ PRIVATE int get_acpi_rsdp(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRIVATE int acpi_read_kernel(phys_bytes addr, void * buff, size_t size)
|
||||
static int acpi_read_kernel(phys_bytes addr, void * buff, size_t size)
|
||||
{
|
||||
phys_copy(addr, vir2phys(buff), size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC void acpi_init(void)
|
||||
void acpi_init(void)
|
||||
{
|
||||
int s, i;
|
||||
read_func = acpi_read_kernel;
|
||||
@@ -229,7 +229,7 @@ PUBLIC void acpi_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC struct acpi_madt_ioapic * acpi_get_ioapic_next(void)
|
||||
struct acpi_madt_ioapic * acpi_get_ioapic_next(void)
|
||||
{
|
||||
static unsigned idx = 0;
|
||||
static struct acpi_madt_hdr * madt_hdr;
|
||||
@@ -251,7 +251,7 @@ PUBLIC struct acpi_madt_ioapic * acpi_get_ioapic_next(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
PUBLIC struct acpi_madt_lapic * acpi_get_lapic_next(void)
|
||||
struct acpi_madt_lapic * acpi_get_lapic_next(void)
|
||||
{
|
||||
static unsigned idx = 0;
|
||||
static struct acpi_madt_hdr * madt_hdr;
|
||||
|
||||
@@ -107,8 +107,8 @@
|
||||
#define SPLHI 0xF
|
||||
|
||||
|
||||
PUBLIC struct io_apic io_apic[MAX_NR_IOAPICS];
|
||||
PUBLIC unsigned nioapics;
|
||||
struct io_apic io_apic[MAX_NR_IOAPICS];
|
||||
unsigned nioapics;
|
||||
|
||||
struct irq;
|
||||
typedef void (* eoi_method_t)(struct irq *);
|
||||
@@ -121,7 +121,7 @@ struct irq {
|
||||
unsigned state;
|
||||
};
|
||||
|
||||
PRIVATE struct irq io_apic_irq[NR_IRQ_VECTORS];
|
||||
static struct irq io_apic_irq[NR_IRQ_VECTORS];
|
||||
|
||||
/*
|
||||
* to make APIC work if SMP is not configured, we need to set the maximal number
|
||||
@@ -146,20 +146,20 @@ PRIVATE struct irq io_apic_irq[NR_IRQ_VECTORS];
|
||||
|
||||
#define VERBOSE_APIC(x) x
|
||||
|
||||
PUBLIC int ioapic_enabled;
|
||||
PUBLIC u32_t lapic_addr_vaddr;
|
||||
PUBLIC vir_bytes lapic_addr;
|
||||
PUBLIC vir_bytes lapic_eoi_addr;
|
||||
PUBLIC int bsp_lapic_id;
|
||||
int ioapic_enabled;
|
||||
u32_t lapic_addr_vaddr;
|
||||
vir_bytes lapic_addr;
|
||||
vir_bytes lapic_eoi_addr;
|
||||
int bsp_lapic_id;
|
||||
|
||||
PRIVATE volatile unsigned probe_ticks;
|
||||
PRIVATE u64_t tsc0, tsc1;
|
||||
PRIVATE u32_t lapic_tctr0, lapic_tctr1;
|
||||
static volatile unsigned probe_ticks;
|
||||
static u64_t tsc0, tsc1;
|
||||
static u32_t lapic_tctr0, lapic_tctr1;
|
||||
|
||||
PRIVATE unsigned apic_imcrp;
|
||||
PRIVATE const unsigned nlints = 0;
|
||||
static unsigned apic_imcrp;
|
||||
static const unsigned nlints = 0;
|
||||
|
||||
PUBLIC void arch_eoi(void)
|
||||
void arch_eoi(void)
|
||||
{
|
||||
apic_eoi();
|
||||
}
|
||||
@@ -169,20 +169,20 @@ PUBLIC void arch_eoi(void)
|
||||
* arch specific cpulocals. As this variable is write-once-read-only it is ok to
|
||||
* have at as an array until we resolve the cpulocals properly
|
||||
*/
|
||||
PRIVATE u32_t lapic_bus_freq[CONFIG_MAX_CPUS];
|
||||
static u32_t lapic_bus_freq[CONFIG_MAX_CPUS];
|
||||
/* the probe period will be roughly 100ms */
|
||||
#define PROBE_TICKS (system_hz / 10)
|
||||
|
||||
#define IOAPIC_IOREGSEL 0x0
|
||||
#define IOAPIC_IOWIN 0x10
|
||||
|
||||
PRIVATE u32_t ioapic_read(u32_t ioa_base, u32_t reg)
|
||||
static u32_t ioapic_read(u32_t ioa_base, u32_t reg)
|
||||
{
|
||||
*((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = (reg & 0xff);
|
||||
return *(u32_t *)(ioa_base + IOAPIC_IOWIN);
|
||||
}
|
||||
|
||||
PRIVATE void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
|
||||
static void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
|
||||
{
|
||||
*((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = reg;
|
||||
*((u32_t *)(ioa_base + IOAPIC_IOWIN)) = val;
|
||||
@@ -191,7 +191,7 @@ PRIVATE void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
|
||||
void lapic_microsec_sleep(unsigned count);
|
||||
void apic_idt_init(const int reset);
|
||||
|
||||
PRIVATE void ioapic_enable_pin(vir_bytes ioapic_addr, int pin)
|
||||
static void ioapic_enable_pin(vir_bytes ioapic_addr, int pin)
|
||||
{
|
||||
u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2);
|
||||
|
||||
@@ -199,7 +199,7 @@ PRIVATE void ioapic_enable_pin(vir_bytes ioapic_addr, int pin)
|
||||
ioapic_write(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2, lo);
|
||||
}
|
||||
|
||||
PRIVATE void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
|
||||
static void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
|
||||
{
|
||||
u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2);
|
||||
|
||||
@@ -208,7 +208,7 @@ PRIVATE void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
|
||||
}
|
||||
|
||||
#if 0
|
||||
PRIVATE void ioapic_redirt_entry_read(void * ioapic_addr,
|
||||
static void ioapic_redirt_entry_read(void * ioapic_addr,
|
||||
int entry,
|
||||
u32_t *hi,
|
||||
u32_t *lo)
|
||||
@@ -219,7 +219,7 @@ PRIVATE void ioapic_redirt_entry_read(void * ioapic_addr,
|
||||
}
|
||||
#endif
|
||||
|
||||
PRIVATE void ioapic_redirt_entry_write(void * ioapic_addr,
|
||||
static void ioapic_redirt_entry_write(void * ioapic_addr,
|
||||
int entry,
|
||||
u32_t hi,
|
||||
u32_t lo)
|
||||
@@ -243,7 +243,7 @@ PRIVATE void ioapic_redirt_entry_write(void * ioapic_addr,
|
||||
|
||||
#define lapic_test_delivery_val(val, vector) ((val) & (1 << ((vector) & 0x1f)))
|
||||
|
||||
PRIVATE void ioapic_eoi_level(struct irq * irq)
|
||||
static void ioapic_eoi_level(struct irq * irq)
|
||||
{
|
||||
reg_t tmr;
|
||||
|
||||
@@ -285,12 +285,12 @@ PRIVATE void ioapic_eoi_level(struct irq * irq)
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE void ioapic_eoi_edge(__unused struct irq * irq)
|
||||
static void ioapic_eoi_edge(__unused struct irq * irq)
|
||||
{
|
||||
apic_eoi();
|
||||
}
|
||||
|
||||
PUBLIC void ioapic_eoi(int irq)
|
||||
void ioapic_eoi(int irq)
|
||||
{
|
||||
if (ioapic_enabled) {
|
||||
io_apic_irq[irq].eoi(&io_apic_irq[irq]);
|
||||
@@ -299,12 +299,12 @@ PUBLIC void ioapic_eoi(int irq)
|
||||
irq_8259_eoi(irq);
|
||||
}
|
||||
|
||||
PUBLIC void ioapic_set_id(u32_t addr, unsigned int id)
|
||||
void ioapic_set_id(u32_t addr, unsigned int id)
|
||||
{
|
||||
ioapic_write(addr, IOAPIC_ID, id << 24);
|
||||
}
|
||||
|
||||
PUBLIC int ioapic_enable_all(void)
|
||||
int ioapic_enable_all(void)
|
||||
{
|
||||
i8259_disable();
|
||||
|
||||
@@ -318,7 +318,7 @@ PUBLIC int ioapic_enable_all(void)
|
||||
}
|
||||
|
||||
/* disables a single IO APIC */
|
||||
PRIVATE void ioapic_disable(struct io_apic * ioapic)
|
||||
static void ioapic_disable(struct io_apic * ioapic)
|
||||
{
|
||||
unsigned p;
|
||||
|
||||
@@ -340,7 +340,7 @@ PRIVATE void ioapic_disable(struct io_apic * ioapic)
|
||||
}
|
||||
|
||||
/* disables all IO APICs */
|
||||
PUBLIC void ioapic_disable_all(void)
|
||||
void ioapic_disable_all(void)
|
||||
{
|
||||
unsigned ioa;
|
||||
if (!ioapic_enabled)
|
||||
@@ -365,7 +365,7 @@ PUBLIC void ioapic_disable_all(void)
|
||||
intr_init(INTS_ORIG, 0); /* no auto eoi */
|
||||
}
|
||||
|
||||
PRIVATE void ioapic_disable_irq(unsigned irq)
|
||||
static void ioapic_disable_irq(unsigned irq)
|
||||
{
|
||||
assert(io_apic_irq[irq].ioa);
|
||||
|
||||
@@ -373,7 +373,7 @@ PRIVATE void ioapic_disable_irq(unsigned irq)
|
||||
io_apic_irq[irq].state |= IOAPIC_IRQ_STATE_MASKED;
|
||||
}
|
||||
|
||||
PRIVATE void ioapic_enable_irq(unsigned irq)
|
||||
static void ioapic_enable_irq(unsigned irq)
|
||||
{
|
||||
assert(io_apic_irq[irq].ioa);
|
||||
|
||||
@@ -381,7 +381,7 @@ PRIVATE void ioapic_enable_irq(unsigned irq)
|
||||
io_apic_irq[irq].state &= ~IOAPIC_IRQ_STATE_MASKED;
|
||||
}
|
||||
|
||||
PUBLIC void ioapic_unmask_irq(unsigned irq)
|
||||
void ioapic_unmask_irq(unsigned irq)
|
||||
{
|
||||
if (ioapic_enabled)
|
||||
ioapic_enable_irq(irq);
|
||||
@@ -390,7 +390,7 @@ PUBLIC void ioapic_unmask_irq(unsigned irq)
|
||||
irq_8259_unmask(irq);
|
||||
}
|
||||
|
||||
PUBLIC void ioapic_mask_irq(unsigned irq)
|
||||
void ioapic_mask_irq(unsigned irq)
|
||||
{
|
||||
if (ioapic_enabled)
|
||||
ioapic_disable_irq(irq);
|
||||
@@ -399,12 +399,12 @@ PUBLIC void ioapic_mask_irq(unsigned irq)
|
||||
irq_8259_mask(irq);
|
||||
}
|
||||
|
||||
PUBLIC unsigned int apicid(void)
|
||||
unsigned int apicid(void)
|
||||
{
|
||||
return lapic_read(LAPIC_ID) >> 24;
|
||||
}
|
||||
|
||||
PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook))
|
||||
static int calib_clk_handler(irq_hook_t * UNUSED(hook))
|
||||
{
|
||||
u32_t tcrt;
|
||||
u64_t tsc;
|
||||
@@ -428,7 +428,7 @@ PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook))
|
||||
return 1;
|
||||
}
|
||||
|
||||
PRIVATE int spurious_irq_handler(irq_hook_t * UNUSED(hook))
|
||||
static int spurious_irq_handler(irq_hook_t * UNUSED(hook))
|
||||
{
|
||||
/*
|
||||
* Do nothing, only unlock the kernel so we do not deadlock!
|
||||
@@ -437,7 +437,7 @@ PRIVATE int spurious_irq_handler(irq_hook_t * UNUSED(hook))
|
||||
return 1;
|
||||
}
|
||||
|
||||
PRIVATE void apic_calibrate_clocks(unsigned cpu)
|
||||
static void apic_calibrate_clocks(unsigned cpu)
|
||||
{
|
||||
u32_t lvtt, val, lapic_delta;
|
||||
u64_t tsc_delta;
|
||||
@@ -520,7 +520,7 @@ PRIVATE void apic_calibrate_clocks(unsigned cpu)
|
||||
BOOT_VERBOSE(cpu_print_freq(cpuid));
|
||||
}
|
||||
|
||||
PUBLIC void lapic_set_timer_one_shot(const u32_t usec)
|
||||
void lapic_set_timer_one_shot(const u32_t usec)
|
||||
{
|
||||
/* sleep in micro seconds */
|
||||
u32_t lvtt;
|
||||
@@ -539,7 +539,7 @@ PUBLIC void lapic_set_timer_one_shot(const u32_t usec)
|
||||
lapic_write(LAPIC_LVTTR, lvtt);
|
||||
}
|
||||
|
||||
PUBLIC void lapic_set_timer_periodic(const unsigned freq)
|
||||
void lapic_set_timer_periodic(const unsigned freq)
|
||||
{
|
||||
/* sleep in micro seconds */
|
||||
u32_t lvtt;
|
||||
@@ -558,7 +558,7 @@ PUBLIC void lapic_set_timer_periodic(const unsigned freq)
|
||||
lapic_write(LAPIC_TIMER_ICR, lapic_ticks_per_clock_tick);
|
||||
}
|
||||
|
||||
PUBLIC void lapic_stop_timer(void)
|
||||
void lapic_stop_timer(void)
|
||||
{
|
||||
u32_t lvtt;
|
||||
lvtt = lapic_read(LAPIC_LVTTR);
|
||||
@@ -568,27 +568,27 @@ PUBLIC void lapic_stop_timer(void)
|
||||
lapic_write(LAPIC_TIMER_CCR, 0);
|
||||
}
|
||||
|
||||
PUBLIC void lapic_restart_timer(void)
|
||||
void lapic_restart_timer(void)
|
||||
{
|
||||
/* restart the timer only if the counter reached zero, i.e. expired */
|
||||
if (lapic_read(LAPIC_TIMER_CCR) == 0)
|
||||
lapic_set_timer_one_shot(1000000/system_hz);
|
||||
}
|
||||
|
||||
PUBLIC void lapic_microsec_sleep(unsigned count)
|
||||
void lapic_microsec_sleep(unsigned count)
|
||||
{
|
||||
lapic_set_timer_one_shot(count);
|
||||
while (lapic_read(LAPIC_TIMER_CCR))
|
||||
arch_pause();
|
||||
}
|
||||
|
||||
PRIVATE u32_t lapic_errstatus(void)
|
||||
static u32_t lapic_errstatus(void)
|
||||
{
|
||||
lapic_write(LAPIC_ESR, 0);
|
||||
return lapic_read(LAPIC_ESR);
|
||||
}
|
||||
|
||||
PRIVATE int lapic_disable_in_msr(void)
|
||||
static int lapic_disable_in_msr(void)
|
||||
{
|
||||
u32_t msr_hi, msr_lo;
|
||||
|
||||
@@ -600,7 +600,7 @@ PRIVATE int lapic_disable_in_msr(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
PUBLIC void lapic_disable(void)
|
||||
void lapic_disable(void)
|
||||
{
|
||||
/* Disable current APIC and close interrupts from PIC */
|
||||
u32_t val;
|
||||
@@ -635,7 +635,7 @@ PUBLIC void lapic_disable(void)
|
||||
lapic_disable_in_msr();
|
||||
}
|
||||
|
||||
PRIVATE int lapic_enable_in_msr(void)
|
||||
static int lapic_enable_in_msr(void)
|
||||
{
|
||||
u32_t msr_hi, msr_lo;
|
||||
|
||||
@@ -664,7 +664,7 @@ PRIVATE int lapic_enable_in_msr(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
PUBLIC int lapic_enable(unsigned cpu)
|
||||
int lapic_enable(unsigned cpu)
|
||||
{
|
||||
u32_t val, nlvt;
|
||||
|
||||
@@ -735,7 +735,7 @@ PUBLIC int lapic_enable(unsigned cpu)
|
||||
return 1;
|
||||
}
|
||||
|
||||
PUBLIC void apic_spurios_intr_handler(void)
|
||||
void apic_spurios_intr_handler(void)
|
||||
{
|
||||
static unsigned x;
|
||||
|
||||
@@ -744,7 +744,7 @@ PUBLIC void apic_spurios_intr_handler(void)
|
||||
printf("WARNING spurious interrupt(s) %d on cpu %d\n", x, cpuid);
|
||||
}
|
||||
|
||||
PUBLIC void apic_error_intr_handler(void)
|
||||
void apic_error_intr_handler(void)
|
||||
{
|
||||
static unsigned x;
|
||||
|
||||
@@ -754,7 +754,7 @@ PUBLIC void apic_error_intr_handler(void)
|
||||
lapic_errstatus(), x, cpuid);
|
||||
}
|
||||
|
||||
PRIVATE struct gate_table_s gate_table_ioapic[] = {
|
||||
static struct gate_table_s gate_table_ioapic[] = {
|
||||
{ apic_hwint0, LAPIC_VECTOR( 0), INTR_PRIVILEGE },
|
||||
{ apic_hwint1, LAPIC_VECTOR( 1), INTR_PRIVILEGE },
|
||||
{ apic_hwint2, LAPIC_VECTOR( 2), INTR_PRIVILEGE },
|
||||
@@ -824,14 +824,14 @@ PRIVATE struct gate_table_s gate_table_ioapic[] = {
|
||||
{ NULL, 0, 0}
|
||||
};
|
||||
|
||||
PRIVATE struct gate_table_s gate_table_common[] = {
|
||||
static struct gate_table_s gate_table_common[] = {
|
||||
{ ipc_entry, IPC_VECTOR, USER_PRIVILEGE },
|
||||
{ kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE },
|
||||
{ NULL, 0, 0}
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
PRIVATE struct gate_table_s gate_table_smp[] = {
|
||||
static struct gate_table_s gate_table_smp[] = {
|
||||
{ apic_ipi_sched_intr, APIC_SMP_SCHED_PROC_VECTOR, INTR_PRIVILEGE },
|
||||
{ apic_ipi_halt_intr, APIC_SMP_CPU_HALT_VECTOR, INTR_PRIVILEGE },
|
||||
{ NULL, 0, 0}
|
||||
@@ -839,7 +839,7 @@ PRIVATE struct gate_table_s gate_table_smp[] = {
|
||||
#endif
|
||||
|
||||
#ifdef APIC_DEBUG
|
||||
PRIVATE void lapic_set_dummy_handlers(void)
|
||||
static void lapic_set_dummy_handlers(void)
|
||||
{
|
||||
char * handler;
|
||||
int vect = 32; /* skip the reserved vectors */
|
||||
@@ -856,7 +856,7 @@ PRIVATE void lapic_set_dummy_handlers(void)
|
||||
#endif
|
||||
|
||||
/* Build descriptors for interrupt gates in IDT. */
|
||||
PUBLIC void apic_idt_init(const int reset)
|
||||
void apic_idt_init(const int reset)
|
||||
{
|
||||
u32_t val;
|
||||
|
||||
@@ -905,7 +905,7 @@ PUBLIC void apic_idt_init(const int reset)
|
||||
|
||||
}
|
||||
|
||||
PRIVATE int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max)
|
||||
static int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max)
|
||||
{
|
||||
unsigned n = 0;
|
||||
struct acpi_madt_ioapic * acpi_ioa;
|
||||
@@ -932,7 +932,7 @@ PRIVATE int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max
|
||||
return n;
|
||||
}
|
||||
|
||||
PUBLIC int detect_ioapics(void)
|
||||
int detect_ioapics(void)
|
||||
{
|
||||
int status;
|
||||
|
||||
@@ -948,7 +948,7 @@ PUBLIC int detect_ioapics(void)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
PUBLIC void apic_send_ipi(unsigned vector, unsigned cpu, int type)
|
||||
void apic_send_ipi(unsigned vector, unsigned cpu, int type)
|
||||
{
|
||||
u32_t icr1, icr2;
|
||||
|
||||
@@ -987,7 +987,7 @@ PUBLIC void apic_send_ipi(unsigned vector, unsigned cpu, int type)
|
||||
|
||||
}
|
||||
|
||||
PUBLIC int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline)
|
||||
int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline)
|
||||
{
|
||||
int timeout;
|
||||
u32_t errstatus = 0;
|
||||
@@ -1033,7 +1033,7 @@ PUBLIC int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline)
|
||||
int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline)
|
||||
{
|
||||
u32_t ptr, errstatus = 0;
|
||||
int timeout;
|
||||
@@ -1108,7 +1108,7 @@ PUBLIC int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SMP
|
||||
PUBLIC int apic_single_cpu_init(void)
|
||||
int apic_single_cpu_init(void)
|
||||
{
|
||||
if (!cpu_feature_apic_on_chip())
|
||||
return 0;
|
||||
@@ -1143,7 +1143,7 @@ PUBLIC int apic_single_cpu_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
PRIVATE eoi_method_t set_eoi_method(unsigned irq)
|
||||
static eoi_method_t set_eoi_method(unsigned irq)
|
||||
{
|
||||
/*
|
||||
* in APIC mode the lowest 16 IRQs are reserved for legacy (E)ISA edge
|
||||
@@ -1156,7 +1156,7 @@ PRIVATE eoi_method_t set_eoi_method(unsigned irq)
|
||||
return ioapic_eoi_level;
|
||||
}
|
||||
|
||||
PUBLIC void set_irq_redir_low(unsigned irq, u32_t * low)
|
||||
void set_irq_redir_low(unsigned irq, u32_t * low)
|
||||
{
|
||||
u32_t val = 0;
|
||||
|
||||
@@ -1182,7 +1182,7 @@ PUBLIC void set_irq_redir_low(unsigned irq, u32_t * low)
|
||||
*low = val;
|
||||
}
|
||||
|
||||
PUBLIC void ioapic_set_irq(unsigned irq)
|
||||
void ioapic_set_irq(unsigned irq)
|
||||
{
|
||||
unsigned ioa;
|
||||
|
||||
@@ -1216,7 +1216,7 @@ PUBLIC void ioapic_set_irq(unsigned irq)
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC void ioapic_unset_irq(unsigned irq)
|
||||
void ioapic_unset_irq(unsigned irq)
|
||||
{
|
||||
assert(irq < NR_IRQ_VECTORS);
|
||||
|
||||
@@ -1225,7 +1225,7 @@ PUBLIC void ioapic_unset_irq(unsigned irq)
|
||||
io_apic_irq[irq].eoi = NULL;
|
||||
}
|
||||
|
||||
PUBLIC void ioapic_reset_pic(void)
|
||||
void ioapic_reset_pic(void)
|
||||
{
|
||||
apic_idt_init(TRUE); /* reset */
|
||||
idt_reload();
|
||||
@@ -1238,7 +1238,7 @@ PUBLIC void ioapic_reset_pic(void)
|
||||
intr_init(INTS_ORIG, 0); /* no auto eoi */
|
||||
}
|
||||
|
||||
PRIVATE void irq_lapic_status(int irq)
|
||||
static void irq_lapic_status(int irq)
|
||||
{
|
||||
u32_t lo;
|
||||
reg_t tmr, irr, isr;
|
||||
@@ -1280,7 +1280,7 @@ PRIVATE void irq_lapic_status(int irq)
|
||||
"masked" : "unmasked");
|
||||
}
|
||||
|
||||
PUBLIC void dump_apic_irq_state(void)
|
||||
void dump_apic_irq_state(void)
|
||||
{
|
||||
int irq;
|
||||
|
||||
|
||||
@@ -34,18 +34,18 @@
|
||||
#define TIMER_FREQ 1193182 /* clock frequency for timer in PC and AT */
|
||||
#define TIMER_COUNT(freq) (TIMER_FREQ/(freq)) /* initial value for counter*/
|
||||
|
||||
PRIVATE irq_hook_t pic_timer_hook; /* interrupt handler hook */
|
||||
static irq_hook_t pic_timer_hook; /* interrupt handler hook */
|
||||
|
||||
PRIVATE unsigned probe_ticks;
|
||||
PRIVATE u64_t tsc0, tsc1;
|
||||
static unsigned probe_ticks;
|
||||
static u64_t tsc0, tsc1;
|
||||
#define PROBE_TICKS (system_hz / 10)
|
||||
|
||||
PRIVATE unsigned tsc_per_ms[CONFIG_MAX_CPUS];
|
||||
static unsigned tsc_per_ms[CONFIG_MAX_CPUS];
|
||||
|
||||
/*===========================================================================*
|
||||
* init_8235A_timer *
|
||||
*===========================================================================*/
|
||||
PUBLIC int init_8253A_timer(const unsigned freq)
|
||||
int init_8253A_timer(const unsigned freq)
|
||||
{
|
||||
/* Initialize channel 0 of the 8253A timer to, e.g., 60 Hz,
|
||||
* and register the CLOCK task's interrupt handler to be run
|
||||
@@ -61,7 +61,7 @@ PUBLIC int init_8253A_timer(const unsigned freq)
|
||||
/*===========================================================================*
|
||||
* stop_8235A_timer *
|
||||
*===========================================================================*/
|
||||
PUBLIC void stop_8253A_timer(void)
|
||||
void stop_8253A_timer(void)
|
||||
{
|
||||
/* Reset the clock to the BIOS rate. (For rebooting.) */
|
||||
outb(TIMER_MODE, 0x36);
|
||||
@@ -69,7 +69,7 @@ PUBLIC void stop_8253A_timer(void)
|
||||
outb(TIMER0, 0);
|
||||
}
|
||||
|
||||
PRIVATE int calib_cpu_handler(irq_hook_t * UNUSED(hook))
|
||||
static int calib_cpu_handler(irq_hook_t * UNUSED(hook))
|
||||
{
|
||||
u64_t tsc;
|
||||
|
||||
@@ -89,7 +89,7 @@ PRIVATE int calib_cpu_handler(irq_hook_t * UNUSED(hook))
|
||||
return 1;
|
||||
}
|
||||
|
||||
PRIVATE void estimate_cpu_freq(void)
|
||||
static void estimate_cpu_freq(void)
|
||||
{
|
||||
u64_t tsc_delta;
|
||||
u64_t cpu_freq;
|
||||
@@ -124,7 +124,7 @@ PRIVATE void estimate_cpu_freq(void)
|
||||
BOOT_VERBOSE(cpu_print_freq(cpuid));
|
||||
}
|
||||
|
||||
PUBLIC int init_local_timer(unsigned freq)
|
||||
int init_local_timer(unsigned freq)
|
||||
{
|
||||
#ifdef USE_APIC
|
||||
/* if we know the address, lapic is enabled and we should use it */
|
||||
@@ -147,7 +147,7 @@ PUBLIC int init_local_timer(unsigned freq)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC void stop_local_timer(void)
|
||||
void stop_local_timer(void)
|
||||
{
|
||||
#ifdef USE_APIC
|
||||
if (lapic_addr) {
|
||||
@@ -160,7 +160,7 @@ PUBLIC void stop_local_timer(void)
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC void restart_local_timer(void)
|
||||
void restart_local_timer(void)
|
||||
{
|
||||
#ifdef USE_APIC
|
||||
if (lapic_addr) {
|
||||
@@ -169,7 +169,7 @@ PUBLIC void restart_local_timer(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC int register_local_timer_handler(const irq_handler_t handler)
|
||||
int register_local_timer_handler(const irq_handler_t handler)
|
||||
{
|
||||
#ifdef USE_APIC
|
||||
if (lapic_addr) {
|
||||
@@ -188,7 +188,7 @@ PUBLIC int register_local_timer_handler(const irq_handler_t handler)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC void cycles_accounting_init(void)
|
||||
void cycles_accounting_init(void)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
unsigned cpu = cpuid;
|
||||
@@ -200,7 +200,7 @@ PUBLIC void cycles_accounting_init(void)
|
||||
make_zero64(get_cpu_var(cpu, cpu_last_idle));
|
||||
}
|
||||
|
||||
PUBLIC void context_stop(struct proc * p)
|
||||
void context_stop(struct proc * p)
|
||||
{
|
||||
u64_t tsc, tsc_delta;
|
||||
u64_t * __tsc_ctr_switch = get_cpulocal_var_ptr(tsc_ctr_switch);
|
||||
@@ -297,7 +297,7 @@ PUBLIC void context_stop(struct proc * p)
|
||||
*__tsc_ctr_switch = tsc;
|
||||
}
|
||||
|
||||
PUBLIC void context_stop_idle(void)
|
||||
void context_stop_idle(void)
|
||||
{
|
||||
int is_idle;
|
||||
#ifdef CONFIG_SMP
|
||||
@@ -317,17 +317,17 @@ PUBLIC void context_stop_idle(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC u64_t ms_2_cpu_time(unsigned ms)
|
||||
u64_t ms_2_cpu_time(unsigned ms)
|
||||
{
|
||||
return mul64u(tsc_per_ms[cpuid], ms);
|
||||
}
|
||||
|
||||
PUBLIC unsigned cpu_time_2_ms(u64_t cpu_time)
|
||||
unsigned cpu_time_2_ms(u64_t cpu_time)
|
||||
{
|
||||
return div64u(cpu_time, tsc_per_ms[cpuid]);
|
||||
}
|
||||
|
||||
PUBLIC short cpu_load(void)
|
||||
short cpu_load(void)
|
||||
{
|
||||
u64_t current_tsc, *current_idle;
|
||||
u64_t tsc_delta, idle_delta, busy;
|
||||
@@ -365,7 +365,7 @@ PUBLIC short cpu_load(void)
|
||||
return load;
|
||||
}
|
||||
|
||||
PUBLIC void busy_delay_ms(int ms)
|
||||
void busy_delay_ms(int ms)
|
||||
{
|
||||
u64_t cycles = ms_2_cpu_time(ms), tsc0, tsc, tsc1;
|
||||
read_tsc_64(&tsc0);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/*===========================================================================*
|
||||
* arch_do_vmctl *
|
||||
*===========================================================================*/
|
||||
PUBLIC int arch_do_vmctl(m_ptr, p)
|
||||
int arch_do_vmctl(m_ptr, p)
|
||||
register message *m_ptr; /* pointer to request message */
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
@@ -42,18 +42,18 @@ static int volatile ap_cpu_ready;
|
||||
static int volatile cpu_down;
|
||||
|
||||
/* there can be at most 255 local APIC ids, each fits in 8 bits */
|
||||
PRIVATE unsigned char apicid2cpuid[255];
|
||||
PUBLIC unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
|
||||
static unsigned char apicid2cpuid[255];
|
||||
unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
|
||||
|
||||
SPINLOCK_DEFINE(smp_cpu_lock)
|
||||
SPINLOCK_DEFINE(dispq_lock)
|
||||
|
||||
FORWARD void smp_reinit_vars(void);
|
||||
static void smp_reinit_vars(void);
|
||||
|
||||
/*
|
||||
* copies the 16-bit AP trampoline code to the first 1M of memory
|
||||
*/
|
||||
PRIVATE phys_bytes copy_trampoline(void)
|
||||
static phys_bytes copy_trampoline(void)
|
||||
{
|
||||
char * s, *end;
|
||||
phys_bytes tramp_base = 0;
|
||||
@@ -93,7 +93,7 @@ PRIVATE phys_bytes copy_trampoline(void)
|
||||
return tramp_base;
|
||||
}
|
||||
|
||||
PRIVATE void smp_start_aps(void)
|
||||
static void smp_start_aps(void)
|
||||
{
|
||||
/*
|
||||
* Find an address and align it to a 4k boundary.
|
||||
@@ -167,12 +167,12 @@ PRIVATE void smp_start_aps(void)
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
PUBLIC void smp_halt_cpu (void)
|
||||
void smp_halt_cpu (void)
|
||||
{
|
||||
NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
PUBLIC void smp_shutdown_aps(void)
|
||||
void smp_shutdown_aps(void)
|
||||
{
|
||||
unsigned cpu;
|
||||
|
||||
@@ -209,7 +209,7 @@ exit_shutdown_aps:
|
||||
return;
|
||||
}
|
||||
|
||||
PRIVATE void ap_finish_booting(void)
|
||||
static void ap_finish_booting(void)
|
||||
{
|
||||
unsigned cpu = cpuid;
|
||||
|
||||
@@ -257,13 +257,13 @@ PRIVATE void ap_finish_booting(void)
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
PUBLIC void smp_ap_boot(void)
|
||||
void smp_ap_boot(void)
|
||||
{
|
||||
switch_k_stack((char *)get_k_stack_top(__ap_id) -
|
||||
X86_STACK_TOP_RESERVED, ap_finish_booting);
|
||||
}
|
||||
|
||||
PRIVATE void smp_reinit_vars(void)
|
||||
static void smp_reinit_vars(void)
|
||||
{
|
||||
lapic_addr = lapic_eoi_addr = 0;
|
||||
ioapic_enabled = 0;
|
||||
@@ -271,7 +271,7 @@ PRIVATE void smp_reinit_vars(void)
|
||||
ncpus = 1;
|
||||
}
|
||||
|
||||
PRIVATE void tss_init_all(void)
|
||||
static void tss_init_all(void)
|
||||
{
|
||||
unsigned cpu;
|
||||
|
||||
@@ -279,7 +279,7 @@ PRIVATE void tss_init_all(void)
|
||||
tss_init(cpu, get_k_stack_top(cpu));
|
||||
}
|
||||
|
||||
PRIVATE int discover_cpus(void)
|
||||
static int discover_cpus(void)
|
||||
{
|
||||
struct acpi_madt_lapic * cpu;
|
||||
|
||||
@@ -293,7 +293,7 @@ PRIVATE int discover_cpus(void)
|
||||
return ncpus;
|
||||
}
|
||||
|
||||
PUBLIC void smp_init (void)
|
||||
void smp_init (void)
|
||||
{
|
||||
/* read the MP configuration */
|
||||
if (!discover_cpus()) {
|
||||
@@ -351,7 +351,7 @@ uniproc_fallback:
|
||||
printf("WARNING : SMP initialization failed\n");
|
||||
}
|
||||
|
||||
PUBLIC void arch_smp_halt_cpu(void)
|
||||
void arch_smp_halt_cpu(void)
|
||||
{
|
||||
/* say that we are down */
|
||||
cpu_down = cpuid;
|
||||
@@ -361,7 +361,7 @@ PUBLIC void arch_smp_halt_cpu(void)
|
||||
for(;;);
|
||||
}
|
||||
|
||||
PUBLIC void arch_send_smp_schedule_ipi(unsigned cpu)
|
||||
void arch_send_smp_schedule_ipi(unsigned cpu)
|
||||
{
|
||||
apic_send_ipi(APIC_SMP_SCHED_PROC_VECTOR, cpu, APIC_IPI_DEST);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "acpi.h"
|
||||
#endif
|
||||
|
||||
PRIVATE int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
|
||||
static int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
|
||||
|
||||
extern __dead void poweroff_jmp();
|
||||
extern void poweroff16();
|
||||
@@ -47,17 +47,17 @@ extern void poweroff16_end();
|
||||
/* set OSXMMEXCPT[bit 10] if we provide #XM handler. */
|
||||
#define CR4_OSXMMEXCPT (1L<<10)
|
||||
|
||||
PUBLIC void * k_stacks;
|
||||
void * k_stacks;
|
||||
|
||||
FORWARD void ser_debug(int c);
|
||||
static void ser_debug(int c);
|
||||
#ifdef CONFIG_SMP
|
||||
FORWARD void ser_dump_proc_cpu(void);
|
||||
static void ser_dump_proc_cpu(void);
|
||||
#endif
|
||||
#if !CONFIG_OXPCIE
|
||||
FORWARD void ser_init(void);
|
||||
static void ser_init(void);
|
||||
#endif
|
||||
|
||||
PUBLIC __dead void arch_monitor(void)
|
||||
__dead void arch_monitor(void)
|
||||
{
|
||||
monitor();
|
||||
}
|
||||
@@ -118,7 +118,7 @@ reset(void)
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE __dead void arch_bios_poweroff(void)
|
||||
static __dead void arch_bios_poweroff(void)
|
||||
{
|
||||
u32_t cr0;
|
||||
|
||||
@@ -134,9 +134,9 @@ PRIVATE __dead void arch_bios_poweroff(void)
|
||||
poweroff_jmp();
|
||||
}
|
||||
|
||||
PUBLIC int cpu_has_tsc;
|
||||
int cpu_has_tsc;
|
||||
|
||||
PUBLIC __dead void arch_shutdown(int how)
|
||||
__dead void arch_shutdown(int how)
|
||||
{
|
||||
u16_t magic;
|
||||
vm_stop();
|
||||
@@ -236,7 +236,7 @@ PUBLIC __dead void arch_shutdown(int how)
|
||||
NOT_REACHABLE;
|
||||
}
|
||||
|
||||
PUBLIC void fpu_init(void)
|
||||
void fpu_init(void)
|
||||
{
|
||||
unsigned short cw, sw;
|
||||
|
||||
@@ -273,7 +273,7 @@ PUBLIC void fpu_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC void save_local_fpu(struct proc *pr, int retain)
|
||||
void save_local_fpu(struct proc *pr, int retain)
|
||||
{
|
||||
/* Save process FPU context. If the 'retain' flag is set, keep the FPU
|
||||
* state as is. If the flag is not set, the state is undefined upon
|
||||
@@ -292,7 +292,7 @@ PUBLIC void save_local_fpu(struct proc *pr, int retain)
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC void save_fpu(struct proc *pr)
|
||||
void save_fpu(struct proc *pr)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
if (cpuid != pr->p_cpu) {
|
||||
@@ -322,7 +322,7 @@ PUBLIC void save_fpu(struct proc *pr)
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC int restore_fpu(struct proc *pr)
|
||||
int restore_fpu(struct proc *pr)
|
||||
{
|
||||
int failed;
|
||||
|
||||
@@ -342,7 +342,7 @@ PUBLIC int restore_fpu(struct proc *pr)
|
||||
return OK;
|
||||
}
|
||||
|
||||
PUBLIC void cpu_identify(void)
|
||||
void cpu_identify(void)
|
||||
{
|
||||
u32_t eax, ebx, ecx, edx;
|
||||
unsigned cpu = cpuid;
|
||||
@@ -376,7 +376,7 @@ PUBLIC void cpu_identify(void)
|
||||
cpu_info[cpu].flags[1] = edx;
|
||||
}
|
||||
|
||||
PUBLIC void arch_init(void)
|
||||
void arch_init(void)
|
||||
{
|
||||
#ifdef USE_APIC
|
||||
/*
|
||||
@@ -424,7 +424,7 @@ PUBLIC void arch_init(void)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_SERIAL
|
||||
PUBLIC void ser_putc(char c)
|
||||
void ser_putc(char c)
|
||||
{
|
||||
int i;
|
||||
int lsr, thr;
|
||||
@@ -447,7 +447,7 @@ PUBLIC void ser_putc(char c)
|
||||
/*===========================================================================*
|
||||
* do_ser_debug *
|
||||
*===========================================================================*/
|
||||
PUBLIC void do_ser_debug()
|
||||
void do_ser_debug()
|
||||
{
|
||||
u8_t c, lsr;
|
||||
|
||||
@@ -466,7 +466,7 @@ PUBLIC void do_ser_debug()
|
||||
ser_debug(c);
|
||||
}
|
||||
|
||||
PRIVATE void ser_dump_queue_cpu(unsigned cpu)
|
||||
static void ser_dump_queue_cpu(unsigned cpu)
|
||||
{
|
||||
int q;
|
||||
struct proc ** rdy_head;
|
||||
@@ -485,7 +485,7 @@ PRIVATE void ser_dump_queue_cpu(unsigned cpu)
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE void ser_dump_queues(void)
|
||||
static void ser_dump_queues(void)
|
||||
{
|
||||
#ifdef CONFIG_SMP
|
||||
unsigned cpu;
|
||||
@@ -500,7 +500,7 @@ PRIVATE void ser_dump_queues(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
PRIVATE void ser_dump_segs(void)
|
||||
static void ser_dump_segs(void)
|
||||
{
|
||||
struct proc *pp;
|
||||
for (pp= BEG_PROC_ADDR; pp < END_PROC_ADDR; pp++)
|
||||
@@ -517,7 +517,7 @@ PRIVATE void ser_dump_segs(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
PRIVATE void dump_bkl_usage(void)
|
||||
static void dump_bkl_usage(void)
|
||||
{
|
||||
unsigned cpu;
|
||||
|
||||
@@ -532,7 +532,7 @@ PRIVATE void dump_bkl_usage(void)
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE void reset_bkl_usage(void)
|
||||
static void reset_bkl_usage(void)
|
||||
{
|
||||
memset(kernel_ticks, 0, sizeof(kernel_ticks));
|
||||
memset(bkl_ticks, 0, sizeof(bkl_ticks));
|
||||
@@ -541,7 +541,7 @@ PRIVATE void reset_bkl_usage(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
PRIVATE void ser_debug(const int c)
|
||||
static void ser_debug(const int c)
|
||||
{
|
||||
serial_debug_active = 1;
|
||||
|
||||
@@ -596,7 +596,7 @@ PRIVATE void ser_debug(const int c)
|
||||
serial_debug_active = 0;
|
||||
}
|
||||
|
||||
PUBLIC void ser_dump_proc()
|
||||
void ser_dump_proc()
|
||||
{
|
||||
struct proc *pp;
|
||||
|
||||
@@ -609,7 +609,7 @@ PUBLIC void ser_dump_proc()
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
PRIVATE void ser_dump_proc_cpu(void)
|
||||
static void ser_dump_proc_cpu(void)
|
||||
{
|
||||
struct proc *pp;
|
||||
unsigned cpu;
|
||||
@@ -629,7 +629,7 @@ PRIVATE void ser_dump_proc_cpu(void)
|
||||
|
||||
#if SPROFILE
|
||||
|
||||
PUBLIC int arch_init_profile_clock(const u32_t freq)
|
||||
int arch_init_profile_clock(const u32_t freq)
|
||||
{
|
||||
int r;
|
||||
/* Set CMOS timer frequency. */
|
||||
@@ -647,7 +647,7 @@ PUBLIC int arch_init_profile_clock(const u32_t freq)
|
||||
return CMOS_CLOCK_IRQ;
|
||||
}
|
||||
|
||||
PUBLIC void arch_stop_profile_clock(void)
|
||||
void arch_stop_profile_clock(void)
|
||||
{
|
||||
int r;
|
||||
/* Disable CMOS timer interrupts. */
|
||||
@@ -657,7 +657,7 @@ PUBLIC void arch_stop_profile_clock(void)
|
||||
outb(RTC_IO, r & ~RTC_B_PIE);
|
||||
}
|
||||
|
||||
PUBLIC void arch_ack_profile_clock(void)
|
||||
void arch_ack_profile_clock(void)
|
||||
{
|
||||
/* Mandatory read of CMOS register to re-enable timer interrupts. */
|
||||
outb(RTC_INDEX, RTC_REG_C);
|
||||
@@ -669,7 +669,7 @@ PUBLIC void arch_ack_profile_clock(void)
|
||||
/* Saved by mpx386.s into these variables. */
|
||||
u32_t params_size, params_offset, mon_ds;
|
||||
|
||||
PUBLIC int arch_get_params(char *params, int maxsize)
|
||||
int arch_get_params(char *params, int maxsize)
|
||||
{
|
||||
phys_copy(seg2phys(mon_ds) + params_offset, vir2phys(params),
|
||||
MIN(maxsize, params_size));
|
||||
@@ -677,7 +677,7 @@ PUBLIC int arch_get_params(char *params, int maxsize)
|
||||
return OK;
|
||||
}
|
||||
|
||||
PUBLIC int arch_set_params(char *params, int size)
|
||||
int arch_set_params(char *params, int size)
|
||||
{
|
||||
if(size > params_size)
|
||||
return E2BIG;
|
||||
@@ -685,7 +685,7 @@ PUBLIC int arch_set_params(char *params, int size)
|
||||
return OK;
|
||||
}
|
||||
|
||||
PUBLIC void arch_do_syscall(struct proc *proc)
|
||||
void arch_do_syscall(struct proc *proc)
|
||||
{
|
||||
/* do_ipc assumes that it's running because of the current process */
|
||||
assert(proc == get_cpulocal_var(proc_ptr));
|
||||
@@ -694,7 +694,7 @@ PUBLIC void arch_do_syscall(struct proc *proc)
|
||||
do_ipc(proc->p_reg.cx, proc->p_reg.retreg, proc->p_reg.bx);
|
||||
}
|
||||
|
||||
PUBLIC struct proc * arch_finish_switch_to_user(void)
|
||||
struct proc * arch_finish_switch_to_user(void)
|
||||
{
|
||||
char * stk;
|
||||
struct proc * p;
|
||||
@@ -710,7 +710,7 @@ PUBLIC struct proc * arch_finish_switch_to_user(void)
|
||||
return p;
|
||||
}
|
||||
|
||||
PUBLIC void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigcontext *sc)
|
||||
void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigcontext *sc)
|
||||
{
|
||||
int fp_error;
|
||||
|
||||
@@ -744,7 +744,7 @@ PUBLIC void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigconte
|
||||
}
|
||||
|
||||
#if !CONFIG_OXPCIE
|
||||
PRIVATE void ser_init(void)
|
||||
static void ser_init(void)
|
||||
{
|
||||
unsigned char lcr;
|
||||
unsigned divisor;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
* Intel architecture performance counters watchdog
|
||||
*/
|
||||
|
||||
PRIVATE struct arch_watchdog intel_arch_watchdog;
|
||||
PRIVATE struct arch_watchdog amd_watchdog;
|
||||
static struct arch_watchdog intel_arch_watchdog;
|
||||
static struct arch_watchdog amd_watchdog;
|
||||
|
||||
PRIVATE void intel_arch_watchdog_init(const unsigned cpu)
|
||||
static void intel_arch_watchdog_init(const unsigned cpu)
|
||||
{
|
||||
u64_t cpuf;
|
||||
u32_t val;
|
||||
@@ -51,13 +51,13 @@ PRIVATE void intel_arch_watchdog_init(const unsigned cpu)
|
||||
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
|
||||
}
|
||||
|
||||
PRIVATE void intel_arch_watchdog_reinit(const unsigned cpu)
|
||||
static void intel_arch_watchdog_reinit(const unsigned cpu)
|
||||
{
|
||||
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
|
||||
ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, ex64lo(watchdog->resetval));
|
||||
}
|
||||
|
||||
PUBLIC int arch_watchdog_init(void)
|
||||
int arch_watchdog_init(void)
|
||||
{
|
||||
u32_t eax, ebx, ecx, edx;
|
||||
unsigned cpu = cpuid;
|
||||
@@ -105,11 +105,11 @@ PUBLIC int arch_watchdog_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PUBLIC void arch_watchdog_stop(void)
|
||||
void arch_watchdog_stop(void)
|
||||
{
|
||||
}
|
||||
|
||||
PUBLIC void arch_watchdog_lockup(const struct nmi_frame * frame)
|
||||
void arch_watchdog_lockup(const struct nmi_frame * frame)
|
||||
{
|
||||
printf("KERNEL LOCK UP\n"
|
||||
"eax 0x%08x\n"
|
||||
@@ -144,7 +144,7 @@ PUBLIC void arch_watchdog_lockup(const struct nmi_frame * frame)
|
||||
panic("Kernel lockup");
|
||||
}
|
||||
|
||||
PUBLIC int i386_watchdog_start(void)
|
||||
int i386_watchdog_start(void)
|
||||
{
|
||||
if (arch_watchdog_init()) {
|
||||
printf("WARNING watchdog initialization "
|
||||
@@ -158,7 +158,7 @@ PUBLIC int i386_watchdog_start(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRIVATE int intel_arch_watchdog_profile_init(const unsigned freq)
|
||||
static int intel_arch_watchdog_profile_init(const unsigned freq)
|
||||
{
|
||||
u64_t cpuf;
|
||||
|
||||
@@ -181,7 +181,7 @@ PRIVATE int intel_arch_watchdog_profile_init(const unsigned freq)
|
||||
return OK;
|
||||
}
|
||||
|
||||
PRIVATE struct arch_watchdog intel_arch_watchdog = {
|
||||
static struct arch_watchdog intel_arch_watchdog = {
|
||||
/*.init = */ intel_arch_watchdog_init,
|
||||
/*.reinit = */ intel_arch_watchdog_reinit,
|
||||
/*.profile_init = */ intel_arch_watchdog_profile_init
|
||||
@@ -191,7 +191,7 @@ PRIVATE struct arch_watchdog intel_arch_watchdog = {
|
||||
#define AMD_MSR_EVENT_CTR0 0xc0010004
|
||||
#define AMD_MSR_EVENT_SEL0_ENABLE (1 << 22)
|
||||
|
||||
PRIVATE void amd_watchdog_init(const unsigned cpu)
|
||||
static void amd_watchdog_init(const unsigned cpu)
|
||||
{
|
||||
u64_t cpuf;
|
||||
u32_t val;
|
||||
@@ -216,14 +216,14 @@ PRIVATE void amd_watchdog_init(const unsigned cpu)
|
||||
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
|
||||
}
|
||||
|
||||
PRIVATE void amd_watchdog_reinit(const unsigned cpu)
|
||||
static void amd_watchdog_reinit(const unsigned cpu)
|
||||
{
|
||||
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
|
||||
ia32_msr_write(AMD_MSR_EVENT_CTR0,
|
||||
ex64hi(watchdog->resetval), ex64lo(watchdog->resetval));
|
||||
}
|
||||
|
||||
PRIVATE int amd_watchdog_profile_init(const unsigned freq)
|
||||
static int amd_watchdog_profile_init(const unsigned freq)
|
||||
{
|
||||
u64_t cpuf;
|
||||
|
||||
@@ -237,7 +237,7 @@ PRIVATE int amd_watchdog_profile_init(const unsigned freq)
|
||||
return OK;
|
||||
}
|
||||
|
||||
PRIVATE struct arch_watchdog amd_watchdog = {
|
||||
static struct arch_watchdog amd_watchdog = {
|
||||
/*.init = */ amd_watchdog_init,
|
||||
/*.reinit = */ amd_watchdog_reinit,
|
||||
/*.profile_init = */ amd_watchdog_profile_init
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "debugreg.h"
|
||||
|
||||
PUBLIC int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
|
||||
int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
|
||||
{
|
||||
unsigned long dr7, dr7flags;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ struct reg86u reg86;
|
||||
/*===========================================================================*
|
||||
* do_int86 *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_int86(struct proc * caller, message * m_ptr)
|
||||
int do_int86(struct proc * caller, message * m_ptr)
|
||||
{
|
||||
data_copy(caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86,
|
||||
KERNEL, (vir_bytes) ®86, sizeof(reg86));
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
/*===========================================================================*
|
||||
* do_iopenable *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_iopenable(struct proc * caller, message * m_ptr)
|
||||
int do_iopenable(struct proc * caller, message * m_ptr)
|
||||
{
|
||||
int proc_nr;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/*===========================================================================*
|
||||
* do_readbios *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_readbios(struct proc * caller, message * m_ptr)
|
||||
int do_readbios(struct proc * caller, message * m_ptr)
|
||||
{
|
||||
struct vir_addr src, dst;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/*===========================================================================*
|
||||
* do_sdevio *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_sdevio(struct proc * caller, message *m_ptr)
|
||||
int do_sdevio(struct proc * caller, message *m_ptr)
|
||||
{
|
||||
vir_bytes newoffset;
|
||||
endpoint_t newep;
|
||||
|
||||
@@ -41,14 +41,14 @@ static struct ex_s ex_data[] = {
|
||||
{ "SIMD exception", SIGFPE, 386 },
|
||||
};
|
||||
|
||||
PRIVATE void inkernel_disaster(struct proc *saved_proc,
|
||||
static void inkernel_disaster(struct proc *saved_proc,
|
||||
struct exception_frame *frame, struct ex_s *ep, int is_nested);
|
||||
|
||||
extern int catch_pagefaults;
|
||||
|
||||
PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc);
|
||||
static void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc);
|
||||
|
||||
PRIVATE void pagefault( struct proc *pr,
|
||||
static void pagefault( struct proc *pr,
|
||||
struct exception_frame * frame,
|
||||
int is_nested)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ PRIVATE void pagefault( struct proc *pr,
|
||||
return;
|
||||
}
|
||||
|
||||
PRIVATE void inkernel_disaster(struct proc *saved_proc,
|
||||
static void inkernel_disaster(struct proc *saved_proc,
|
||||
struct exception_frame * frame, struct ex_s *ep,
|
||||
int is_nested)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ PRIVATE void inkernel_disaster(struct proc *saved_proc,
|
||||
/*===========================================================================*
|
||||
* exception *
|
||||
*===========================================================================*/
|
||||
PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
|
||||
void exception_handler(int is_nested, struct exception_frame * frame)
|
||||
{
|
||||
/* An exception or unexpected interrupt has occurred. */
|
||||
register struct ex_s *ep;
|
||||
@@ -278,7 +278,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
|
||||
/*===========================================================================*
|
||||
* proc_stacktrace_execute *
|
||||
*===========================================================================*/
|
||||
PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc)
|
||||
static void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc)
|
||||
{
|
||||
reg_t v_hbp;
|
||||
int iskernel;
|
||||
@@ -322,21 +322,21 @@ PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t p
|
||||
/*===========================================================================*
|
||||
* proc_stacktrace *
|
||||
*===========================================================================*/
|
||||
PUBLIC void proc_stacktrace(struct proc *whichproc)
|
||||
void proc_stacktrace(struct proc *whichproc)
|
||||
{
|
||||
#if USE_SYSDEBUG
|
||||
proc_stacktrace_execute(whichproc, whichproc->p_reg.fp, whichproc->p_reg.pc);
|
||||
#endif /* USE_SYSDEBUG */
|
||||
}
|
||||
|
||||
PUBLIC void enable_fpu_exception(void)
|
||||
void enable_fpu_exception(void)
|
||||
{
|
||||
u32_t cr0 = read_cr0();
|
||||
if(!(cr0 & I386_CR0_TS))
|
||||
write_cr0(cr0 | I386_CR0_TS);
|
||||
}
|
||||
|
||||
PUBLIC void disable_fpu_exception(void)
|
||||
void disable_fpu_exception(void)
|
||||
{
|
||||
clts();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/*===========================================================================*
|
||||
* intr_init *
|
||||
*===========================================================================*/
|
||||
PUBLIC int intr_init(const int mine, const int auto_eoi)
|
||||
int intr_init(const int mine, const int auto_eoi)
|
||||
{
|
||||
/* Initialize the 8259s, finishing with all interrupts disabled. This is
|
||||
* only done in protected mode, in real mode we don't touch the 8259s, but
|
||||
@@ -72,27 +72,27 @@ PUBLIC int intr_init(const int mine, const int auto_eoi)
|
||||
return OK;
|
||||
}
|
||||
|
||||
PUBLIC void irq_8259_unmask(const int irq)
|
||||
void irq_8259_unmask(const int irq)
|
||||
{
|
||||
const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK;
|
||||
outb(ctl_mask, inb(ctl_mask) & ~(1 << (irq & 0x7)));
|
||||
}
|
||||
|
||||
PUBLIC void irq_8259_mask(const int irq)
|
||||
void irq_8259_mask(const int irq)
|
||||
{
|
||||
const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK;
|
||||
outb(ctl_mask, inb(ctl_mask) | (1 << (irq & 0x7)));
|
||||
}
|
||||
|
||||
/* Disable 8259 - write 0xFF in OCW1 master and slave. */
|
||||
PUBLIC void i8259_disable(void)
|
||||
void i8259_disable(void)
|
||||
{
|
||||
outb(INT2_CTLMASK, 0xFF);
|
||||
outb(INT_CTLMASK, 0xFF);
|
||||
inb(INT_CTLMASK);
|
||||
}
|
||||
|
||||
PUBLIC void irq_8259_eoi(int irq)
|
||||
void irq_8259_eoi(int irq)
|
||||
{
|
||||
if (irq < 8)
|
||||
eoi_8259_master();
|
||||
|
||||
@@ -27,20 +27,20 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PUBLIC int i386_paging_enabled = 0;
|
||||
int i386_paging_enabled = 0;
|
||||
|
||||
PRIVATE int psok = 0;
|
||||
static int psok = 0;
|
||||
|
||||
#define MAX_FREEPDES 2
|
||||
PRIVATE int nfreepdes = 0, freepdes[MAX_FREEPDES];
|
||||
static int nfreepdes = 0, freepdes[MAX_FREEPDES];
|
||||
|
||||
#define HASPT(procptr) ((procptr)->p_seg.p_cr3 != 0)
|
||||
|
||||
FORWARD u32_t phys_get32(phys_bytes v);
|
||||
FORWARD void vm_enable_paging(void);
|
||||
static u32_t phys_get32(phys_bytes v);
|
||||
static void vm_enable_paging(void);
|
||||
|
||||
|
||||
PUBLIC void segmentation2paging(struct proc * current)
|
||||
void segmentation2paging(struct proc * current)
|
||||
{
|
||||
/* switch to the current process page tables before turning paging on */
|
||||
switch_address_space(current);
|
||||
@@ -67,7 +67,7 @@ PUBLIC void segmentation2paging(struct proc * current)
|
||||
* pde number to be used, and a pointer to it (linear address) is returned
|
||||
* for actual use by phys_copy or phys_memset.
|
||||
*/
|
||||
PRIVATE phys_bytes createpde(
|
||||
static phys_bytes createpde(
|
||||
const struct proc *pr, /* Requested process, NULL for physical. */
|
||||
const phys_bytes linaddr,/* Address after segment translation. */
|
||||
phys_bytes *bytes, /* Size of chunk, function may truncate it. */
|
||||
@@ -132,7 +132,7 @@ PRIVATE phys_bytes createpde(
|
||||
/*===========================================================================*
|
||||
* lin_lin_copy *
|
||||
*===========================================================================*/
|
||||
PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
|
||||
static int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
|
||||
struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes)
|
||||
{
|
||||
u32_t addr;
|
||||
@@ -214,7 +214,7 @@ PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
|
||||
}
|
||||
|
||||
|
||||
PRIVATE u32_t phys_get32(phys_bytes addr)
|
||||
static u32_t phys_get32(phys_bytes addr)
|
||||
{
|
||||
const u32_t v;
|
||||
int r;
|
||||
@@ -233,7 +233,7 @@ PRIVATE u32_t phys_get32(phys_bytes addr)
|
||||
}
|
||||
|
||||
#if 0
|
||||
PRIVATE char *cr0_str(u32_t e)
|
||||
static char *cr0_str(u32_t e)
|
||||
{
|
||||
static char str[80];
|
||||
strcpy(str, "");
|
||||
@@ -249,7 +249,7 @@ PRIVATE char *cr0_str(u32_t e)
|
||||
return str;
|
||||
}
|
||||
|
||||
PRIVATE char *cr4_str(u32_t e)
|
||||
static char *cr4_str(u32_t e)
|
||||
{
|
||||
static char str[80];
|
||||
strcpy(str, "");
|
||||
@@ -266,12 +266,12 @@ PRIVATE char *cr4_str(u32_t e)
|
||||
}
|
||||
#endif
|
||||
|
||||
PUBLIC void vm_stop(void)
|
||||
void vm_stop(void)
|
||||
{
|
||||
write_cr0(read_cr0() & ~I386_CR0_PG);
|
||||
}
|
||||
|
||||
PRIVATE void vm_enable_paging(void)
|
||||
static void vm_enable_paging(void)
|
||||
{
|
||||
u32_t cr0, cr4;
|
||||
int pgeok;
|
||||
@@ -311,7 +311,7 @@ PRIVATE void vm_enable_paging(void)
|
||||
/*===========================================================================*
|
||||
* umap_local *
|
||||
*===========================================================================*/
|
||||
PUBLIC phys_bytes umap_local(rp, seg, vir_addr, bytes)
|
||||
phys_bytes umap_local(rp, seg, vir_addr, bytes)
|
||||
register struct proc *rp; /* pointer to proc table entry for process */
|
||||
int seg; /* T, D, or S segment */
|
||||
vir_bytes vir_addr; /* virtual address in bytes within the seg */
|
||||
@@ -350,7 +350,7 @@ vir_bytes bytes; /* # of bytes to be copied */
|
||||
/*===========================================================================*
|
||||
* umap_virtual *
|
||||
*===========================================================================*/
|
||||
PUBLIC phys_bytes umap_virtual(rp, seg, vir_addr, bytes)
|
||||
phys_bytes umap_virtual(rp, seg, vir_addr, bytes)
|
||||
register struct proc *rp; /* pointer to proc table entry for process */
|
||||
int seg; /* T, D, or S segment */
|
||||
vir_bytes vir_addr; /* virtual address in bytes within the seg */
|
||||
@@ -399,7 +399,7 @@ vir_bytes bytes; /* # of bytes to be copied */
|
||||
/*===========================================================================*
|
||||
* vm_lookup *
|
||||
*===========================================================================*/
|
||||
PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual,
|
||||
int vm_lookup(const struct proc *proc, const vir_bytes virtual,
|
||||
phys_bytes *physical, u32_t *ptent)
|
||||
{
|
||||
u32_t *root, *pt;
|
||||
@@ -455,7 +455,7 @@ PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual,
|
||||
/*===========================================================================*
|
||||
* vm_lookup_range *
|
||||
*===========================================================================*/
|
||||
PUBLIC size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr,
|
||||
size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr,
|
||||
phys_bytes *phys_addr, size_t bytes)
|
||||
{
|
||||
/* Look up the physical address corresponding to linear virtual address
|
||||
@@ -507,7 +507,7 @@ PUBLIC size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr,
|
||||
/*===========================================================================*
|
||||
* vm_suspend *
|
||||
*===========================================================================*/
|
||||
PRIVATE void vm_suspend(struct proc *caller, const struct proc *target,
|
||||
static void vm_suspend(struct proc *caller, const struct proc *target,
|
||||
const vir_bytes linaddr, const vir_bytes len, const int type)
|
||||
{
|
||||
/* This range is not OK for this process. Set parameters
|
||||
@@ -534,7 +534,7 @@ PRIVATE void vm_suspend(struct proc *caller, const struct proc *target,
|
||||
/*===========================================================================*
|
||||
* vm_check_range *
|
||||
*===========================================================================*/
|
||||
PUBLIC int vm_check_range(struct proc *caller, struct proc *target,
|
||||
int vm_check_range(struct proc *caller, struct proc *target,
|
||||
vir_bytes vir_addr, size_t bytes)
|
||||
{
|
||||
/* Public interface to vm_suspend(), for use by kernel calls. On behalf
|
||||
@@ -562,7 +562,7 @@ PUBLIC int vm_check_range(struct proc *caller, struct proc *target,
|
||||
/*===========================================================================*
|
||||
* delivermsg *
|
||||
*===========================================================================*/
|
||||
PUBLIC void delivermsg(struct proc *rp)
|
||||
void delivermsg(struct proc *rp)
|
||||
{
|
||||
int r = OK;
|
||||
|
||||
@@ -589,7 +589,7 @@ PUBLIC void delivermsg(struct proc *rp)
|
||||
}
|
||||
|
||||
#if 0
|
||||
PRIVATE char *flagstr(u32_t e, const int dir)
|
||||
static char *flagstr(u32_t e, const int dir)
|
||||
{
|
||||
static char str[80];
|
||||
strcpy(str, "");
|
||||
@@ -606,7 +606,7 @@ PRIVATE char *flagstr(u32_t e, const int dir)
|
||||
return str;
|
||||
}
|
||||
|
||||
PRIVATE void vm_pt_print(u32_t *pagetable, const u32_t v)
|
||||
static void vm_pt_print(u32_t *pagetable, const u32_t v)
|
||||
{
|
||||
int pte;
|
||||
int col = 0;
|
||||
@@ -630,7 +630,7 @@ PRIVATE void vm_pt_print(u32_t *pagetable, const u32_t v)
|
||||
return;
|
||||
}
|
||||
|
||||
PRIVATE void vm_print(u32_t *root)
|
||||
static void vm_print(u32_t *root)
|
||||
{
|
||||
int pde;
|
||||
|
||||
@@ -705,7 +705,7 @@ int vm_phys_memset(phys_bytes ph, const u8_t c, phys_bytes bytes)
|
||||
/*===========================================================================*
|
||||
* virtual_copy_f *
|
||||
*===========================================================================*/
|
||||
PUBLIC int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck)
|
||||
int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck)
|
||||
struct proc * caller;
|
||||
struct vir_addr *src_addr; /* source virtual address */
|
||||
struct vir_addr *dst_addr; /* destination virtual address */
|
||||
@@ -848,7 +848,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
|
||||
/*===========================================================================*
|
||||
* data_copy *
|
||||
*===========================================================================*/
|
||||
PUBLIC int data_copy(const endpoint_t from_proc, const vir_bytes from_addr,
|
||||
int data_copy(const endpoint_t from_proc, const vir_bytes from_addr,
|
||||
const endpoint_t to_proc, const vir_bytes to_addr,
|
||||
size_t bytes)
|
||||
{
|
||||
@@ -866,7 +866,7 @@ PUBLIC int data_copy(const endpoint_t from_proc, const vir_bytes from_addr,
|
||||
/*===========================================================================*
|
||||
* data_copy_vmcheck *
|
||||
*===========================================================================*/
|
||||
PUBLIC int data_copy_vmcheck(struct proc * caller,
|
||||
int data_copy_vmcheck(struct proc * caller,
|
||||
const endpoint_t from_proc, const vir_bytes from_addr,
|
||||
const endpoint_t to_proc, const vir_bytes to_addr,
|
||||
size_t bytes)
|
||||
@@ -885,7 +885,7 @@ PUBLIC int data_copy_vmcheck(struct proc * caller,
|
||||
/*===========================================================================*
|
||||
* arch_pre_exec *
|
||||
*===========================================================================*/
|
||||
PUBLIC void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
|
||||
void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
|
||||
{
|
||||
/* set program counter and stack pointer. */
|
||||
pr->p_reg.pc = ip;
|
||||
@@ -895,7 +895,7 @@ PUBLIC void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
|
||||
/*===========================================================================*
|
||||
* arch_umap *
|
||||
*===========================================================================*/
|
||||
PUBLIC int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count,
|
||||
int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count,
|
||||
int seg, phys_bytes *addr)
|
||||
{
|
||||
switch(seg) {
|
||||
@@ -919,12 +919,12 @@ void i386_freepde(const int pde)
|
||||
freepdes[nfreepdes++] = pde;
|
||||
}
|
||||
|
||||
PRIVATE int oxpcie_mapping_index = -1,
|
||||
static int oxpcie_mapping_index = -1,
|
||||
lapic_mapping_index = -1,
|
||||
ioapic_first_index = -1,
|
||||
ioapic_last_index = -1;
|
||||
|
||||
PUBLIC int arch_phys_map(const int index,
|
||||
int arch_phys_map(const int index,
|
||||
phys_bytes *addr,
|
||||
phys_bytes *len,
|
||||
int *flags)
|
||||
@@ -988,7 +988,7 @@ PUBLIC int arch_phys_map(const int index,
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
PUBLIC int arch_phys_map_reply(const int index, const vir_bytes addr)
|
||||
int arch_phys_map_reply(const int index, const vir_bytes addr)
|
||||
{
|
||||
#ifdef USE_APIC
|
||||
/* if local APIC is enabled */
|
||||
@@ -1013,7 +1013,7 @@ PUBLIC int arch_phys_map_reply(const int index, const vir_bytes addr)
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
PUBLIC int arch_enable_paging(struct proc * caller, const message * m_ptr)
|
||||
int arch_enable_paging(struct proc * caller, const message * m_ptr)
|
||||
{
|
||||
struct vm_ep_data ep_data;
|
||||
int r;
|
||||
@@ -1099,13 +1099,13 @@ PUBLIC int arch_enable_paging(struct proc * caller, const message * m_ptr)
|
||||
return OK;
|
||||
}
|
||||
|
||||
PUBLIC void release_address_space(struct proc *pr)
|
||||
void release_address_space(struct proc *pr)
|
||||
{
|
||||
pr->p_seg.p_cr3_v = NULL;
|
||||
}
|
||||
|
||||
/* computes a checksum of a buffer of a given length. The byte sum must be zero */
|
||||
PUBLIC int platform_tbl_checksum_ok(void *ptr, unsigned int length)
|
||||
int platform_tbl_checksum_ok(void *ptr, unsigned int length)
|
||||
{
|
||||
u8_t total = 0;
|
||||
unsigned int i;
|
||||
@@ -1114,7 +1114,7 @@ PUBLIC int platform_tbl_checksum_ok(void *ptr, unsigned int length)
|
||||
return !total;
|
||||
}
|
||||
|
||||
PUBLIC int platform_tbl_ptr(phys_bytes start,
|
||||
int platform_tbl_ptr(phys_bytes start,
|
||||
phys_bytes end,
|
||||
unsigned increment,
|
||||
void * buff,
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#include "oxpcie.h"
|
||||
#include "serial.h"
|
||||
|
||||
PRIVATE unsigned char *oxpcie_vaddr = NULL;
|
||||
static unsigned char *oxpcie_vaddr = NULL;
|
||||
|
||||
PUBLIC void oxpcie_set_vaddr(unsigned char *vaddr)
|
||||
void oxpcie_set_vaddr(unsigned char *vaddr)
|
||||
{
|
||||
oxpcie_vaddr = vaddr;
|
||||
}
|
||||
|
||||
PRIVATE void oxpcie_init(void)
|
||||
static void oxpcie_init(void)
|
||||
{
|
||||
printf("oxpcie_init\n");
|
||||
/* Enable access to EFR and DLM+DLL */
|
||||
@@ -45,7 +45,7 @@ PRIVATE void oxpcie_init(void)
|
||||
OXPCIE_CPR2 = 0;
|
||||
}
|
||||
|
||||
PUBLIC void oxpcie_putc(char c)
|
||||
void oxpcie_putc(char c)
|
||||
{
|
||||
static int inuse = 0;
|
||||
|
||||
@@ -68,7 +68,7 @@ PUBLIC void oxpcie_putc(char c)
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC int oxpcie_in(void)
|
||||
int oxpcie_in(void)
|
||||
{
|
||||
if(vm_running && oxpcie_vaddr) {
|
||||
int lsr;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#define mb_clear_memrange(start, end) \
|
||||
phys_memset((start), 0, (end)-(start))
|
||||
|
||||
PRIVATE void mb_itoa(u32_t val, char * out)
|
||||
static void mb_itoa(u32_t val, char * out)
|
||||
{
|
||||
char ret[ITOA_BUFFER_SIZE];
|
||||
int i = ITOA_BUFFER_SIZE - 2;
|
||||
@@ -67,7 +67,7 @@ PRIVATE void mb_itoa(u32_t val, char * out)
|
||||
strcpy(out, ret + i + 1);
|
||||
}
|
||||
|
||||
PRIVATE void mb_itox(u32_t val, char *out)
|
||||
static void mb_itox(u32_t val, char *out)
|
||||
{
|
||||
char ret[9];
|
||||
int i = 7;
|
||||
@@ -92,7 +92,7 @@ PRIVATE void mb_itox(u32_t val, char *out)
|
||||
strcpy(out, ret + i + 1);
|
||||
}
|
||||
|
||||
PRIVATE void mb_put_char(char c, int line, int col)
|
||||
static void mb_put_char(char c, int line, int col)
|
||||
{
|
||||
/* Write a char to vga display buffer. */
|
||||
if (line<MULTIBOOT_CONSOLE_LINES&&col<MULTIBOOT_CONSOLE_COLS)
|
||||
@@ -104,7 +104,7 @@ PRIVATE void mb_put_char(char c, int line, int col)
|
||||
1);
|
||||
}
|
||||
|
||||
PRIVATE char mb_get_char(int line, int col)
|
||||
static char mb_get_char(int line, int col)
|
||||
{
|
||||
char c;
|
||||
/* Read a char to from display buffer. */
|
||||
@@ -119,11 +119,11 @@ PRIVATE char mb_get_char(int line, int col)
|
||||
}
|
||||
|
||||
/* Give non-zero values to avoid them in BSS */
|
||||
PRIVATE int print_line = 1, print_col = 1;
|
||||
static int print_line = 1, print_col = 1;
|
||||
|
||||
#include <sys/video.h>
|
||||
|
||||
PUBLIC void mb_cls(void)
|
||||
void mb_cls(void)
|
||||
{
|
||||
int i, j;
|
||||
/* Clear screen */
|
||||
@@ -139,7 +139,7 @@ PUBLIC void mb_cls(void)
|
||||
outb(C_6845+DATA, 0);
|
||||
}
|
||||
|
||||
PRIVATE void mb_scroll_up(int lines)
|
||||
static void mb_scroll_up(int lines)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < MULTIBOOT_CONSOLE_LINES; i++ ) {
|
||||
@@ -153,7 +153,7 @@ PRIVATE void mb_scroll_up(int lines)
|
||||
print_line-= lines;
|
||||
}
|
||||
|
||||
PUBLIC void mb_print_char(char c)
|
||||
void mb_print_char(char c)
|
||||
{
|
||||
while (print_line >= MULTIBOOT_CONSOLE_LINES)
|
||||
mb_scroll_up(1);
|
||||
@@ -177,7 +177,7 @@ PUBLIC void mb_print_char(char c)
|
||||
mb_scroll_up(1);
|
||||
}
|
||||
|
||||
PUBLIC void mb_print(char *str)
|
||||
void mb_print(char *str)
|
||||
{
|
||||
while (*str) {
|
||||
mb_print_char(*str);
|
||||
@@ -191,7 +191,7 @@ PUBLIC void mb_print(char *str)
|
||||
#define KB_OUT_FULL 0x01 /* status bit set when keypress char pending */
|
||||
#define KB_AUX_BYTE 0x20 /* Auxiliary Device Output Buffer Full */
|
||||
|
||||
PUBLIC int mb_read_char(unsigned char *ch)
|
||||
int mb_read_char(unsigned char *ch)
|
||||
{
|
||||
unsigned long b, sb;
|
||||
#ifdef DEBUG_SERIAL
|
||||
@@ -220,7 +220,7 @@ PUBLIC int mb_read_char(unsigned char *ch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRIVATE void mb_print_hex(u32_t value)
|
||||
static void mb_print_hex(u32_t value)
|
||||
{
|
||||
int i;
|
||||
char c;
|
||||
@@ -238,7 +238,7 @@ PRIVATE void mb_print_hex(u32_t value)
|
||||
mb_print(out);
|
||||
}
|
||||
|
||||
PRIVATE int mb_set_param(char *name, char *value)
|
||||
static int mb_set_param(char *name, char *value)
|
||||
{
|
||||
char *p = multiboot_param_buf;
|
||||
char *q;
|
||||
@@ -281,7 +281,7 @@ PRIVATE int mb_set_param(char *name, char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRIVATE void get_parameters(multiboot_info_t *mbi)
|
||||
static void get_parameters(multiboot_info_t *mbi)
|
||||
{
|
||||
char mem_value[40], temp[ITOA_BUFFER_SIZE];
|
||||
int i;
|
||||
@@ -354,7 +354,7 @@ PRIVATE void get_parameters(multiboot_info_t *mbi)
|
||||
}
|
||||
}
|
||||
|
||||
PRIVATE void mb_extract_image(multiboot_info_t mbi)
|
||||
static void mb_extract_image(multiboot_info_t mbi)
|
||||
{
|
||||
multiboot_module_t *mb_module_info;
|
||||
multiboot_module_t *module;
|
||||
@@ -458,7 +458,7 @@ PRIVATE void mb_extract_image(multiboot_info_t mbi)
|
||||
return;
|
||||
}
|
||||
|
||||
PUBLIC phys_bytes pre_init(u32_t ebx)
|
||||
phys_bytes pre_init(u32_t ebx)
|
||||
{
|
||||
multiboot_info_t mbi;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ struct gatedesc_s {
|
||||
u16_t offset_high;
|
||||
};
|
||||
|
||||
PUBLIC struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */
|
||||
struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */
|
||||
{ {0},
|
||||
{0,0,0,0}, /* GDT descriptor */
|
||||
{0,0,0,0}, /* IDT descriptor */
|
||||
@@ -35,16 +35,16 @@ PUBLIC struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */
|
||||
{0xffff,0,0,0x9b,0xcf,0}, /* kernel CS */
|
||||
{0xffff,0,0,0x9b,0xcf,0}, /* temp for BIOS (386: monitor CS at startup) */
|
||||
};
|
||||
PRIVATE struct gatedesc_s idt[IDT_SIZE]; /* zero-init so none present */
|
||||
PUBLIC struct tss_s tss[CONFIG_MAX_CPUS]; /* zero init */
|
||||
static struct gatedesc_s idt[IDT_SIZE]; /* zero-init so none present */
|
||||
struct tss_s tss[CONFIG_MAX_CPUS]; /* zero init */
|
||||
|
||||
FORWARD void sdesc(struct segdesc_s *segdp, phys_bytes base, vir_bytes
|
||||
static void sdesc(struct segdesc_s *segdp, phys_bytes base, vir_bytes
|
||||
size);
|
||||
|
||||
/*===========================================================================*
|
||||
* enable_iop *
|
||||
*===========================================================================*/
|
||||
PUBLIC void enable_iop(struct proc *pp)
|
||||
void enable_iop(struct proc *pp)
|
||||
{
|
||||
/* Allow a user process to use I/O instructions. Change the I/O Permission
|
||||
* Level bits in the psw. These specify least-privileged Current Permission
|
||||
@@ -57,7 +57,7 @@ PUBLIC void enable_iop(struct proc *pp)
|
||||
/*===========================================================================*
|
||||
* seg2phys *
|
||||
*===========================================================================*/
|
||||
PUBLIC phys_bytes seg2phys(const u16_t seg)
|
||||
phys_bytes seg2phys(const u16_t seg)
|
||||
{
|
||||
/* Return the base address of a segment, with seg being a
|
||||
* register, or a 286/386 segment selector.
|
||||
@@ -75,7 +75,7 @@ PUBLIC phys_bytes seg2phys(const u16_t seg)
|
||||
/*===========================================================================*
|
||||
* init_dataseg *
|
||||
*===========================================================================*/
|
||||
PUBLIC void init_dataseg(register struct segdesc_s *segdp,
|
||||
void init_dataseg(register struct segdesc_s *segdp,
|
||||
phys_bytes base, vir_bytes size, const int privilege)
|
||||
{
|
||||
/* Build descriptor for a data segment. */
|
||||
@@ -88,7 +88,7 @@ PUBLIC void init_dataseg(register struct segdesc_s *segdp,
|
||||
/*===========================================================================*
|
||||
* init_codeseg *
|
||||
*===========================================================================*/
|
||||
PRIVATE void init_codeseg(register struct segdesc_s *segdp, phys_bytes base,
|
||||
static void init_codeseg(register struct segdesc_s *segdp, phys_bytes base,
|
||||
vir_bytes size, int privilege)
|
||||
{
|
||||
/* Build descriptor for a code segment. */
|
||||
@@ -98,7 +98,7 @@ PRIVATE void init_codeseg(register struct segdesc_s *segdp, phys_bytes base,
|
||||
/* CONFORMING = 0, ACCESSED = 0 */
|
||||
}
|
||||
|
||||
PUBLIC struct gate_table_s gate_table_pic[] = {
|
||||
struct gate_table_s gate_table_pic[] = {
|
||||
{ hwint00, VECTOR( 0), INTR_PRIVILEGE },
|
||||
{ hwint01, VECTOR( 1), INTR_PRIVILEGE },
|
||||
{ hwint02, VECTOR( 2), INTR_PRIVILEGE },
|
||||
@@ -118,7 +118,7 @@ PUBLIC struct gate_table_s gate_table_pic[] = {
|
||||
{ NULL, 0, 0}
|
||||
};
|
||||
|
||||
PUBLIC void tss_init(unsigned cpu, void * kernel_stack)
|
||||
void tss_init(unsigned cpu, void * kernel_stack)
|
||||
{
|
||||
struct tss_s * t = &tss[cpu];
|
||||
|
||||
@@ -146,7 +146,7 @@ PUBLIC void tss_init(unsigned cpu, void * kernel_stack)
|
||||
/*===========================================================================*
|
||||
* prot_init *
|
||||
*===========================================================================*/
|
||||
PUBLIC void prot_init(void)
|
||||
void prot_init(void)
|
||||
{
|
||||
/* Set up tables for protected mode.
|
||||
* All GDT slots are allocated at compile time.
|
||||
@@ -192,7 +192,7 @@ PUBLIC void prot_init(void)
|
||||
tss_init(0, &k_boot_stktop);
|
||||
}
|
||||
|
||||
PUBLIC void idt_copy_vectors(struct gate_table_s * first)
|
||||
void idt_copy_vectors(struct gate_table_s * first)
|
||||
{
|
||||
struct gate_table_s *gtp;
|
||||
for (gtp = first; gtp->gate; gtp++) {
|
||||
@@ -203,7 +203,7 @@ PUBLIC void idt_copy_vectors(struct gate_table_s * first)
|
||||
}
|
||||
|
||||
/* Build descriptors for interrupt gates in IDT. */
|
||||
PUBLIC void idt_init(void)
|
||||
void idt_init(void)
|
||||
{
|
||||
struct gate_table_s gate_table[] = {
|
||||
{ divide_error, DIVIDE_VECTOR, INTR_PRIVILEGE },
|
||||
@@ -238,7 +238,7 @@ PUBLIC void idt_init(void)
|
||||
/*===========================================================================*
|
||||
* sdesc *
|
||||
*===========================================================================*/
|
||||
PRIVATE void sdesc(segdp, base, size)
|
||||
static void sdesc(segdp, base, size)
|
||||
register struct segdesc_s *segdp;
|
||||
phys_bytes base;
|
||||
vir_bytes size;
|
||||
@@ -263,7 +263,7 @@ vir_bytes size;
|
||||
/*===========================================================================*
|
||||
* int_gate *
|
||||
*===========================================================================*/
|
||||
PUBLIC void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type)
|
||||
void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type)
|
||||
{
|
||||
/* Build descriptor for an interrupt gate. */
|
||||
register struct gatedesc_s *idp;
|
||||
@@ -278,7 +278,7 @@ PUBLIC void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type)
|
||||
/*===========================================================================*
|
||||
* alloc_segments *
|
||||
*===========================================================================*/
|
||||
PUBLIC void alloc_segments(register struct proc *rp)
|
||||
void alloc_segments(register struct proc *rp)
|
||||
{
|
||||
/* This is called at system initialization from main() and by do_newmap().
|
||||
* The code has a separate function because of all hardware-dependencies.
|
||||
@@ -322,7 +322,7 @@ PUBLIC void alloc_segments(register struct proc *rp)
|
||||
/*===========================================================================*
|
||||
* check_segments *
|
||||
*===========================================================================*/
|
||||
PRIVATE void check_segments(char *File, int line)
|
||||
static void check_segments(char *File, int line)
|
||||
{
|
||||
int checked = 0;
|
||||
int fail = 0;
|
||||
@@ -363,7 +363,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
|
||||
/*===========================================================================*
|
||||
* printseg *
|
||||
*===========================================================================*/
|
||||
PUBLIC void printseg(char *banner, const int iscs, struct proc *pr,
|
||||
void printseg(char *banner, const int iscs, struct proc *pr,
|
||||
const u32_t selector)
|
||||
{
|
||||
#if USE_SYSDEBUG
|
||||
@@ -453,7 +453,7 @@ PUBLIC void printseg(char *banner, const int iscs, struct proc *pr,
|
||||
/*===========================================================================*
|
||||
* prot_set_kern_seg_limit *
|
||||
*===========================================================================*/
|
||||
PUBLIC int prot_set_kern_seg_limit(const vir_bytes limit)
|
||||
int prot_set_kern_seg_limit(const vir_bytes limit)
|
||||
{
|
||||
struct proc *rp;
|
||||
int orig_click;
|
||||
|
||||
Reference in New Issue
Block a user