#define VERBOSE_APIC(x) x
-PUBLIC int reboot_type;
-PUBLIC int ioapic_enabled;
-PUBLIC u32_t ioapic_id_mask[8], lapic_id_mask[8];
+PRIVATE int reboot_type;
+PRIVATE int ioapic_enabled;
+PRIVATE u32_t ioapic_id_mask[8];
+PRIVATE u32_t lapic_id_mask[8];
PUBLIC u32_t lapic_addr_vaddr;
PUBLIC vir_bytes lapic_addr;
PUBLIC vir_bytes lapic_eoi_addr;
-PUBLIC u32_t lapic_taskpri_addr;
-PUBLIC int bsp_lapic_id;
+PRIVATE u32_t lapic_taskpri_addr;
PRIVATE volatile int probe_ticks;
PRIVATE u64_t tsc0, tsc1;
PRIVATE u32_t lapic_tctr0, lapic_tctr1;
-u8_t apicid2cpuid[MAX_NR_APICIDS+1];
-unsigned apic_imcrp;
-unsigned nioapics;
-unsigned nbuses;
-unsigned nintrs;
-unsigned nlints;
+/* FIXME: this is only accessed from assembly, never from C. Move to asm? */
+PUBLIC u8_t apicid2cpuid[MAX_NR_APICIDS+1]; /* Accessed from asm */
+
+PRIVATE unsigned apic_imcrp;
+PRIVATE unsigned nioapics;
+PRIVATE unsigned nbuses;
+PRIVATE unsigned nintrs;
+PRIVATE const unsigned nlints = 0;
/*
* FIXME this should be a cpulocal variable but there are some problems with
return 1;
}
-PUBLIC void apic_calibrate_clocks(void)
+PRIVATE void apic_calibrate_clocks(void)
{
u32_t lvtt, val, lapic_delta;
u64_t tsc_delta;
lapic_write(LAPIC_LVTTR, lvtt | APIC_LVTT_MASK);
}
-PUBLIC void lapic_microsec_sleep(unsigned count)
+PRIVATE void lapic_microsec_sleep(unsigned count)
{
lapic_set_timer_one_shot(count);
while (lapic_read (LAPIC_TIMER_CCR));
}
-PUBLIC u32_t lapic_errstatus (void)
+PRIVATE u32_t lapic_errstatus(void)
{
lapic_write(LAPIC_ESR, 0);
return lapic_read(LAPIC_ESR);
}
-PUBLIC void lapic_disable(void)
+PRIVATE void lapic_disable(void)
{
/* Disable current APIC and close interrupts from PIC */
u32_t val;
#endif
/* Build descriptors for interrupt gates in IDT. */
-PUBLIC void apic_idt_init(const int reset)
+PRIVATE void apic_idt_init(const int reset)
{
/* Set up idt tables for smp mode.
*/
#include "kernel/kernel.h"
-EXTERN int ioapic_enabled;
EXTERN vir_bytes lapic_addr;
EXTERN u32_t lapic_eoi_addr;
-EXTERN u32_t lapic_taskpri_addr;
-EXTERN int bsp_lapic_id;
#define MAX_NR_IOAPICS 32
#define MAX_NR_BUSES 32
#define MAX_NR_LCLINTS 2
EXTERN u8_t apicid2cpuid[MAX_NR_APICIDS+1];
-EXTERN unsigned apic_imcrp;
-EXTERN unsigned nioapics;
-EXTERN unsigned nbuses;
-EXTERN unsigned nintrs;
-EXTERN unsigned nlints;
-
-EXTERN u32_t ioapic_id_mask[8];
-EXTERN u32_t lapic_id_mask[8];
+
EXTERN u32_t lapic_addr_vaddr; /* we remember the virtual address here until we
switch to paging */
-_PROTOTYPE (void calc_bus_clock, (void));
-_PROTOTYPE (u32_t lapic_errstatus, (void));
/*
_PROTOTYPE (u32_t ioapic_read, (u32_t addr, u32_t offset));
_PROTOTYPE (void ioapic_write, (u32_t addr, u32_t offset, u32_t data));
_PROTOTYPE (void lapic_eoi, (void));
*/
-_PROTOTYPE (void lapic_microsec_sleep, (unsigned count));
-_PROTOTYPE (void smp_ioapic_unmask, (void));
-_PROTOTYPE (void ioapic_disable_irqs, (u32_t irq));
-_PROTOTYPE (void ioapic_enable_irqs, (u32_t irq));
-_PROTOTYPE (u32_t ioapic_irqs_inuse, (void));
-_PROTOTYPE (void smp_recv_ipi, (int arg));
-_PROTOTYPE (void ioapic_config_pci_irq, (u32_t data));
_PROTOTYPE (int lapic_enable, (void));
-_PROTOTYPE (void lapic_disable, (void));
-
-_PROTOTYPE (void ioapic_disable_all, (void));
-_PROTOTYPE (int ioapic_enable_all, (void));
-
-_PROTOTYPE(void apic_idt_init, (int reset));
_PROTOTYPE(int apic_single_cpu_init, (void));
#include "debugreg.h"
-int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
+PRIVATE int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
{
u32_t dr7, dr7flags;
#include "kernel/proc.h"
#include "kernel/proto.h"
-extern int catch_pagefaults;
+extern int catch_pagefaults = 0;
void pagefault( struct proc *pr,
struct exception_frame * frame,
#define ICW4_PC_AEOI_SLAVE 0x0B /* not SFNM, buffered, auto EOI, 8086 */
#define ICW4_PC_AEOI_MASTER 0x0F /* not SFNM, buffered, auto EOI, 8086 */
+/*===========================================================================*
+ * intr_disabled *
+ *===========================================================================*/
+PRIVATE int intr_disabled(void)
+{
+ if(!(read_cpu_flags() & X86_FLAG_I))
+ return 1;
+ return 0;
+}
+
/*===========================================================================*
* intr_init *
*===========================================================================*/
return OK;
}
-/*===========================================================================*
- * intr_disabled *
- *===========================================================================*/
-PUBLIC int intr_disabled(void)
-{
- if(!(read_cpu_flags() & X86_FLAG_I))
- return 1;
- return 0;
-}
-
PUBLIC void irq_8259_unmask(const int irq)
{
const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK;
#define BREAKPOINT_FLAG_MODE_LOCAL (1 << 4)
#define BREAKPOINT_FLAG_MODE_GLOBAL (2 << 4)
-_PROTOTYPE(int breakpoint_set, (phys_bytes linaddr, int index, int flags));
-
/* functions defined in architecture-independent kernel source. */
#include "kernel/proto.h"
EXTERN u32_t system_hz; /* HZ value */
/* Miscellaneous. */
-EXTERN reg_t mon_ss, mon_sp; /* boot monitor stack */
+EXTERN reg_t mon_sp; /* boot monitor stack */
EXTERN int mon_return; /* true if we can return to monitor */
EXTERN int do_serial_debug;
EXTERN time_t boottime;
EXTERN char params_buffer[512]; /* boot monitor parameters */
EXTERN int minix_panicing;
-EXTERN int locklevel;
EXTERN char fpu_presence;
EXTERN char osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
EXTERN int verboseboot; /* verbose boot, init'ed in cstart */
#include "hw_intr.h"
/* number of lists of IRQ hooks, one list per supported line. */
-PUBLIC irq_hook_t* irq_handlers[NR_IRQ_VECTORS] = {0};
+PRIVATE irq_hook_t* irq_handlers[NR_IRQ_VECTORS] = {0};
+
/*===========================================================================*
* put_irq_handler *
*===========================================================================*/
/*===========================================================================*
* main *
*===========================================================================*/
-PUBLIC void main()
+PUBLIC void main(void)
{
/* Start the ball rolling. */
struct boot_image *ip; /* boot image pointer */
umap_local(proc_addr(proc_nr), D, (vir_addr), (bytes))
_PROTOTYPE( phys_bytes umap_grant, (struct proc *, cp_grant_id_t, vir_bytes));
_PROTOTYPE( void clear_endpoint, (struct proc *rc) );
-_PROTOTYPE( void clear_ipc, (struct proc *rc) );
_PROTOTYPE( void clear_ipc_refs, (struct proc *rc, int caller_ret) );
_PROTOTYPE( phys_bytes umap_bios, (vir_bytes vir_addr, vir_bytes bytes));
_PROTOTYPE( void kernel_call_resume, (struct proc *p));
_PROTOTYPE( void vm_init, (struct proc *first) );
_PROTOTYPE( phys_bytes umap_local, (register struct proc *rp, int seg,
vir_bytes vir_addr, vir_bytes bytes));
-_PROTOTYPE( void cp_mess, (int src,phys_clicks src_clicks,
- vir_bytes src_offset, phys_clicks dst_clicks, vir_bytes dst_offset));
_PROTOTYPE( phys_bytes umap_remote, (const struct proc* rp, int seg,
vir_bytes vir_addr, vir_bytes bytes) );
_PROTOTYPE( phys_bytes umap_virtual, (struct proc* rp,
_PROTOTYPE( vir_bytes alloc_remote_segment, (u32_t *, segframe_t *,
int, phys_bytes, vir_bytes, int));
_PROTOTYPE( int intr_init, (int, int) );
-_PROTOTYPE( int intr_disabled, (void) );
_PROTOTYPE( void halt_cpu, (void) );
_PROTOTYPE( void arch_init, (void) );
_PROTOTYPE( void ser_putc, (char) );
* because the dummy is declared extern. If an illegal call is given, the
* array size will be negative and this won't compile.
*/
-PUBLIC int (*call_vec[NR_SYS_CALLS])(struct proc * caller, message *m_ptr);
-char *callnames[NR_SYS_CALLS];
+PRIVATE int (*call_vec[NR_SYS_CALLS])(struct proc * caller, message *m_ptr);
+PRIVATE char *callnames[NR_SYS_CALLS];
#define map(call_nr, handler) \
{extern int dummy[NR_SYS_CALLS>(unsigned)(call_nr-KERNEL_CALL) ? 1:-1];} \
return ret;
}
-/*===========================================================================*
- * clear_endpoint *
- *===========================================================================*/
-PUBLIC void clear_endpoint(rc)
-register struct proc *rc; /* slot of process to clean up */
-{
- if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint);
-
- /* Make sure that the exiting process is no longer scheduled. */
- RTS_SET(rc, RTS_NO_ENDPOINT);
- if (priv(rc)->s_flags & SYS_PROC)
- {
- priv(rc)->s_asynsize= 0;
- }
-
- /* If the process happens to be queued trying to send a
- * message, then it must be removed from the message queues.
- */
- clear_ipc(rc);
-
- /* Likewise, if another process was sending or receive a message to or from
- * the exiting process, it must be alerted that process no longer is alive.
- * Check all processes.
- */
- clear_ipc_refs(rc, EDEADSRCDST);
-
-}
-
/*===========================================================================*
* clear_ipc *
*===========================================================================*/
-PUBLIC void clear_ipc(rc)
-register struct proc *rc; /* slot of process to clean up */
+PRIVATE void clear_ipc(
+ register struct proc *rc /* slot of process to clean up */
+)
{
/* Clear IPC data for a given process slot. */
struct proc **xpp; /* iterate over caller queue */
rc->p_rts_flags &= ~RTS_RECEIVING;
}
+/*===========================================================================*
+ * clear_endpoint *
+ *===========================================================================*/
+PUBLIC void clear_endpoint(rc)
+register struct proc *rc; /* slot of process to clean up */
+{
+ if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint);
+
+ /* Make sure that the exiting process is no longer scheduled. */
+ RTS_SET(rc, RTS_NO_ENDPOINT);
+ if (priv(rc)->s_flags & SYS_PROC)
+ {
+ priv(rc)->s_asynsize= 0;
+ }
+
+ /* If the process happens to be queued trying to send a
+ * message, then it must be removed from the message queues.
+ */
+ clear_ipc(rc);
+
+ /* Likewise, if another process was sending or receive a message to or from
+ * the exiting process, it must be alerted that process no longer is alive.
+ * Check all processes.
+ */
+ clear_ipc_refs(rc, EDEADSRCDST);
+
+}
+
/*===========================================================================*
* clear_ipc_refs *
*===========================================================================*/
#include "watchdog.h"
-unsigned watchdog_local_timer_ticks;
+unsigned watchdog_local_timer_ticks = 0U;
struct arch_watchdog *watchdog;
int watchdog_enabled;