Motorola MC68030 User Manual page 381

Enhanced 32-811 microprocessor
Hide thumbs Also See for MC68030:
Table of Contents

Advertisement

the table size}. By convention, the first entry maps the supervisor address
space and has supervisor protection. The routine never modifies this first
entry. The 31 entries after the first are available to be allocated as user address
space.
A routine similar to this that linearly extends (grows) a previously allocated
memory block could be written. A stack is a good example. The operating
system can allocate the top of the memory (the thirty-second upper level
table entry) as a stack that grows downward from the highest address. If a
task needs several large stacks, a 16-Mbyte block can be used for each stack,
with a software flag set to indicate growth in a downward direction.
The logic of Vallocate is:
1. Validate the request and calculate number of pages required.
2. Scan each upper table entry's lower page tables (where they exist)
looking for an adequate group of unallocated pages.
3. If no space is found,see if the lower table is less than its maximum size
and if the block can be allocated by expanding it at the end.
4. If still no space is found, use the next free upper table entry and initialize
its new lower level page table to allocate the block here.
5. Set allocated page entries to indicate virgin status (allocated, invalid,
and not swapped out).
6. Return status. If status is OK, also return virtual address.
The code for Vallocate is:
Vall ocate (SlzelnBytes, VlrtualAddressReturned, StatuS)i
/* The following are global to all routines
/* Symbolicly define the upper level pointer table
Declare Upper_Table[32] Record of
Status=(unallocated, allocated),
LimiCField=(O to 4k),
Pointer;
f
lower table here or not
f
limit for lower page table
faddress of lower page table if allocated
*'
*'
*' *'
*'
/* Symbolicly define the lower level page table
*'
Declare Lowec Table[O to Limit_Field] Based Record of
Status=(invalid_unallocated,
fnot allocated to User
*'
invalid-paged_out,
/*allocated but paged out
*'
invalid_virgin,
fallocated but not yet used
*'
valid_in_memory),
fallocated and in memory
*'
Pointer;
fphysical address or disk address of page
*'
MOTOROLA
MC68030 USER'S MANUAL
9-79

Advertisement

Table of Contents
loading

Table of Contents