Changeset 162 for soft/giet_vm/boot/boot_handler.c
- Timestamp:
- Jun 20, 2012, 5:11:11 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/boot/boot_handler.c
r160 r162 52 52 #include <boot_handler.h> 53 53 #include <mapping_info.h> 54 #include <hwr_mapping.h>55 54 #include <mwmr.h> 56 55 … … 80 79 { [0 ... GIET_NB_VSPACE_MAX-1] = 0 }; 81 80 82 // Page table pointer 81 // Page table pointers 83 82 page_table_t* _ptabs[GIET_NB_VSPACE_MAX]; 84 83 … … 149 148 } 150 149 boot_tty_puts(buf); 151 }152 153 unsigned int _tty_puts(const char *buffer, unsigned int length)154 {155 unsigned int* tty_address = (unsigned int*)&seg_tty_base;156 unsigned int n;157 158 for ( n=0; n<length; n++)159 {160 if (buffer[n] == 0) break;161 tty_address[0] = (unsigned int)buffer[n];162 }163 164 return n;165 }166 167 ////////////////////////////////////////////////////////////////////////////////////168 // tty_printf()169 // This function is a simplified version of the mutek_printf() function.170 // The terminal index must be defined in the calling task context.171 // It doesn't use the IRQ_PUT interrupt, and the associated kernel buffer.172 // Only a limited number of formats are supported:173 // - %d : signed decimal174 // - %u : unsigned decimal175 // - %x : hexadecimal176 // - %c : char177 // - %s : string178 // - Returns 0 if success, > 0 if error.179 ////////////////////////////////////////////////////////////////////////////////////180 unsigned int _tty_printf(char *format, ...)181 {182 va_list ap;183 va_start(ap, format);184 unsigned int ret;185 186 printf_text:187 188 while (*format) {189 unsigned int i;190 for (i = 0; format[i] && format[i] != '%'; i++)191 ;192 if (i) {193 ret = _tty_puts(format,i);194 if (ret != i)195 return 1; /* return error */196 format += i;197 }198 if (*format == '%') {199 format++;200 goto printf_arguments;201 }202 }203 204 va_end(ap);205 return 0;206 207 printf_arguments:208 209 {210 int val = va_arg(ap, long);211 char buf[20];212 char* pbuf;213 unsigned int len = 0;214 static const char HexaTab[] = "0123456789ABCDEF";215 unsigned int i;216 217 switch (*format++) {218 case ('c'): /* char conversion */219 len = 1;220 buf[0] = val;221 pbuf = buf;222 break;223 case ('d'): /* decimal signed integer */224 if (val < 0) {225 val = -val;226 ret = _tty_puts("-",1);227 if (ret != 1)228 return 1; /* return error */229 }230 case ('u'): /* decimal unsigned integer */231 for( i=0 ; i<10 ; i++) {232 buf[9-i] = HexaTab[val % 10];233 if (!(val /= 10)) break;234 }235 len = i+1;236 pbuf = &buf[9-i];237 break;238 case ('x'): /* hexadecimal integer */239 ret = _tty_puts("0x",2);240 if (ret != 2)241 return 1; /* return error */242 for( i=0 ; i<8 ; i++) {243 buf[7-i] = HexaTab[val % 16U];244 if (!(val /= 16U)) break;245 }246 len = i+1;247 pbuf = &buf[7-i];248 break;249 case ('s'): /* string */250 {251 char *str = (char*)val;252 while ( str[len] ) len++;253 pbuf = (char*)val;254 }255 break;256 default:257 goto printf_text;258 }259 260 ret = _tty_puts(pbuf, len);261 if (ret != len)262 return 1;263 goto printf_text;264 }265 150 } 266 151 … … 718 603 /////////////////////////////////////////////////////////////////////////// 719 604 // Initialise vobjs 605 // For now only one type is initialised the: PTAB 606 // 720 607 // param: 721 // vobj: the vobj to initialise722 // region_id: the vspace in wich the vobj is located or the global space(-1).608 // vobj: the vobj to initialise 609 // region_id: the vspace in wich the vobj is located or the global space(-1). 723 610 /////////////////////////////////////////////////////////////////////////// 724 void init ialise_ptabs(mapping_vobj_t* vobj, unsigned int region_id)611 void initailise_vobj(mapping_vobj_t* vobj, unsigned int region_id) 725 612 { 726 613 if(vobj->type == PTAB) … … 804 691 // + to computes the length of the current vseg 805 692 // + Align vobjs 806 // + Initialise the ptabs if the vobj correspond693 // + Initialise the vobj 807 694 cur_vaddr = vseg->vbase; 808 695 cur_paddr = vseg->pbase; … … 821 708 cur_vaddr += vobj[vobj_id].length; 822 709 cur_paddr += vobj[vobj_id].length; 823 init ialise_ptabs(&vobj[vobj_id], region_id);710 initailise_vobj(&vobj[vobj_id], region_id); 824 711 } 825 712
Note: See TracChangeset
for help on using the changeset viewer.