Multitasking problem
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
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?
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
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.
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
Maybe i overwrite the data.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.
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.
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Multitasking problem
Define a symbol at the end of your kernel in your linker script. Use the address of that symbol.WinExperements wrote:how i can get the kernel end address?
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
Yeah i add this, but the address in this symbol are incorrect, the value is 10696057704939582.Octocontrabass wrote:Define a symbol at the end of your kernel in your linker script. Use the address of that symbol.WinExperements wrote:how i can get the kernel end address?
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 = .;
}
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Multitasking problem
How are you getting an address that doesn't fit in 32 bits?
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
Problem in my linker script or in how i use this variable? I define it as uint64_t in my kernel sourceOctocontrabass wrote:How are you getting an address that doesn't fit in 32 bits?
Re: Multitasking problem
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.
Code: Select all
extern char <name>[];
Carpe diem!
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
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:
How i convert it:
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_
Code: Select all
objcopy -O elf32-i386 -B i386 -I binary font.psf font.o
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Multitasking problem
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.
Try "readelf -s -W" or "objdump -t" and you'll see the correct symbol names.
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
Hello! How i can translate virtual address to physical knows only the page directory and virtual address?
Re: Multitasking problem
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).
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
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?
And how correctly get page table address from page directory?
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Multitasking problem
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.
You can get the physical address from the entry by using bitwise AND to mask the lower 12 bits.
-
- Member
- Posts: 97
- Joined: Thu Jul 14, 2022 9:45 am
- Contact:
Re: Multitasking problem
How i can mask 12 bits in C? Can you give example of it?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.