a mobius question
a mobius question
Hi tim,
I'm checkin mobius source code, and i have something i can't found.
where is declared _scode variable? and what it contains?
thanks.
I'm checkin mobius source code, and i have something i can't found.
where is declared _scode variable? and what it contains?
thanks.
Re:a mobius question
My guess is that its a symbol exported by the kernel linker script. It probably contains the address of the start of the code section of the kernel.
Re:a mobius question
That's right. &scode is the virtual address of the start of the kernel image.
Re:a mobius question
hi,
well, i don't know much about linker scripts. i see this "_scode = __image_base__;" what is __image_base__ , or better where can i find a simple tutorial about linker scripts?
thanks
well, i don't know much about linker scripts. i see this "_scode = __image_base__;" what is __image_base__ , or better where can i find a simple tutorial about linker scripts?
thanks
Re:a mobius question
__image_base__ is defined by Cygwin ld to be the address specified with the --image-base command line option.
Somebody posted a link to a tutorial on linker scripts recently. Use the Search function to find it.
Somebody posted a link to a tutorial on linker scripts recently. Use the Search function to find it.
Re:a mobius question
It is used to store uninitialized data. (for example, global variables that you don't initially assign a value to when you declare them)
Code: Select all
int x = 0; // data section
int y; // bss section
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:a mobius question
your binary file will not store any byte for the .bss ('Below Stack Segment'), however, the loader will have to make sure that there's enough space to hold the binary image *plus* the BSS section and will have to ensure the memory assigned to the BSS is zeroed before running the program.
Re:a mobius question
Ok.
One more question ( i know these one may be a silly question ):
I'm using gcc and ld.. but don't know how to link kernel to use 0xd000000 address, but it will be loaded at 0x100000. ( i'm not talkin about GDT or mangle pointer, only ld,gcc parameters.. ) I use these link script:
OUTPUT_FORMAT("elf32-i386")
ENTRY(AsmStart)
SECTIONS
{
stext = 0xc0000000;
.text 0xc0000000 +0x1000: {
*(.text)
*(.rodata*)
}
.data : {
*(.data)
}
.bss :
{
*(.bss)
}
}
One more question ( i know these one may be a silly question ):
I'm using gcc and ld.. but don't know how to link kernel to use 0xd000000 address, but it will be loaded at 0x100000. ( i'm not talkin about GDT or mangle pointer, only ld,gcc parameters.. ) I use these link script:
OUTPUT_FORMAT("elf32-i386")
ENTRY(AsmStart)
SECTIONS
{
stext = 0xc0000000;
.text 0xc0000000 +0x1000: {
*(.text)
*(.rodata*)
}
.data : {
*(.data)
}
.bss :
{
*(.bss)
}
}
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:a mobius question
i'd be tempted to say that your linker does not have to worry about where in physical memory the kernel will be loaded as soon as the loader does the correct job in order to make the image appear at the requested virtual address.
Re:a mobius question
well,
well, tim's memory manmagement1 tell to link the kernel to words at the virtual address X but it really will be loaded at Y. And 'till you got paggin enabled, you should do something to cheat the kernel. I don't know how compile the kernel to do this ( work in the virtual address X, and load it a the Y real address )
well, tim's memory manmagement1 tell to link the kernel to words at the virtual address X but it really will be loaded at Y. And 'till you got paggin enabled, you should do something to cheat the kernel. I don't know how compile the kernel to do this ( work in the virtual address X, and load it a the Y real address )
Re:a mobius question
I use PE, which doesn't know about physical addresses. The physical address is determined only by the loader. I understand that ELF knows what physical address it wants to be loaded at, which messes things up.
Re:a mobius question
yeah, that's my problem wich i don't know how to solve. How can i link the kernel,in elf32 format, to work at 0xC0000000 virutal address, but load it at 0x100000??
Re:a mobius question
anyone knows it???
is it possible to outputs PE format with ld? i'm confused about that. And i try this i know it works
But even, i'm confused about this. How can i tell ld to link a kernel to work at this address? is like i have in the 'link script' posted before?
is it possible to outputs PE format with ld? i'm confused about that. And i try this i know it works
But even, i'm confused about this. How can i tell ld to link a kernel to work at this address? is like i have in the 'link script' posted before?