[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Corruption of high TPA



Petr Stehlik wrote:
Please try running the attached executable and post your results.

Thanks for this nice program !

I have slightly modified it, see attached files:

1) Modified for gas syntax

2) Added the following thing to avoid the crash.
 	sub.l	#64,d0		| stack adjustment for buggy OS
I think the MiNTLib should be fixed like that.

3) Additional stuff displayed.

Here is the output on my problematic system:
  Basepage = $0272C000
Initial SP = $02B2DFD8
  High TPA = $02B2E000

I use aranym-mmu.exe 0.9.8 beta on Windows.
See the attached config.
There is the following line :
FastRAM = 32

My kernel is FreeMiNT v1.16.3-ALPHA compiled May  1 2005
I don't know if it is an official version or not.

My MINT.CNF is attched.
The following lines are interesting :
KERN_MEM_PROT=YES
KERN_SECURITY_LEVEL=2
KERN_MPFLAGS=1
TPA_INITIALMEM=4096

I have set_mmu.prg in the AUTO folder, too.
The attached file MMUSETUP.CNF is in my C:\

I didn't manage to reproduce the problem on another ARAnyM setup, however I didn't try a lot.

I hope this information will be useful for memory protection gurus.

--
Vincent Rivière
	move.l	sp,a4

	move.l	4(sp),a0	| get basepage
	move.l	a0,a5

	move.l	4(a0),d0	| get _base->p_hitpa
	move.l	d0,a6

	and.l	#0xfffffffc,d0	| align on lower 4 bytes
	
	sub.l	#64,d0		| stack adjustment for buggy OS

	move.l	d0,sp		| this is the new stack

| Print basepage
	pea	msgbp
	move.w	#9,-(sp)	| Cconws()
	trap	#1
	addq.l	#6,sp
	
	move.l	a5,d0
	bsr	printnum
	
	pea	eol
	move.w	#9,-(sp)
	trap	#1
	addq.l	#6,sp
	
| Print initial sp
	pea	msgisp
	move.w	#9,-(sp)	| Cconws()
	trap	#1
	addq.l	#6,sp
	
	move.l	a4,d0
	bsr	printnum
	
	pea	eol
	move.w	#9,-(sp)
	trap	#1
	addq.l	#6,sp
	
| Print high TPA
	pea	msgtpa
	move.w	#9,-(sp)	| Cconws()
	trap	#1
	addq.l	#6,sp
	
	move.l	a6,d0
	bsr	printnum
	
	pea	eol
	move.w	#9,-(sp)
	trap	#1
	addq.l	#6,sp
	
| Wait for key
	move.w	#8,-(sp)	| Cnecin()
	trap	#1
	addq.l	#2,sp

	clr.w	-(sp)		| Pterm0()
	trap	#1

printnum:
	movem.l	d0-d3/a0-a3,-(sp)
	move.l	d0,d1
	moveq	#7,d2
	lea	.prtend(pc),a0
.prloop:
	move.l	d1,d0
	asr.l	#4,d1
	and.l	#0x0F,d0
	add	#'0',d0
	cmp	#'9',d0
	ble	.pr2
	add	#('A'-'9'-1),d0
.pr2:	move.b	d0,-(a0)
	dbf	d2,.prloop
	pea	(a0)
	move	#9,-(sp)
	trap	#1
	addq	#6,sp
	movem.l	(sp)+,d0-d3/a0-a3
	rts
	.ds.b	8
.prtend:	dc.b	0
	.even

msgbp:	.asciz	"  Basepage = $"
msgisp:	.asciz	"Initial SP = $"
msgtpa:	.asciz	"  High TPA = $"

eol:	.dc.b	13,10,0

Attachment: print_s2.tos
Description: Binary data

# This is the configuration file for SET_MMU.PRG, and must be located in either
# the root directory of the boot drive or in the autofolder.

# This is the file I use when I want to split the Hades RAM into ST and TT
# RAM. Copy this file to the root of you boot partition and rename to MMUSETUP.CNF
# to use it.

# Split RAM into ST and TT RAM
split_ram=no

# "pagesize" can be either 4k for 4k pages or 8k for ..eh.. 8k pages.
pagesize=8k

# With the "cacr" variable you set the cacr cpu register.
# The following are the following flags you can use...
#
# edc  - Enable Data Cache
# nad  - No Allocate Mode (data cache)
# esb  - Enable Store Buffer
# dpi  - Disable CPUSH Invalidation
# foc  - 1/2 cache operation mode enable (data cache)
# ebc  - Enable Branch Cache
# cabc - Clear all entries in the branch cache
# cubc - Clear all user entries in the branch cache
# eic  - Enable Instruction cache
# nai  - No Allocation Mode (instruction cache)
# fic  - 1/2 cache operation mode enable (instruction cache)
cacr=edc,esb,ebc,cabc,eic

# itt0, dtt0, itt1 and dtt1 sets the cpu registers with the same name to the
# value give here. These are the "Transparent Translation Registers".
# Since we are covering everything in the tree, we turn Trasparent Translation off.
# This also fixes (I hope) the problems that Mach64 users have had.
itt0=$0
dtt0=$0
itt1=$0
dtt1=$0

# To define a block of logical addressing area, used to build the translation
# tree, the following variables are used for each block you wich to define.
# logical  - The logical start address of the block to define
# physical - The physical start address of the block. The logical and physical
#            addresses are set equal in most cases. The CPU always uses logical
#            addresses to access memory, and then uses to tranlation tree to
#            obtain the actual physical address of that memory.
# size     - The size of the block.
# pd_flags - This is used to set initial flags in the page descriptors, as the
#            tree is built. For example  the caching mode is set using this flag.
# These are the following flags you can use with pd_flags. It is highly
# recommended you only use this to set the cache-mode, unless you know what you
# do!
#
# - The following flags are understood, but not used! pdt_r1 is always forced
# - into the pdt field of page descriptors. Also, SET_MMU can not create
# - indirect page descriptors at this time!
#
# pdt_iv    - Page Descriptor Type = invalid  ( %00 )
# pdt_r1    - ------- "" --------  = Resident ( %01 ) This is the pdt value set
#                                                     by SET_MMU.
# pdt_r2    - ------- "" --------  = Resident ( %11 )
# pdt_id    - ------- "" --------  = Indirect ( %10 )
#
# - The following flags can all be set at will, but dont do that unless you know
# - why you do it ;-)
#
# wp            - Write Protect, the Page is write protected
# used          - Used.
# modified      - Modified.
# super         - Page is supervisor accessible only.
# upa_0 - upa_3 - Sets the user page attribute field to 0,1,2 or 3
# global        - Global.
# ur1/ur2       - Sets the User reserved bit 11 (ur1) and 12 (ur2).
#
# The we have the caching modes..
#
# c_wt   - Cachable, Writetrought. Sets Writetrought caching.
# c_cb   - Cachable, CopyBack. Sets Copyback caching.
# c_p    - Cache inhibit, Precise exception model.
# c_ip   - Cache inhibit, ImPrecise exception model.
#
# All logical address spaces not defined by these blocks are marked INVALID in
# the translation tree.
#
# IMPORTANT: There *MUST* be an empty line between translation definition blocks!!
#
# Since we split the available RAM into ST/TT RAM, we need to first set up the
# block defining the ST RAM.
logical=$0
physical=$0
size=14*1024*1024
pd_flags=c_wt

# TOS ROM
logical=$00e00000
physical=$00e00000
size=1024*1024
pd_flags=c_p

# I/O space
logical=$00f00000
physical=$00f00000
size=1024*1024
pd_flags=c_p

# Then we set up the block that define the TT RAM. I have got a total of 40Mb in
# my Hades, and when 16Mb are gone ( 14Mb = ST ram, 2Mb lost ) we subtract that
# from the total amout of RAM available. I use 40-16=24Mb ( I WANT MORE RAM!! )
# This is the only thing you need to change in this file.
logical=$01000000
physical=$01000000
size=64*1024*1024
pd_flags=c_wt

# VideoRAM (10 MB)
#logical=$f0000000
#physical=$f0000000
#size=10*1024*1024
#pd_flags=c_p

# mirror
logical=$ff000000
physical=$ff000000
size=14*1024*1024
pd_flags=c_wt

logical=$ffe00000
physical=$ffe00000
size=1024*1024
pd_flags=c_p

logical=$fff00000
physical=$fff00000
size=1024*1024
pd_flags=c_p
# ---------------- FreeMiNT configuration file ---------------------
#
# The mint.cnf file is loaded, when the entire system is practically
# up, all device drivers and filesystem drivers have been loaded etc.
# If you want to control earlier settings, see mint.ini file.
#
# Edit this with a normal ASCII text editor. Lines starting with '#'
# are comments. Other lines are commands for MiNT to execute at boot
# up, or variables that control how MiNT behaves.

# NOTICE: as of FreeMiNT 1.16.0, the format of most keywords has
#         changed. Old keywords are still supported, however, you
#         cannot use this configuration file for older versions
#         of MiNT!

# The term `sysdir' we use here is short for `system directory' and
# means the directory, where you keep your mint.cnf file, your
# modules (XFS and XDD files) and other such system binaries. The
# sysdir value is usually u:/c/mint.
#
# For clarity, it is assumed all over this example file, that your
# boot drive is C:, and, if you have installed SpareMiNT distribution,
# that your SpareMiNT drive is E:. Note, that if you have installed
# SpareMiNT, you can refer to your sysdir as u:/boot/mint/

#
# -------------------- ACTUAL CONFIGURATION -----------------------
#

# Set current working directory to u: respective /
#
# FreeMiNT 1.16 does this automatically, this line is only required
# on previous versions (also on 1.16 alphas compiled before second
# half of July 2004).

#cd u:/

#
# ------------------ mint.cnf parser commands ---------------------
#

# The '#' sign at the begin of the line means that a comment follows.
# The entire line after the '#' sign will be ignored by the parser.

# Choose the AES : XaAES or MyAeS

#INIT=u:/c/mint/xaaes/xaloader.prg
INIT=u:/c/gemsys/myaes/myaes.tos
#INIT=u:/j/myaes2/myaes.tos

# The "set" directive controls the behaviour of the mint.cnf parser.
# It accepts one of three parameters:
#
#set -q - silent output (+q for verbose output)
#set -v - print command lines (+v don't)
#set -c - control interpretation of escape sequences

#set -q

# The include command allows you to include other files while the
# mint.cnf file is being interpreted. The included file will be
# interpreted as a part of the mint.cnf file.

#include u:/c/mint/vars.cnf

# More commands follow.

#
# Various stuff. This is usually the best configuration.
# See docs for details.
#

setenv ALERT YES

#
# Configure the filesystems
#

# UNIXMODE is used by all programs linked with MiNTlibs. See docs.
setenv UNIXMODE /brUs

#
# ---------------------- Kernel settings --------------------------
#

KERN_MEM_PROT=YES

#
# Here are things you can change if you want to. There are reasonable
# defaults for all of these.
#

# KERN_SLICES controls how long a process may run before being
# interrupted. The number means an amount of 20 ms time intervals.
#
# The default value (2) is usually best, but if you tend to run
# very processor intensive applications in the foreground, you might
# want to put KERN_SLICES=3 (this makes CPU hogs get more time than
# they otherwise would).
#
# The smaller the KERN_SLICES value, your processes have faster
# response time but the general performance is worse. Very fast
# machines however, may benefit from setting 1 here.

#KERN_SLICES=2

# KERN_DEBUG_LEVEL controls output of global debugging information.
# The higher the level, the more stuff MiNT will spew about about
# what it's doing.
#
# The average user doesn't want to hear about this stuff, so the
# default is 1, i.e. display ALERT messages only. Note that you need
# a debug kernel to get more: normal kernels do not contain so much
# debug information.
#
# KERN_DEBUG_DEVNO is the BIOS device number to which the info
# should be sent.
#
# Devno can be: 0=printer, 1=aux/modem, 2=screen (console), 3=midi,
# 4=keybrd, 5=raw.
#
# The default is the console.

#KERN_DEBUG_LEVEL=1
#KERN_DEBUG_DEVNO=2

# KERN_BIOSBUF controls how BIOS I/O is performed. Normally, MiNT
# tries to buffer this to provide a (considerable) improvement in
# speed. However, some applications may get upset by this.
#
# KERN_BIOSBUF=NO turns off all buffering for maximum compatibility.
# The default is YES.

KERN_BIOSBUF=YES

# KERN_SECURITY_LEVEL= enables the appropriate security level:
#
# 0 - recommended for single user setups, like MultiTOS (default).
# 1 - recommended for multiuser setups, like KGMD.
# 2 - full protection, unsupported by software, thus discouraged.

KERN_SECURITY_LEVEL=2

# KERN_MPFLAGS controls the memory protection behaviour. Its argument
# is a bitfield. Only the bit 0 is defined: 1 means, that more strict
# model of the protection should be enabled. Some programs may
# refuse to run, so the default is 0.

KERN_MPFLAGS=1

# TPA_FASTLOAD=YES forces fast loading (without zeroing all the
# memory) for all programs. This defines a default state, that can be
# modified later via appropriate kernel calls (use MiNT Setter
# utility to toggle it later when neessary, without reboots).
#
# TPA_FASTLOAD=NO (default) means that the information from the
# program header will be used to decide (this is like TOS does).

TPA_FASTLOAD=NO

# Set maximum additional TPA size for new processes
# (in kilobytes). The default is 1024. Better keep it low (1024 is
# what we call low) if your machine has 4 MB RAM or less.

TPA_INITIALMEM=4096

# FS_NEWFATFS= enables the new FAT filesystem driver for selected FAT
# filesystems. The old TOS FS will be used otherwise.
#
# The default depends on whether the TOSFS driver is compiled into the
# kernel or not. If it is, all drives are TOSFS by default. If not,
# all drives are NEWFATFS by default and this keyword has no effect.

#FS_NEWFATFS=A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,V,W,X,Y,Z

# FS_VFAT= enables VFAT extension for selected drives specified in the
# FS_NEWFATFS= command. The VFAT extension is disabled by default.
#
# If you use both TOS and MiNT, better don't enable VFAT extension
# on your boot drive.

FS_VFAT=R

# FS_VFAT_LCASE=YES tells the kernel to return lowercase filenames
# from VFAT directory searches. The default is NO.

FS_VFAT_LCASE=YES

# FS_WB_ENABLE= enables write back cache for selected drives. The
# write back cache is disabled by default. Also, it does not have
# any effect for TOSFS drives.

# FS_WB_ENABLE=E,F,H,I,J,K,L,M,ram

# FS_CACHE_SIZE= specifies the size of disk cache in kilobytes for the
# internal caching module. Default is 128.

FS_CACHE_SIZE=0

# FS_CACHE_PERCENTAGE specifies the size of the disk cache (in
# percents) to be filled with linear reads. The default is 5.

FS_CACHE_PERCENTAGE=10

# FS_UPDATE= set update time for system update daemon in seconds
# default is 5, it isn't recommended to use a value less than 4.

#FS_UPDATE=10

# Software write protection on filesystem level.

#FS_WRITE_PROTECT=R,S

# FDC_HIDE_B= tells the MiNT to remove floppy drive B: from the
# system.
# It is useful on single floppy systems to get rid of "Insert
# disk B: into drive A:" messages from the AES. Default is NO.

FDC_HIDE_B=YES

# PROC_MAXMEM= gives the maximum amount of memory that any process
# may use (in kilobytes). The default is to make this unlimited, but
# if you have a lot of memory and/or programs that grab more memory
# than they should, try setting this.
#
# E.g. to limit processes to 4096K of memory, remove the '#' at the
# beginning of the next line.
#
# WARNING: the process will not be allowed to allocate memory beyond
# the limit, and it won't "see" more memory as available from the
# system.
# Please understand that programs like "free" (or any other that
# interrogates the system how much memory is available) is a process
# as well, thus it will undergo this limit too!
#
# Decent shells (desktops) allow you to limit the maximum amount of
# memory independently for each program.

#PROC_MAXMEM=0

# Three commands, that define output files for RS-232, console and
# printer devices. The argument for each one must be a pathname.
#
# For best results, the convention u:/drive/pathname should be used
# for all specified pathnames from now on.

#GEMDOS_AUX=u:/c/mint/aux.out
#GEMDOS_CON=u:/c/mint/con.out
#GEMDOS_PRN=u:/c/mint/prn.out

# End of kernel settings

#
# -------------------------- Commands ------------------------------
#

# Here are some commands that you can give to MiNT:
#
# alias d: path -- make a fake "drive" that actually points to the
#                  given path
# cd path       -- changes MiNT's default directory
# echo message  -- print something on the screen
# exec program  -- runs a program; you must give the complete path
#                  and file extensions (e.g. c:/bin/echo.prg)
# include file  -- include another portion of the MINT.CNF file.
# sln path link -- make a symbolic link named "link" pointing to
#                  "path". "link" must be on drive U: for this to work

# Examples follow
#
# Notice you have to adjust commands below for your filesystem
# structure.
#
# You could use "alias" to provide a quick way of getting at
# nested directories, e.g. if you do
#
# alias r: u:/c/some/long/path
#
# then clicking on drive r: puts you into the folder c:/some/long/path

# The "sln" command may be used to create "links" on drive U:. If
# u:/foo is a link to c:/bar, then u:/foo/foo.txt is another way
# of saying c:/bar/foo.txt. Judicious use of links can make
# re-arranging hard disks and directories painless (if you always
# use the names on drive u:, it doesn't matter where you put
# the actual directories).

# Setting up the root filesystem for UNIX environment
#
# WARNING: directories listed in the left column must really exist!

sln h:/bin2      u:/bin
#sln e:/boot     u:/boot
#sln e:/etc      u:/etc
#sln e:/home     u:/home
#sln e:/lib      u:/lib
#sln e:/lost+found u:/lost+found
#sln e:/mnt      u:/mnt
#sln e:/opt      u:/opt
#sln e:/root     u:/root
#sln e:/sbin     u:/sbin
#sln e:/tmp      u:/tmp
#sln e:/usr      u:/usr
#sln e:/var      u:/var

# Some people want also to do this:

#sln u:/pipe/pty.A u:/dev/pty.A 
#sln u:/pipe/pty.B u:/dev/pty.B 
#sln u:/pipe/pty.C u:/dev/pty.C 
#sln u:/pipe/pty.D u:/dev/pty.D 
#sln u:/pipe/pty.E u:/dev/pty.E 
#sln u:/pipe/pty.F u:/dev/pty.F 
#sln u:/pipe/pty.G u:/dev/pty.G 
#sln u:/pipe/pty.H u:/dev/pty.H 
#sln u:/pipe/pty.I u:/dev/pty.I 
#sln u:/pipe/pty.J u:/dev/pty.J 
#sln u:/pipe/pty.K u:/dev/pty.K 

sln u:/ram      u:/tmp

# PCONVERT and UNIXMODE variables control some internals of
# MiNT Library.
#
# FreeMiNT 1.16.0 sets these two below automatically.
# Default values are as below.

setenv TMPDIR u:/ram
setenv TEMP u:/ram
setenv TMP u:/ram
setenv PCONVERT PATH,HOME,SHELL
setenv PATH c:/;c:/mint;c:/taskbar;c:/mint/toswin2
setenv SLBPATH c:/mint/slb
setenv OLGAMANAGER c:/tools/olga.app
setenv SDMASTER c:/mint/shutdown/gemhalt.prg
setenv TOSRUN c:/mint/toswin2/tw-call.app

# Examples follow
#
# Notice you have to adjust commands below for your filesystem 
# structure.
#
# You could use "alias" to provide a quick way of getting at
# nested directories, e.g. if you do
# alias r: u:/c/some/long/path
# then clicking on drive r: puts you into the folder c:/some/long/path

