Kernel: convert K&R functions to ANSI

Changed all K&R style functions to ANSI-style declarations within the
kernel directory. The code compiles and aparently works for i386. For
arm my toolchain does not work, but I have changed the code with great
care. Also, the make command fails for the test suite. Therefore, I
strongly recommand to review the code with care.

Edited by David van Moolenbroek to convert really all K&R functions.

Change-Id: I58cde797d36f4caa9c72db4e4dc27d8545ab8866
This commit is contained in:
Dr. Florian Grätz 2015-11-05 15:39:38 +01:00 committed by Lionel Sambuc
parent d8c1e15ae6
commit 6077d1ad24
30 changed files with 138 additions and 128 deletions

View File

@ -32,9 +32,10 @@ static void set_ttbr(struct proc *p, u32_t ttbr, u32_t *v)
/*===========================================================================* /*===========================================================================*
* arch_do_vmctl * * arch_do_vmctl *
*===========================================================================*/ *===========================================================================*/
int arch_do_vmctl(m_ptr, p) int arch_do_vmctl(
register message *m_ptr; /* pointer to request message */ register message *m_ptr, /* pointer to request message */
struct proc *p; struct proc *p
)
{ {
switch(m_ptr->SVMCTL_PARAM) { switch(m_ptr->SVMCTL_PARAM) {
case VMCTL_GET_PDBR: case VMCTL_GET_PDBR:

View File

@ -134,7 +134,7 @@ void arch_init(void)
/*===========================================================================* /*===========================================================================*
* do_ser_debug * * do_ser_debug *
*===========================================================================*/ *===========================================================================*/
void do_ser_debug() void do_ser_debug(void)
{ {
} }

View File

@ -2,6 +2,6 @@
#define _BSP_INIT_H_ #define _BSP_INIT_H_
/* BSP init */ /* BSP init */
void bsp_init(); void bsp_init(void);
#endif /* __BSP_INIT_H__ */ #endif /* __BSP_INIT_H__ */

View File

@ -1,6 +1,7 @@
#ifndef _BSP_SERIAL_H_ #ifndef _BSP_SERIAL_H_
#define _BSP_SERIAL_H_ #define _BSP_SERIAL_H_
void bsp_ser_init(); void bsp_ser_init(void);
void bsp_ser_putc(char c); void bsp_ser_putc(char c);
#endif /* _BSP_SERIAL_H_ */ #endif /* _BSP_SERIAL_H_ */

View File

@ -5,8 +5,9 @@
#include "bsp_reset.h" #include "bsp_reset.h"
void void
bsp_init() bsp_init(void)
{ {
/* map memory for padconf */ /* map memory for padconf */
bsp_padconf_init(); bsp_padconf_init();

View File

@ -43,7 +43,7 @@ static kern_phys_map serial_phys_map;
* in high memory so keep in mind there are two copies of this code in the kernel. * in high memory so keep in mind there are two copies of this code in the kernel.
*/ */
void void
bsp_ser_init() bsp_ser_init(void)
{ {
if (BOARD_IS_BBXM(machine.board_id)) { if (BOARD_IS_BBXM(machine.board_id)) {
omap_serial.base = OMAP3_DM37XX_DEBUG_UART_BASE; omap_serial.base = OMAP3_DM37XX_DEBUG_UART_BASE;

View File

@ -19,7 +19,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
void omap3_ser_init(); void omap3_ser_init(void);
void omap3_ser_putc(char c); void omap3_ser_putc(char c);
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */

View File

@ -258,7 +258,7 @@ omap3_frclock_init(void)
} }
void void
omap3_frclock_stop() omap3_frclock_stop(void)
{ {
mmio_clear(fr_timer->base + fr_timer->regs->TCLR, OMAP3_TCLR_ST); mmio_clear(fr_timer->base + fr_timer->regs->TCLR, OMAP3_TCLR_ST);
} }
@ -328,7 +328,7 @@ bsp_timer_init(unsigned freq)
} }
void void
bsp_timer_stop() bsp_timer_stop(void)
{ {
mmio_clear(timer->base + timer->regs->TCLR, OMAP3_TCLR_ST); mmio_clear(timer->base + timer->regs->TCLR, OMAP3_TCLR_ST);
} }
@ -369,7 +369,7 @@ frc_overflow_check(u32_t cur_frc)
} }
void void
bsp_timer_int_handler() bsp_timer_int_handler(void)
{ {
/* Clear all interrupts */ /* Clear all interrupts */
u32_t tisr, now; u32_t tisr, now;

View File

@ -13,4 +13,4 @@ void hw_intr_unmask(int irq){
void hw_intr_ack(int irq){}; void hw_intr_ack(int irq){};
void hw_intr_used(int irq){}; void hw_intr_used(int irq){};
void hw_intr_not_used(int irq){}; void hw_intr_not_used(int irq){};
void hw_intr_disable_all(){}; void hw_intr_disable_all(void){};

View File

@ -115,7 +115,7 @@ int kern_phys_map_ptr( phys_bytes base_address, vir_bytes io_size,
int vm_flags, kern_phys_map * priv, int vm_flags, kern_phys_map * priv,
vir_bytes ptr); vir_bytes ptr);
void arch_ser_init(); void arch_ser_init(void);
/* functions defined in architecture-independent kernel source. */ /* functions defined in architecture-independent kernel source. */
#include "kernel/proto.h" #include "kernel/proto.h"

View File

@ -44,7 +44,7 @@ static inline void barrier(void)
/* Read CLIDR, Cache Level ID Register */ /* Read CLIDR, Cache Level ID Register */
static inline u32_t read_clidr(){ static inline u32_t read_clidr(void){
u32_t clidr; u32_t clidr;
asm volatile("mrc p15, 1, %[clidr], c0, c0 , 1 @ READ CLIDR\n\t" asm volatile("mrc p15, 1, %[clidr], c0, c0 , 1 @ READ CLIDR\n\t"
: [clidr] "=r" (clidr)); : [clidr] "=r" (clidr));
@ -53,7 +53,7 @@ static inline u32_t read_clidr(){
/* Read CSSELR, Cache Size Selection Register */ /* Read CSSELR, Cache Size Selection Register */
static inline u32_t read_csselr(){ static inline u32_t read_csselr(void){
u32_t csselr; u32_t csselr;
asm volatile("mrc p15, 2, %[csselr], c0, c0 , 0 @ READ CSSELR\n\t" asm volatile("mrc p15, 2, %[csselr], c0, c0 , 0 @ READ CSSELR\n\t"
: [csselr] "=r" (csselr)); : [csselr] "=r" (csselr));
@ -67,7 +67,7 @@ static inline void write_csselr(u32_t csselr){
} }
/* Read Cache Size ID Register */ /* Read Cache Size ID Register */
static inline u32_t read_ccsidr() static inline u32_t read_ccsidr(void)
{ {
u32_t ccsidr; u32_t ccsidr;
asm volatile("mrc p15, 1, %[ccsidr], c0, c0, 0 @ Read CCSIDR\n\t" asm volatile("mrc p15, 1, %[ccsidr], c0, c0, 0 @ Read CCSIDR\n\t"
@ -76,7 +76,7 @@ static inline u32_t read_ccsidr()
} }
/* Read TLBTR, TLB Type Register */ /* Read TLBTR, TLB Type Register */
static inline u32_t read_tlbtr() static inline u32_t read_tlbtr(void)
{ {
u32_t tlbtr; u32_t tlbtr;
asm volatile("mrc p15, 0, %[tlbtr], c0, c0, 3 @ Read TLBTR\n\t" asm volatile("mrc p15, 0, %[tlbtr], c0, c0, 3 @ Read TLBTR\n\t"
@ -152,10 +152,10 @@ static inline void dcache_maint(int type){
isb(); isb();
} }
static inline void dcache_clean(){ static inline void dcache_clean(void){
dcache_maint(1); dcache_maint(1);
} }
static inline void dcache_invalidate (){ static inline void dcache_invalidate(void){
dcache_maint(2); dcache_maint(2);
} }
@ -189,7 +189,7 @@ static inline void refresh_tlb(void)
/* Read System Control Register */ /* Read System Control Register */
static inline u32_t read_sctlr() static inline u32_t read_sctlr(void)
{ {
u32_t ctl; u32_t ctl;
@ -208,7 +208,7 @@ static inline void write_sctlr(u32_t ctl)
} }
/* Read Translation Table Base Register 0 */ /* Read Translation Table Base Register 0 */
static inline u32_t read_ttbr0() static inline u32_t read_ttbr0(void)
{ {
u32_t bar; u32_t bar;
@ -241,7 +241,7 @@ static inline void reload_ttbr0(void)
} }
/* Read Translation Table Base Register 1 */ /* Read Translation Table Base Register 1 */
static inline u32_t read_ttbr1() static inline u32_t read_ttbr1(void)
{ {
u32_t bar; u32_t bar;
@ -271,7 +271,7 @@ static inline void reload_ttbr1(void)
} }
/* Read Translation Table Base Control Register */ /* Read Translation Table Base Control Register */
static inline u32_t read_ttbcr() static inline u32_t read_ttbcr(void)
{ {
u32_t bcr; u32_t bcr;
@ -291,7 +291,7 @@ static inline void write_ttbcr(u32_t bcr)
} }
/* Read Domain Access Control Register */ /* Read Domain Access Control Register */
static inline u32_t read_dacr() static inline u32_t read_dacr(void)
{ {
u32_t dacr; u32_t dacr;
@ -311,7 +311,7 @@ static inline void write_dacr(u32_t dacr)
} }
/* Read Data Fault Status Register */ /* Read Data Fault Status Register */
static inline u32_t read_dfsr() static inline u32_t read_dfsr(void)
{ {
u32_t fsr; u32_t fsr;
@ -331,7 +331,7 @@ static inline void write_dfsr(u32_t fsr)
} }
/* Read Instruction Fault Status Register */ /* Read Instruction Fault Status Register */
static inline u32_t read_ifsr() static inline u32_t read_ifsr(void)
{ {
u32_t fsr; u32_t fsr;
@ -351,7 +351,7 @@ static inline void write_ifsr(u32_t fsr)
} }
/* Read Data Fault Address Register */ /* Read Data Fault Address Register */
static inline u32_t read_dfar() static inline u32_t read_dfar(void)
{ {
u32_t far; u32_t far;
@ -371,7 +371,7 @@ static inline void write_dfar(u32_t far)
} }
/* Read Instruction Fault Address Register */ /* Read Instruction Fault Address Register */
static inline u32_t read_ifar() static inline u32_t read_ifar(void)
{ {
u32_t far; u32_t far;
@ -391,7 +391,7 @@ static inline void write_ifar(u32_t far)
} }
/* Read Vector Base Address Register */ /* Read Vector Base Address Register */
static inline u32_t read_vbar() static inline u32_t read_vbar(void)
{ {
u32_t vbar; u32_t vbar;
@ -411,7 +411,7 @@ static inline void write_vbar(u32_t vbar)
} }
/* Read the Main ID Register */ /* Read the Main ID Register */
static inline u32_t read_midr() static inline u32_t read_midr(void)
{ {
u32_t id; u32_t id;
@ -422,7 +422,7 @@ static inline u32_t read_midr()
} }
/* Read Auxiliary Control Register */ /* Read Auxiliary Control Register */
static inline u32_t read_actlr() static inline u32_t read_actlr(void)
{ {
u32_t ctl; u32_t ctl;
@ -443,7 +443,7 @@ static inline void write_actlr(u32_t ctl)
} }
/* Read Current Program Status Register */ /* Read Current Program Status Register */
static inline u32_t read_cpsr() static inline u32_t read_cpsr(void)
{ {
u32_t status; u32_t status;

View File

@ -10,6 +10,6 @@ void hw_intr_unmask(int irq);
void hw_intr_ack(int irq); void hw_intr_ack(int irq);
void hw_intr_used(int irq); void hw_intr_used(int irq);
void hw_intr_not_used(int irq); void hw_intr_not_used(int irq);
void hw_intr_disable_all(); void hw_intr_disable_all(void);
#endif /* __HW_INTR_ARM_H__ */ #endif /* __HW_INTR_ARM_H__ */

View File

@ -252,11 +252,12 @@ static u32_t phys_get32(phys_bytes addr)
/*===========================================================================* /*===========================================================================*
* umap_virtual * * umap_virtual *
*===========================================================================*/ *===========================================================================*/
phys_bytes umap_virtual(rp, seg, vir_addr, bytes) phys_bytes umap_virtual(
register struct proc *rp; /* pointer to proc table entry for process */ register struct proc *rp, /* pointer to proc table entry for process */
int seg; /* T, D, or S segment */ int seg, /* T, D, or S segment */
vir_bytes vir_addr; /* virtual address in bytes within the seg */ vir_bytes vir_addr, /* virtual address in bytes within the seg */
vir_bytes bytes; /* # of bytes to be copied */ vir_bytes bytes /* # of bytes to be copied */
)
{ {
phys_bytes phys = 0; phys_bytes phys = 0;
@ -489,12 +490,13 @@ int vm_memset(struct proc* caller, endpoint_t who, phys_bytes ph, int c,
/*===========================================================================* /*===========================================================================*
* virtual_copy_f * * virtual_copy_f *
*===========================================================================*/ *===========================================================================*/
int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck) int virtual_copy_f(
struct proc * caller; struct proc * caller,
struct vir_addr *src_addr; /* source virtual address */ struct vir_addr *src_addr, /* source virtual address */
struct vir_addr *dst_addr; /* destination virtual address */ struct vir_addr *dst_addr, /* destination virtual address */
vir_bytes bytes; /* # of bytes to copy */ vir_bytes bytes, /* # of bytes to copy */
int vmcheck; /* if nonzero, can return VMSUSPEND */ int vmcheck /* if nonzero, can return VMSUSPEND */
)
{ {
/* Copy bytes from virtual address src_addr to virtual address dst_addr. */ /* Copy bytes from virtual address src_addr to virtual address dst_addr. */
struct vir_addr *vir_addr[2]; /* virtual source and destination address */ struct vir_addr *vir_addr[2]; /* virtual source and destination address */

View File

@ -240,7 +240,7 @@ void vm_enable_paging(void)
write_sctlr(sctlr); write_sctlr(sctlr);
} }
phys_bytes pg_load() phys_bytes pg_load(void)
{ {
phys_bytes phpagedir = vir2phys(pagedir); phys_bytes phpagedir = vir2phys(pagedir);
write_ttbr0(phpagedir); write_ttbr0(phpagedir);

View File

@ -74,7 +74,7 @@ multiboot_module_t *bootmod(int pnr)
int booting_cpu = 0; int booting_cpu = 0;
void prot_init() void prot_init(void)
{ {
/* tell the HW where we stored our vector table */ /* tell the HW where we stored our vector table */
write_vbar((reg_t)&exc_vector_table); write_vbar((reg_t)&exc_vector_table);

View File

@ -36,9 +36,10 @@ static void setcr3(struct proc *p, u32_t cr3, u32_t *v)
/*===========================================================================* /*===========================================================================*
* arch_do_vmctl * * arch_do_vmctl *
*===========================================================================*/ *===========================================================================*/
int arch_do_vmctl(m_ptr, p) int arch_do_vmctl(
register message *m_ptr; /* pointer to request message */ register message *m_ptr, /* pointer to request message */
struct proc *p; struct proc *p
)
{ {
switch(m_ptr->SVMCTL_PARAM) { switch(m_ptr->SVMCTL_PARAM) {
case VMCTL_GET_PDBR: case VMCTL_GET_PDBR:

View File

@ -286,7 +286,7 @@ void arch_init(void)
/*===========================================================================* /*===========================================================================*
* do_ser_debug * * do_ser_debug *
*===========================================================================*/ *===========================================================================*/
void do_ser_debug() void do_ser_debug(void)
{ {
u8_t c, lsr; u8_t c, lsr;
@ -421,7 +421,7 @@ static void ser_debug(const int c)
#if DEBUG_SERIAL #if DEBUG_SERIAL
static void ser_dump_vfs() static void ser_dump_vfs(void)
{ {
/* Notify VFS it has to generate stack traces. Kernel can't do that as /* Notify VFS it has to generate stack traces. Kernel can't do that as
* it's not aware of user space threads. * it's not aware of user space threads.

View File

@ -280,11 +280,12 @@ static char *cr4_str(u32_t e)
/*===========================================================================* /*===========================================================================*
* umap_virtual * * umap_virtual *
*===========================================================================*/ *===========================================================================*/
phys_bytes umap_virtual(rp, seg, vir_addr, bytes) phys_bytes umap_virtual(
register struct proc *rp; /* pointer to proc table entry for process */ register struct proc *rp, /* pointer to proc table entry for process */
int seg; /* T, D, or S segment */ int seg, /* T, D, or S segment */
vir_bytes vir_addr; /* virtual address in bytes within the seg */ vir_bytes vir_addr, /* virtual address in bytes within the seg */
vir_bytes bytes; /* # of bytes to be copied */ vir_bytes bytes /* # of bytes to be copied */
)
{ {
phys_bytes phys = 0; phys_bytes phys = 0;
@ -589,12 +590,13 @@ int vm_memset(struct proc* caller, endpoint_t who, phys_bytes ph, int c,
/*===========================================================================* /*===========================================================================*
* virtual_copy_f * * virtual_copy_f *
*===========================================================================*/ *===========================================================================*/
int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck) int virtual_copy_f(
struct proc * caller; struct proc * caller,
struct vir_addr *src_addr; /* source virtual address */ struct vir_addr *src_addr, /* source virtual address */
struct vir_addr *dst_addr; /* destination virtual address */ struct vir_addr *dst_addr, /* destination virtual address */
vir_bytes bytes; /* # of bytes to copy */ vir_bytes bytes, /* # of bytes to copy */
int vmcheck; /* if nonzero, can return VMSUSPEND */ int vmcheck /* if nonzero, can return VMSUSPEND */
)
{ {
/* Copy bytes from virtual address src_addr to virtual address dst_addr. */ /* Copy bytes from virtual address src_addr to virtual address dst_addr. */
struct vir_addr *vir_addr[2]; /* virtual source and destination address */ struct vir_addr *vir_addr[2]; /* virtual source and destination address */

View File

@ -239,7 +239,7 @@ void vm_enable_paging(void)
write_cr4(cr4); write_cr4(cr4);
} }
phys_bytes pg_load() phys_bytes pg_load(void)
{ {
phys_bytes phpagedir = vir2phys(pagedir); phys_bytes phpagedir = vir2phys(pagedir);
write_cr3(phpagedir); write_cr3(phpagedir);

View File

@ -320,7 +320,7 @@ void prot_load_selectors(void)
/*===========================================================================* /*===========================================================================*
* prot_init * * prot_init *
*===========================================================================*/ *===========================================================================*/
void prot_init() void prot_init(void)
{ {
extern char k_boot_stktop; extern char k_boot_stktop;

View File

@ -227,10 +227,11 @@ time_t get_boottime(void)
/*===========================================================================* /*===========================================================================*
* set_kernel_timer * * set_kernel_timer *
*===========================================================================*/ *===========================================================================*/
void set_kernel_timer(tp, exp_time, watchdog) void set_kernel_timer(
minix_timer_t *tp; /* pointer to timer structure */ minix_timer_t *tp, /* pointer to timer structure */
clock_t exp_time; /* expiration monotonic time */ clock_t exp_time, /* expiration monotonic time */
tmr_func_t watchdog; /* watchdog to be called */ tmr_func_t watchdog /* watchdog to be called */
)
{ {
/* Insert the new timer in the active timers list. Always update the /* Insert the new timer in the active timers list. Always update the
* next timeout time by setting it to the front of the active list. * next timeout time by setting it to the front of the active list.
@ -242,8 +243,9 @@ tmr_func_t watchdog; /* watchdog to be called */
/*===========================================================================* /*===========================================================================*
* reset_kernel_timer * * reset_kernel_timer *
*===========================================================================*/ *===========================================================================*/
void reset_kernel_timer(tp) void reset_kernel_timer(
minix_timer_t *tp; /* pointer to timer structure */ minix_timer_t *tp /* pointer to timer structure */
)
{ {
/* The timer pointed to by 'tp' is no longer needed. Remove it from both the /* The timer pointed to by 'tp' is no longer needed. Remove it from both the
* active and expired lists. Always update the next timeout time by setting * active and expired lists. Always update the next timeout time by setting

View File

@ -403,7 +403,7 @@ void minix_shutdown(minix_timer_t *tp)
/*===========================================================================* /*===========================================================================*
* cstart * * cstart *
*===========================================================================*/ *===========================================================================*/
void cstart() void cstart(void)
{ {
/* Perform system initializations prior to calling main(). Most settings are /* Perform system initializations prior to calling main(). Most settings are
* determined with help of the environment strings passed by MINIX' loader. * determined with help of the environment strings passed by MINIX' loader.

View File

@ -703,10 +703,11 @@ int do_ipc(reg_t r1, reg_t r2, reg_t r3)
/*===========================================================================* /*===========================================================================*
* deadlock * * deadlock *
*===========================================================================*/ *===========================================================================*/
static int deadlock(function, cp, src_dst_e) static int deadlock(
int function; /* trap number */ int function, /* trap number */
register struct proc *cp; /* pointer to caller */ register struct proc *cp, /* pointer to caller */
endpoint_t src_dst_e; /* src or dst process */ endpoint_t src_dst_e /* src or dst process */
)
{ {
/* Check for deadlock. This can happen if 'caller_ptr' and 'src_dst' have /* Check for deadlock. This can happen if 'caller_ptr' and 'src_dst' have
* a cyclic dependency of blocking send and receive calls. The only cyclic * a cyclic dependency of blocking send and receive calls. The only cyclic
@ -1347,8 +1348,7 @@ static int mini_senda(struct proc *caller_ptr, asynmsg_t *table, size_t size)
/*===========================================================================* /*===========================================================================*
* try_async * * try_async *
*===========================================================================*/ *===========================================================================*/
static int try_async(caller_ptr) static int try_async(struct proc * caller_ptr)
struct proc *caller_ptr;
{ {
int r; int r;
struct priv *privp; struct priv *privp;
@ -1831,15 +1831,11 @@ struct proc *endpoint_lookup(endpoint_t e)
* isokendpt_f * * isokendpt_f *
*===========================================================================*/ *===========================================================================*/
#if DEBUG_ENABLE_IPC_WARNINGS #if DEBUG_ENABLE_IPC_WARNINGS
int isokendpt_f(file, line, e, p, fatalflag) int isokendpt_f(const char * file, int line, endpoint_t e, int * p,
const char *file; const int fatalflag)
int line;
#else #else
int isokendpt_f(e, p, fatalflag) int isokendpt_f(endpoint_t e, int * p, const int fatalflag)
#endif #endif
endpoint_t e;
int *p;
const int fatalflag;
{ {
int ok = 0; int ok = 0;
/* Convert an endpoint number into a process number. /* Convert an endpoint number into a process number.
@ -1974,7 +1970,7 @@ void release_fpu(struct proc * p) {
*fpu_owner_ptr = NULL; *fpu_owner_ptr = NULL;
} }
void ser_dump_proc() void ser_dump_proc(void)
{ {
struct proc *pp; struct proc *pp;

View File

@ -44,7 +44,7 @@ void init_profile_clock(u32_t freq)
/*===========================================================================* /*===========================================================================*
* profile_clock_stop * * profile_clock_stop *
*===========================================================================*/ *===========================================================================*/
void stop_profile_clock() void stop_profile_clock(void)
{ {
arch_stop_profile_clock(); arch_stop_profile_clock();

View File

@ -89,7 +89,7 @@ int try_deliver_senda(struct proc *caller_ptr, asynmsg_t *table, size_t
size); size);
/* start.c */ /* start.c */
void cstart(); void cstart(void);
char *env_get(const char *key); char *env_get(const char *key);
/* system.c */ /* system.c */
@ -169,8 +169,8 @@ void stop_profile_clock(void);
#endif #endif
/* functions defined in architecture-dependent files. */ /* functions defined in architecture-dependent files. */
void prot_init(); void prot_init(void);
void arch_post_init(); void arch_post_init(void);
void arch_set_secondary_ipc_return(struct proc *, u32_t val); void arch_set_secondary_ipc_return(struct proc *, u32_t val);
phys_bytes phys_copy(phys_bytes source, phys_bytes dest, phys_bytes phys_bytes phys_copy(phys_bytes source, phys_bytes dest, phys_bytes
count); count);

View File

@ -272,9 +272,10 @@ void system_init(void)
/*===========================================================================* /*===========================================================================*
* get_priv * * get_priv *
*===========================================================================*/ *===========================================================================*/
int get_priv(rc, priv_id) int get_priv(
register struct proc *rc; /* new (child) process pointer */ register struct proc *rc, /* new (child) process pointer */
int priv_id; /* privilege id */ int priv_id /* privilege id */
)
{ {
/* Allocate a new privilege structure for a system process. Privilege ids /* Allocate a new privilege structure for a system process. Privilege ids
* can be assigned either statically or dynamically. * can be assigned either statically or dynamically.
@ -386,11 +387,10 @@ int send_sig(endpoint_t ep, int sig_nr)
/*===========================================================================* /*===========================================================================*
* cause_sig * * cause_sig *
*===========================================================================*/ *===========================================================================*/
void cause_sig(proc_nr, sig_nr) void cause_sig(proc_nr_t proc_nr, int sig_nr)
proc_nr_t proc_nr; /* process to be signalled */
int sig_nr; /* signal to be sent */
{ {
/* A system process wants to send a signal to a process. Examples are: /* A system process wants to send signal 'sig_nr' to process 'proc_nr'.
* Examples are:
* - HARDWARE wanting to cause a SIGSEGV after a CPU exception * - HARDWARE wanting to cause a SIGSEGV after a CPU exception
* - TTY wanting to cause SIGINT upon getting a DEL * - TTY wanting to cause SIGINT upon getting a DEL
* - FS wanting to cause SIGPIPE for a broken pipe * - FS wanting to cause SIGPIPE for a broken pipe
@ -538,9 +538,9 @@ static void clear_ipc(
/*===========================================================================* /*===========================================================================*
* clear_endpoint * * clear_endpoint *
*===========================================================================*/ *===========================================================================*/
void clear_endpoint(rc) void clear_endpoint(struct proc * rc)
register struct proc *rc; /* slot of process to clean up */
{ {
/* Clean up the slot of the process given as 'rc'. */
if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint); if(isemptyp(rc)) panic("clear_proc: empty process: %d", rc->p_endpoint);
@ -575,9 +575,10 @@ register struct proc *rc; /* slot of process to clean up */
/*===========================================================================* /*===========================================================================*
* clear_ipc_refs * * clear_ipc_refs *
*===========================================================================*/ *===========================================================================*/
void clear_ipc_refs(rc, caller_ret) void clear_ipc_refs(
register struct proc *rc; /* slot of process to clean up */ register struct proc *rc, /* slot of process to clean up */
int caller_ret; /* code to return on callers */ int caller_ret /* code to return on callers */
)
{ {
/* Clear IPC references for a given process slot. */ /* Clear IPC references for a given process slot. */
struct proc *rp; /* iterate over process table */ struct proc *rp; /* iterate over process table */

View File

@ -141,8 +141,7 @@ int do_irqctl(struct proc * caller, message * m_ptr)
/*===========================================================================* /*===========================================================================*
* generic_handler * * generic_handler *
*===========================================================================*/ *===========================================================================*/
static int generic_handler(hook) static int generic_handler(irq_hook_t * hook)
irq_hook_t *hook;
{ {
/* This function handles hardware interrupt in a simple and generic way. All /* This function handles hardware interrupt in a simple and generic way. All
* interrupts are transformed into messages to a driver. The IRQ line will be * interrupts are transformed into messages to a driver. The IRQ line will be

View File

@ -32,16 +32,17 @@ static int safecopy(struct proc *, endpoint_t, endpoint_t,
/*===========================================================================* /*===========================================================================*
* verify_grant * * verify_grant *
*===========================================================================*/ *===========================================================================*/
int verify_grant(granter, grantee, grant, bytes, access, int verify_grant(
offset_in, offset_result, e_granter, flags) endpoint_t granter, /* copyee */
endpoint_t granter, grantee; /* copyee, copyer */ endpoint_t grantee, /* copyer */
cp_grant_id_t grant; /* grant id */ cp_grant_id_t grant, /* grant id */
vir_bytes bytes; /* copy size */ vir_bytes bytes, /* copy size */
int access; /* direction (read/write) */ int access, /* direction (read/write) */
vir_bytes offset_in; /* copy offset within grant */ vir_bytes offset_in, /* copy offset within grant */
vir_bytes *offset_result; /* copy offset within virtual address space */ vir_bytes *offset_result, /* copy offset within virtual address space */
endpoint_t *e_granter; /* new granter (magic grants) */ endpoint_t *e_granter, /* new granter (magic grants) */
u32_t *flags; /* CPF_* */ u32_t *flags /* CPF_* */
)
{ {
static cp_grant_t g; static cp_grant_t g;
static int proc_nr; static int proc_nr;
@ -246,16 +247,18 @@ u32_t *flags; /* CPF_* */
/*===========================================================================* /*===========================================================================*
* safecopy * * safecopy *
*===========================================================================*/ *===========================================================================*/
static int safecopy(caller, granter, grantee, grantid, bytes, static int safecopy(
g_offset, addr, access) struct proc * caller,
struct proc * caller; endpoint_t granter,
endpoint_t granter, grantee; endpoint_t grantee,
cp_grant_id_t grantid; cp_grant_id_t grantid,
size_t bytes; size_t bytes,
vir_bytes g_offset, addr; vir_bytes g_offset,
int access; /* CPF_READ for a copy from granter to grantee, CPF_WRITE vir_bytes addr,
int access /* CPF_READ for a copy from granter to grantee, CPF_WRITE
* for a copy from grantee to granter. * for a copy from grantee to granter.
*/ */
)
{ {
static struct vir_addr v_src, v_dst; static struct vir_addr v_src, v_dst;
static vir_bytes v_offset; static vir_bytes v_offset;

View File

@ -78,8 +78,7 @@ int do_vtimer(struct proc * caller, message * m_ptr)
/*===========================================================================* /*===========================================================================*
* vtimer_check * * vtimer_check *
*===========================================================================*/ *===========================================================================*/
void vtimer_check(rp) void vtimer_check(struct proc * rp)
struct proc *rp; /* pointer to the process */
{ {
/* This is called from the clock task, so we can be interrupted by the clock /* This is called from the clock task, so we can be interrupted by the clock
* interrupt, but not by the system task. Therefore we only have to protect * interrupt, but not by the system task. Therefore we only have to protect

View File

@ -51,8 +51,9 @@ void panic(const char *fmt, ...)
/*===========================================================================* /*===========================================================================*
* kputc * * kputc *
*===========================================================================*/ *===========================================================================*/
void kputc(c) void kputc(
int c; /* character to append */ int c /* character to append */
)
{ {
/* Accumulate a single character for a kernel message. Send a notification /* Accumulate a single character for a kernel message. Send a notification
* to the output drivers if an END_OF_KMESS is encountered. * to the output drivers if an END_OF_KMESS is encountered.
@ -83,8 +84,9 @@ int c; /* character to append */
/*===========================================================================* /*===========================================================================*
* _exit * * _exit *
*===========================================================================*/ *===========================================================================*/
void _exit(e) void _exit(
int e; /* error code */ int e /* error code */
)
{ {
panic("_exit called from within the kernel, should not happen. (err %i)", e); panic("_exit called from within the kernel, should not happen. (err %i)", e);
} }