Commit 2efacf83 authored by Léo Grange's avatar Léo Grange

use static inline instead of extern inline, switch to C99 by default

parent 49eb21a6
......@@ -10,7 +10,7 @@
struct process;
// extern inline void arch_kernel_contextjmp(struct _context_info *cnt)
// static inline void arch_kernel_contextjmp(struct _context_info *cnt)
// __attribute__ ((noreturn)) ;
void arch_kernel_contextjmp(struct _context_info *cnt, struct _context_info **old_cnt);
......
......@@ -33,7 +33,7 @@
// flush the TLB (set V bit of each entry to 0)
extern inline void mmu_tlbflush() {
static inline void mmu_tlbflush() {
MMU.MMUCR.BIT.TF = 1;
}
......@@ -43,20 +43,20 @@ void mmu_init();
// set the current ASID (dangerous if virtual memory is used consecutivly!)
extern inline void mmu_setasid(unsigned char asid) {
static inline void mmu_setasid(unsigned char asid) {
MMU.PTEH.BIT.ASID = asid;
}
// get the current ASID
extern inline unsigned char mmu_getasid() {
static inline unsigned char mmu_getasid() {
return MMU.PTEH.BIT.ASID;
}
// fill and load a TLB entry in PTEL without change informations in PTEH
// (after a TLB miss, PTEH should be valid if the page is allowed)
// PPN must be given like a 1K page number (even for 4K page!)
extern inline void mmu_tlb_fillload(unsigned int ppn, unsigned short flags) {
static inline void mmu_tlb_fillload(unsigned int ppn, unsigned short flags) {
MMU.PTEL.LONG = (ppn << 10) | flags;
__asm__ volatile ("ldtlb":::"memory" );
}
......
......@@ -29,7 +29,7 @@ void vfs_file_init();
* Allocate a new file structure.
* Returns NULL if allocation can't be done.
*/
extern inline struct file *vfs_file_alloc() {
static inline struct file *vfs_file_alloc() {
return pool_alloc(&_vfs_file_palloc);
}
......@@ -37,7 +37,7 @@ extern inline struct file *vfs_file_alloc() {
/**
* Free an allocated file structure.
*/
extern inline void vfs_file_free(struct file *filep) {
static inline void vfs_file_free(struct file *filep) {
pool_free(&_vfs_file_palloc, filep);
}
......
......@@ -14,5 +14,5 @@ G1A_WRAPPER:=c_g1awrapper
# global tool options
CFLAGS:=-g -Wall -m3 -mb -Os -fno-builtin $(CFLAGS)
CFLAGS:=-g -std=c99 -Wall -m3 -mb -Os -fno-builtin $(CFLAGS)
LDFLAGS:=-nostdlib $(LDFLAGS)
......@@ -13,27 +13,27 @@ typedef __kernel_uint32 sigset_t;
// not exactly the POSIX specification, but should be usefull :
extern inline int sigemptyset(sigset_t *set) {
static inline int sigemptyset(sigset_t *set) {
*set = 0;
return 0;
}
extern inline int sigfillset(sigset_t *set) {
static inline int sigfillset(sigset_t *set) {
*set = 0xFFFFFFFF;
return 0;
}
extern inline int sigaddset(sigset_t *set, int sig) {
static inline int sigaddset(sigset_t *set, int sig) {
*set |= (1<<sig);
return 0;
}
extern inline int sigdelset(sigset_t *set, int sig) {
static inline int sigdelset(sigset_t *set, int sig) {
*set &= ~(1<<sig);
return 0;
}
extern inline int sigismember(sigset_t *set, int sig) {
static inline int sigismember(sigset_t *set, int sig) {
return (*set & (1<<sig)) != 0;
}
......
......@@ -16,7 +16,7 @@
* call monotnick_ticks() if not needed).
* Should be called before any usage of the load data.
*/
extern inline void load_proc_update(struct process *p, clock_t cur_ticks) {
static inline void load_proc_update(struct process *p, clock_t cur_ticks) {
clock_t deltasample;
deltasample = cur_ticks/PROC_LOAD_SAMPMAX - p->load_last/PROC_LOAD_SAMPMAX;
......@@ -52,7 +52,7 @@ extern inline void load_proc_update(struct process *p, clock_t cur_ticks) {
}
extern inline void load_proc_addtick(struct process *p) {
static inline void load_proc_addtick(struct process *p) {
load_proc_update(p, time_monotonic_ticks());
p->load_cursamp++;
}
......@@ -63,7 +63,7 @@ extern inline void load_proc_addtick(struct process *p) {
* The returned value is 100 times the percent of CPU usage.
* TODO fixed point!
*/
extern inline int load_proc_average(struct process *p) {
static inline int load_proc_average(struct process *p) {
int i;
int ret;
......
......@@ -153,7 +153,7 @@ int mem_area_insert(struct process *proc, struct mem_area *area);
* range.
* The implementation specific operation is called to set the corresponding page.
*/
extern inline union pm_page mem_area_pagefault(struct mem_area *area,
static inline union pm_page mem_area_pagefault(struct mem_area *area,
void *addrfault)
{
if(area->ops != NULL && area->ops->area_pagefault != NULL) {
......@@ -170,7 +170,7 @@ extern inline union pm_page mem_area_pagefault(struct mem_area *area,
* Release, and free if necessary, the given area, after calling the
* implementation-specific release callback if any.
*/
extern inline void mem_area_release(struct mem_area *area) {
static inline void mem_area_release(struct mem_area *area) {
if(area->ops != NULL && area->ops->area_release != NULL)
area->ops->area_release(area);
mem_area_free(area);
......@@ -189,7 +189,7 @@ int mem_area_resize(struct mem_area *area, size_t new_size, struct process *proc
/**
* Duplicate an area.
*/
extern inline struct mem_area *mem_area_clone(struct mem_area *area) {
static inline struct mem_area *mem_area_clone(struct mem_area *area) {
struct mem_area *ret = mem_area_alloc();
if(ret != NULL) {
*ret = *area;
......
......@@ -176,7 +176,7 @@ void process_free(struct process *proc);
/**
* Return the running process at the time this function is called.
*/
extern inline struct process *process_get_current() {
static inline struct process *process_get_current() {
return _proc_current;
}
......
......@@ -46,7 +46,7 @@ void time_do_tick();
* Add time described in t1 and t2, and write the result in res.
* res may points to the same location as t1 or t2.
*/
extern inline void time_add_hr(const struct timespec *t1,
static inline void time_add_hr(const struct timespec *t1,
const struct timespec *t2, struct timespec *res)
{
res->tv_sec = t1->tv_sec + t2->tv_sec;
......
......@@ -94,13 +94,13 @@ struct tty_ops {
int tty_default_init(struct tty *tty);
extern inline int tty_is_ready(struct tty *tty) {
static inline int tty_is_ready(struct tty *tty) {
if(tty->ops->is_ready == NULL)
return 1;
return tty->ops->is_ready(tty);
}
extern inline int tty_write(struct tty *tty, const char *data, size_t len) {
static inline int tty_write(struct tty *tty, const char *data, size_t len) {
if(tty->ops->tty_write == NULL)
return -EIO;
return tty->ops->tty_write(tty, data, len);
......@@ -109,7 +109,7 @@ extern inline int tty_write(struct tty *tty, const char *data, size_t len) {
int tty_read(struct tty *tty, char *dest, size_t len);
extern inline int tty_getwinsize(struct tty *tty, struct winsize *size) {
static inline int tty_getwinsize(struct tty *tty, struct winsize *size) {
if(tty->ops->ioctl_getwinsize == NULL) {
size->ws_col = 80;
size->ws_row = 24;
......@@ -118,14 +118,14 @@ extern inline int tty_getwinsize(struct tty *tty, struct winsize *size) {
return tty->ops->ioctl_getwinsize(tty, size);
}
extern inline int tty_setwinsize(struct tty *tty, const struct winsize *size) {
static inline int tty_setwinsize(struct tty *tty, const struct winsize *size) {
if(tty->ops->ioctl_setwinsize == NULL)
return -EINVAL;
return tty->ops->ioctl_setwinsize(tty, size);
}
extern inline int tty_setctty(struct tty *tty, int arg) {
static inline int tty_setctty(struct tty *tty, int arg) {
(void)arg;
if(_proc_current->ctty != NULL)
return -EINVAL;
......@@ -137,7 +137,7 @@ extern inline int tty_setctty(struct tty *tty, int arg) {
}
extern inline int tty_noctty(struct tty *tty) {
static inline int tty_noctty(struct tty *tty) {
if(_proc_current->ctty != tty)
return -EINVAL;
......@@ -150,7 +150,7 @@ extern inline int tty_noctty(struct tty *tty) {
return 0;
}
extern inline int tty_setpgrp(struct tty *tty, const pid_t *pid) {
static inline int tty_setpgrp(struct tty *tty, const pid_t *pid) {
if(pid == NULL)
return -EINVAL;
......@@ -158,7 +158,7 @@ extern inline int tty_setpgrp(struct tty *tty, const pid_t *pid) {
return 0;
}
extern inline int tty_getpgrp(struct tty *tty, pid_t *pid) {
static inline int tty_getpgrp(struct tty *tty, pid_t *pid) {
if(pid == NULL)
return -EINVAL;
......@@ -166,7 +166,7 @@ extern inline int tty_getpgrp(struct tty *tty, pid_t *pid) {
return 0;
}
extern inline int tty_getsid(struct tty *tty, pid_t *sid) {
static inline int tty_getsid(struct tty *tty, pid_t *sid) {
if(sid == NULL)
return -EINVAL;
......@@ -175,7 +175,7 @@ extern inline int tty_getsid(struct tty *tty, pid_t *sid) {
}
extern inline int tty_set_termios(struct tty *tty, const struct termios *ios)
static inline int tty_set_termios(struct tty *tty, const struct termios *ios)
{
if(tty->ops->set_termios != NULL) {
return tty->ops->set_termios(tty, ios);
......@@ -205,20 +205,20 @@ int tty_input_char(struct tty *tty, char c);
* Should be as simple as possible, because it may be called from unstable
* states, as a last chance to show something to the user.
*/
extern inline int tty_force_flush(struct tty *tty) {
static inline int tty_force_flush(struct tty *tty) {
if(tty->ops->force_flush != NULL)
return tty->ops->force_flush(tty);
return -EIO;
}
extern inline int tty_open(struct tty *tty) {
static inline int tty_open(struct tty *tty) {
if(tty->ops->open != NULL)
return tty->ops->open(tty);
return 0;
}
extern inline void tty_release(struct tty *tty) {
static inline void tty_release(struct tty *tty) {
if(tty->ops->release != NULL)
tty->ops->release(tty);
}
......
......@@ -9,7 +9,7 @@
* Functions for reading/writing safely in a given process address space.
*/
extern inline uint32 user_read_32(void *addr, struct process *proc) {
static inline uint32 user_read_32(void *addr, struct process *proc) {
union pm_page *page;
page = mem_find_page(proc->dir_list, addr);
......@@ -32,7 +32,7 @@ extern inline uint32 user_read_32(void *addr, struct process *proc) {
return 0;
}
extern inline void user_write_32(void *addr, uint32 value, struct process *proc) {
static inline void user_write_32(void *addr, uint32 value, struct process *proc) {
union pm_page *page;
page = mem_find_page(proc->dir_list, addr);
......
......@@ -15,17 +15,17 @@
#define BITFIELD_STATIC(name, bits) \
uint32 name[(bits-1) / BITFIELD_BITS + 1]
extern inline int bitfield_get(const uint32 *bitfield, int bit) {
static inline int bitfield_get(const uint32 *bitfield, int bit) {
return !!(bitfield[bit/BITFIELD_BITS] & (1 << (bit%BITFIELD_BITS)) );
}
extern inline void bitfield_set(uint32 *bitfield, int bit) {
static inline void bitfield_set(uint32 *bitfield, int bit) {
bitfield[bit/BITFIELD_BITS] |= (1 << (bit%BITFIELD_BITS) );
}
extern inline void bitfield_clear(uint32 *bitfield, int bit) {
static inline void bitfield_clear(uint32 *bitfield, int bit) {
bitfield[bit/BITFIELD_BITS] &= ~(1 << (bit%BITFIELD_BITS) );
}
......@@ -33,7 +33,7 @@ extern inline void bitfield_clear(uint32 *bitfield, int bit) {
/**
* Change the given bit to the given value.
*/
extern inline void bitfield_set_value(uint32 *bitfield, int bit, int val) {
static inline void bitfield_set_value(uint32 *bitfield, int bit, int val) {
if(val)
bitfield_set(bitfield, bit);
else
......@@ -41,7 +41,7 @@ extern inline void bitfield_set_value(uint32 *bitfield, int bit, int val) {
}
extern inline void bitfield_all_clear(uint32 *bitfield, int size) {
static inline void bitfield_all_clear(uint32 *bitfield, int size) {
int i;
for(i=0; i < ((size-1) / BITFIELD_BITS + 1); i++)
bitfield[i] = 0x00000000;
......
......@@ -41,7 +41,7 @@ struct dlist_head {
list_for_each(cur, head)
extern inline void list_push_front(struct list_head *head,
static inline void list_push_front(struct list_head *head,
struct list_head *element)
{
element->next = head->next;
......@@ -49,7 +49,7 @@ extern inline void list_push_front(struct list_head *head,
}
// not possible to remove an element in O(1) in a simply linked list
extern inline void list_remove(struct list_head *head,
static inline void list_remove(struct list_head *head,
struct list_head *element)
{
struct list_head *prev;
......@@ -62,7 +62,7 @@ extern inline void list_remove(struct list_head *head,
}
extern inline void dlist_push_front(struct dlist_head *head,
static inline void dlist_push_front(struct dlist_head *head,
struct dlist_head *element)
{
element->next = head->next;
......@@ -72,7 +72,7 @@ extern inline void dlist_push_front(struct dlist_head *head,
}
extern inline void dlist_push_back(struct dlist_head *head,
static inline void dlist_push_back(struct dlist_head *head,
struct dlist_head *element)
{
element->prev = head->prev;
......@@ -82,7 +82,7 @@ extern inline void dlist_push_back(struct dlist_head *head,
}
// no need of the head of the list here
extern inline void dlist_remove(struct dlist_head *element)
static inline void dlist_remove(struct dlist_head *element)
{
element->next->prev = element->prev;
element->prev->next = element->next;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment