From e4e49d0b7d478e2fc9d8cc74bb752bb9a93fe5a2 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 6 Jan 2015 23:28:15 +0000 Subject: [PATCH] Final tweaks and TRS80 now swaps on partitions other than 0 You can now set up a 10MB hd or similar with a mix of disk and swap, and it also won't randomly pee on disks it doesn't own. --- Kernel/include/diskgeom.h | 10 +++++----- Kernel/platform-trs80/devhd.c | 4 ++-- Kernel/tools/trslabel.c | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Kernel/include/diskgeom.h b/Kernel/include/diskgeom.h index e77b43a7..faffec12 100644 --- a/Kernel/include/diskgeom.h +++ b/Kernel/include/diskgeom.h @@ -30,18 +30,18 @@ struct diskgeom { /* Labelling bits needed for a CHS drive */ struct minipart { struct diskgeom g; - uint16_t cyl[15]; - uint8_t type[15]; + uint16_t cyl[16]; + uint8_t type[16]; }; /* The full entry, including the LBA offsets added by the labeller for use if in LBA mode. The LBAs must match the cyl pointers */ struct minipart_lba { struct diskgeom g; - uint16_t cyl[15]; - uint8_t type[15]; + uint16_t cyl[16]; + uint8_t type[16]; uint8_t gap; - uint32_t lba[15]; + uint32_t lba[16]; }; #endif diff --git a/Kernel/platform-trs80/devhd.c b/Kernel/platform-trs80/devhd.c index c46bfed3..c0812fd9 100644 --- a/Kernel/platform-trs80/devhd.c +++ b/Kernel/platform-trs80/devhd.c @@ -79,7 +79,7 @@ static uint8_t hd_xfer(bool is_read, uint16_t addr) hd_xfer_in(addr); else hd_xfer_out(addr); - /* Should beeturning READY, and maybe SEEKDONE */ + /* Should be returning READY, and maybe SEEKDONE */ return hd_status; } @@ -231,7 +231,7 @@ static void hd_swapon(struct minipart *p, unsigned int d, unsigned int i) We need 32K per process: hardwire it here - FIX if you change the mapping model */ - swap_dev = d << 4 + i + 1 + 0x100; + swap_dev = (d << 4) + i + 1 + 0x100; if (cyls >= MAX_SWAPS) cyls = MAX_SWAPS - 1; diff --git a/Kernel/tools/trslabel.c b/Kernel/tools/trslabel.c index 6409560a..0895f5ef 100644 --- a/Kernel/tools/trslabel.c +++ b/Kernel/tools/trslabel.c @@ -39,7 +39,8 @@ int main(int argc, const char *argv[]) { p.g.seek = 0; p.g.secsize = 8; - p.cyl[0] = p.g.cyl - 32; + p.cyl[0] = 0; /* Must be zero */ + p.cyl[1] = p.g.cyl - 32; p.type[0] = 0x55; p.type[1] = 0x56; -- 2.34.1