rbj@druhi.ATT.COM (Russell B. Jorgensen) (06/09/91)
I've been experimenting around with writing some protected mode programs for my PC/AT (iAPX286 processor w/ 4 Mb). But, I've run into a snag when accessing memory over 1Mb. Basically, both the 1st and 2nd meg of memory seem to be physically the same, the 3rd and 4th meg of memory the same, etc. To prove the point to myself, I used the following subroutine -- it just writes 0, 1, 2, ... into the first location of each 64K segment, and then prints out the value in the first location of each 64K segment. As you can see from the output that follows, both the 1st and 2nd meg of memory contain the values that were written into the 2nd meg, the 3rd and 4th meg exhibit the same symptoms, etc. The seg_alloc() routine searches the GDT for an empty slot, fills in the limit, base_low, base_hi, and access fields, and returns a 32-bit pointer to the base of the new segment. The program was compiled large model. I've printed out the GDT to verify that seg_alloc() is working, and also verified that the virtual addresses seg_alloc() is returning are sane. I'm not getting any general protection faults, so I'm 99% sure that all of my virtual memory setup is sane. I'd really appreciate it if somebody who has had some experience with this would take a look at it -- I'm at my wit's end! Thanks. Russ Jorgensen ...!att!druhi!rbj rbj@druhi.att.com P.S. I run Microport SysV/AT UNIX most of the time, so I'm discounting the possibility of a hardware problem, since UNIX is steady as a rock (ie., no weird crashes). ========================= memory test subroutine ======================= extern char *seg_alloc(); unsigned int *vaddr[256]; void tst_mem () { int i; unsigned long paddr; /* write into memory */ paddr = 0L; for (i=0; i<256; i++) { vaddr[i] = (unsigned int *) seg_alloc (paddr, 0xffff); *(vaddr[i]) = i; paddr += 0x00010000L; } /* read from memory */ for (i=0; i<256; i++) kprintf ("%4.4x ", *(vaddr[i])); } ============================= output ============================== 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 ffff 001b ffff ffff 484c 484c 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 ffff 001b ffff ffff 484c 484c 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f 0050 0051 0052 0053 0054 0055 ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff 0050 0051 0052 0053 0054 0055 ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff
feustel@netcom.COM (David Feustel) (06/10/91)
You probably need to enable the A20 address line. -- David Feustel, 1930 Curdes Ave, Fort Wayne, IN 46805, (219) 482-9631 EMAIL: feustel@netcom.com or feustel@cvax.ipfw.indiana.edu
ephram@violet.berkeley.edu (Ephram Cohen;B50 Tolman Hall;25352;4156548978;LE56) (06/11/91)
In article <8980@drutx.ATT.COM> rbj@druhi.ATT.COM (Russell B. Jorgensen) writes: >I've been experimenting around with writing some protected mode programs >for my PC/AT (iAPX286 processor w/ 4 Mb). But, I've run into a snag >when accessing memory over 1Mb. Basically, both the 1st and 2nd meg of >memory seem to be physically the same, the 3rd and 4th meg of memory the >same, etc. I can not say for sure but it may be that address line 20 on the buss is disabled. There should be a function call to enable address line 20. You should mention what kind and version of BIOS you have. -- We must prevent those commies from compromising the integrity of our precious bodily fluids. -Gen. Jack D. Ripper Ephram Cohen ephram@violet.berkeley.edu 466 44th St. #1 3210 Tolman Hall