alias r: u:/ram

#
# start Draconis to MiNT-Net gateway
#
#exec u:/boot/mint/mgw.prg

#
# start Gluestik
#
#exec u:/boot/mint/gluestik.prg

#---------- Thing -----------
#setenv	AVSERVER THING
#setenv	THINGDIR h:/thing/thing127/thing
#setenv	FONTSELECT THING

#---------- Teradesk -----------
setenv	AVSERVER DESKTOP
setenv	FONTSELECT DESKTOP

#---------- Jinnee -----------
#setenv	AVSERVER JINNEE
#setenv	FONTSELECT JINNEE

setenv TMPDIR F:\

sln j:\usr u:\usr

#
# The "echo" command is really straightforward.
#
echo Setup complete, now booting the system...
echo
[GLOBAL]
FastRAM = 32
Floppy = 
;TOS = TOS404.IMG
;EmuTOS = ..\..\ROMs\etos512k.img
EmuTOS = F:\compil\emutos-CVS-20090611\etos512k.img
Bootstrap = 
BootstrapArgs = 
BootDrive =  
AutoGrabMouse = Yes
GMTime = No
Logo = logo.bmp

[HOTKEYS]
Setup = 19:0
Quit = 19:0x1
Reboot = 19:0x40
Ungrab = 0:0x141
Debug = 19:0x100
Screenshot = 316:0
Fullscreen = 302:0

[STARTUP]
GrabMouse = yes
Debugger = No

[JIT]
JIT = No
JITFPU = No
JITCacheSize = 8192
JITLazyFlush = 1
JITBlackList = 
JITInline = No

[VIDEO]
FullScreen = No
BootColorDepth = -1
VidelRefresh = 2
VidelMonitor = -1

[TOS]
Cookie_MCH = 50000
RedirConsole = No

[IDE1]
Present = No
IsCDROM = No
Path = disk-mmu.img
Cylinders = 16
Heads = 16
SectorsPerTrack = 63
ByteSwap = No
ModelName = AFROS
ReadOnly = No

[IDE0]
Present = Yes
IsCDROM = No
ByteSwap = No
ReadOnly = No
Path = diskdemo.img
Cylinders = 16
Heads = 16
SectorsPerTrack = 63
ModelName = Master

[PARTITION0]
Path = 
Present = No
PartID = BGM
ByteSwap = No
ReadOnly = No

[HOSTFS]
A = 
B = 
C = 
D = 
E = F:\cygwin\mintshare
F = 
G = 
H = ..\..\diskC
I = 
J = 
K = 
L = 
M = 
N = 
O = 
P = 
Q = 
R = 
S = 
T = 
U = 
V = 
W = 
X = 
Y = 
Z = 

[OPENGL]
Enabled = No
Filtered = No
Library = 

[ETH0]
Type = 
Tunnel = 
HostIP = 
AtariIP = 
Netmask = 
MAC = 00:41:45:54:48:30

[LILO]
Kernel = 
Args = 
Ramdisk = 

[MIDI]
Type = none
File = 
Sequencer = /dev/sequencer

[CDROMS]
A = -1
B = -1
C = -1
D = -1
E = -1
F = -1
G = -1
H = -1
I = -1
J = -1
K = -1
L = -1
M = -1
N = -1
O = -1
P = -1
Q = -1
R = -1
S = -1
T = -1
U = -1
V = -1
W = -1
X = -1
Y = -1
Z = -1

[AUTOZOOM]
Enabled = No
IntegerCoefs = No
FixedSize = Yes
Width = 1024
Height = 800

[NFOSMESA]
ChannelSize = 0
LibGL = libGL.so
LibOSMesa = libOSMesa.so

[PARALLEL]
Type = 
File = 
Parport = 

[NATFEATS]
CDROM = sdl
Vdi = vdi

[NFVDI]
UseHostMouseCursor = Yes

[IKBD]
WheelEiffel = No
AltGr = Yes