tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] tinycc as romcc?


From: Rudolf Marek
Subject: [Tinycc-devel] tinycc as romcc?
Date: Sun, 08 Apr 2012 13:19:45 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.26) Gecko/20120131 Thunderbird/3.1.18

Hi all

The coreboot project uses a ROMCC which is a C compiler which does not use stack. This is needed if you want to write raminit in C and you have no memory for the stack.

You can find it here:
http://review.coreboot.org/gitweb?p=coreboot.git;a=tree;f=util/romcc;hb=HEAD

The romcc is kind of fragile beast, I was wondering if tinycc could be changed to handle everything just with the CPU registers.

The romcc uses SSE/MMX registers for this. I started to look into that and I think it could go.

While at it, I started experimenting with tinycc and I wanted to change the way how the subroutines are called. (something like doing jmp fn and storing return addrress somewhere in register, this is just for a test (of course if subsubroutine is called we must push it somewhere)

So, I added following into

static void gcall_or_jmp(int is_jmp)

This is just for a call:

This generates still a call to fn

oad(0xe8, vtop->c.ul - 4);

I think I need anonymous symbol to get actual address of "EIP" after function
call.

Sym *sym = get_sym_ref(&char_pointer_type, cur_text_section, 0, 0);

    greloc(cur_text_section, sym,
           ind + 1, R_386_PC32);

        oad(0xb8, ind); /* call/jmp im */

This just tries to put the current "EIP" address into EAX. If compiled I receive allthetime just 0xfffffff in the eax... Not even sure if it is good way.

I spent some hours with that but I'm kind of stuck. Any help welcome.

Thanks
Rudolf



reply via email to

[Prev in Thread] Current Thread [Next in Thread]