소스 검색

evx: modify something ugly

rain 4 년 전
부모
커밋
0ba060c629
11개의 변경된 파일과 6개의 추가작업 그리고 69개의 파일을 삭제
  1. 0 8
      init/main.c
  2. 1 7
      kernel/kmlog.c
  3. 3 18
      kernel/mempool.c
  4. 0 4
      kernel/mm.c
  5. 0 2
      kernel/page.c
  6. 0 1
      kernel/panic.c
  7. 0 3
      kernel/task.c
  8. 0 3
      kernel/tty.c
  9. 0 6
      kernel/vsprintf.c
  10. 0 4
      lib/klist.c
  11. 2 13
      modules/console.c

+ 0 - 8
init/main.c

@@ -35,10 +35,8 @@
 
 
 int init_state;
-
 static int do_init_calls(void);
 
-
 int __init init(void) {
 	init_state = STATE_INIT_CALLS;
 
@@ -48,16 +46,12 @@ int __init init(void) {
 	return 0;
 }
 
-
 void *__init_data init_call_levels[] = {
 	&_init_call_arch, &_einit_call_arch, 
 	&_init_call_kernel, &_einit_call_kernel, 
 	&_init_call_modules, &_einit_call_modules
 };
 
-
-
-
 /*
  * call hooks in those sections those defined with init_call_levels. 
  *
@@ -76,7 +70,6 @@ static int do_init_calls(void) {
 	__archptr_t *start, *end;
 	__archptr_t fn, *initcalls;
 
-	
 	for (i = 0; i < ARRAYSIZE(init_call_levels); i++) {
 		start = init_call_levels[i];
 		end = init_call_levels[++i];
@@ -98,4 +91,3 @@ static int do_init_calls(void) {
 	return 0;
 }
 
-

+ 1 - 7
kernel/kmlog.c

@@ -46,7 +46,6 @@
 char 	*kmlog_buf;
 int 	kmlog_index = 1;
 
-
 int kmlog(char *s, ...) {
 	int len, i, level;
 	char buf[512];
@@ -57,15 +56,12 @@ int kmlog(char *s, ...) {
 	va_start(args, s);
 
 	if (*s == '#') {
-		level = atoi(s[1]);
-
-		if (level < KMLOG_LEVEL) 
+		if ((level = atoi(s[1])) < KMLOG_LEVEL) 
 			return 0;
 
 		s += 2;
 	}
 
-
 	len = vsprintf(buf, s, args);
 
 	/* replace last zero */
@@ -88,5 +84,3 @@ int kmlog(char *s, ...) {
 	return 0;
 }
 
-
-

+ 3 - 18
kernel/mempool.c

@@ -42,12 +42,10 @@ static void *__early_alloc(int size) {
 	return early_kmalloc(size, 1);
 }
 
-
 static void *__pool_alloc(int size) {
 	return early_kmalloc(size, CACHE_SIZE);
 }
 
-
 struct mempool_dir mempools[] = {
 	/* you can join a structure in here too */
 
@@ -64,8 +62,6 @@ struct mempool_dir mempools[] = {
 	{ 0, NULL }
 };
 
-
-
 int early_mempool_init(void) {
 	struct mempool_dir *dir;
 
@@ -75,7 +71,6 @@ int early_mempool_init(void) {
 	return 0;
 }
 
-
 struct mempool *mempool_create(int size, void *(* alloc) (int size), void *(* pool_alloc) (int)) {
 	struct mempool *pool;
 	struct bucket_entry *e;
@@ -89,7 +84,6 @@ struct mempool *mempool_create(int size, void *(* alloc) (int size), void *(* po
 		/* this printk is not safe, as you know */
 		panic("mempool_create: Out of memory\n");
 
-
 	pool->size = size;
 
 	/* we'll not free this */
@@ -112,7 +106,6 @@ struct mempool *mempool_create(int size, void *(* alloc) (int size), void *(* po
 	return pool;
 }
 
-
 void *__mempool_alloc(struct mempool *pool) {
 	struct bucket_entry *e = pool->freeptr;
 	struct mempool *p = pool;
@@ -129,7 +122,6 @@ void *__mempool_alloc(struct mempool *pool) {
 	return (void *) e; 
 }
 
-
 int __mempool_free(struct mempool *pool, void *p) {
 	struct bucket_entry *old, *e;
 
@@ -144,8 +136,6 @@ int __mempool_free(struct mempool *pool, void *p) {
 	return 0;
 }
 
-
-
 void *kmalloc(int size) {
 	struct mempool_dir *d;
 
@@ -154,12 +144,11 @@ void *kmalloc(int size) {
 			break;
 	
 	if (!d->size) 
-		panic("WARNING: kmalloc: size is too big\n");
+		panic("kmalloc: size is too big\n");
 
 	return __mempool_alloc(d->pools);
 }
 
-
 int free_s(void *p, int size) {
 	struct mempool_dir *d;
 	struct mempool *pool;
@@ -176,16 +165,15 @@ int free_s(void *p, int size) {
 			pool = pool->next_pool;
 
 		if (!pool && size) 
-			panic("WARNING: free_s: object is not in any mempool\n");
+			panic("free_s: object is not in any mempool\n");
 	}
 
 	if (!d->size) 
-		panic("WARNING: free_s: object is not in any mempool\n");
+		panic("free_s: object is not in any mempool\n");
 
 	return __mempool_free(pool, p);
 }
 
-
 int dump_pool(struct mempool_dir *d) {
 	struct mempool *p;
 	int total;
@@ -198,8 +186,6 @@ int dump_pool(struct mempool_dir *d) {
 	return 0;
 }
 
-
-
 int kmalloc_report(void) {
 	struct mempool_dir 	*d;
 
@@ -209,4 +195,3 @@ int kmalloc_report(void) {
 	return 0;
 }
 
-

+ 0 - 4
kernel/mm.c

@@ -29,7 +29,6 @@
 
 #include <sys/types.h>
 
-
 int early_mempool_init(void);
 int pages_init(void);
 
@@ -38,7 +37,6 @@ struct page *kmem_pages;
 
 int nr_ram_pages = 0, usable_ram_pages = 0;
 
-
 int mm_init(void) {
 	early_mempool_init();
 	pages_init();
@@ -46,7 +44,5 @@ int mm_init(void) {
 	return 0;
 }
 
-
 kernel_init(mm_init);
 
-

+ 0 - 2
kernel/page.c

@@ -95,7 +95,6 @@ int __init pages_init(void) {
 	return 0;
 }
 
-
 /* NOTE that nr means number of pages but not the order. 
  * 
  * support buddy later ... */
@@ -126,4 +125,3 @@ struct page *getfreepages(int nr, int gfp_mask) {
 	return p;
 }
 
-

+ 0 - 1
kernel/panic.c

@@ -28,7 +28,6 @@
 #include <arch/asm.h>
 
 
-
 int panic(char *s) {
 	kmlog("Kernel panic: %s\n", s);
 

+ 0 - 3
kernel/task.c

@@ -44,7 +44,6 @@ struct task init_task = {
 struct task *current = &init_task;
 int next_pid = 1;
 
-
 int task_init(void) {
 	struct task *new = dup_task();
 
@@ -56,7 +55,6 @@ int task_init(void) {
 	return 0;
 }
 
-
 struct task *dup_task(void) {
 	struct task *tsk;
 
@@ -75,6 +73,5 @@ struct task *dup_task(void) {
 	return tsk;
 }
 
-
 kernel_init(task_init);
 

+ 0 - 3
kernel/tty.c

@@ -33,7 +33,6 @@
 
 struct klist_node ttys = KLIST_NODE_INIT(&ttys);
 
-
 int tty_register(struct tty *tty) {
 	struct klist_node *n = kmalloc(sizeof(struct klist_node));
 
@@ -51,7 +50,6 @@ int tty_register(struct tty *tty) {
 	return 0;
 }
 
-
 int tty_write(struct tty *tty, char *s) {
 	int err;
 
@@ -75,4 +73,3 @@ int tty_write_all(char *p) {
  	return 0;
 }
 
-

+ 0 - 6
kernel/vsprintf.c

@@ -47,7 +47,6 @@ static const char digits[] = "0123456789abcdef";
 #define ZERO		1
 #define UNSIGNED 	2
 
-
 static int number(char *buf, long x, int base, int flags, int width) {
 	int neg = 0, i = 0, j;
 	char t[PTRSIZE * 2];
@@ -72,7 +71,6 @@ static int number(char *buf, long x, int base, int flags, int width) {
 		nr /= base;
 	}
 
-
 	if (neg) 
 		t[i++] = '-';
 	
@@ -99,14 +97,11 @@ static int number(char *buf, long x, int base, int flags, int width) {
 	return i;
 }
 
-
-
 /* the function used to format a string, using stdargs */
 #define output(c) 	buf[bufindex++] = c
 
 int vsprintf(char *buf, const char *s, va_list args) {
 	int i, bufindex, flag;
-
 	char *t, *fmt;
        
 	bufindex = 0;
@@ -173,4 +168,3 @@ int vsprintf(char *buf, const char *s, va_list args) {
 	return bufindex;
 }
 
-

+ 0 - 4
lib/klist.c

@@ -37,7 +37,6 @@ struct klist_node *klist_find_value(struct klist_node *head, int value) {
 	return NULL;
 }
 
-
 void klist_init(struct klist_node *head) {
 	head->next = head;
 	head->prev = head;
@@ -47,7 +46,6 @@ void klist_init(struct klist_node *head) {
 	return;
 }
 
-
 void klist_add(struct klist_node *head, struct klist_node *new) {
 	/* head->prev: the last. */
 	new->prev = head->prev;
@@ -60,7 +58,6 @@ void klist_add(struct klist_node *head, struct klist_node *new) {
 	return;
 }
 
-
 void klist_del(struct klist_node *head, struct klist_node *will_del) {
 	will_del->prev->next = will_del->next;
 	will_del->next->prev = will_del->prev;
@@ -68,4 +65,3 @@ void klist_del(struct klist_node *head, struct klist_node *will_del) {
 	return;
 }
 
-

+ 2 - 13
modules/console.c

@@ -33,7 +33,6 @@
 #include <arch/string.h>
 #include <arch/io.h>
 
-
 __uint16_t pos = 0;
 __uint16_t x = 0, y = 0;
 
@@ -56,7 +55,6 @@ struct tty console_tty = {
 	.getc = NULL, 
 };
 
-
 int __init init_console(void) {
 	pos = read_cursor();
 	POS2XY(pos);
@@ -67,7 +65,6 @@ int __init init_console(void) {
 	return tty_register(&console_tty);
 }
 
-
 static __uint16_t read_cursor(void) {
 	__uint16_t rv = 0;
 
@@ -80,7 +77,6 @@ static __uint16_t read_cursor(void) {
 	return rv;
 }
 
-
 int cano_putc(char c) {
 	if (c == '\n') {
 		y++;
@@ -100,7 +96,6 @@ int cano_putc(char c) {
 
 		if (t == x) 
 			x += TABSIZE;
-
 		else 
 			x = t;
 
@@ -113,7 +108,6 @@ int cano_putc(char c) {
 	}
 
 	raw_putc(pos++, 7, c);
-
 	x++;
 
 	if (x == COLMS) {
@@ -121,17 +115,12 @@ int cano_putc(char c) {
 		x = 0;
 	}
 
-out:
-	update_cursor();
-
+out:	update_cursor();
 	return 0;
 }
 
-
 void raw_putc(__uint16_t pos, __uint8_t color, char c) {
-	__uint16_t *fb = FB_ADDR + pos;
-
-	*fb = (color << 8) + c;
+	FB_ADDR[pos] = (color << 8) + c;
 
 	return;
 }