IRQs...botchs....real PC

2»

Comments

  • : I think you misunderstood me i know that the file isnt stored in the
    : file allocation table, what i meant was for example say i have a 1MB
    : file that i want to load, and i try to malloc 1MB of memory, what
    : happens if there isnt a 1MB block of continuous memory, should the
    : file be split over several blocks? (similar to the way a file is
    : stored on a disk with it split over clusters in different
    : locations?) or should i just return an error saying that there isnt
    : enough memory, i could not work out the problme with the disk
    : driver, so in the end i just implemented the DMA, which was
    : suprprisingly easy.
    :

    Thats up to you. Most OSs, like Windows, allocate different clusters
    using a linked-list like structure to map them as part of the same
    file.

    And, if you start running out of memory, virtual memory or pagefiles
    will work.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • That is pretty much what i thought, but i am wondering if, for example, you load a program into memory (this example will asume that other files will have been loaded and removed previously) how will the program know the address in memory to call when it gets to the end of that chunk...e.g:
    (OP = Our Program)
    MEMORY (RAM)
    | 1KB | 1KB | 1KB | 1KB |
    | File1 | OP (1st 1KB chunk) | Another File | OP (2nd chunk) |

    This example loads a program (something that intends to be executed not displayed) into memory, it is 2 KB long, so the pointer to the program would be at byte 1025 (1st byte of second 1KB chunk) but how would the OS know that once it executed the opcode at byte 2048 that it needed to junp to byte 3073 (1st byte of 4th 1KB chunk)?

    would i need to load 1023 bits per chunk and put a jump command in the last byte for example?

    I would have no problem loading a file into memory and being able to display all of the chunks it would be very similar to reading a FAT table in reality, the problem i have is how would you execute code that is split accross memory?

    I think i have explained fully what i mean

    Thanks


  • I recommend taking a look at paging. The MMU (Memory Management Unit)
    in an x86 motherboard provides a way to map a virtual address space
    into a physical address space. This insures all programs (And files, for
    that matter) begin at virtual address 0000:0000, but are loaded at
    a different physical address. This solves a programs' relocation
    problem.

    Using Paging, you can load all programs into a virtual address space,
    and not worry about memory fragmentation, as they would all have their
    own virtual space.

    This, alng with Virtual Memory, are the most common ways, anyways.
    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • Has anyone else noticed how much smaller this thread becomes in Threaded view?

    I wonder what it would look like in another 10 replys :-D
    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • This might help:

    [link=http://www.osdev.org/wiki/Page_Frame_Allocation]Page Frame Allocation[/link]

    This should give you some ideas, anyways.
    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • Interesting--It seems my reply counter in my page isnt going up :-/
  • That looks lie a really good set of information, i think what i have working for me is a flat list, it allocates 1KB blocks, and then allocates a series of 1KB blocks if the program is bigger than this, i think that for now this will do, it would not be an enormous job to change the memory management system when things become larger and more complicated, for now i think i will concentrate on getting the HDD and net adapters working... (i thought the HDD would be easy after the FDD...but i was wrong) lol

    thanks for the help so far
  • : (i thought the HDD would be easy
    : after the FDD...but i was wrong) lol

    Nothing is ever easy with OS dev.

    Ever:-)

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • LOL i am aware of that, but i thought that after programming one disk driver i would have gotten to grips with that kind of thing, but the damnded thing isnt giving me any data (it returns 0's from the status ports and doesnt give an Interupt)....am i right in thinking that the primary IDE channel is at address 1f0h, and secondary at 170h?
  • Those ports are correct for the IDE controller -- But not for SCSI.

    Do you have an IDE or SATA drive? The IDE Controller only works for
    devices connected via IDE cables, and wont work for SATA.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • I have a small hard drive connected to the primary IDE and two dvd re-writers connected to the secondary IDE and 3 SATA hard drives
  • : I have a small hard drive connected to the primary IDE and two dvd
    : re-writers connected to the secondary IDE and 3 SATA hard drives
    :

    Did you set Bochs to a virtual disk drive?

    Heres an example config file:
    [code]
    #---------------------------
    # Enable 4 ATA channels
    #---------------------------
    ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
    ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
    ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e8, irq=11
    ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x368, irq=9

    #---------------------------
    # ATA image files
    #---------------------------

    # It is HIGHLEY recommended to use an image file for
    # the hdd. Bochs will emulate this hdd as the primary master
    ata0-master: type=disk, path=hdd_primary.img, cylinders=615, heads=6, spt=17

    # A slave drive
    ata0-slave: type=disk, path=hdd_slave, cylinders=615, heads=4, spt=17

    # A CD drive
    ata1-slave: type=cdrom, path=cd.img, status=inserted

    #You can continue adding primary/slave drives up to ATA4
    [/code]

    I suspect this is the problem. Bochs does not work directly with hdds
    under Windows (Altough it does with Linux), but there is no need for it.
    It will emulate the image file as the primary master in the example above.

    [b]Note: This will not effect any physical hdd on your system. However,
    when testing on a real mahine, it will, of course, read/write the physical
    hdd. Be careful:-)[/b]

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories