Annotation of nono/vm/romemu_virt68k.h, revision 1.1.1.1

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2024 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // virt68k の IPLROM 相当の何か
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "rom.h"
                     14: 
                     15: class BootInfo;
                     16: class IODeviceStream;
                     17: class LoadInfo;
                     18: class MainRAMDevice;
                     19: 
                     20: class Virt68kROMEmuDevice : public ROMDevice
                     21: {
                     22:        using inherited = ROMDevice;
                     23: 
                     24:        // BootInfo (抜粋)
                     25: 
                     26:        // タグ
                     27:        static const uint BI_LAST               = 0;
                     28:        static const uint BI_MACHTYPE   = 1;    // machine type (uint32)
                     29:        static const uint BI_CPUTYPE    = 2;    // CPU type (uint32)
                     30:        static const uint BI_FPUTYPE    = 3;    // FPU type (uint32)
                     31:        static const uint BI_MMUTYPE    = 4;    // MMU type (uint32)
                     32:        static const uint BI_MEMCHUNK   = 5;    // memory segment (bi_mem_info)
                     33:        static const uint BI_RAMDISK    = 6;    // RAMDISK (bi_mem_info)
                     34:        static const uint BI_COMMANDLINE= 7;    // カーネルコマンドライン
                     35:                                                                                        //  パラメータ (C string)
                     36:        static const uint BI_RNG_SEED   = 8;    // 乱数シード (bi_data)
                     37: 
                     38:        #define BI_MACHDEP(x) (0x8000 + (x))
                     39:        static const uint BI_QEMU_VER   = BI_MACHDEP(0);        // (uint32)
                     40:        static const uint BI_GFPIC              = BI_MACHDEP(1);        // (bi_virt_dev *)
                     41:        static const uint BI_GFRTC              = BI_MACHDEP(2);
                     42:        static const uint BI_GFTTY              = BI_MACHDEP(3);
                     43:        static const uint BI_VIRTIO             = BI_MACHDEP(4);
                     44:        static const uint BI_CTRL               = BI_MACHDEP(5);
                     45: 
                     46:        // BI_MACHTYPE
                     47:        static const uint32 BI_MACH_VIRT        = 14;
                     48: 
                     49:        // BI_CPUTYPE
                     50:        static const uint32 BI_CPU_68020        = (1U << 0);
                     51:        static const uint32 BI_CPU_68030        = (1U << 1);
                     52:        static const uint32 BI_CPU_68040        = (1U << 2);
                     53:        static const uint32 BI_CPU_68060        = (1U << 3);
                     54: 
                     55:        // BI_FPUTYPE
                     56:        static const uint32 BI_FPU_68881        = (1U << 0);
                     57:        static const uint32 BI_FPU_68882        = (1U << 1);
                     58:        static const uint32 BI_FPU_68040        = (1U << 2);
                     59:        static const uint32 BI_FPU_68060        = (1U << 3);
                     60: 
                     61:        // BI_MMUTYPE
                     62:        static const uint32 BI_MMU_68851        = (1U << 0);
                     63:        static const uint32 BI_MMU_68030        = (1U << 1);
                     64:        static const uint32 BI_MMU_68040        = (1U << 2);
                     65:        static const uint32 BI_MMU_68060        = (1U << 3);
                     66: 
                     67:        // bi_mem_info {
                     68:        //  uint32 addr;
                     69:        //  uint32 size;
                     70:        // };
                     71:        //
                     72:        // bi_data {
                     73:        //  uint16 data_length;
                     74:        //  uint8[] data_bytes;
                     75:        // };
                     76:        //
                     77:        // bi_vert_dev {
                     78:        //  uint32 addr;
                     79:        //  uint32 irq;
                     80:        // };
                     81: 
                     82:  protected:
                     83:        // このデバイス先頭アドレス
                     84:        static const uint32 baseaddr            = 0xff000000;
                     85: 
                     86:        // 謎の I/O 空間
                     87:        static const uint32 ROMIO_BASE          = 0xff008000;
                     88:        static const uint32 ROMIO_INIT          = (ROMIO_BASE + 0);
                     89: 
                     90:  public:
                     91:        Virt68kROMEmuDevice();
                     92:        ~Virt68kROMEmuDevice() override;
                     93: 
                     94:        bool Init() override;
                     95:        void ResetHard(bool poweron) override;
                     96: 
                     97:        busdata Read32(uint32 addr) override;
                     98: 
                     99:  private:
                    100:        uint32 ROM_Init();
                    101:        bool MakeBootInfo(LoadInfo *);
                    102:        void WriteBootInfo(IODeviceStream&, BootInfo&);
                    103: 
                    104:        static const std::pair<uint32, const char *> tag_str[];
                    105:        static const std::pair<uint32, const char *> mach_str[];
                    106:        static const std::pair<uint32, const char *> cpu_str[];
                    107:        static const std::pair<uint32, const char *> fpu_str[];
                    108:        static const std::pair<uint32, const char *> mmu_str[];
                    109: 
                    110:        MainRAMDevice *mainram {};
                    111: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.