Page 3 of 4
Re: Multitasking problem
Posted: Tue Aug 02, 2022 5:52 am
by WinExperements
Hello again, i have problem with multiboot, when i am trying to run system with modules on some emulators, grub doesn't provide modules, modules count and address are zero, what is reason?
Modules are provided only when virtual machine have 128MB of ram.
When i enable paging the data of multiboot are sets to zero, why?
Re: Multitasking problem
Posted: Tue Aug 02, 2022 8:11 am
by iansjack
But the multiboot data is provided before you enable paging. If it disappears after you enable paging then you are overwriting the data, or not mapping the memory region where it is contained properly.
Re: Multitasking problem
Posted: Tue Aug 02, 2022 12:23 pm
by WinExperements
iansjack wrote:But the multiboot data is provided before you enable paging. If it disappears after you enable paging then you are overwriting the data, or not mapping the memory region where it is contained properly.
Maybe i overwrite the data.
I have second problem, if i pass the another file as module the module start field are zero, but if i pass the same module as second module, it's work, why?
And about multiboot the same if i load and enable paging after loading modules.
EDIT: Modules works fine, but kernel end address are incorrect, how i can get the kernel end address? And the problem caused by invalid kernel end address.
Re: Multitasking problem
Posted: Tue Aug 02, 2022 12:59 pm
by Octocontrabass
WinExperements wrote:how i can get the kernel end address?
Define a symbol at the end of your kernel in your
linker script. Use the address of that symbol.
Re: Multitasking problem
Posted: Tue Aug 02, 2022 3:35 pm
by WinExperements
Octocontrabass wrote:WinExperements wrote:how i can get the kernel end address?
Define a symbol at the end of your kernel in your
linker script. Use the address of that symbol.
Yeah i add this, but the address in this symbol are incorrect, the value is 10696057704939582.
My linker script:
Code: Select all
ENTRY(_start)
OUTPUT_FORMAT(elf32-i386)
OUTPUT_ARCH(i386:i386)
SECTIONS
{
. = 0x100000;
kernel_start = .;
.text :
{
*(.multiboot)
*(.text*)
*(.rodata)
}
.data :
{
*(.data)
}
.bss :
{
*(.bss)
}
kernel_end = .;
}
What i do wrong in my linker script and how correctly get kernel end address and size?
Re: Multitasking problem
Posted: Tue Aug 02, 2022 3:59 pm
by Octocontrabass
How are you getting an address that doesn't fit in 32 bits?
Re: Multitasking problem
Posted: Tue Aug 02, 2022 7:26 pm
by WinExperements
Octocontrabass wrote:How are you getting an address that doesn't fit in 32 bits?
Problem in my linker script or in how i use this variable? I define it as uint64_t in my kernel source
Re: Multitasking problem
Posted: Tue Aug 02, 2022 10:34 pm
by nullplan
You should define linker symbols in C as
The value of a symbol from the linker shows up as address of a name in C. If you declare that name as an array, just referencing the name will automatically take its address. If you define it as anything else, you must take the address. What you did was likely to dereference it. Thus showing you that there are indeed some data bytes at the end of your kernel, and what they look like if interpreted as a 64-bit number. But that doesn't help you.
Re: Multitasking problem
Posted: Wed Aug 03, 2022 2:32 pm
by WinExperements
Hello again, i have some problems with vga fonts.
After converting psf to elf, my symbol table seems incorrect, what is reason?
Converted PSF symtab:
Code: Select all
Symbol table '.symtab' contains 5 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 SECTION LOCAL DEFAULT 1
2: 00000000 0 NOTYPE GLOBAL DEFAULT 1 _binary_D__Download_font_
3: 00008020 0 NOTYPE GLOBAL DEFAULT 1 _binary_D__Download_font_
4: 00008020 0 NOTYPE GLOBAL DEFAULT ABS _binary_D__Download_font_
How i convert it:
Code: Select all
objcopy -O elf32-i386 -B i386 -I binary font.psf font.o
Re: Multitasking problem
Posted: Wed Aug 03, 2022 2:53 pm
by Octocontrabass
There's nothing wrong with your symbol table. The symbol names are being truncated by readelf.
Try "readelf -s -W" or "objdump -t" and you'll see the correct symbol names.
Re: Multitasking problem
Posted: Sat Aug 06, 2022 8:22 am
by WinExperements
Hello! How i can translate virtual address to physical knows only the page directory and virtual address?
Re: Multitasking problem
Posted: Sat Aug 06, 2022 8:37 am
by iansjack
You read the physical address from the page directory. The other way round is more difficult (and is not necessarily a 1 to 1 relationship).
Re: Multitasking problem
Posted: Sat Aug 06, 2022 12:15 pm
by WinExperements
Hello, i am about translation virtual to physical address, how i can get physical address from page table entry?
And how correctly get page table address from page directory?
Re: Multitasking problem
Posted: Sat Aug 06, 2022 1:50 pm
by Octocontrabass
The upper 20 bits of the physical address are stored in the upper 20 bits of the entry. The lower 12 bits of the physical address are always 0. This applies to both page table and page directory entries.
You can get the physical address from the entry by using bitwise AND to mask the lower 12 bits.
Re: Multitasking problem
Posted: Sat Aug 06, 2022 4:04 pm
by WinExperements
Octocontrabass wrote:The upper 20 bits of the physical address are stored in the upper 20 bits of the entry. The lower 12 bits of the physical address are always 0. This applies to both page table and page directory entries.
You can get the physical address from the entry by using bitwise AND to mask the lower 12 bits.
How i can mask 12 bits in C? Can you give example of it?