Ignore:
Timestamp:
Mar 12, 2019, 1:37:38 PM (6 years ago)
Author:
alain
Message:

Fix several bugs to use the instruction MMU in kernel mode
in replacement of the instruction address extension register,
and remove the "kentry" segment.

This version is running on the tsar_generic_iob" platform.

One interesting bug: the cp0_ebase defining the kernel entry point
(for interrupts, exceptions and syscalls) must be initialized
early in kernel_init(), because the VFS initialisation done by
kernel_ini() uses RPCs, and RPCs uses Inter-Processor-Interrup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/mini-libc/stdio.c

    r623 r624  
    5252
    5353///////////////////////////////////////////////////
    54 static unsigned int xprintf( char         * string,
    55                              unsigned int   length,
    56                              const char   * format,
    57                              va_list      * args )
    58 {
    59     unsigned int ps = 0;    // write index to the string buffer
    60 
    61 #define TO_STREAM(x) do { string[ps] = (x); ps++; if(ps==length) return 0xFFFFFFFF; } while(0);
     54static int xprintf( char         * string,
     55                    int            length,
     56                    const char   * format,
     57                    va_list      * args )
     58{
     59    int ps = 0;    // write index to the string buffer
     60
     61#define TO_STREAM(x) do { string[ps] = (x); ps++; if(ps==length) return -1; } while(0);
    6262
    6363xprintf_text:
     
    259259            default:       // unsupported argument type
    260260            {
    261                 return 0xFFFFFFFF;
     261                return -1;
    262262            }
    263263        }  // end switch on  argument type
     
    326326
    327327    va_start( args, format );
    328     count = xprintf( string , length , format , &args );
     328    count = xprintf( string , (int)length , format , &args );
    329329    va_end( args );
    330330
     
    398398    char               string[4096];
    399399    va_list            args;
    400     unsigned int       count;
     400    int                count;
     401    int                writen;
    401402    int                fd;
    402403   
     
    408409    va_end( args );
    409410
    410     if ( count == 0xFFFFFFFF )
     411    if ( count < 0 )
    411412    {
    412413        display_string( "fprintf : xprintf failure" );
     
    421422        string[count] = 0;
    422423
    423 printf("\n[%s] fd = %d for string :\n", __FUNCTION__, fd, string );
    424 
    425         return write( fd , &string , count );
     424printf("\n[%s] fd = %d for string : %s\n", __FUNCTION__, fd, string );
     425
     426idbg();
     427
     428        // copy string to file
     429        writen = write( fd , &string , count );
     430
     431        if( writen != count )
     432        {
     433            display_string( "fprintf : write failure" );
     434            return -1;
     435        }
     436
     437idbg();
     438
     439        return writen;
    426440    }
    427441}  // end fprintf()
Note: See TracChangeset for help on using the changeset viewer.