This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Code16gcc strings


I try to write a small bios using .code16 and .code16gcc.
The problem that I have is that the bios code is loaded at 0xf0000, and
when I want to access the strings from .rodata section, the generated
code is the following one:

xorl    %ebx, %ebx              # EBX = 0
movzwl  %bx, %eax               # EAX = 0
movzbl  (%eax,%ebp), %eax
| %eax is base, and %ebp is index, meaning that it reads from 
(%eax+%ebp) = 0 + %ebp instead of 0xf0000 + %ebp.

I want to know if it is possible read the string relative to 0xf0000
instead of 0x0 or to have the code generated in relative locations, not
in absolute ones. Any other ideas or solutions are welcomed.

This is the linker script I use:

MEMORY { rom : ORIGIN = 0x0, LENGTH = 64k }
        .text 0x0 : AT (0x0) {
                        . = ALIGN (32);
        .data 0x0 : AT (0x0)
                . = ALIGN (32);
        } > rom =0

        .bss (NOLOAD) : {
                *(.bss) *(COMMON)
                . = ALIGN (4);
        } > rom = 0

        .note (NOLOAD) : {
        .comment (NOLOAD) : {
        .stab (NOLOAD) : {
        .stabstr (NOLOAD) : {

I tried to put AT(0xF0000), but the linker gives me some error like
"relocation truncated to fit: R_386_16" which I don't know what it

But even if it does not link, it still generates the code which is
exactly the above one.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]