LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Openrisc > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: Gy?rgy 'nog' Jeney<nog@s...>
    Date: Mon Mar 28 09:33:45 CEST 2005
    Subject: [openrisc] [or1ksim #37] Fix simprintf
    Top
    > eval_direct8 was not defined in any header so its parameters were not checked
    > when simprintf.c was being compiled and so its incorrect use was not detected.
    > This fixes it.
    >
    > ChangeLog:
    > * Correct incorrect calls to eval_direct8.

    > #37 resend patch. (there is incorrect patch applied to email #37)

    Oops, sorry about that. The attached patch was #38. The attached one is the
    real #37.

    nog.
    -------------- next part --------------
    diff -urp --unidirectional-new-file /home/nog/or1ksim-split/cpu/common/abstract.h ./cpu/common/abstract.h
    --- cpu/common/abstract.h 2005-02-25 16:56:06.000000000 +0100
    +++ ./cpu/common/abstract.h 2005-03-09 21:16:50.000000000 +0100
    @@ -140,6 +140,8 @@ char *generate_time_pretty (char *dest,
    /* Returns 32-bit values from mem array. */
    uint32_t eval_insn(oraddr_t, int *);

    +uint8_t eval_direct8(oraddr_t memaddr, int *breakpoint, int through_mmu, int through_dc);
    +uint16_t eval_direct16(oraddr_t memaddr, int *breakpoint, int through_mmu, int through_dc);
    uint32_t eval_direct32(oraddr_t addr, int *breakpoint, int through_mmu, int through_dc);

    void set_direct32(uint32_t addr, uint32_t value, int *breakpoint, int through_mmu, int through_dc);
    diff -urp --unidirectional-new-file /home/nog/or1ksim-split/support/simprintf.c ./support/simprintf.c
    --- support/simprintf.c 2005-02-09 18:04:04.000000000 +0100
    +++ ./support/simprintf.c 2005-03-05 14:32:27.000000000 +0100
    @@ -54,8 +54,8 @@ char *simgetstr(oraddr_t stackaddr, unsi
    fmtaddr = regparam;

    i = 0;
    - while (eval_direct8(fmtaddr,&breakpoint) != '\0') {
    - fmtstr[i++] = eval_direct8(fmtaddr,&breakpoint);
    + while (eval_direct8(fmtaddr,&breakpoint,1,0) != '\0') {
    + fmtstr[i++] = eval_direct8(fmtaddr,&breakpoint,1,0);
    fmtaddr++;
    if (i == FMTLEN - 1)
    break;
    @@ -100,7 +100,7 @@ void simprintf(oraddr_t stackaddr, unsig
    int string = 0;
    debug(6, " 3");
    #if STACK_ARGS
    - arg = eval_direct32(argaddr,&breakpoint);
    + arg = eval_direct32(argaddr,&breakpoint,1,0);
    argaddr += 4;
    #else
    {
    @@ -110,7 +110,8 @@ void simprintf(oraddr_t stackaddr, unsig
    arg = evalsim_reg(atoi(regstr));
    }
    #endif
    - debug(6, " 4: fmtstrpart=%p fmtstrpart=%s arg=%p\n", fmtstrpart, fmtstrpart, arg);
    + debug(6, " 4: fmtstrpart=%p fmtstrpart=%s arg=0x%08"PRIx32"\n",
    + fmtstrpart, fmtstrpart, arg);
    tmp = fmtstrpart;
    if (*tmp == '%') {
    tmp++;
    @@ -120,14 +121,14 @@ void simprintf(oraddr_t stackaddr, unsig
    if (string) {
    int len = 0;
    char *str;
    - for(; eval_direct8(arg++,&breakpoint); len++);
    + for(; eval_direct8(arg++,&breakpoint,1,0); len++);
    len++; /* for null char */
    arg -= len;
    str = (char *)malloc(len);
    len = 0;
    - for(; eval_direct8(arg,&breakpoint); len++)
    - *(str+len) = eval_direct8(arg++,&breakpoint);
    - *(str+len) = eval_direct8(arg,&breakpoint); /* null ch */
    + for(; eval_direct8(arg,&breakpoint,1,0); len++)
    + *(str+len) = eval_direct8(arg++,&breakpoint,1,0);
    + *(str+len) = eval_direct8(arg,&breakpoint,1,0); /* null ch */
    debug(6, "4a: len=%d str=%s\n", len, str);
    debug(6, "4b:");
    fprintf(f, fmtstrpart, str);

    ReferenceAuthor
    [openrisc] [or1ksim #37] Fix simprintf=?unknown-8bit?Q?Gy=F6rgy?= 'nog' Jeney

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.