Page 1 of 1

problem with pm

Posted: Fri Aug 10, 2001 11:00 pm
by Thomas Sendelbach
I have a bootloader which switches to protected mode
and than jmps to a c-programm (my kernel)
the kernel creates some descriptors
one of them is a video_descriptor he points to the
address 0xb8000.
So how can I access this memory
char *video=(char*)0xb8000;
or
char *video=(char*)descriptornumber;

p.s. i am from german so my english is quite bad

RE:problem with pm

Posted: Fri Aug 10, 2001 11:00 pm
by Thomas Sendelbach
>On 2001-08-11 02:59:42, Thomas Sendelbach wrote:
>I have a bootloader which switches to protected mode
>and than jmps to a c-programm (my kernel)
>the kernel creates some descriptors
>one of them is a video_descriptor he points to the
>address 0xb8000.
>So how can I access this memory
>char *video=(char*)0xb8000;
>or
>char *video=(char*)descriptornumber;
>
>p.s. i am from german so my english is quite bad

the bootloader created the gdt and a code and a data descriptor
and now the kernel creates the videodescriptor
so now the post is complete

RE:problem with pm

Posted: Fri Aug 10, 2001 11:00 pm
by Guest
>char *video=(char*)0xb8000;
>or
>char *video=(char*)descriptornumber;

Try 'em both... :)

Actually, what you have to do is load a segment
register with your new descriptor.

In assembly:
mov es, VIDEO_SEG

And then you can access video memory as es:offset
(es:di, for example).

You're getting into far pointers though... it'll
be faster just to define one segment for everything,
starting at 0x0, with a length of 0xfffff pages
and then you can access video memory like this:

char *video = (char *)0x000b8000;
video[offset] = data;

>p.s. i am from german so my english is quite bad

No problem... I just hope I didn't make any
"hang-over" mistakes :)

RE:problem with pm

Posted: Fri Aug 10, 2001 11:00 pm
by Guest
>On 2001-08-11 15:27:11, Anonymous wrote:
>>char *video=(char*)0xb8000;
>>or
>>char *video=(char*)descriptornumber;

pokeb(video_selector, 0, 'A');
or maybe
pokeb(linear_memory_selector, 0xB8000, 'A');

>char *video = (char *)0x000b8000;
>video[offset] = data;

That only works with paging, or if the kernel
data segment has base address 0. If the base
address is not 0, you must subtract it:

char *video = (char *)(0xB8000 - kernel_ds_base);
video[0] = 'A';
video[1] = 0x1F; /* white on blue */