Changeset 58af50d in rtems


Ignore:
Timestamp:
11/20/14 14:00:27 (9 years ago)
Author:
Jan Dolezal <dolezj21@…>
Branches:
4.11, 5, master
Children:
d885b2b2
Parents:
ec494ff
git-author:
Jan Dolezal <dolezj21@…> (11/20/14 14:00:27)
git-committer:
Gedare Bloom <gedare@…> (11/20/14 14:52:38)
Message:

score: i386: functions converting real mode pointer to physical address and back

Location:
cpukit/score/cpu/i386
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/cpu/i386/cpu_asm.S

    rec494ff r58af50d  
    328328        ret
    329329
     330/*
     331 *  int i386_Physical_to_real(
     332 *     void     *address,
     333 *     uint16_t *segment,
     334 *     uint16_t *offset
     335 *  );
     336 *
     337 *  Fills segment:offest realmode pointer counted from thirty-two bit physical
     338 *  address.
     339 *  Returns 0 if unconvertible, 1 if successfuly converted.
     340 */
     341
     342.set PHYS_PTR_ARG,   4
     343.set RM_PTR_SEG_ARG, 8
     344.set RM_PTR_OFF_ARG, 12
     345
     346       PUBLIC (i386_Physical_to_real)
     347
     348SYM (i386_Physical_to_real):
     349        movl    PHYS_PTR_ARG(esp),eax
     350        cmpl    $0x10FFF0, eax
     351        js      1f
     352        movl    $0, eax
     353        ret
     3541:      cmpl    $0x100000, eax
     355        js      2f
     356        subl    $0xFFFF0, eax
     357        movl    RM_PTR_OFF_ARG(esp), ecx
     358        movw    ax, (ecx)
     359        movl    RM_PTR_SEG_ARG(esp), ecx
     360        movw    $0xFFFF, (ecx)
     361        movl    $1, eax
     362        ret
     3632:      movl    eax, edx
     364        and     $0xF, ax
     365        movl    RM_PTR_OFF_ARG(esp), ecx
     366        movw    ax, (ecx)
     367        shrl    $4, edx
     368        movl    RM_PTR_SEG_ARG(esp), ecx
     369        movw    dx, (ecx)
     370        movl    $1, eax
     371        ret
     372
    330373END_CODE
    331374
  • cpukit/score/cpu/i386/rtems/score/i386.h

    rec494ff r58af50d  
    187187
    188188/*
     189 *  i386_Real_to_physical
     190 *
     191 *  Converts real mode pointer {segment, offset} to physical address.
     192 */
     193RTEMS_INLINE_ROUTINE void *i386_Real_to_physical(
     194    uint16_t segment,
     195    uint16_t offset)
     196{
     197    return (void *)(((uint32_t)segment<<4)+offset);
     198}
     199
     200/*
     201 *  i386_Physical_to_real
     202 *  Retreives real mode pointer elements {segmnet, offset} from physical address
     203 *  Function returns the highest segment (base) address possible.
     204 *  Example:    input   address - 0x4B3A2
     205 *              output  segment - 0x4B3A
     206 *                      offset  - 0x2
     207 *              input   address - 0x10F12E
     208 *              output  segment - 0xFFFF
     209 *                      offset  - 0xF13E
     210 *
     211 *  return  0 address not convertible, must be less than 0x10FFEF
     212 *          1 segment and offset extracted
     213 */
     214int i386_Physical_to_real(
     215  void *address,
     216  uint16_t *segment,
     217  uint16_t *offset
     218);
     219
     220/*
    189221 *  "Simpler" names for a lot of the things defined in this file
    190222 */
Note: See TracChangeset for help on using the changeset viewer.