// /usr/lib/gcc/i486-linux-gnu/4.1.3/cc1 -quiet -nostdinc -nostdinc -Iinc -MD obj/bsp/console.d -MQ obj/bsp/console.o -D__MIMOSA_KERNEL__ platform/bsp/drivers/console.c -quiet -dumpbase console.c -mtune=generic -auxbase-strip obj/bsp/console.o -gstabs -O0 -Wall -Wno-format -Wno-unused -Werror -std=c99 -fno-builtin -fstack-protector -fstack-protector -o - -frandom-seed=0 # 1 "platform/bsp/drivers/console.c" # 1 "/home/nalaginrut/Project/mimosa//" # 1 "" # 1 "" # 1 "platform/bsp/drivers/console.c" # 17 "platform/bsp/drivers/console.c" # 1 "inc/now/cpu/port.h" 1 # 20 "inc/now/cpu/port.h" # 1 "inc/now/bsp_types.h" 1 # 29 "inc/now/bsp_types.h" typedef enum BOOL { true=0 ,false=1 } __bool; typedef signed char __s8_t; typedef unsigned char __u8_t; typedef short __s16_t; typedef unsigned short __u16_t; typedef int __s32_t; typedef unsigned int __u32_t; typedef long long __s64_t; typedef unsigned long long __u64_t; typedef __u32_t __longword; typedef __s32_t __intptr_t; typedef __u32_t __uintptr_t; typedef __u32_t __physaddr_t; # 66 "inc/now/bsp_types.h" typedef __u8_t *__bptr; typedef __u16_t *__wptr; typedef __u32_t *__lptr; typedef const __u8_t *__cb_p; typedef const __u16_t *__cw_p; typedef const __u32_t *__cl_p; typedef __u8_t *const __b_cp; typedef __u16_t *const __w_cp; typedef __u32_t *const __l_cp; typedef void* __gptr_t; typedef const void *__cptr_t; typedef char* __stdptr_t; typedef __stdptr_t __mem_t; typedef __u32_t __ppn_t; typedef __u32_t __size_t; typedef __s32_t __ssize_t; typedef __s32_t __off_t; typedef __u32_t frame_pt; typedef __u32_t ereg_t; typedef __u16_t reg_t; # 116 "inc/now/bsp_types.h" typedef void (*entry_t)(void); # 21 "inc/now/cpu/port.h" 2 # 1 "inc/now/bsp_bits.h" 1 # 23 "inc/now/bsp_bits.h" # 1 "inc/now/bsp_types.h" 1 # 24 "inc/now/bsp_bits.h" 2 # 22 "inc/now/cpu/port.h" 2 static __inline__ ereg_t read_ebp() __attribute__((always_inline)); static __inline__ __u8_t port_rb(__u32_t port) __attribute__((always_inline)); static __inline__ __u16_t port_rw(__u32_t port) __attribute__((always_inline)); static __inline__ __u32_t port_rl(__u32_t port) __attribute__((always_inline)); static __inline__ void port_rnb(__u32_t port, __gptr_t addr, __u32_t cnt) __attribute__((always_inline)); static __inline__ void port_rnw(__u32_t port, __gptr_t addr, __u32_t cnt) __attribute__((always_inline)); static __inline__ void port_rnl(__u32_t port, __gptr_t addr, __u32_t cnt) __attribute__((always_inline)); static __inline__ void port_wb(__u32_t port ,__u8_t data) __attribute__((always_inline)); static __inline__ void port_ww(__u32_t port ,__u16_t data) __attribute__((always_inline)); static __inline__ void port_wl(__u32_t port ,__u32_t data) __attribute__((always_inline)); static __inline__ void port_wnb(__u32_t port, __cptr_t addr, __u32_t cnt) __attribute__((always_inline)); static __inline__ void port_wnw(__u32_t port, __cptr_t addr, __u32_t cnt) __attribute__((always_inline)); static __inline__ void port_wnl(__u32_t port, __cptr_t addr, __u32_t cnt) __attribute__((always_inline)); # 103 "inc/now/cpu/port.h" static __inline__ __u8_t port_rb(__u32_t port) { __u8_t data; do{ __asm__ __volatile__("in%z0 %w1 ,%0" :"=a" ((__u8_t)data) :"d" (port) ); }while(0);; return data; } static __inline__ __u16_t port_rw(__u32_t port) { __u16_t data; do{ __asm__ __volatile__("in%z0 %w1 ,%0" :"=a" ((__u16_t)data) :"d" (port) ); }while(0);; return data; } static __inline__ __u32_t port_rl(__u32_t port) { __u32_t data; do{ __asm__ __volatile__("in%z0 %w1 ,%0" :"=a" ((__u32_t)data) :"d" (port) ); }while(0);; return data; } static __inline__ void port_rnb(__u32_t port ,__gptr_t addr ,__u32_t cnt) { do{ __asm__ __volatile__("cld\n\t" "repne\n\t" "insb" :"=D" (addr) ,"=c" (cnt) :"d" (port) ,"0" (addr) ,"1" (cnt) :"memory" ,"cc" ); }while(0);; } static __inline__ void port_rnw(__u32_t port ,__gptr_t addr ,__u32_t cnt) { do{ __asm__ __volatile__("cld\n\t" "repne\n\t" "insw" :"=D" (addr) ,"=c" (cnt) :"d" (port) ,"0" (addr) ,"1" (cnt) :"memory" ,"cc" ); }while(0);; } static __inline__ void port_rnl(__u32_t port ,__gptr_t addr ,__u32_t cnt) { do{ __asm__ __volatile__("cld\n\t" "repne\n\t" "insl" :"=D" (addr) ,"=c" (cnt) :"d" (port) ,"0" (addr) ,"1" (cnt) :"memory" ,"cc" ); }while(0);; } static __inline__ ereg_t read_ebp() { ereg_t value; __asm__ __volatile__ ("mov%z0 %%ebp ,%0" :"=r" (value) ); return value; } static __inline__ void port_wb(__u32_t port ,__u8_t data) { do{ __asm__ __volatile__("out%z0 %0 ,%w1" : :"a" ((__u8_t)data) ,"d" (port) ); }while(0);; } static __inline__ void port_ww(__u32_t port ,__u16_t data) { do{ __asm__ __volatile__("out%z0 %0 ,%w1" : :"a" ((__u16_t)data) ,"d" (port) ); }while(0);; } static __inline__ void port_wl(__u32_t port ,__u32_t data) { do{ __asm__ __volatile__("out%z0 %0 ,%w1" : :"a" ((__u32_t)data) ,"d" (port) ); }while(0);; } static __inline__ void port_wnb(__u32_t port, __cptr_t addr, __u32_t cnt) { do{ __asm__ __volatile__("cld\n\t" "repne\n\t" "outsb" :"=S" (addr) ,"=c" (cnt) :"d" (port) ,"0" (addr) ,"1" (cnt) :"cc" ); }while(0);; } static __inline__ void port_wnw(__u32_t port, __cptr_t addr, __u32_t cnt) { do{ __asm__ __volatile__("cld\n\t" "repne\n\t" "outsw" :"=S" (addr) ,"=c" (cnt) :"d" (port) ,"0" (addr) ,"1" (cnt) :"cc" ); }while(0);; } static __inline__ void port_wnl(__u32_t port, __cptr_t addr, __u32_t cnt) { do{ __asm__ __volatile__("cld\n\t" "repne\n\t" "outsl" :"=S" (addr) ,"=c" (cnt) :"d" (port) ,"0" (addr) ,"1" (cnt) :"cc" ); }while(0);; } # 18 "platform/bsp/drivers/console.c" 2 # 1 "inc/now/drivers/console.h" 1 # 19 "inc/now/drivers/console.h" # 1 "inc/osconfig.h" 1 # 20 "inc/now/drivers/console.h" 2 extern char principio[]; # 39 "inc/now/drivers/console.h" void console_init(); void console_putc(__u16_t ch); static void cga_init(); void cga_putc(__u16_t ch); # 20 "platform/bsp/drivers/console.c" 2 # 1 "inc/now/drivers/kbd.h" 1 # 114 "inc/now/drivers/kbd.h" static int kbd_proc_data(void); void kbd_intr(void); void kbd_init(void); void cons_intr(int (*proc)(void)); int cons_getc(void); void cons_putc(int c); int getchar(void); int iscons(int fdnum); # 21 "platform/bsp/drivers/console.c" 2 # 1 "inc/libkern.h" 1 # 19 "inc/libkern.h" # 1 "inc/types.h" 1 # 28 "inc/types.h" typedef __bool bool; typedef __longword longword; typedef __s8_t s8_t; typedef __u8_t u8_t; typedef __s16_t s16_t; typedef __u16_t u16_t; typedef __s32_t s32_t; typedef __u32_t u32_t; typedef __s64_t s64_t; typedef __u64_t u64_t; typedef __bptr bptr; typedef __wptr wptr; typedef __lptr lptr; typedef __cb_p cb_p; typedef __cw_p cw_p; typedef __cl_p cl_p; typedef __b_cp b_cp; typedef __w_cp w_cp; typedef __l_cp l_cp; typedef __gptr_t gptr_t; typedef __cptr_t cptr_t; typedef __stdptr_t stdptr_t; typedef __intptr_t intptr_t; typedef __uintptr_t uintptr_t; typedef __physaddr_t physaddr_t; typedef __ppn_t ppn_t; typedef __size_t size_t; typedef __ssize_t ssize_t; typedef __off_t off_t; # 20 "inc/libkern.h" 2 char *strndup(const char *str ,size_t n); size_t strnlen(const char *str, size_t n); char *strncat(char *dest, const char *src, size_t n); char *strncpy(char *dest, const char *src, size_t n); int strncmp(const char *p, const char *q, size_t n); void *strchr(void const *str ,int c_in); long strtol(const char *s ,char **endptr ,int base); void *memcpy (void *dest ,void const *src ,size_t n); void *memset(void *str, int c, size_t n); void *memchr(void const *str ,int c_in ,size_t n); void *memmove(void *dest ,void const *src ,size_t n); # 22 "platform/bsp/drivers/console.c" 2 # 1 "inc/debug.h" 1 # 25 "inc/debug.h" # 1 "inc/debug/display.h" 1 # 22 "inc/debug/display.h" void msg_print(const char *str); void write_string(int color ,const char *string); # 26 "inc/debug.h" 2 # 1 "inc/debug/trace.h" 1 # 20 "inc/debug/trace.h" # 1 "inc/retnum.h" 1 # 22 "inc/retnum.h" typedef enum Return_Number { EINVSZ=0xE001 , OK=0, }retnum; # 21 "inc/debug/trace.h" 2 # 1 "inc/error.h" 1 # 23 "inc/debug/trace.h" 2 typedef struct FrameInfo { }frame_info; retnum pcall_backtrace(frame_info fi ,u32_t back_count); # 27 "inc/debug.h" 2 # 25 "platform/bsp/drivers/console.c" 2 static __u32_t port_6845; static __u16_t *crt_buf; static __u16_t crt_pos; void console_init() { cga_init(); kbd_init(); } void console_putc(__u16_t ch) { cga_putc(ch); } static void cga_init() { __u16_t tmp; tmp = *((volatile __u16_t*)(0xC0000000 + 0xB8000)); *((volatile __u16_t*)(0xC0000000 + 0xB8000)) = (__u16_t)0xA55A; port_6845 = (*((volatile __u16_t*)(0xC0000000 + 0xB8000)) == 0xA55A)? 0x3D4 : 0x3B4; *((volatile __u16_t*)(0xC0000000 + 0xB8000)) = tmp; crt_buf = (__u16_t*)((port_6845 == 0x3B4)? ((volatile __u16_t*)(0xC0000000 + 0xB0000)) : ((volatile __u16_t*)(0xC0000000 + 0xB8000))); port_wb(port_6845 ,0x0E); crt_pos = port_rb(port_6845 + 1) << 8; port_wb(port_6845 ,0x0F); crt_pos |= port_rb(port_6845 + 1); } void cga_putc(__u16_t ch) { ch = (ch & 0xFF00)? ch : (ch | 0x0700); switch( ch & 0xFF ) { case '\b': if( crt_pos > 0 ) { crt_pos--; crt_buf[crt_pos] = ((ch & 0xFF00) | ' '); } break; case '\n': crt_pos += 80; break; case '\r': crt_pos -= (crt_pos % 80); case '\t': console_putc(' ');console_putc(' '); console_putc(' ');console_putc(' '); break; default: crt_buf[crt_pos++] = ch; break; } if (crt_pos >= (25 * 80)) { int i; memcpy(crt_buf, crt_buf + 80, ((25 * 80) - 80) * sizeof(__u16_t)); for (i = (25 * 80) - 80; i < (25 * 80); i++) crt_buf[i] = 0x0700 | ' '; crt_pos -= 80; } port_wb(port_6845 ,0x0E); port_wb(port_6845 + 1 ,crt_pos >> 8); port_wb(port_6845 ,0x0F); port_wb(port_6845 + 1 ,crt_pos); }