Hello,
I've used a similar technique, for sharing memory (256 Mb computer but the amount of
mem doesn't matter here) , rtai_shm is not appropriate here because I must have big (8
Mb) block of contiguous physical memory to share with others device via a VME /PCI
bridge
I changed my lilo.conf file with :
append="248M"
then, run lilo again (obvious but I forgot to do it once .... ).
And, .... I got a segmentation fault when I try to insert my module that want s to
access my shared memory.
I then did a dmesg in order to check what happened. It turned out that the faulty
instruction (assembly level), was a move to the first address of shared memory, the
kernel indicated that it cannot handle a page fault at the address of my first word
of
shared memory.
After that I tried to inspect the GDT (a quick hack in inline assembly with a simple
SGDT statement. Note that you can do it even in user mode ) , and segment register
(dumped in log file when the segmentation fault occured, Data one DS/ES (code didn't
seem to be involved)).
This leads me to discover that :
- The segment descriptors pointed to the GDT (I really expected it ;-)).
-The pointed GDT entry was a full flat segment with base 0 and limit set to FFFFF (
it was the third (segment register value were 0x18 which means third entry in the GDT
with requested priviledge level). one in the GDT, but honnestly I don't know the
exact structure of the GDT for linux )
So, I decided to try to inspect the page table with a simple gdb session as root :
gdb /usr/src/linux/vmlinux /proc/kcore
And then I ask to see memory, at the CR3 value (0x0xxxxxx) that was indicated by the
kernel panic (normally at that time the CR3 register should contains the physical
address of the page table register). But unfortunately, the debugger can't access this
address (or more precisely the equivalent virtual address).
After that, I remembered that the kernel address space was made of large pages, and
that my address (248 Mb after 0) was just on a 4Mb aligned address and that would
logically generate a page fault (Am I right here ?) ... So I decided to change my
lilo.conf to
append="mem=245M"
And then, I could access my memory till (248Mb-1 byte). So I came to the conclusion
that maybe there is something wrong with the page table setting. But if I change that,
how can I prevent the regular linux kernel to use that memory for it's own use ?
So my questions is:
How can I actually use more than 4Mb ofcontiguous memory ?
Configuration:
- VME PC PentiumII Mobile 400Mhz with 256Mb (VMIC 7695).
- Suse Linux 7.0 Professionnal (Kernel 2.2.16) with RTAI 1.5 on top of it.
My module do the following in order to access the shared memory:
- I setup a base pointer, to the value of the high_memory variable (= virtual address
of the TOP of the "declared" RAM, BTW if somebody could explain me the difference
between high_memory and memory_end, that would be interresting ...).
- I initialize the VME Bridge
- Then do a simple write access to memory.
The "funny" part of it is that I could access the whole memory over the VME bus ....
Laurent Kersten
ABSp.
"Estabridis, Janet P" <[EMAIL PROTECTED]> on 11/27/2000 07:10:45 PM
To: "'RT Linux Group'" <[EMAIL PROTECTED]>
cc: (bcc: Laurent KERSTEN/BE/ALCATEL)
Subject: [rtl] Linux BootPrompt Question
Hi,
I want use the old type of shared memory on my embedded system running the
miniRTL (kernel 2.2.14 rtlv2.3). I have 128MBytes of memory and I have
added the statement:
append="mem=125M"
to the linux.cfg file on the disk.
Here is my linux.cfg file:
.\zimage
append="mem=125M"
append=load_ramdisk=1
initrd=root.rtl
initrd_archive=minix
ramdisk_size=50000
root=/dev/ram0
boot=/dev/hda1,msdos
RTL=etc,sshd,log,local,modules,thttpd
RTLPATH=/linux/
The problem is that I do not see the memory getting set aside when I do a
more on /proc/meminfo. Consequently, I get a Segmentation Fault when I
insert the module and there are any statements that try and access any
shared memory variables.
Can I not use this type of shared memory anymore ?
I'm I doing something stupid and I need enlightenment?
Thanks in advance --
Janet Estabridis
Electrical Engineer
NAWC Code 472E40D
Building 31440 Room 1017
China Lake, CA 93555
[EMAIL PROTECTED]
(760) 939-2896 FAX (760) 939 -3075
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/