IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Assembleur Discussion :

Connaitre la taille de la RAM


Sujet :

Assembleur

  1. #21
    Membre du Club

    Inscrit en
    Août 2003
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Août 2003
    Messages : 33
    Points : 45
    Points
    45
    Par défaut
    Je remonte le sujet...
    Je viens de trouver une docs interressante sur le sujet:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    Counting RAM using the BIOS
    You can determine RAM size with the BIOS via two different calls.
     
    The first call is built in nearly every BIOS, the later call is only contained within newer BIOS's (from Ralf Browns Interrupt List:)
     
        --------B-1588-------------------------------
        INT 15 - SYSTEM - GET EXTENDED MEMORY SIZE (286+)
          AH = 88h
          Return: CF clear if successful
            AX = number of contiguous KB starting at absolute address 100000h
            CF set on error
          AH = status
            80h invalid command (PC,PCjr)
            86h unsupported function (XT,PS30)
    Notes: DOS TSRs which wish to allocate extended memory for themselves often hook this call, and return a reduced memory size. They are then free to use the memory between the new and old sizes at will. RFC: that TSR-thing is irrelevant for OS-programming, imho
     
    the standard BIOS only returns memory between 1MB and 16MB; use AH=C7h for memory beyond 16MB not all BIOSes correctly return the carry flag, making this call unreliable unless one first checks whether it is supported through a mechanism other than calling the function and testing CF
     
        SeeAlso:AH=87h,AH=8Ah"Phoenix",AH=C7h,AX=DA88h,AX=E801h,AX=E820h
     
        --------b-15E820-----------------------------
        INT 15 - newer BIOSes - GET SYSTEM MEMORY MAP
          AX = E820h
          EAX = 0000E820h
          EDX = 534D4150h ('SMAP')
          EBX = continuation value or 00000000h to start at beginning of map
          ECX = size of buffer for result, in bytes (should be >= 20 bytes)
          ES:DI -> buffer for result (see #00560)
          Return: CF clear if successful
            EAX = 534D4150h ('SMAP')
            ES:DI buffer filled
            EBX = next offset from which to copy or 00000000h if all done
            ECX = actual length returned in bytes
            CF set on error
              AH = error code (86h) (see #00475 at INT 15/AH=80h)
    Notes: originally introduced with the Phoenix BIOS v4.0, this function is now supported by most newer BIOSes, since various versions of Windows call it to find out about the system memory a maximum of 20 bytes will be transferred at one time, even if ECX is higher; some BIOSes (e.g. Award Modular BIOS v4.50PG) ignore the value of ECX on entry, and always copy 20 bytes some BIOSes expect the high word of EAX to be clear on entry, I.e. EAX=0000E820h
     
    if this function is not supported, an application should fall back to AX=E802h, AX=E801h, and then AH= 88h the BIOS is permitted to return a nonzero continuation value in EBX and indicate that the end of the list has already been reached by returning with CF set on the next iteration this function will return base memory and ISA/PCI memory contiguous with base memory as normal memory ranges; it will indicate chipset-defined address holes which are not in use and motherboard memory-mapped devices, and all occurrences of the system BIOS as reserved standard PC address ranges will not be reported
     
        SeeAlso:AH=C7h,AX=E801h"Phoenix",AX=E881h,MEM xxxxh:xxx0h"ACPI"
     
        Format of Phoenix BIOS system memory map address range descriptor:
        Offset      Size    Description     (Table 00559)
         00h        QWORD   base address
         08h        QWORD   length in bytes
         10h        DWORD   type of address range (see #00560)
     
        (Table 00560)
        Values for System Memory Map address type:
         01h        memory, available to OS
         02h        reserved, not available (e.g. system ROM, memory-mapped device)
         03h        ACPI Reclaim Memory (useable by OS after reading ACPI tables)
         04h        ACPI NVS Memory (OS is required to save this memory between NVS
                      sessions)
         other      not defined yet -- treat as Reserved
     SeeAlso: #00559

  2. #22
    Candidat au Club
    Inscrit en
    Août 2004
    Messages
    5
    Détails du profil
    Informations forums :
    Inscription : Août 2004
    Messages : 5
    Points : 4
    Points
    4
    Par défaut
    la doc c'est ralf brown cherche laba c tres interessant
    mais G une kestion pour le multiplixeur int 0x2f pour le lecteur CD
    sous nommé MSCDEX est ce ke ca fait partie du bis ou du dos
    car actuellement je veut implementer ce code
    INT 0x2F ????DOS OU BIS

  3. #23
    Responsable Pascal, Lazarus et Assembleur


    Avatar de Alcatîz
    Homme Profil pro
    Ressources humaines
    Inscrit en
    Mars 2003
    Messages
    7 946
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ressources humaines
    Secteur : Service public

    Informations forums :
    Inscription : Mars 2003
    Messages : 7 946
    Points : 59 446
    Points
    59 446
    Billets dans le blog
    2
    Par défaut
    Salut !

    MSCDEX est fourni avec le DOS.

  4. #24
    Membre averti
    Avatar de VBurel
    Profil pro
    Développeur Indépendant
    Inscrit en
    Août 2004
    Messages
    121
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Indépendant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Août 2004
    Messages : 121
    Points : 358
    Points
    358
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par Albus
    Salut,
    j'ai un moyen tout simple pour trouver la taille de la RAM (hé, hé, hé... )
    tu fais un compteur ecx allant de 0 à 4294967296-1 (soit 0xFFFFFFFF)
    et tu essayes de lire a l'adresse [ecx]: ex: mov eax, [ecx]
    -> si ya de la RAM à cet endrois, ça marche
    -> sinon ça déclenche une exception du genre "segment fault"
    l'idée est bonne, et elle marche à un petit détail prèt :
    lire ou ecrire dans la RAM ne génère pas d'exception, même si l'adresse ne correspond pas à de la mémoire physique. Donc pour tester la validiter d'une adresse il faut :

    1- ecrire qqc dedans (write access)
    2- lire ce qu'on a mis dedans (read access)
    3- vérifier que ce qu'on a lu est égal a ce qui a été écrit.

    si c'est différent alors l'adresse logique ne correspond pas à un emplacement physique en RAM (commencer le test au dessus du Mo)

    VB

Discussions similaires

  1. [C#] Comment connaitre la taille d'un fichier.
    Par PascalCmoa dans le forum Windows Forms
    Réponses: 6
    Dernier message: 09/02/2018, 08h54
  2. Réponses: 7
    Dernier message: 08/06/2005, 11h04
  3. [JSP] Connaitre la taille d'un fichier
    Par dst dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 21/06/2004, 17h22
  4. [JVM] Connaitre la taille mémoire utilisé par les dif classe
    Par sur_uix dans le forum Général Java
    Réponses: 4
    Dernier message: 18/09/2003, 09h17
  5. recuperer la frequence du proc , la taille de la RAM , ..
    Par Cthulhu 22 dans le forum C++Builder
    Réponses: 5
    Dernier message: 05/09/2002, 12h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo