Combuster wrote: After an exception control is transferred to the kernel which DOES live above the 1MB mark. You are looking at the EIP of a JMP $ instruction inside the kernel.
![Embarassed :oops:](./images/smilies/icon_redface.gif)
I made a simple normal task not virtual and it was at 4KB (0x1000).
Inside this normal task I printed a char using direct access to
video memory 0xB8000 and every thing worked fine without any exceptions.
but when I tried to use my normal functions such as printf I got gpf.
what does this mean? why I couldn't use my functions there at 0x1000?
The logic behind that: an function thinks relative to itself. When you move a single function, all the functions related to it are somewhere completely different (they are now 1MB rather than a few bytes):Have you actually organised your code with an entry point of 0x1000 [ORG 0x1000]? If you are using C, you will need to link to entry point 0x1000.
I used the same task but this time I enabled VM bit in EFLAGS so this task
became a virtual task I tried to print a char using direct access to 0xB8000
but I got gpf this sould be fine as long as I don't have a gpf handluer,
Am I right?
Thanx.
* You can not normally use GCC to generate code for virtual 8086 tasks. This is because GCC generates 32-bit code while in virtual mode code is executed as 16 bits. The easiest way is to write 16-bit assembly with nasm/yasm and use that.
I think I didn't get this point quite right,would you please give me moreThe logic behind that: an function thinks relative to itself. When you move a single function, all the functions related to it are somewhere completely different (they are now 1MB rather than a few bytes):
I'm using C ,so how can I link to an entry point 0x1000?Have you actually organised your code with an entry point of 0x1000 [ORG 0x1000]? If you are using C, you will need to link to entry point 0x1000.
Code: Select all
ENTRY(__main);
phys = 0x1000;
SECTIONS
{
.text phys : AT(phys) {
...
...
}