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: Wed Mar 30 22:33:32 CEST 2005
    Subject: [openrisc] or1ksim patches #34, #43, #53-2, #64, #68-#73
    Top
    > This is not what i ment. The
    >
    > static void *pfoo_call __attribute__((section(".text")));
    >
    > only creates pointer in the .text section, which is pointing then to
    > something in heap. i thought something like
    >
    > static char __attribute__((section(".text"))) page[PAGE_SIZE];
    >
    > and then copy some executable code to that page and execute the code
    > from there...

    Actually not ignoring the assembler warnings the variable doesn't even go into
    the text section: "Warning: ignoring changed section attributes for .text".
    Forcing a write to the text section also causes a segmentation fault, as
    demonstrated with the modified execs.c program (attached). Also the immu has a
    configurable page size. For now it is hardcoded to 8192 in the recompiler,
    which will need to get fixed someday.

    > > - The sim crashes when running `ls' in proc/net.
    >
    > this is interesting. where it crashes (ethernet ???, but why...)

    I'm still investigateing.

    > > - Running the `test' program (in the initrd) fails, same as vi, and some others.
    >
    > how it fails ?

    Userspace sigsegv. It's the fault of the recompiler.

    > > Before I go and commint > 40 patches to cvs in one go, is the cvs-checkins list
    > > going to work anytime soon? It is much easier to do regression tests if the
    > > commit logs are availible.
    >
    > agreed, but very unlikely that it will be fixed in forseeable time.
    > what you could do, and it will actually help with regression tests is to
    > do a cvs tag after each patch...

    Ok, tomorrow afternoon the patches go in. Do we really want > 40 tags in the
    repostry (that are usefull only for a limited time)?

    nog.

    PS: You neglected to comment on patch #51 and #52...
    -------------- next part --------------

    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>

    /*
    static void *pfoo_call __attribute__((section(".text"))) = NULL;
    */
    extern void *pfoo_call;

    asm(
    ".section .text\n"
    "pfoo_call: movl $0xffffffff, %eax\n"
    );

    void foo(void)
    {
    printf("Hello World!\n");
    }

    void foo_call(void);

    asm(
    ".section .text\n"
    ".globl foo_call\n"
    "\t.type foo_call,@function\n"
    "foo_call:\n"
    "\tmov $foo, %eax\n"
    "\tjmp *%eax\n"
    );

    int main()
    {
    /* foo_call is 8 bytes long */
    pfoo_call = malloc(8);
    memcpy(pfoo_call, foo_call, 8);
    asm volatile ("movl %0, %%eax\n"
    "call *%%eax\n" : : "m" (pfoo_call) : "eax");
    return 0;
    }

    ReferenceAuthor
    [openrisc] or1ksim patches #34, #43, #53-2, #64, #68-#73Matjaz Breskvar

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