You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(26) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Lawrence S. <ljs...@us...> - 2014-04-06 04:42:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 64fcf84781df572490f455e9112017947a2f4840 (commit) from 6447a9fc5ae74429c94eb30a7b2c8ee867989ec1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 64fcf84781df572490f455e9112017947a2f4840 Author: Lawrence Sebald <ljs...@us...> Date: Sun Apr 6 00:42:29 2014 -0400 Add Multi-Word DMA support to g1ata. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/g1ata.c | 305 +++++++++++++++++++++++++++++- kernel/arch/dreamcast/include/dc/g1ata.h | 51 +++++- 2 files changed, 348 insertions(+), 8 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 8aefc68..cea5b62 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -1,7 +1,7 @@ /* KallistiOS ##version## hardware/g1ata.c - Copyright (C) 2013 Lawrence Sebald + Copyright (C) 2013, 2014 Lawrence Sebald */ #include <errno.h> @@ -9,7 +9,11 @@ #include <stdlib.h> #include <dc/g1ata.h> +#include <dc/asic.h> + #include <kos/dbglog.h> +#include <kos/sem.h> + #include <arch/timer.h> /* @@ -58,7 +62,7 @@ static struct { uint16_t cylinders; uint16_t heads; uint16_t sectors; - uint16_t reserved; + uint16_t wdma_modes; } device; /* The type of the dev_data in the block device structure */ @@ -87,6 +91,15 @@ typedef struct ata_devdata { #define G1_ATA_STATUS_REG 0xA05F709C /* Read */ #define G1_ATA_COMMAND_REG 0xA05F709C /* Write */ +/* DMA-related registers. */ +#define G1_ATA_DMA_RACCESS_WAIT 0xA05F74A0 /* Write-only */ +#define G1_ATA_DMA_WACCESS_WAIT 0xA05F74A4 /* Write-only */ +#define G1_ATA_DMA_ADDRESS 0xA05F7404 /* Read/Write */ +#define G1_ATA_DMA_LENGTH 0xA05F7408 /* Read/Write */ +#define G1_ATA_DMA_DIRECTION 0xA05F740C /* Read/Write */ +#define G1_ATA_DMA_ENABLE 0xA05F7414 /* Read/Write */ +#define G1_ATA_DMA_STATUS 0xA05F7418 /* Read/Write */ + /* Bitmasks for the STATUS_REG/ALT_STATUS registers. */ #define G1_ATA_SR_ERR 0x01 #define G1_ATA_SR_IDX 0x02 @@ -100,11 +113,27 @@ typedef struct ata_devdata { /* ATA Commands we might like to send. */ #define ATA_CMD_READ_SECTORS 0x20 #define ATA_CMD_READ_SECTORS_EXT 0x24 +#define ATA_CMD_READ_DMA_EXT 0x25 #define ATA_CMD_WRITE_SECTORS 0x30 #define ATA_CMD_WRITE_SECTORS_EXT 0x34 +#define ATA_CMD_READ_DMA 0xC8 #define ATA_CMD_FLUSH_CACHE 0xE7 #define ATA_CMD_FLUSH_CACHE_EXT 0xEA #define ATA_CMD_IDENTIFY 0xEC +#define ATA_CMD_SET_FEATURES 0xEF + +/* Subcommands we might care about for the SET FEATURES command. */ +#define ATA_FEATURE_TRANSFER_MODE 0x03 + +/* Transfer mode values. */ +#define ATA_TRANSFER_PIO_DEFAULT 0x00 +#define ATA_TRANSFER_PIO_NOIORDY 0x01 +#define ATA_TRANSFER_PIO_FLOW(x) 0x08 | ((x) & 0x07) +#define ATA_TRANSFER_WDMA(x) 0x20 | ((x) & 0x07) +#define ATA_TRANSFER_UDMA(x) 0x40 | ((x) & 0x07) + +/* Access timing data. */ +#define G1_ACCESS_WDMA_MODE2 0x00001001 /* Macros to access the ATA registers */ #define OUT32(addr, data) *((volatile uint32_t *)addr) = data @@ -117,12 +146,36 @@ typedef struct ata_devdata { static int initted = 0; static int devices = 0; +/* Variables related to DMA. */ +static int dma_in_progress = 0; +static int dma_blocking = 0; +static semaphore_t dma_done = SEM_INITIALIZER(0); + #define g1_ata_wait_nbsy() \ do {} while((IN8(G1_ATA_ALTSTATUS) & G1_ATA_SR_BSY)) #define g1_ata_wait_drdy() \ do {} while(!(IN8(G1_ATA_ALTSTATUS) & G1_ATA_SR_DRDY)) +static void g1_dma_irq_hnd(uint32 code) { + /* XXXX: Probably should look at the code to make sure it isn't an error. */ + (void)code; + + /* Signal the calling thread to continue, if it is blocking. */ + if(dma_blocking) { + sem_signal(&dma_done); + thd_schedule(1, 0); + dma_blocking = 0; + } + + dma_in_progress = 0; +} + +/* Is a G1 DMA in progress? */ +int g1_dma_in_progress(void) { + return IN32(G1_ATA_DMA_STATUS); +} + /* This one is an inline function since it needs to return something... */ static inline int g1_ata_wait_drq(void) { uint8_t val = IN8(G1_ATA_ALTSTATUS); @@ -377,6 +430,155 @@ out: return rv; } +static int dma_common(uint8_t cmd, size_t nsects, uint32_t addr, int block) { + uint8_t status; + + /* Set the DMA parameters up. */ + OUT32(G1_ATA_DMA_ADDRESS, addr); + OUT32(G1_ATA_DMA_LENGTH, nsects * 512); + OUT32(G1_ATA_DMA_DIRECTION, 1); + + /* Enable G1 DMA. */ + OUT32(G1_ATA_DMA_ENABLE, 1); + + /* Wait until the drive is ready to accept the command. */ + g1_ata_wait_nbsy(); + g1_ata_wait_drdy(); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, cmd); + + /* Start the DMA transfer. */ + OUT32(G1_ATA_DMA_STATUS, 1); + + if(block) + sem_wait(&dma_done); + + /* Ack the IRQ. */ + status = IN8(G1_ATA_STATUS_REG); + + /* Was there an error doing the transfer? */ + if(status & G1_ATA_SR_ERR) { + errno = EIO; + return -1; + } + + return 0; +} + +int g1_ata_read_lba_dma(uint64_t sector, size_t count, uint16_t *buf, + int block) { + int rv = 0; + uint8_t dsel; + uint32_t addr; + int old; + + /* Make sure we're actually being asked to do work... */ + if(!count) + return 0; + + if(!buf) { + errno = EFAULT; + return -1; + } + + /* Make sure that we've been initialized and there's a disk attached. */ + if(!devices) { + errno = ENXIO; + return -1; + } + + /* Make sure the disk supports LBA mode. */ + if(!device.max_lba) { + errno = ENOTSUP; + return -1; + } + + /* Make sure the disk supports Multi-Word DMA mode 2. */ + if(!device.wdma_modes) { + errno = EPERM; + return -1; + } + + /* Chaining isn't done yet, so make sure we don't need to. */ + if(count > 256) { + errno = EOVERFLOW; + return -1; + } + + /* Make sure the range of sectors is valid. */ + if((sector + count) > device.max_lba) { + errno = EOVERFLOW; + return -1; + } + + /* Check the alignment of the address. */ + addr = ((uint32_t)buf) & 0x0FFFFFFF; + + if(addr & 0x1F) { + dbglog(DBG_ERROR, "g1_ata_read_lba_dma: Unaligned output address\n"); + errno = EFAULT; + return -1; + } + + /* Disable IRQs temporarily... */ + old = irq_disable(); + + /* Make sure there is no DMA in progress already. */ + if(dma_in_progress || g1_dma_in_progress()) { + irq_restore(old); + dbglog(DBG_KDEBUG, "g1_ata_read_lba_dma: DMA in progress\n"); + errno = EIO; + return -1; + } + + /* Set the settings for this transfer and reenable IRQs. */ + dma_blocking = block; + dma_in_progress = 1; + irq_restore(old); + + /* Wait for the device to signal it is ready. */ + g1_ata_wait_nbsy(); + + /* For now, just assume we're accessing the slave device. We don't care + about the primary device, since it should always be the GD-ROM drive. */ + dsel = IN8(G1_ATA_DEVICE_SELECT); + + /* Which mode are we using: LBA28 or LBA48? */ + if((sector + count) <= 0x0FFFFFFF) { + OUT8(G1_ATA_DEVICE_SELECT, 0xF0 | ((sector >> 24) & 0x0F)); + + /* Write out the number of sectors we want and the lower 24-bits of + the LBA we're looking for. */ + OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)count); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); + + /* Do the rest of the work... */ + rv = dma_common(ATA_CMD_READ_DMA, count, addr, block); + } + else { + OUT8(G1_ATA_DEVICE_SELECT, 0xF0); + + /* Write out the number of sectors we want and the LBA. */ + OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)(count >> 8)); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 32) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 40) & 0xFF)); + OUT8(G1_ATA_SECTOR_COUNT, (uint8_t)count); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); + + /* Do the rest of the work... */ + rv = dma_common(ATA_CMD_READ_DMA_EXT, count, addr, block); + } + + OUT8(G1_ATA_DEVICE_SELECT, dsel); + return rv; +} + int g1_ata_write_lba(uint64_t sector, size_t count, const uint16_t *buf) { int rv = 0; unsigned int i, j; @@ -489,6 +691,33 @@ int g1_ata_flush(void) { return 0; } +static int g1_ata_set_transfer_mode(uint8_t mode) { + uint8_t status; + + /* Fill in the registers as is required. */ + OUT8(G1_ATA_FEATURES, ATA_FEATURE_TRANSFER_MODE); + OUT8(G1_ATA_SECTOR_COUNT, mode); + OUT8(G1_ATA_CHS_SECTOR, 0); + OUT8(G1_ATA_CHS_CYL_LOW, 0); + OUT8(G1_ATA_CHS_CYL_HIGH, 0); + + /* Send the SET FEATURES command. */ + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_SET_FEATURES); + timer_spin_sleep(1); + + /* Wait for command completion. */ + g1_ata_wait_nbsy(); + + /* See if the command completed. */ + status = IN8(G1_ATA_STATUS_REG); + if((status & G1_ATA_SR_ERR) || (status & G1_ATA_SR_DF)) { + dbglog(DBG_KDEBUG, "Error setting transfer mode %02x\n", mode); + return -1; + } + + return 0; +} + static int g1_ata_scan(void) { uint8_t dsel = IN8(G1_ATA_DEVICE_SELECT), st; int rv, i; @@ -535,6 +764,7 @@ static int g1_ata_scan(void) { /* Read off some information we might need. */ device.command_sets = (uint32_t)(data[82]) | ((uint32_t)(data[83]) << 16); device.capabilities = (uint32_t)(data[49]) | ((uint32_t)(data[50]) << 16); + device.wdma_modes = data[63]; /* See if we support LBA mode or not... */ if(!(device.capabilities & (1 << 9))) { @@ -565,6 +795,24 @@ static int g1_ata_scan(void) { rv = 1; + /* Set our transfer modes. */ + g1_ata_set_transfer_mode(ATA_TRANSFER_PIO_DEFAULT); + + /* Do we support Multiword DMA mode 2? If so, enable it. Otherwise, we won't + even bother doing DMA at all. */ + if(device.wdma_modes & 0x0004) { + if(!g1_ata_set_transfer_mode(ATA_TRANSFER_WDMA(2))) { + OUT32(G1_ATA_DMA_RACCESS_WAIT, G1_ACCESS_WDMA_MODE2); + OUT32(G1_ATA_DMA_WACCESS_WAIT, G1_ACCESS_WDMA_MODE2); + } + else { + device.wdma_modes = 0; + } + } + else { + device.wdma_modes = 0; + } + out: OUT8(G1_ATA_DEVICE_SELECT, dsel); return rv; @@ -599,6 +847,19 @@ static int atab_read_blocks(kos_blockdev_t *d, uint64_t block, size_t count, return g1_ata_read_lba(block + data->start_block, count, (uint16_t *)buf); } +static int atab_read_blocks_dma(kos_blockdev_t *d, uint64_t block, size_t count, + void *buf) { + ata_devdata_t *data = (ata_devdata_t *)d->dev_data; + + if(block + count > data->end_block) { + errno = EOVERFLOW; + return -1; + } + + return g1_ata_read_lba_dma(block + data->start_block, count, + (uint16_t *)buf, 1); +} + static int atab_write_blocks(kos_blockdev_t *d, uint64_t block, size_t count, const void *buf) { ata_devdata_t *data = (ata_devdata_t *)d->dev_data; @@ -674,6 +935,17 @@ static kos_blockdev_t ata_blockdev = { &atab_flush /* flush */ }; +static kos_blockdev_t ata_blockdev_dma = { + NULL, /* dev_data */ + 9, /* l_block_size (block size of 512 bytes) */ + &atab_init, /* init */ + &atab_shutdown, /* shutdown */ + &atab_read_blocks_dma, /* read_blocks */ + &atab_write_blocks, /* XXXX: write_blocks */ + &atab_count_blocks, /* count_blocks */ + &atab_flush /* flush */ +}; + static kos_blockdev_t ata_blockdev_chs = { NULL, /* dev_data */ 9, /* l_block_size (block size of 512 bytes) */ @@ -685,7 +957,7 @@ static kos_blockdev_t ata_blockdev_chs = { &atab_flush /* flush */ }; -int g1_ata_blockdev_for_partition(int partition, kos_blockdev_t *rv, +int g1_ata_blockdev_for_partition(int partition, int dma, kos_blockdev_t *rv, uint8_t *partition_type) { uint8_t buf[512]; int pval; @@ -744,10 +1016,15 @@ int g1_ata_blockdev_for_partition(int partition, kos_blockdev_t *rv, } /* Copy in the template block device and fill it in */ - if(device.max_lba) - memcpy(rv, &ata_blockdev, sizeof(kos_blockdev_t)); - else + if(device.max_lba) { + if(dma && device.wdma_modes) + memcpy(rv, &ata_blockdev_dma, sizeof(kos_blockdev_t)); + else + memcpy(rv, &ata_blockdev, sizeof(kos_blockdev_t)); + } + else { memcpy(rv, &ata_blockdev_chs, sizeof(kos_blockdev_t)); + } /* It doesn't matter whether we're using CHS or LBA... We only bother to parse out the LBA information from the MBR. Should be valid either @@ -778,6 +1055,14 @@ int g1_ata_init(void) { return -1; } + /* Hook all the DMA related events. */ + asic_evt_set_handler(ASIC_EVT_GD_DMA, g1_dma_irq_hnd); + asic_evt_enable(ASIC_EVT_GD_DMA, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_GD_DMA_OVERRUN, g1_dma_irq_hnd); + asic_evt_enable(ASIC_EVT_GD_DMA_OVERRUN, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_GD_DMA_ILLADDR, g1_dma_irq_hnd); + asic_evt_enable(ASIC_EVT_GD_DMA_ILLADDR, ASIC_IRQ_DEFAULT); + initted = 1; return 0; @@ -791,4 +1076,12 @@ void g1_ata_shutdown(void) { initted = 0; memset(&device, 0, sizeof(device)); + + /* Unhook the events and disable the IRQs. */ + asic_evt_disable(ASIC_EVT_GD_DMA, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_GD_DMA, NULL); + asic_evt_disable(ASIC_EVT_GD_DMA_OVERRUN, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_GD_DMA_OVERRUN, NULL); + asic_evt_disable(ASIC_EVT_GD_DMA_ILLADDR, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_GD_DMA_ILLADDR, NULL); } diff --git a/kernel/arch/dreamcast/include/dc/g1ata.h b/kernel/arch/dreamcast/include/dc/g1ata.h index a514d08..8326ede 100644 --- a/kernel/arch/dreamcast/include/dc/g1ata.h +++ b/kernel/arch/dreamcast/include/dc/g1ata.h @@ -1,7 +1,7 @@ /* KallistiOS ##version## dc/g1ata.h - Copyright (C) 2013 Lawrence Sebald + Copyright (C) 2013, 2014 Lawrence Sebald */ /** \file dc/g1ata.h @@ -37,6 +37,16 @@ __BEGIN_DECLS #include <stdint.h> #include <kos/blockdev.h> +/** \brief Is there a G1 DMA in progress currently? + + This function returns non-zero if a DMA is in progress. This can be used to + check on the completion of DMA transfers when non-blocking mode was selected + at transfer time. + + \return 0 if no DMA is in progress, nonzero otherwise. +*/ +int g1_dma_in_progress(void); + /** \brief Read one or more disk sectors with Cylinder-Head-Sector addressing. This function reads one or more 512-byte disk blocks from the slave device @@ -127,6 +137,41 @@ int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, */ int g1_ata_read_lba(uint64_t sector, size_t count, uint16_t *buf); +/** \brief DMA read disk sectors with Linear Block Addressing (LBA). + + This function reads one or more 512-byte disk blocks from the slave device + on the G1 ATA bus using LBA mode (either 28 or 48 bits, as appropriate). + This function uses DMA and optionally blocks until the data is read. + + \param sector The sector to start reading from. + \param count The number of disk sectors to read. + \param buf Storage for the read-in disk sectors. This should be + at least (count * 512) bytes in length, and must be + at least 32-byte aligned. + \param block Non-zero to block until the transfer completes. + \return 0 on success. < 0 on failure, setting errno as + appropriate. + + \note If errno is set to ENOTSUP after calling this + function, you must use a CHS addressed transfer + function instead, like g1_ata_read_chs(). + + \note If errno is set to EPERM after calling this + function, DMA mode is not supported. You should use + a PIO transfer function like g1_ata_read_lba() + instead. + + \par Error Conditions: + \em EIO - an I/O error occurred in reading data \n + \em ENXIO - ATA support not initialized or no device attached \n + \em EOVERFLOW - one or more of the requested sectors is out of the + range of the disk \n + \em ENOTSUP - LBA mode not supported by the device \n + \em EPERM - device does not support DMA +*/ +int g1_ata_read_lba_dma(uint64_t sector, size_t count, uint16_t *buf, + int block); + /** \brief Write one or more disk sectors with Linear Block Addressing (LBA). This function writes one or more 512-byte disk blocks to the slave device @@ -176,6 +221,8 @@ int g1_ata_flush(void); filesystems on the device. \param partition The partition number (0-3) to use. ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-03-26 05:00:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 6447a9fc5ae74429c94eb30a7b2c8ee867989ec1 (commit) from 5087f089c81068fdeface03e33344c115d60a38c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6447a9fc5ae74429c94eb30a7b2c8ee867989ec1 Author: Lawrence Sebald <ljs...@us...> Date: Wed Mar 26 01:00:16 2014 -0400 No need to wait for a vblank when doing render-to-texture. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 13 ++++++++ examples/dreamcast/pvr/texture_render/ta.c | 40 ++++++++++++++----------- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 16 ++++++++-- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 64901a7..0259ccf 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -16,7 +16,20 @@ KallistiOS version 2.0.1 ----------------------------------------------- - *** Cleaned up warnings with -std=c99 for C code [LS] - DC Changed the PVR render-to-texture support to allow for two render-to- texture passes without an intervening render-to-screen pass [LS] +- *** Fixed an issue in fs_ext2 that would allow you to rename a directory to be + a child of itself, thus chopping it off from the rest of the directory + tree [LS] +- *** Added a fs_readlink() function to resolve symlinks [LS] +- *** Fixed the vqenc and kmgenc utilities for compilation on a 64-bit OS [LS] +- DC Corrected an issue with video cable detection with GCC 4.8.x [LS] - DC Added support for ATA devices on the G1 bus [LS] +- DC Fixed an infinite loop in ATA initialization if nothing except the GD-ROM + drive is connected [LS] +- *** Added documentation for the addons tree [LS] +- DC Made the hardware auto-initialization/shutdown functions weakly linked so + that they can be overridden without modifying KOS [LS] +- DC Corrected render-to-texture mode so that you don't have to wait for a + vblank to actually render to the texture [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/examples/dreamcast/pvr/texture_render/ta.c b/examples/dreamcast/pvr/texture_render/ta.c index 3842eb6..492de15 100644 --- a/examples/dreamcast/pvr/texture_render/ta.c +++ b/examples/dreamcast/pvr/texture_render/ta.c @@ -1,14 +1,11 @@ /* This program is a slight modification of the libdream/ta example program. The big difference in this program is that we add in a small bit of user - input code, and support render-to-texture mode. */ - -/* This is a port of my original 3dtest example to KOS. The big difference - here is that the background plane is no longer used. */ + input code, and that we support render-to-texture mode. */ #include <kos.h> -/* A little test program -- creates twelve rainbow polygons and - moves them around over a color-shifting background. */ +/* A little test program -- creates six rainbow polygons and + moves them around over a white background. */ typedef struct { float x, y, z; float dx, dy; @@ -124,7 +121,7 @@ void draw_frame() { if(!to_texture) pvr_scene_begin(); - else { + else { pvr_scene_begin_txr(d_texture, &tx_x, &tx_y); to_texture = 2; } @@ -151,7 +148,6 @@ void draw_frame() { void draw_textured() { pvr_poly_cxt_t cxt; pvr_poly_hdr_t hdr; - pvr_ptr_t tmp; int i; pvr_poly_cxt_txr(&cxt, PVR_LIST_OP_POLY, PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED, 1024, 512, d_texture, PVR_FILTER_NONE); @@ -196,7 +192,8 @@ int main(int argc, char **argv) { maple_device_t *cont; cont_state_t *state; int finished = 0; - uint64 timer = timer_ms_gettime64(); + uint64 timer = timer_ms_gettime64(), start, end; + uint32 counter = 0; pvr_init(&pvr_params); @@ -205,34 +202,41 @@ int main(int argc, char **argv) { pvr_set_bg_color(1.0f, 1.0f, 1.0f); - while(!finished) { + start = timer_ms_gettime64(); + + while(!finished) { cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); - if(cont != NULL) { + if(cont != NULL) { state = (cont_state_t *) maple_dev_status(cont); - if(state != NULL && timer < timer_ms_gettime64()) { + if(state != NULL && timer < timer_ms_gettime64()) { if(state->buttons & CONT_START) finished = 1; - else if(state->buttons & CONT_A && (to_texture % 2) != 1) { + else if(state->buttons & CONT_A && (to_texture % 2) != 1) { ++to_texture; timer = timer_ms_gettime64() + 200; } - else if(state->buttons & CONT_B && to_texture) { + else if(state->buttons & CONT_B && to_texture) { to_texture = 0; timer = timer_ms_gettime64() + 200; } } } - if(to_texture < 2) { + if(to_texture < 2) draw_frame(); - } - else { + else draw_textured(); - } + + ++counter; } + end = timer_ms_gettime64(); + + printf("%lu frames in %llu ms = %f FPS\n", counter, end - start, + counter / ((float)end - start) * 1000.0f); + pvr_mem_free(d_texture); /* Shutdown isn't technically neccessary, but is possible */ diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c index a8c0abf..de1732d 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c @@ -122,9 +122,19 @@ void pvr_int_handler(uint32 code) { return; } - // If it's not a vblank, ignore for now for the rest of this. - if(code != ASIC_EVT_PVR_VBLINT) - return; + if(!pvr_state.to_texture[bufn]) { + // If it's not a vblank, ignore the rest of this for now. + if(code != ASIC_EVT_PVR_VBLINT) + return; + } + else { + // We don't need to wait for a vblank for rendering to a texture, but + // we really don't care about anything else unless we've actually gotten + // all the data submitted to the TA. + if(pvr_state.lists_transferred != pvr_state.lists_enabled && + !pvr_state.render_completed) + return; + } // If the render-done interrupt has fired then we are ready to flip to the // new frame buffer. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-03-15 02:48:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5087f089c81068fdeface03e33344c115d60a38c (commit) from 9fc71f07e1032165f39e4422ca171ed105837bd6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5087f089c81068fdeface03e33344c115d60a38c Author: Lawrence Sebald <ljs...@us...> Date: Fri Mar 14 22:47:24 2014 -0400 Define arch_auto_init() and arch_auto_shutdown() to be weak symbols, so that you can replace them in your own program, if you see fit to do so. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/init.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index b93e79e..9f0c5d8 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -45,7 +45,7 @@ int dbgio_handler_cnt = sizeof(dbgio_handlers) / sizeof(dbgio_handler_t *); /* Auto-init stuff: comment out here if you don't like this stuff to be running in your build, and also below in arch_main() */ /* #if 0 */ -int arch_auto_init() { +int __attribute__((weak)) arch_auto_init() { /* Initialize memory management */ mm_init(); @@ -139,7 +139,7 @@ int arch_auto_init() { return 0; } -void arch_auto_shutdown() { +void __attribute__((weak)) arch_auto_shutdown() { fs_dclsocket_shutdown(); net_shutdown(); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-03-15 02:44:41
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 9fc71f07e1032165f39e4422ca171ed105837bd6 (commit) from dcbe25916d0cca0bc02310a4de9b217b020507ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9fc71f07e1032165f39e4422ca171ed105837bd6 Author: Lawrence Sebald <ljs...@us...> Date: Fri Mar 14 22:43:58 2014 -0400 Add a few constants that Newlib fails to define for any platforms other than Cygwin. ----------------------------------------------------------------------- Summary of changes: include/sys/_types.h | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/include/sys/_types.h b/include/sys/_types.h index 682bf80..24bc22a 100644 --- a/include/sys/_types.h +++ b/include/sys/_types.h @@ -99,6 +99,29 @@ typedef void *_iconv_t; /** \brief PDP Endian test macro */ #define PDP_ENDIAN 3412 +/* Sigh... for some reason, Newlib only bothers defining these on Cygwin... + We're only actually concerned with AT_SYMLINK_NOFOLLOW currently. These + should all be defined in <fcntl.h>, by the way. */ +#ifndef AT_EACCESS +/** \brief Check access using effective user and group ID */ +#define AT_EACCESS 1 +#endif + +#ifndef AT_SYMLINK_NOFOLLOW +/** \brief Do not follow symlinks */ +#define AT_SYMLINK_NOFOLLOW 2 +#endif + +#ifndef AT_SYMLINK_FOLLOW +/** \brief Follow symbolic links */ +#define AT_SYMLINK_FOLLOW 4 +#endif + +#ifndef AT_REMOVEDIR +/** \brief Remove directory instead of file */ +#define AT_REMOVEDIR 8 +#endif + // And this is for old KOS source compatability. #include <arch/types.h> hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-03-15 02:35:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via dcbe25916d0cca0bc02310a4de9b217b020507ab (commit) from abd905c6a87e888d0abef384e83acfdbb7df339d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dcbe25916d0cca0bc02310a4de9b217b020507ab Author: Lawrence Sebald <ljs...@us...> Date: Fri Mar 14 22:34:39 2014 -0400 Add documentation for the addons tree, and adjust the Doxyfile so it will generate said documentation. ----------------------------------------------------------------------- Summary of changes: addons/include/ext2/fs_ext2.h | 3 - addons/include/kos/bspline.h | 51 ++++++++---- addons/include/kos/img.h | 186 +++++++++++++++++++++++++++++++--------- addons/include/kos/md5.h | 54 +++++++++++- addons/include/kos/netcfg.h | 159 +++++++++++++++++++++++++++-------- addons/include/kos/pcx.h | 51 +++++++++-- addons/include/kos/vector.h | 28 +++++-- doc/Doxyfile | 38 +-------- 8 files changed, 419 insertions(+), 151 deletions(-) diff --git a/addons/include/ext2/fs_ext2.h b/addons/include/ext2/fs_ext2.h index e0803de..39932aa 100644 --- a/addons/include/ext2/fs_ext2.h +++ b/addons/include/ext2/fs_ext2.h @@ -43,9 +43,6 @@ __BEGIN_DECLS the ext2fs layer anyway, as this layer should give you everything you need by interfacing with the VFS in the normal fashion. - Also, at the moment, this is a read-only filesystem. Write support will be - forthcoming, but it may take a bit of time to get completely working. - There's one final note that I should make. Everything in fs_ext2 and ext2fs is licensed under the same license as the rest of KOS. None of it was derived from GPLed sources. Pretty much all of what's in ext2fs was written diff --git a/addons/include/kos/bspline.h b/addons/include/kos/bspline.h index 8ba59d9..cfae65a 100644 --- a/addons/include/kos/bspline.h +++ b/addons/include/kos/bspline.h @@ -1,37 +1,54 @@ /* KallistiOS ##version## bspline.h - (c)2000 Dan Potter + Copyright (C) 2000 Dan Potter */ #ifndef __KOS_BSPLINE_H #define __KOS_BSPLINE_H -#include <sys/cdefs.h> -__BEGIN_DECLS +/** \file kos/bspline.h + \brief B-Spline curve support. + + This module provides utility functions to generate b-spline curves in your + program. It is used by passing in a set of control points to + bspline_coeff(), and then querying for individual points using + bspline_get_point(). -/** \file - This module provides utility functions to generate b-spline - curves in your program. It is used by passing in a set of - control points to bspline_coeff, and then querying for - individual points using bspline_get_point. + Note that this module is NOT thread-safe. + + \author Dan Potter */ +#include <sys/cdefs.h> +__BEGIN_DECLS + #include <kos/vector.h> -/** - Pass it an array of points and it will calculate a set of B-spline - co-efficients for generating a curve. There must be at least one point - before the "current" one, and at least two after the "current" one (a - total of four points required). These values will be used in the - function below. +/** \brief Calculate and set b-spline coefficients. + + This function performs the initial setup work of calculating the + coefficients needed to generate a b-spline curve for the specified set of + points. The calculation is based on a total of 4 points: one previous point, + the current point, and two points that occur after the current point. + + The current point should be at pnt[0], the previous at pnt[-1], and the + future points should be at pnt[1], and pnt[2]. I repeat: pnt[-1] must be a + valid point for this to work properly. + + \param pnt The array of points used to calculate the b-spline + coefficients. */ void bspline_coeff(const point_t *pnt); -/** - Given a 't' (between 0.0f and 1.0f) this will generate the next point - values for the current set of coefficients. +/** \brief Generate the next point for the current set of coefficients. + + Given a 't' (between 0.0f and 1.0f) this will generate the next point value + for the current set of coefficients. + + \param t The "t" value for the b-spline generation function. + \param p Storage for the generated point. */ void bspline_get_point(float t, point_t *p); diff --git a/addons/include/kos/img.h b/addons/include/kos/img.h index 8193562..80a35c5 100644 --- a/addons/include/kos/img.h +++ b/addons/include/kos/img.h @@ -1,66 +1,168 @@ /* KallistiOS ##version## kos/img.h - (c)2002 Dan Potter + Copyright (C) 2002 Dan Potter */ #ifndef __KOS_IMG_H #define __KOS_IMG_H +/** \file kos/img.h + \brief Platform-independent image type. + + This file provides a platform-independent image type that is designed to + hold any sort of textures or other image data. This type contains a very + basic description of the image data (width, height, pixel format), as well + as the image data itself. + + All of the image-loading libraries in kos-ports should provide a function + to load the image data into one of these types. + + \author Dan Potter +*/ + #include <sys/cdefs.h> __BEGIN_DECLS #include <arch/types.h> -/* KOS Platform independent image struct; you can use this for textures or - whatever you feel it's appropriate for. "width" and "height" are as you - would expect. "format" has a lower-half which is platform independent - and used to basically describe the contained data; the upper-half is - platform dependent and can hold anything (so AND it off if you want - the bottom part). Note that in some of the more obscure formats (like - the paletted formats) the data interpretation _may_ be platform dependent. - Thus we also provide a data-length field. */ +/** \brief Platform-indpendent image type. + + You can use this type for textures or whatever you feel it's appropriate + for. "width" and "height" are as you would expect. "format" has a lower-half + which is platform-independent and used to basically describe the contained + data; the upper-half is platform-dependent and can hold anything (so AND it + off if you only want the bottom part). + + Note that in some of the more obscure formats (like the paletted formats) + the data interpretation may be platform dependent. Thus we also provide a + data length field. + + \headerfile kos/img.h +*/ typedef struct kos_img { - void * data; - uint32 w, h; - uint32 fmt; - uint32 byte_count; + void *data; /**< \brief Image data in the specified format. */ + uint32 w; /**< \brief Width of the image. */ + uint32 h; /**< \brief Height of the image. */ + uint32 fmt; /**< \brief Format of the image data. + \see kos_img_fmts + \see kos_img_fmt_macros */ + uint32 byte_count; /**< \brief Length of the image data, in bytes. */ } kos_img_t; -/* Access to the upper and lower pieces of the format word */ -#define KOS_IMG_FMT_I(x) ((x) & 0xffff) /* Platform independent part */ +/** \defgroup kos_img_fmt_macros Macros for accessing the format of an image + + These macros provide easy access to the fmt field of a kos_img_t object. + + @{ +*/ +/** \brief Read the platform-independent half of the format. + + This macro masks the format of a kos_img_t to give you just the lower half + of the value, which contains the platform-independent half of the format. + + \param x An image format (fmt field of a kos_img_t). + \return The platform-independent half of the format. +*/ +#define KOS_IMG_FMT_I(x) ((x) & 0xffff) + +/** \brief Read the platform-specific half of the format. + + This macro masks the format of a kos_img_t to give you just the upper half + of the value, which contains the platform-specific half of the format. + + \param x An image format (fmt field of a kos_img_t). + \return The platform-specific half of the format. +*/ #define KOS_IMG_FMT_D(x) (((x) >> 16) & 0xffff) -/* Macro to create a new format word */ +/** \brief Build a format value from a platform-independent half and a + platform-specific half of the value. + + This macro combines the platform-independent and platform-specific portions + of an image format into a value suitable for storing as the fmt field of a + kos_img_t object. + + \param i The platform-independent half of the format. + \param d The platform-specific half of the format. This should + not be pre-shifted. + \return A complete image format value, suitable for placing in + the fmt variable of a kos_img_t. +*/ #define KOS_IMG_FMT(i, d) ( ((i) & 0xffff) | (((d) & 0xffff) << 16) ) -/* Definitions for the plat independent part *************************************/ - -/* Bitmap formats */ -#define KOS_IMG_FMT_NONE 0x00 /* Undefined */ -#define KOS_IMG_FMT_RGB888 0x01 /* Interleaved r/g/b bytes (24-bit) */ -#define KOS_IMG_FMT_ARGB8888 0x02 /* Interleaved a/r/g/b bytes (32-bit) */ -#define KOS_IMG_FMT_RGB565 0x03 /* r/g/b 5/6/5 (16-bit) */ -#define KOS_IMG_FMT_ARGB4444 0x04 /* a/r/g/b 4/4/4/4 (16-bit) */ -#define KOS_IMG_FMT_ARGB1555 0x05 /* a/r/g/b 1/5/5/5 (16-bit) */ -#define KOS_IMG_FMT_PAL4BPP 0x06 /* Paletted (4-bit) */ -#define KOS_IMG_FMT_PAL8BPP 0x07 /* Paletted (8-bit) */ -#define KOS_IMG_FMT_YUV422 0x08 /* y/u/v 4/2/2 (8-bit) */ -#define KOS_IMG_FMT_BGR565 0x09 /* b/g/r 5/6/5 (16-bit) */ -#define KOS_IMG_FMT_RGBA8888 0x10 /* Interleaved r/g/b/a bytes (32-bit) */ -#define KOS_IMG_FMT_MASK 0xff - -/* Misc attributes */ -#define KOS_IMG_INVERTED_X 0x0100 /* X axis is inverted */ -#define KOS_IMG_INVERTED_Y 0x0200 /* Y axis is inverted */ -#define KOS_IMG_NOT_OWNER 0x0400 /* We don't own the buffer containing -the data (ROM or similar) */ - -/* Util functions ****************************************************************/ - -/* Free a kos_img_t which was created by an image loader; set struct_also to non-zero - if you want it to free the struct itself as well. */ +/** @} */ + +/** \defgroup kos_img_fmts Image format types + + This is the list of platform-independent image types that can be used as the + lower-half of the fmt value for a kos_img_t. + + @{ +*/ +/** \brief Undefined or uninitialized format. */ +#define KOS_IMG_FMT_NONE 0x00 + +/** \brief 24-bpp interleaved R/G/B bytes. */ +#define KOS_IMG_FMT_RGB888 0x01 + +/** \brief 32-bpp interleaved A/R/G/B bytes. */ +#define KOS_IMG_FMT_ARGB8888 0x02 + +/** \brief 16-bpp interleaved R (5 bits), G (6 bits), B (5 bits). */ +#define KOS_IMG_FMT_RGB565 0x03 + +/** \brief 16-bpp interleaved A/R/G/B (4 bits each). */ +#define KOS_IMG_FMT_ARGB4444 0x04 + +/** \brief 16-bpp interleaved A (1 bit), R (5 bits), G (5 bits), B (5 bits). + \note This can also be used for RGB555 (with the top bit ignored). */ +#define KOS_IMG_FMT_ARGB1555 0x05 + +/** \brief Paletted, 4 bits per pixel (16 colors). */ +#define KOS_IMG_FMT_PAL4BPP 0x06 + +/** \brief Paletted, 8 bits per pixel (256 colors). */ +#define KOS_IMG_FMT_PAL8BPP 0x07 + +/** \brief 8-bit Y (4 bits), U (2 bits), V (2 bits). */ +#define KOS_IMG_FMT_YUV422 0x08 + +/** \brief 15-bpp interleaved B (5 bits), G (6 bits), R (5 bits). */ +#define KOS_IMG_FMT_BGR565 0x09 + +/** \brief 32-bpp interleaved R/G/B/A bytes. */ +#define KOS_IMG_FMT_RGBA8888 0x10 + +/** \brief Basic format mask (not an actual format value). */ +#define KOS_IMG_FMT_MASK 0xff + +/** \brief X axis of image data is inverted (stored right to left). */ +#define KOS_IMG_INVERTED_X 0x0100 + +/** \brief Y axis of image data is inverted (stored bottom to top). */ +#define KOS_IMG_INVERTED_Y 0x0200 + +/** \brief The image is not the owner of the image data buffer. + + This generally implies that the image data is stored in ROM and thus cannot + be freed. +*/ +#define KOS_IMG_NOT_OWNER 0x0400 + +/** @} */ + +/** \brief Free a kos_img_t object. + + This function frees the data in a kos_img_t object, returning any memory to + the heap as appropriate. Optionally, this can also free the object itself, + if required. + + \param img The image object to free. + \param struct_also Set to non-zero to free the image object itself, + as well as any data contained therein. +*/ void kos_img_free(kos_img_t *img, int struct_also); __END_DECLS diff --git a/addons/include/kos/md5.h b/addons/include/kos/md5.h index 8afacf9..8901cc1 100644 --- a/addons/include/kos/md5.h +++ b/addons/include/kos/md5.h @@ -7,19 +7,67 @@ #ifndef __KOS_MD5_H #define __KOS_MD5_H +/** \file kos/md5.h + \brief Message Digest 5 (MD5) hashing support. + + This file provides the functionality to compute MD5 hashes over any data + buffer. While MD5 isn't considered a safe cryptographic hash any more, it + still has its uses. + + \author Lawrence Sebald +*/ + #include <sys/cdefs.h> __BEGIN_DECLS #include <arch/types.h> +/** \brief MD5 context. + + This structure contains the variables needed to maintain the internal state + of the MD5 code. You should not manipulate these variables manually, but + rather use the kos_md5_* functions to do everything you need. + + \headerfile kos/md5.h +*/ typedef struct kos_md5_cxt { - uint64 size; - uint32 hash[4]; - uint8 buf[64]; + uint64 size; /**< \brief Size of the data in buf. */ + uint32 hash[4]; /**< \brief Intermediate hash value. */ + uint8 buf[64]; /**< \brief Temporary storage of values to be hashed. */ } kos_md5_cxt_t; +/** \brief Initialize a MD5 context. + + This function initializes the context passed in to the initial state needed + for computing a MD5 hash. You must call this function to initialize the + state variables before attempting to hash any blocks of data. + + \param cxt The MD5 context to initialize. +*/ void kos_md5_start(kos_md5_cxt_t *cxt); + +/** \brief Hash a block of data with MD5. + + This function is used to hash the block of data input into the function with + MD5, updating the state context as appropriate. If the data does not fill an + entire block of 64-bytes (or there is left-over data), it will be stored in + the context for hashing with a future block. Thus, do not attempt to read + the intermediate hash value, as it will not be complete. + + \param cxt The MD5 context to use. + \param input The block of data to hash. + \param size The number of bytes of input data passed in. +*/ void kos_md5_hash_block(kos_md5_cxt_t *cxt, const uint8 *input, uint32 size); + +/** \brief Complete a MD5 hash. + + This function computes the final MD5 hash of the context passed in, + returning the completed digest in the output parameter. + + \param cxt The MD5 context to finalize. + \param output Where to store the final digest. +*/ void kos_md5_finish(kos_md5_cxt_t *cxt, uint8 output[16]); __END_DECLS diff --git a/addons/include/kos/netcfg.h b/addons/include/kos/netcfg.h index 75e875b..659a2ae 100644 --- a/addons/include/kos/netcfg.h +++ b/addons/include/kos/netcfg.h @@ -1,62 +1,153 @@ /* KallistiOS ##version## kos/netcfg.h - Copyright (C)2003 Dan Potter + Copyright (C) 2003 Dan Potter */ #ifndef __KOS_NETCFG_H #define __KOS_NETCFG_H +/** \file kos/netcfg.h + \brief Network configuration interface. + + This file provides a common interface for reading and writing the network + configuration on KOS. The interface can read from the flashrom on the + Dreamcast or from a file (such as on a VMU or the like), and can write data + back to a file. + + The data that is written out by this code is written in a relatively easy to + parse text-based format. + + \author Dan Potter +*/ + #include <sys/cdefs.h> __BEGIN_DECLS #include <arch/types.h> -/* Network configuration info. This holds the information about how we - will start the networking and what settings to use. */ -#define NETCFG_METHOD_DHCP 0 -#define NETCFG_METHOD_STATIC 1 -#define NETCFG_METHOD_PPPOE 4 -#define NETCFG_SRC_VMU 0 -#define NETCFG_SRC_FLASH 1 -#define NETCFG_SRC_CWD 2 -#define NETCFG_SRC_CDROOT 3 +/** \defgroup netcfg_methods Network connection methods + + These constants give the list of network connection methods that are + supported by the netcfg_t type. One of these will be in the method field of + objects of that type. + + @{ +*/ +#define NETCFG_METHOD_DHCP 0 /**< \brief Use DHCP to configure. */ +#define NETCFG_METHOD_STATIC 1 /**< \brief Static network configuration. */ +#define NETCFG_METHOD_PPPOE 4 /**< \brief Use PPPoE. */ +/** @} */ + +/** \defgroup netcfg_srcs Network configuration sources + + These constants give the list of places that the network configuration might + be read from. One of these constants should be in the src field of objects + of type netcfg_t. + + @{ +*/ +#define NETCFG_SRC_VMU 0 /**< \brief Read from a VMU. */ +#define NETCFG_SRC_FLASH 1 /**< \brief Read from the flashrom. */ +#define NETCFG_SRC_CWD 2 /**< \brief Read from the working directory. */ +#define NETCFG_SRC_CDROOT 3 /**< \brief Read from the root of the CD. */ +/** @} */ + +/** \brief Network configuration information. + + This structure contains information about the network configuration of the + system, as set up by the user. + + \headerfile kos/netcfg.h +*/ typedef struct netcfg { - int src; // Config source - int method; // Configuration method - uint32 ip; // IP addresses - uint32 gateway; - uint32 netmask; - uint32 broadcast; - uint32 dns[2]; // DNS servers - char hostname[64]; // DHCP hostname - char email[64]; // E-Mail address - char smtp[64]; // SMTP server - char pop3[64]; // POP3 server - char pop3_login[64]; // POP3 login name - char pop3_passwd[64]; // POP3 password - char proxy_host[64]; // Proxy server hostname - int proxy_port; // Proxy server port - char ppp_login[64]; // PPP login - char ppp_passwd[64]; // PPP password - char driver[64]; // Driver program filename (if any) + /** \brief Where was this configuration read from? + \see netcfg_srcs + */ + int src; + + /** \brief How should the network be configured? + \see netcfg_methods + */ + int method; + + uint32 ip; /**< \brief IPv4 address of the console */ + uint32 gateway; /**< \brief IPv4 address of the gateway/router. */ + uint32 netmask; /**< \brief Network mask for the local net. */ + uint32 broadcast; /**< \brief Broadcast address for the local net. */ + uint32 dns[2]; /**< \brief IPv4 address of the DNS servers. */ + char hostname[64]; /**< \brief DNS/DHCP hostname. */ + char email[64]; /**< \brief E-Mail address. */ + char smtp[64]; /**< \brief SMTP server address. */ + char pop3[64]; /**< \brief POP3 server address. */ + char pop3_login[64]; /**< \brief POP3 server username. */ + char pop3_passwd[64]; /**< \brief POP3 server password. */ + char proxy_host[64]; /**< \brief Proxy server address. */ + int proxy_port; /**< \brief Proxy server port. */ + char ppp_login[64]; /**< \brief PPP Username. */ + char ppp_passwd[64]; /**< \brief PPP Password. */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-02-17 14:43:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via abd905c6a87e888d0abef384e83acfdbb7df339d (commit) from 4701ba49c8bb62a3fbd2be5655d8e6312112414a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit abd905c6a87e888d0abef384e83acfdbb7df339d Author: Lawrence Sebald <ljs...@us...> Date: Mon Feb 17 09:42:24 2014 -0500 dc-chain: Rolling back, once again, to GCC 4.7.3 due to some performance regressions in 4.8.x. Also, added a flag to the download.sh and unpack.sh scripts to not download/set up the GCC dependencies (in case you install them separately). ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile | 2 +- utils/dc-chain/download.sh | 69 +++++++++++++++++++++++++++++++++++-------- utils/dc-chain/unpack.sh | 49 ++++++++++++++++++++++++++----- 3 files changed, 98 insertions(+), 22 deletions(-) diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index d3e0c79..6cec899 100644 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -29,7 +29,7 @@ kos_root=$(CURDIR)/../../.. # kos_base: equivalent of KOS_BASE (contains include/ and kernel/) kos_base=$(CURDIR)/../.. binutils_ver=2.23.2 -gcc_ver=4.8.2 +gcc_ver=4.7.3 newlib_ver=2.0.0 gdb_ver=6.7.1 insight_ver=6.7.1 diff --git a/utils/dc-chain/download.sh b/utils/dc-chain/download.sh index e5dce05..3c18d76 100755 --- a/utils/dc-chain/download.sh +++ b/utils/dc-chain/download.sh @@ -1,13 +1,38 @@ #!/bin/sh # These version numbers are all that should ever have to be changed. -export GCC_VER=4.8.2 +export GCC_VER=4.7.3 export BINUTILS_VER=2.23.2 export NEWLIB_VER=2.0.0 export GMP_VER=5.1.3 export MPFR_VER=3.1.2 export MPC_VER=1.0.1 +while [ "$1" != "" ]; do + PARAM=`echo $1 | awk -F= '{print $1}'` + case $PARAM in + --no-gmp) + unset GMP_VER + ;; + --no-mpfr) + unset MPFR_VER + ;; + --no-mpc) + unset MPC_VER + ;; + --no-deps) + unset GMP_VER + unset MPFR_VER + unset MPC_VER + ;; + *) + echo "ERROR: unknown parameter \"$PARAM\"" + exit 1 + ;; + esac + shift +done + # Download everything. if command -v wget >/dev/null 2>&1; then echo "Downloading binutils-$BINUTILS_VER..." @@ -16,12 +41,21 @@ if command -v wget >/dev/null 2>&1; then wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2 || exit 1 echo "Downloading Newlib $NEWLIB_VER..." wget -c ftp://sourceware.org/pub/newlib/newlib-$NEWLIB_VER.tar.gz || exit 1 - echo "Downloading GMP $GMP_VER..." - wget -c ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.bz2 || exit 1 - echo "Downloading MPFR $MPFR_VER..." - wget -c http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VER.tar.bz2 || exit 1 - echo "Downloading MPC $MPC_VER..." - wget -c http://www.multiprecision.org/mpc/download/mpc-$MPC_VER.tar.gz || exit 1 + + if [ -n "$GMP_VER" ]; then + echo "Downloading GMP $GMP_VER..." + wget -c ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.bz2 || exit 1 + fi + + if [ -n "$MPFR_VER" ]; then + echo "Downloading MPFR $MPFR_VER..." + wget -c http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VER.tar.bz2 || exit 1 + fi + + if [ -n "$MPC_VER" ]; then + echo "Downloading MPC $MPC_VER..." + wget -c http://www.multiprecision.org/mpc/download/mpc-$MPC_VER.tar.gz || exit 1 + fi elif command -v curl >/dev/null 2>&1; then echo "Downloading Binutils $BINUTILS_VER..." curl -C - -O ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.bz2 || exit 1 @@ -29,12 +63,21 @@ elif command -v curl >/dev/null 2>&1; then curl -C - -O ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2 || exit 1 echo "Downloading Newlib $NEWLIB_VER..." curl -C - -O ftp://sourceware.org/pub/newlib/newlib-$NEWLIB_VER.tar.gz || exit 1 - echo "Downloading GMP $GMP_VER..." - curl -C - -O ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.bz2 || exit 1 - echo "Downloading MPFR $MPFR_VER..." - curl -O http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VER.tar.bz2 || exit 1 - echo "Downloading MPC $MPC_VER..." - curl -O http://www.multiprecision.org/mpc/download/mpc-$MPC_VER.tar.gz || exit 1 + + if [ -n "$GMP_VER" ]; then + echo "Downloading GMP $GMP_VER..." + curl -C -O ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.bz2 || exit 1 + fi + + if [ -n "$MPFR_VER" ]; then + echo "Downloading MPFR $MPFR_VER..." + curl -O http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VER.tar.bz2 || exit 1 + fi + + if [ -n "$MPC_VER" ]; then + echo "Downloading MPC $MPC_VER..." + curl -O http://www.multiprecision.org/mpc/download/mpc-$MPC_VER.tar.gz || exit 1 + fi else echo >&2 "You must have either wget or cURL installed to use this script!" exit 1 diff --git a/utils/dc-chain/unpack.sh b/utils/dc-chain/unpack.sh index 342eb13..ffecabb 100755 --- a/utils/dc-chain/unpack.sh +++ b/utils/dc-chain/unpack.sh @@ -1,13 +1,38 @@ #!/bin/sh # These version numbers are all that should ever have to be changed. -export GCC_VER=4.8.2 +export GCC_VER=4.7.3 export BINUTILS_VER=2.23.2 export NEWLIB_VER=2.0.0 export GMP_VER=5.1.3 export MPFR_VER=3.1.2 export MPC_VER=1.0.1 +while [ "$1" != "" ]; do + PARAM=`echo $1 | awk -F= '{print $1}'` + case $PARAM in + --no-gmp) + unset GMP_VER + ;; + --no-mpfr) + unset MPFR_VER + ;; + --no-mpc) + unset MPC_VER + ;; + --no-deps) + unset GMP_VER + unset MPFR_VER + unset MPC_VER + ;; + *) + echo "ERROR: unknown parameter \"$PARAM\"" + exit 1 + ;; + esac + shift +done + # Clean up from any old builds. rm -rf binutils-$BINUTILS_VER gcc-$GCC_VER newlib-$NEWLIB_VER rm -rf gmp-$GMP_VER mpfr-$MPFR_VER mpc-$MPC_VER @@ -16,11 +41,19 @@ rm -rf gmp-$GMP_VER mpfr-$MPFR_VER mpc-$MPC_VER tar jxf binutils-$BINUTILS_VER.tar.bz2 || exit 1 tar jxf gcc-$GCC_VER.tar.bz2 || exit 1 tar zxf newlib-$NEWLIB_VER.tar.gz || exit 1 -tar jxf gmp-$GMP_VER.tar.bz2 || exit 1 -tar jxf mpfr-$MPFR_VER.tar.bz2 || exit 1 -tar zxf mpc-$MPC_VER.tar.gz || exit 1 -# Move the GCC dependencies into their required locations. -mv gmp-$GMP_VER gcc-$GCC_VER/gmp -mv mpfr-$MPFR_VER gcc-$GCC_VER/mpfr -mv mpc-$MPC_VER gcc-$GCC_VER/mpc +# Unpack the GCC dependencies and move them into their required locations. +if [ -n "$GMP_VER" ]; then + tar jxf gmp-$GMP_VER.tar.bz2 || exit 1 + mv gmp-$GMP_VER gcc-$GCC_VER/gmp +fi + +if [ -n "$MPFR_VER" ]; then + tar jxf mpfr-$MPFR_VER.tar.bz2 || exit 1 + mv mpfr-$MPFR_VER gcc-$GCC_VER/mpfr +fi + +if [ -n "$MPC_VER" ]; then + tar zxf mpc-$MPC_VER.tar.gz || exit 1 + mv mpc-$MPC_VER gcc-$GCC_VER/mpc +fi hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-02-13 01:48:36
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4701ba49c8bb62a3fbd2be5655d8e6312112414a (commit) from 01f82714515d1f8050965f2e7eb549e241938c26 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4701ba49c8bb62a3fbd2be5655d8e6312112414a Author: Lawrence Sebald <ljs...@us...> Date: Wed Feb 12 20:48:00 2014 -0500 Fix an infinite loop if you call g1_ata_init() without a device attached. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/g1ata.c | 12 ++++++++---- kernel/arch/dreamcast/include/dc/g1ata.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c index 49ed997..8aefc68 100644 --- a/kernel/arch/dreamcast/hardware/g1ata.c +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -490,7 +490,7 @@ int g1_ata_flush(void) { } static int g1_ata_scan(void) { - uint8_t dsel = IN8(G1_ATA_DEVICE_SELECT); + uint8_t dsel = IN8(G1_ATA_DEVICE_SELECT), st; int rv, i; uint16_t data[256]; @@ -507,10 +507,10 @@ static int g1_ata_scan(void) { /* Send the IDENTIFY command. */ OUT8(G1_ATA_COMMAND_REG, ATA_CMD_IDENTIFY); timer_spin_sleep(1); + st = IN8(G1_ATA_STATUS_REG); /* Check if there's anything on the bus. */ - if(!IN8(G1_ATA_STATUS_REG)) { - dbglog(DBG_KDEBUG, "g1_ata_scan: no device present\n"); + if(!st || st == 0xFF) { rv = 0; goto out; } @@ -773,7 +773,11 @@ int g1_ata_init(void) { return -1; } - dbglog(DBG_KDEBUG, "g1_ata_init: Found %d devices\n", devices); + if(!devices) { + dbglog(DBG_KDEBUG, "g1_ata_init: no adapter or device present\n"); + return -1; + } + initted = 1; return 0; diff --git a/kernel/arch/dreamcast/include/dc/g1ata.h b/kernel/arch/dreamcast/include/dc/g1ata.h index e95f348..a514d08 100644 --- a/kernel/arch/dreamcast/include/dc/g1ata.h +++ b/kernel/arch/dreamcast/include/dc/g1ata.h @@ -203,7 +203,7 @@ int g1_ata_blockdev_for_partition(int partition, kos_blockdev_t *rv, some devices. Currently only the slave device is scanned, as the master device should always be the GD-ROM drive. - \return 0 on success. <0 on error. + \return 0 on success, <0 on error or if no device is present */ int g1_ata_init(void); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-01-15 23:07:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 01f82714515d1f8050965f2e7eb549e241938c26 (commit) from ba26256094fdee4521261c56539007198b9c11ac (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 01f82714515d1f8050965f2e7eb549e241938c26 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jan 15 18:06:30 2014 -0500 Use F_PI instead of M_PI in the kgl bubbles example. The rest of the example is using the fmath functions anyway, so we might as well use the F_PI constant that is there too. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/kgl/demos/bubbles/bubbles.c | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/dreamcast/kgl/demos/bubbles/bubbles.c b/examples/dreamcast/kgl/demos/bubbles/bubbles.c index 826329f..ee375d2 100644 --- a/examples/dreamcast/kgl/demos/bubbles/bubbles.c +++ b/examples/dreamcast/kgl/demos/bubbles/bubbles.c @@ -6,7 +6,6 @@ */ #include <kos.h> -#include <math.h> #include <GL/gl.h> #include <GL/glu.h> @@ -81,14 +80,14 @@ static void sphere(float radius, int slices, int stacks) { /* Iterate over stacks */ for(i = 0; i < stacks; i++) { - pitch = 2 * M_PI * ((float)i / (float)stacks); - pitch2 = 2 * M_PI * ((float)(i + 1) / (float)stacks); + pitch = 2 * F_PI * ((float)i / (float)stacks); + pitch2 = 2 * F_PI * ((float)(i + 1) / (float)stacks); /* Iterate over slices: each entire stack will be one long triangle strip. */ for(j = 0; j <= slices / 2; j++) { - yaw = 2 * M_PI * ((float)j / (float)slices); - yaw2 = 2 * M_PI * ((float)(j + 1) / (float)slices); + yaw = 2 * F_PI * ((float)j / (float)slices); + yaw2 = 2 * F_PI * ((float)(j + 1) / (float)slices); /* x, y+1 */ x = radius * fcos(yaw) * fcos(pitch2); @@ -152,7 +151,7 @@ static void sphere_frame_opaque() { for(i = 0; i < SPHERE_CNT; i++) { glPushMatrix(); - glTranslatef(6.0f * fcos(i * 2 * M_PI / SPHERE_CNT), 0.0f, 6.0f * fsin(i * 2 * M_PI / SPHERE_CNT)); + glTranslatef(6.0f * fcos(i * 2 * F_PI / SPHERE_CNT), 0.0f, 6.0f * fsin(i * 2 * F_PI / SPHERE_CNT)); glRotatef(r, 1.0f, 1.0f, 1.0f); sphere(1.2f, 20, 20); glPopMatrix(); @@ -165,7 +164,7 @@ static void sphere_frame_opaque() { for(i = 0; i < SPHERE_CNT; i++) { glPushMatrix(); - glTranslatef(3.0f * fcos(i * 2 * M_PI / SPHERE_CNT), 0.0f, 3.0f * fsin(i * 2 * M_PI / SPHERE_CNT)); + glTranslatef(3.0f * fcos(i * 2 * F_PI / SPHERE_CNT), 0.0f, 3.0f * fsin(i * 2 * F_PI / SPHERE_CNT)); glRotatef(r, 1.0f, 1.0f, 1.0f); sphere(0.8f, 20, 20); glPopMatrix(); @@ -176,7 +175,7 @@ static void sphere_frame_opaque() { vid_border_color(0, 0, 255); glKosFinishFrame(); r++; - phase += 2 * M_PI / 240.0f; + phase += 2 * F_PI / 240.0f; } static void sphere_frame_trans() { @@ -195,7 +194,7 @@ static void sphere_frame_trans() { for(i = 0; i < SPHERE_CNT; i++) { glPushMatrix(); - glTranslatef(4.0f * fcos(i * 2 * M_PI / SPHERE_CNT), 0.0f, 4.0f * fsin(i * 2 * M_PI / SPHERE_CNT)); + glTranslatef(4.0f * fcos(i * 2 * F_PI / SPHERE_CNT), 0.0f, 4.0f * fsin(i * 2 * F_PI / SPHERE_CNT)); glRotatef(r, 1.0f, 1.0f, 1.0f); sphere(1.0f, 20, 20); glPopMatrix(); @@ -205,7 +204,7 @@ static void sphere_frame_trans() { glKosFinishFrame(); vid_border_color(255, 0, 0); r++; - phase += 2 * M_PI / 240.0f; + phase += 2 * F_PI / 240.0f; } void do_sphere_test() { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-01-01 03:13:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ba26256094fdee4521261c56539007198b9c11ac (commit) from 5ea1debafea9a5b42c203efb4f522630017c3fa2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ba26256094fdee4521261c56539007198b9c11ac Author: Lawrence Sebald <ljs...@us...> Date: Tue Dec 31 22:13:19 2013 -0500 Might help if I checked in the Makefile too. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/Makefile | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/Makefile b/kernel/arch/dreamcast/hardware/Makefile index 7b5084a..d8110eb 100644 --- a/kernel/arch/dreamcast/hardware/Makefile +++ b/kernel/arch/dreamcast/hardware/Makefile @@ -25,6 +25,9 @@ OBJS += sq.o scif.o # SPI device support OBJS += scif-spi.o sd.o +# G1 Bus ATA support +OBJS += g1ata.o + SUBDIRS = pvr network maple modem include $(KOS_BASE)/Makefile.prefab hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2014-01-01 00:30:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5ea1debafea9a5b42c203efb4f522630017c3fa2 (commit) from e35e088fda474f075ef0ec1d13b62b944ee610ec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5ea1debafea9a5b42c203efb4f522630017c3fa2 Author: Lawrence Sebald <ljs...@us...> Date: Tue Dec 31 19:29:48 2013 -0500 Add G1 ATA device support. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + kernel/arch/dreamcast/hardware/g1ata.c | 790 ++++++++++++++++++++++++++++++ kernel/arch/dreamcast/include/dc/g1ata.h | 219 +++++++++ 3 files changed, 1010 insertions(+), 0 deletions(-) create mode 100644 kernel/arch/dreamcast/hardware/g1ata.c create mode 100644 kernel/arch/dreamcast/include/dc/g1ata.h diff --git a/doc/CHANGELOG b/doc/CHANGELOG index f6c9aff..64901a7 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -16,6 +16,7 @@ KallistiOS version 2.0.1 ----------------------------------------------- - *** Cleaned up warnings with -std=c99 for C code [LS] - DC Changed the PVR render-to-texture support to allow for two render-to- texture passes without an intervening render-to-screen pass [LS] +- DC Added support for ATA devices on the G1 bus [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c new file mode 100644 index 0000000..49ed997 --- /dev/null +++ b/kernel/arch/dreamcast/hardware/g1ata.c @@ -0,0 +1,790 @@ +/* KallistiOS ##version## + + hardware/g1ata.c + Copyright (C) 2013 Lawrence Sebald +*/ + +#include <errno.h> +#include <string.h> +#include <stdlib.h> + +#include <dc/g1ata.h> +#include <kos/dbglog.h> +#include <arch/timer.h> + +/* + This file implements support for accessing devices over the G1 bus by the + AT Attachment (aka ATA, PATA, or IDE) protocol. See, the GD-ROM drive is + actually just an ATA device that implements a different packet command set + than the normal ATAPI set. Not only that, but Sega left everything in the + hardware to actually support two devices on the bus at a time. Thus, you can + put together a very simple passthrough adapter to get a normal 40-pin IDE + port to work with and hook up a hard drive to. In theory, you could also hook + up various other devices including DVD drives, CD Burners, and the whole nine + yards, but for now this just supports hard drives (and Compact Flash cards). + + The setup here is relatively simple, because we only have one channel which + can have a maximum of two devices attached to it at a time. Normally the + primary device would be the GD-ROM drive itself, so we're only actually + concerned with the secondary device (use the normal cdrom_* functions to + access the GD-ROM drive -- there's not a particularly compelling reason to + support its odd packet interface here). Also, at the moment, only PIO + transfers are supported. I'll look into DMA at some point in the future. + + There are a few potentially useful outward facing functions here, but most of + the time all you'll need here is the function to get a block device for a + given partition. The individual block read/write functions are all public as + well, in case you have a reason to want to use them directly. Just keep in + mind that all block numbers in those are absolute (i.e, not offset by any + partition boundaries or whatnot). + + If you want to learn more about ATA, look around the internet for the + AT Attachment - 8 ATA/ATAPI Command Set document. That's where most of the + fun stuff in here comes from. Register locations and such were derived from + a couple of different sources, including Quzar's GDINFO program, my own SPI + CD Player program (which I should eventually release), and the source code to + the emulator NullDC. Also, various postings at OSDev were quite useful in + working some of this out. + + Anyway, that's enough for this wall of text... +*/ + +/* An ATA device. For the moment, we only support one of these, which happens to + be the slave device on the only ATA bus Sega gave us. */ +static struct { + uint32_t command_sets; + uint32_t capabilities; + uint64_t max_lba; + uint16_t cylinders; + uint16_t heads; + uint16_t sectors; + uint16_t reserved; +} device; + +/* The type of the dev_data in the block device structure */ +typedef struct ata_devdata { + uint64_t block_count; + uint64_t start_block; + uint64_t end_block; +} ata_devdata_t; + +/* ATA-related registers. Some of these serve very different purposes when read + than they do when written (hence why some addresses are duplicated). */ +#define G1_ATA_ALTSTATUS 0xA05F7018 /* Read */ +#define G1_ATA_CTL 0xA05F7018 /* Write */ +#define G1_ATA_DATA 0xA05F7080 /* Read/Write */ +#define G1_ATA_ERROR 0xA05F7084 /* Read */ +#define G1_ATA_FEATURES 0xA05F7084 /* Write */ +#define G1_ATA_IRQ_REASON 0xA05F7088 /* Read */ +#define G1_ATA_SECTOR_COUNT 0xA05F7088 /* Write */ +#define G1_ATA_LBA_LOW 0xA05F708C /* Read/Write */ +#define G1_ATA_LBA_MID 0xA05F7090 /* Read/Write */ +#define G1_ATA_LBA_HIGH 0xA05F7094 /* Read/Write */ +#define G1_ATA_CHS_SECTOR G1_ATA_LBA_LOW +#define G1_ATA_CHS_CYL_LOW G1_ATA_LBA_MID +#define G1_ATA_CHS_CYL_HIGH G1_ATA_LBA_HIGH +#define G1_ATA_DEVICE_SELECT 0xA05F7098 /* Read/Write */ +#define G1_ATA_STATUS_REG 0xA05F709C /* Read */ +#define G1_ATA_COMMAND_REG 0xA05F709C /* Write */ + +/* Bitmasks for the STATUS_REG/ALT_STATUS registers. */ +#define G1_ATA_SR_ERR 0x01 +#define G1_ATA_SR_IDX 0x02 +#define G1_ATA_SR_CORR 0x04 +#define G1_ATA_SR_DRQ 0x08 +#define G1_ATA_SR_DSC 0x10 +#define G1_ATA_SR_DF 0x20 +#define G1_ATA_SR_DRDY 0x40 +#define G1_ATA_SR_BSY 0x80 + +/* ATA Commands we might like to send. */ +#define ATA_CMD_READ_SECTORS 0x20 +#define ATA_CMD_READ_SECTORS_EXT 0x24 +#define ATA_CMD_WRITE_SECTORS 0x30 +#define ATA_CMD_WRITE_SECTORS_EXT 0x34 +#define ATA_CMD_FLUSH_CACHE 0xE7 +#define ATA_CMD_FLUSH_CACHE_EXT 0xEA +#define ATA_CMD_IDENTIFY 0xEC + +/* Macros to access the ATA registers */ +#define OUT32(addr, data) *((volatile uint32_t *)addr) = data +#define OUT16(addr, data) *((volatile uint16_t *)addr) = data +#define OUT8(addr, data) *((volatile uint8_t *)addr) = data +#define IN32(addr) *((volatile uint32_t *)addr) +#define IN16(addr) *((volatile uint16_t *)addr) +#define IN8(addr) *((volatile uint8_t *)addr) + +static int initted = 0; +static int devices = 0; + +#define g1_ata_wait_nbsy() \ + do {} while((IN8(G1_ATA_ALTSTATUS) & G1_ATA_SR_BSY)) + +#define g1_ata_wait_drdy() \ + do {} while(!(IN8(G1_ATA_ALTSTATUS) & G1_ATA_SR_DRDY)) + +/* This one is an inline function since it needs to return something... */ +static inline int g1_ata_wait_drq(void) { + uint8_t val = IN8(G1_ATA_ALTSTATUS); + + while(!(val & G1_ATA_SR_DRQ) && !(val & (G1_ATA_SR_ERR | G1_ATA_SR_DF))) { + val = IN8(G1_ATA_ALTSTATUS); + } + + return (val & (G1_ATA_SR_ERR | G1_ATA_SR_DF)) ? -1 : 0; +} + +int g1_ata_read_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, + uint16_t *buf) { + int rv = 0; + unsigned int i, j; + uint8_t nsects = (uint8_t)count; + uint8_t dsel; + + /* Make sure that we've been initialized and there's a disk attached. */ + if(!devices) { + errno = ENODEV; + return -1; + } + + /* Wait for the device to signal it is ready. */ + g1_ata_wait_nbsy(); + + /* For now, just assume we're accessing the slave device. We don't care + about the primary device, since it should always be the GD-ROM drive. */ + dsel = IN8(G1_ATA_DEVICE_SELECT); + + while(count) { + nsects = count > 255 ? 255 : (uint8_t)count; + count -= nsects; + + OUT8(G1_ATA_DEVICE_SELECT, 0xB0 | (h & 0x0F)); + + /* Write out the number of sectors we want as well as the cylinder and + sector. */ + OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_CHS_SECTOR, s); + OUT8(G1_ATA_CHS_CYL_LOW, (uint8_t)((c >> 0) & 0xFF)); + OUT8(G1_ATA_CHS_CYL_HIGH, (uint8_t)((c >> 8) & 0xFF)); + + /* Wait until the drive is ready to accept the command. */ + g1_ata_wait_nbsy(); + g1_ata_wait_drdy(); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_READ_SECTORS); + + /* Now, wait for the drive to give us back each sector. */ + for(i = 0; i < nsects; ++i, ++s) { + /* Make sure to keep track of where we are, just in case something + errors out (or we have to deal with a second pass). */ + if(s >= device.sectors) { + if(++h == device.heads) { + h = 0; + ++c; + } + + s = 1; + } + + /* Wait for data */ + if(g1_ata_wait_drq()) { + dbglog(DBG_KDEBUG, "g1_ata_read_chs: error reading CHS " + "%d, %d, %d of device: %02x\n", (int)c, (int)h, (int)s, + IN8(G1_ATA_ALTSTATUS)); + errno = EIO; + rv = -1; + goto out; + } + + for(j = 0; j < 256; ++j) { + *buf++ = IN16(G1_ATA_DATA); + } + } + } + + rv = 0; + +out: + OUT8(G1_ATA_DEVICE_SELECT, dsel); + return rv; +} + +int g1_ata_write_chs(uint16_t c, uint8_t h, uint8_t s, size_t count, + const uint16_t *buf) { + int rv = 0; + unsigned int i, j; + uint8_t nsects = (uint8_t)count; + uint8_t dsel; + + /* Make sure that we've been initialized and there's a disk attached. */ + if(!devices) { + errno = ENXIO; + return -1; + } + + /* Wait for the device to signal it is ready. */ + g1_ata_wait_nbsy(); + + /* For now, just assume we're accessing the slave device. We don't care + about the primary device, since it should always be the GD-ROM drive. */ + dsel = IN8(G1_ATA_DEVICE_SELECT); + + while(count) { + nsects = count > 255 ? 255 : (uint8_t)count; + count -= nsects; + + OUT8(G1_ATA_DEVICE_SELECT, 0xB0 | (h & 0x0F)); + + /* Write out the number of sectors we want as well as the cylinder and + sector. */ + OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_CHS_SECTOR, s); + OUT8(G1_ATA_CHS_CYL_LOW, (uint8_t)((c >> 0) & 0xFF)); + OUT8(G1_ATA_CHS_CYL_HIGH, (uint8_t)((c >> 8) & 0xFF)); + + /* Wait until the drive is ready to accept the command. */ + g1_ata_wait_nbsy(); + g1_ata_wait_drdy(); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_WRITE_SECTORS); + + /* Now, send the drive each sector. */ + for(i = 0; i < nsects; ++i, ++s) { + /* Make sure to keep track of where we are, just in case something + errors out (or we have to deal with a second pass). */ + if(s >= device.sectors) { + if(++h >= device.heads) { + h = 0; + ++c; + } + + s = 1; + } + + /* Wait for the device to signal it is ready. */ + g1_ata_wait_nbsy(); + + /* Send the data! */ + for(j = 0; j < 256; ++j) { + OUT16(G1_ATA_DATA, *buf++); + } + } + } + + rv = 0; + + OUT8(G1_ATA_DEVICE_SELECT, dsel); + return rv; +} + +int g1_ata_read_lba(uint64_t sector, size_t count, uint16_t *buf) { + int rv = 0; + unsigned int i, j; + uint8_t nsects = (uint8_t)count; + uint8_t dsel; + + /* Make sure that we've been initialized and there's a disk attached. */ + if(!devices) { + errno = ENXIO; + return -1; + } + + /* Make sure the disk supports LBA mode. */ + if(!device.max_lba) { + errno = ENOTSUP; + return -1; + } + + /* Make sure the range of sectors is valid. */ + if((sector + count) > device.max_lba) { + errno = EOVERFLOW; + return -1; + } + + /* Wait for the device to signal it is ready. */ + g1_ata_wait_nbsy(); + + /* For now, just assume we're accessing the slave device. We don't care + about the primary device, since it should always be the GD-ROM drive. */ + dsel = IN8(G1_ATA_DEVICE_SELECT); + + while(count) { + nsects = count > 255 ? 255 : (uint8_t)count; + count -= nsects; + + /* Which mode are we using: LBA28 or LBA48? */ + if((sector + nsects) <= 0x0FFFFFFF) { + OUT8(G1_ATA_DEVICE_SELECT, 0xF0 | ((sector >> 24) & 0x0F)); + + /* Write out the number of sectors we want and the lower 24-bits of + the LBA we're looking for. */ + OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); + + /* Wait until the drive is ready to accept the command. */ + g1_ata_wait_nbsy(); + g1_ata_wait_drdy(); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_READ_SECTORS); + } + else { + OUT8(G1_ATA_DEVICE_SELECT, 0xF0); + + /* Write out the number of sectors we want and the LBA. */ + OUT8(G1_ATA_SECTOR_COUNT, 0); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 32) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 40) & 0xFF)); + OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); + + /* Wait until the drive is ready to accept the command. */ + g1_ata_wait_nbsy(); + g1_ata_wait_drdy(); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_READ_SECTORS_EXT); + } + + /* Now, wait for the drive to give us back each sector. */ + for(i = 0; i < nsects; ++i, ++sector) { + /* Wait for data */ + if(g1_ata_wait_drq()) { + dbglog(DBG_KDEBUG, "g1_ata_read_lba: error reading sector %d " + "of device: %02x\n", (int)sector, IN8(G1_ATA_ALTSTATUS)); + errno = EIO; + rv = -1; + goto out; + } + + for(j = 0; j < 256; ++j) { + *buf++ = IN16(G1_ATA_DATA); + } + } + } + + rv = 0; + +out: + OUT8(G1_ATA_DEVICE_SELECT, dsel); + return rv; +} + +int g1_ata_write_lba(uint64_t sector, size_t count, const uint16_t *buf) { + int rv = 0; + unsigned int i, j; + uint8_t nsects = (uint8_t)count; + uint8_t dsel; + + /* Make sure that we've been initialized and there's a disk attached. */ + if(!devices) { + errno = ENXIO; + return -1; + } + + /* Make sure the disk supports LBA mode. */ + if(!device.max_lba) { + errno = ENOTSUP; + return -1; + } + + /* Make sure the range of sectors is valid. */ + if((sector + count) > device.max_lba) { + errno = EOVERFLOW; + return -1; + } + + /* Wait for the device to signal it is ready. */ + g1_ata_wait_nbsy(); + + /* For now, just assume we're accessing the slave device. We don't care + about the primary device, since it should always be the GD-ROM drive. */ + dsel = IN8(G1_ATA_DEVICE_SELECT); + + while(count) { + nsects = count > 255 ? 255 : (uint8_t)count; + count -= nsects; + + /* Which mode are we using: LBA28 or LBA48? */ + if((sector + nsects) <= 0x0FFFFFFF) { + OUT8(G1_ATA_DEVICE_SELECT, 0xF0 | ((sector >> 24) & 0x0F)); + + /* Write out the number of sectors we want and the lower 24-bits of + the LBA we're looking for. */ + OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_WRITE_SECTORS); + } + else { + OUT8(G1_ATA_DEVICE_SELECT, 0xF0); + + /* Write out the number of sectors we want and the LBA. */ + OUT8(G1_ATA_SECTOR_COUNT, 0); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 24) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 32) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 40) & 0xFF)); + OUT8(G1_ATA_SECTOR_COUNT, nsects); + OUT8(G1_ATA_LBA_LOW, (uint8_t)((sector >> 0) & 0xFF)); + OUT8(G1_ATA_LBA_MID, (uint8_t)((sector >> 8) & 0xFF)); + OUT8(G1_ATA_LBA_HIGH, (uint8_t)((sector >> 16) & 0xFF)); + + /* Write out the command to the device. */ + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_WRITE_SECTORS_EXT); + } + + /* Now, send the drive each sector. */ + for(i = 0; i < nsects; ++i, ++sector) { + /* Wait for the device to signal it is ready. */ + g1_ata_wait_nbsy(); + + /* Send the data! */ + for(j = 0; j < 256; ++j) { + OUT16(G1_ATA_DATA, *buf++); + } + } + } + + rv = 0; + + OUT8(G1_ATA_DEVICE_SELECT, dsel); + return rv; +} + +int g1_ata_flush(void) { + uint8_t dsel; + + /* Make sure that we've been initialized and there's a disk attached. */ + if(!devices) { + errno = ENXIO; + return -1; + } + + /* Select the slave device. */ + dsel = IN8(G1_ATA_DEVICE_SELECT); + OUT8(G1_ATA_DEVICE_SELECT, 0xF0); + timer_spin_sleep(1); + + /* Flush the disk's write cache to make sure everything gets written out. */ + if(device.max_lba > 0x0FFFFFFF) + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_FLUSH_CACHE_EXT); + else + OUT8(G1_ATA_COMMAND_REG, ATA_CMD_FLUSH_CACHE); + + timer_spin_sleep(1); + g1_ata_wait_nbsy(); + + /* Restore the old selected device and return. */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-12-15 00:00:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e35e088fda474f075ef0ec1d13b62b944ee610ec (commit) from 84d3fd8b0d564c15049d2b59db1c20f8172bf755 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e35e088fda474f075ef0ec1d13b62b944ee610ec Author: Lawrence Sebald <ljs...@us...> Date: Sat Dec 14 18:58:26 2013 -0500 Fix a bug in the mke2fs example. If a filesystem had more than one block for block group descriptors (which means that there were more than 128 block groups with 4096 byte blocks), then the the descriptors for groups 128 and up would be wrong (just mirrors of those for groups 0-127). You'd need a pretty big SD card to make this happen (>16GiB). ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/sd/mke2fs/mke2fs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/examples/dreamcast/sd/mke2fs/mke2fs.c b/examples/dreamcast/sd/mke2fs/mke2fs.c index 18fcd6e..104ab81 100644 --- a/examples/dreamcast/sd/mke2fs/mke2fs.c +++ b/examples/dreamcast/sd/mke2fs/mke2fs.c @@ -266,7 +266,7 @@ static int write_bg_descs(ext2_superblock_t *sb, kos_blockdev_t *bd, /* Write them */ for(i = 0; i < nblks && !rv; ++i) { - rv = write_fs_block(sb, bd, blk + i, buf); + rv = write_fs_block(sb, bd, blk + i, buf + (block_size * i)); } free(buf); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-12-14 17:34:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 84d3fd8b0d564c15049d2b59db1c20f8172bf755 (commit) from dbcb94b47a0c15e4112693c5bc1fa0b76a715799 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 84d3fd8b0d564c15049d2b59db1c20f8172bf755 Author: Lawrence Sebald <ljs...@us...> Date: Sat Dec 14 12:33:48 2013 -0500 Change the type of block numbers in the block device code to uint64_t. ----------------------------------------------------------------------- Summary of changes: include/kos/blockdev.h | 6 +++--- kernel/arch/dreamcast/hardware/sd.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/kos/blockdev.h b/include/kos/blockdev.h index 0a25268..3625b42 100644 --- a/include/kos/blockdev.h +++ b/include/kos/blockdev.h @@ -81,7 +81,7 @@ typedef struct kos_blockdev { \retval 0 On success. \retval -1 On failure. Set errno as appropriate. */ - int (*read_blocks)(struct kos_blockdev *d, uint32_t block, size_t count, + int (*read_blocks)(struct kos_blockdev *d, uint64_t block, size_t count, void *buf); /** \brief Write a number of blocks to the device. @@ -96,7 +96,7 @@ typedef struct kos_blockdev { \retval 0 On success. \retval -1 On failure. Set errno as appropriate. */ - int (*write_blocks)(struct kos_blockdev *d, uint32_t block, size_t count, + int (*write_blocks)(struct kos_blockdev *d, uint64_t block, size_t count, const void *buf); /** \brief Count the number of blocks on the device. @@ -108,7 +108,7 @@ typedef struct kos_blockdev { \param d The device to read the block count from. \return The number of blocks that the device has. */ - uint32_t (*count_blocks)(struct kos_blockdev *d); + uint64_t (*count_blocks)(struct kos_blockdev *d); /** \brief Flush the write cache (if any) of the device. diff --git a/kernel/arch/dreamcast/hardware/sd.c b/kernel/arch/dreamcast/hardware/sd.c index 684ec0f..43f05a8 100644 --- a/kernel/arch/dreamcast/hardware/sd.c +++ b/kernel/arch/dreamcast/hardware/sd.c @@ -32,8 +32,8 @@ static int initted = 0; /* The type of the dev_data in the block device structure */ typedef struct sd_devdata { - uint32_t block_count; - uint32_t start_block; + uint64_t block_count; + uint64_t start_block; } sd_devdata_t; /* Table/algorithm generated by pycrc. I really wanted to have a much smaller @@ -589,14 +589,14 @@ static int sdb_shutdown(kos_blockdev_t *d) { return 0; } -static int sdb_read_blocks(kos_blockdev_t *d, uint32_t block, size_t count, +static int sdb_read_blocks(kos_blockdev_t *d, uint64_t block, size_t count, void *buf) { sd_devdata_t *data = (sd_devdata_t *)d->dev_data; return sd_read_blocks(block + data->start_block, count, (uint8 *)buf); } -static int sdb_write_blocks(kos_blockdev_t *d, uint32_t block, size_t count, +static int sdb_write_blocks(kos_blockdev_t *d, uint64_t block, size_t count, const void *buf) { sd_devdata_t *data = (sd_devdata_t *)d->dev_data; @@ -604,7 +604,7 @@ static int sdb_write_blocks(kos_blockdev_t *d, uint32_t block, size_t count, (const uint8 *)buf); } -static uint32_t sdb_count_blocks(kos_blockdev_t *d) { +static uint64_t sdb_count_blocks(kos_blockdev_t *d) { sd_devdata_t *data = (sd_devdata_t *)d->dev_data; return data->block_count; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-12-14 03:39:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via dbcb94b47a0c15e4112693c5bc1fa0b76a715799 (commit) from 977c0d9f3a2a02f8b2a212d1c657bd8b4b6183b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dbcb94b47a0c15e4112693c5bc1fa0b76a715799 Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 13 22:39:05 2013 -0500 Add a function to the kos_blockdev_t type to flush any write caches on the block device. ----------------------------------------------------------------------- Summary of changes: include/kos/blockdev.h | 14 +++++++++++++- kernel/arch/dreamcast/hardware/sd.c | 11 +++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/kos/blockdev.h b/include/kos/blockdev.h index 80b115f..0a25268 100644 --- a/include/kos/blockdev.h +++ b/include/kos/blockdev.h @@ -1,7 +1,7 @@ /* KallistiOS ##version## kos/blockdev.h - Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2012, 2013 Lawrence Sebald */ #ifndef __KOS_BLOCKDEV_H @@ -109,6 +109,18 @@ typedef struct kos_blockdev { \return The number of blocks that the device has. */ uint32_t (*count_blocks)(struct kos_blockdev *d); + + /** \brief Flush the write cache (if any) of the device. + + This function shall signal to the device that any write caches that are + present on the device shall be flushed so that all data written to this + point shall persist to the underlying storage. + + \param d The device to flush caches on. + \retval 0 On success. + \retval -1 On failure. Set errno as appropriate. + */ + int (*flush)(struct kos_blockdev *d); } kos_blockdev_t; __END_DECLS diff --git a/kernel/arch/dreamcast/hardware/sd.c b/kernel/arch/dreamcast/hardware/sd.c index 856d0aa..684ec0f 100644 --- a/kernel/arch/dreamcast/hardware/sd.c +++ b/kernel/arch/dreamcast/hardware/sd.c @@ -1,7 +1,7 @@ /* KallistiOS ##version## sd.c - Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2012, 2013 Lawrence Sebald */ /* The code contained herein is basically directly implementing what is @@ -610,6 +610,12 @@ static uint32_t sdb_count_blocks(kos_blockdev_t *d) { return data->block_count; } +static int sdb_flush(kos_blockdev_t *d) { + /* Cache? We don't need no steenkin' cache! */ + (void)d; + return 0; +} + static kos_blockdev_t sd_blockdev = { NULL, /* dev_data */ 9, /* l_block_size (block size of 512 bytes) */ @@ -617,7 +623,8 @@ static kos_blockdev_t sd_blockdev = { &sdb_shutdown, /* shutdown */ &sdb_read_blocks, /* read_blocks */ &sdb_write_blocks, /* write_blocks */ - &sdb_count_blocks /* count_blocks */ + &sdb_count_blocks, /* count_blocks */ + &sdb_flush /* flush */ }; int sd_blockdev_for_partition(int partition, kos_blockdev_t *rv, hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-12-06 18:44:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 977c0d9f3a2a02f8b2a212d1c657bd8b4b6183b4 (commit) from c2bdfacbad506cf107e007dd773819aaf5ad51fd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 977c0d9f3a2a02f8b2a212d1c657bd8b4b6183b4 Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 6 13:43:56 2013 -0500 Revert "Rolling back to GCC 4.7.3 for the moment, as someone has reported problems with 4.8.2." This reverts commit 13c2ac2b71c0311f236c78a0bd050f1ffac39339. Commit c2bdfacbad506cf107e007dd773819aaf5ad51fd fixes the issue reported, so back to 4.8.2 we go. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile | 2 +- utils/dc-chain/download.sh | 2 +- utils/dc-chain/unpack.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index 6cec899..d3e0c79 100644 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -29,7 +29,7 @@ kos_root=$(CURDIR)/../../.. # kos_base: equivalent of KOS_BASE (contains include/ and kernel/) kos_base=$(CURDIR)/../.. binutils_ver=2.23.2 -gcc_ver=4.7.3 +gcc_ver=4.8.2 newlib_ver=2.0.0 gdb_ver=6.7.1 insight_ver=6.7.1 diff --git a/utils/dc-chain/download.sh b/utils/dc-chain/download.sh index 77969c1..e5dce05 100755 --- a/utils/dc-chain/download.sh +++ b/utils/dc-chain/download.sh @@ -1,7 +1,7 @@ #!/bin/sh # These version numbers are all that should ever have to be changed. -export GCC_VER=4.7.3 +export GCC_VER=4.8.2 export BINUTILS_VER=2.23.2 export NEWLIB_VER=2.0.0 export GMP_VER=5.1.3 diff --git a/utils/dc-chain/unpack.sh b/utils/dc-chain/unpack.sh index fb3f7b6..342eb13 100755 --- a/utils/dc-chain/unpack.sh +++ b/utils/dc-chain/unpack.sh @@ -1,7 +1,7 @@ #!/bin/sh # These version numbers are all that should ever have to be changed. -export GCC_VER=4.7.3 +export GCC_VER=4.8.2 export BINUTILS_VER=2.23.2 export NEWLIB_VER=2.0.0 export GMP_VER=5.1.3 hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-12-06 18:30:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via c2bdfacbad506cf107e007dd773819aaf5ad51fd (commit) from 10a6d57a3bfe3223aa311bccedca0337a88f7311 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c2bdfacbad506cf107e007dd773819aaf5ad51fd Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 6 13:28:55 2013 -0500 Make the pointers volatile when reading the video cable type. This should fix the issue reported by SWAT in this DCEmulation post: http://dcemulation.org/phpBB/viewtopic.php?p=1041464#p1041464 ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/video.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/video.c b/kernel/arch/dreamcast/hardware/video.c index 8b344b0..b480bac 100644 --- a/kernel/arch/dreamcast/hardware/video.c +++ b/kernel/arch/dreamcast/hardware/video.c @@ -407,8 +407,8 @@ vid_mode_t vid_builtin[DM_MODE_COUNT] = { }; /*-----------------------------------------------------------------------------*/ -volatile uint32 *regs = (uint32*)0xA05F8000; -vid_mode_t currmode = { 0 }; +static vuint32 *regs = (uint32*)0xA05F8000; +static vid_mode_t currmode = { 0 }; vid_mode_t *vid_mode = 0; uint16 *vram_s; uint32 *vram_l; @@ -427,12 +427,12 @@ uint32 *vram_l; [This is the old KOS function by Dan.] */ int vid_check_cable() { - uint32 * porta = (uint32 *)0xff80002c; + vuint32 * porta = (vuint32 *)0xff80002c; *porta = (*porta & 0xfff0ffff) | 0x000a0000; /* Read port8 and port9 */ - return (*((uint16*)(porta + 1)) >> 8) & 3; + return (*((vuint16*)(porta + 1)) >> 8) & 3; } /*-----------------------------------------------------------------------------*/ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-12-06 16:10:42
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 10a6d57a3bfe3223aa311bccedca0337a88f7311 (commit) from 13c2ac2b71c0311f236c78a0bd050f1ffac39339 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 10a6d57a3bfe3223aa311bccedca0337a88f7311 Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 6 11:10:17 2013 -0500 Fix vqenc and kmgenc on a 64-bit host. ----------------------------------------------------------------------- Summary of changes: utils/kmgenc/Makefile | 4 ++-- utils/kmgenc/kmg.h | 10 ++++++---- utils/kmgenc/readpng.h | 8 +++++--- utils/vqenc/Makefile | 4 ++-- utils/vqenc/kmg.h | 10 ++++++---- utils/vqenc/readpng.h | 8 +++++--- utils/vqenc/vq_types.h | 8 +++++--- 7 files changed, 31 insertions(+), 21 deletions(-) diff --git a/utils/kmgenc/Makefile b/utils/kmgenc/Makefile index bdacfe0..4f1c6ee 100644 --- a/utils/kmgenc/Makefile +++ b/utils/kmgenc/Makefile @@ -1,8 +1,8 @@ # Makefile for the kmgenc program. -CFLAGS = -O2 -Wall -DINLINE=inline #-g# -LDFLAGS = -s -lpng -ljpeg -lz #-g +CFLAGS = -O2 -Wall -DINLINE=inline -I/usr/local/include #-g# +LDFLAGS = -s -lpng -ljpeg -lz -L/usr/local/lib #-g all: kmgenc diff --git a/utils/kmgenc/kmg.h b/utils/kmgenc/kmg.h index ed8f886..13f683b 100644 --- a/utils/kmgenc/kmg.h +++ b/utils/kmgenc/kmg.h @@ -14,10 +14,12 @@ # include <arch/types.h> #else +#include <stdint.h> + #ifdef NEED_KOS_TYPES -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned long uint32; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; #endif #endif @@ -36,7 +38,7 @@ typedef struct kmg_header { uint32 height; /* Image height */ uint32 byte_count; /* Image's data size in bytes */ uint8 padding[36]; /* Pad to a 64-byte header (all zeros) */ -} kmg_header_t; +} __attribute__((packed)) kmg_header_t; /* Magic code -- every KMG will start with one of these. */ #define KMG_MAGIC 0x00474d4b /* 'KMG\0' */ diff --git a/utils/kmgenc/readpng.h b/utils/kmgenc/readpng.h index f8d45da..af0cc29 100644 --- a/utils/kmgenc/readpng.h +++ b/utils/kmgenc/readpng.h @@ -2,9 +2,11 @@ typedef unsigned short uint16; typedef unsigned char uint8; */ -#define uint32 unsigned int -#define uint16 unsigned short -#define uint8 unsigned char +#include <stdint.h> + +#define uint32 uint32_t +#define uint16 uint16_t +#define uint8 uint8_t #ifndef TRUE # define TRUE 1 diff --git a/utils/vqenc/Makefile b/utils/vqenc/Makefile index 0659a6f..449c560 100644 --- a/utils/vqenc/Makefile +++ b/utils/vqenc/Makefile @@ -6,8 +6,8 @@ #LDFLAGS = -s -L/sw/lib -lpng -ljpeg -lz #-g # Use for other systems -CFLAGS = -O2 -Wall -DINLINE=inline #-g# -LDFLAGS = -lpng -ljpeg -lz -lm #-s -g +CFLAGS = -O2 -Wall -DINLINE=inline -I/usr/local/include #-g# +LDFLAGS = -lpng -ljpeg -lz -lm -L/usr/local/lib #-s -g all: vqenc diff --git a/utils/vqenc/kmg.h b/utils/vqenc/kmg.h index ed8f886..1e35927 100644 --- a/utils/vqenc/kmg.h +++ b/utils/vqenc/kmg.h @@ -15,9 +15,11 @@ #else #ifdef NEED_KOS_TYPES -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned long uint32; +#include <stdint.h> + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; #endif #endif @@ -36,7 +38,7 @@ typedef struct kmg_header { uint32 height; /* Image height */ uint32 byte_count; /* Image's data size in bytes */ uint8 padding[36]; /* Pad to a 64-byte header (all zeros) */ -} kmg_header_t; +} __attribute__((packed)) kmg_header_t; /* Magic code -- every KMG will start with one of these. */ #define KMG_MAGIC 0x00474d4b /* 'KMG\0' */ diff --git a/utils/vqenc/readpng.h b/utils/vqenc/readpng.h index d86a07d..1c4a034 100644 --- a/utils/vqenc/readpng.h +++ b/utils/vqenc/readpng.h @@ -2,9 +2,11 @@ typedef unsigned short uint16; typedef unsigned char uint8; */ -#define uint32 unsigned int -#define uint16 unsigned short -#define uint8 unsigned char +#include <stdint.h> + +#define uint32 uint32_t +#define uint16 uint16_t +#define uint8 uint8_t #ifndef TRUE # define TRUE 1 diff --git a/utils/vqenc/vq_types.h b/utils/vqenc/vq_types.h index 2a1813c..bda199d 100644 --- a/utils/vqenc/vq_types.h +++ b/utils/vqenc/vq_types.h @@ -3,9 +3,11 @@ #define __VQ_TYPES_H #ifndef uint8 -typedef unsigned char uint8; -typedef unsigned short uint16; -typedef unsigned long uint32; +#include <stdint.h> + +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; #endif /* from 2x2 to 1024x1024 */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-12-06 15:00:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 13c2ac2b71c0311f236c78a0bd050f1ffac39339 (commit) from 7f4c1c5aa6c4b8dce6fc98bfd0f161a5ff7d2492 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 13c2ac2b71c0311f236c78a0bd050f1ffac39339 Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 6 09:59:14 2013 -0500 Rolling back to GCC 4.7.3 for the moment, as someone has reported problems with 4.8.2. See this topic at DCEmulation: http://dcemulation.org/phpBB/viewtopic.php?f=29&t=102800 ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile | 2 +- utils/dc-chain/download.sh | 2 +- utils/dc-chain/unpack.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index d3e0c79..6cec899 100644 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -29,7 +29,7 @@ kos_root=$(CURDIR)/../../.. # kos_base: equivalent of KOS_BASE (contains include/ and kernel/) kos_base=$(CURDIR)/../.. binutils_ver=2.23.2 -gcc_ver=4.8.2 +gcc_ver=4.7.3 newlib_ver=2.0.0 gdb_ver=6.7.1 insight_ver=6.7.1 diff --git a/utils/dc-chain/download.sh b/utils/dc-chain/download.sh index e5dce05..77969c1 100755 --- a/utils/dc-chain/download.sh +++ b/utils/dc-chain/download.sh @@ -1,7 +1,7 @@ #!/bin/sh # These version numbers are all that should ever have to be changed. -export GCC_VER=4.8.2 +export GCC_VER=4.7.3 export BINUTILS_VER=2.23.2 export NEWLIB_VER=2.0.0 export GMP_VER=5.1.3 diff --git a/utils/dc-chain/unpack.sh b/utils/dc-chain/unpack.sh index 342eb13..fb3f7b6 100755 --- a/utils/dc-chain/unpack.sh +++ b/utils/dc-chain/unpack.sh @@ -1,7 +1,7 @@ #!/bin/sh # These version numbers are all that should ever have to be changed. -export GCC_VER=4.8.2 +export GCC_VER=4.7.3 export BINUTILS_VER=2.23.2 export NEWLIB_VER=2.0.0 export GMP_VER=5.1.3 hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-11-18 02:40:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 7f4c1c5aa6c4b8dce6fc98bfd0f161a5ff7d2492 (commit) from d4348100d82ba60f8ad9d3f1809e00cdfd3873b7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7f4c1c5aa6c4b8dce6fc98bfd0f161a5ff7d2492 Author: Lawrence Sebald <ljs...@us...> Date: Sun Nov 17 21:38:46 2013 -0500 A few changes/updates to dc-chain: 1. Update GCC version to 4.8.2. 2. Automatically build GCC's dependencies along with GCC. 3. Add in a small fix for OS X Mavericks (GCC can't be built against libc++). ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile | 25 +++- utils/dc-chain/download.sh | 42 +++++- .../{gcc-4.7.3-kos.diff => gcc-4.8.1-kos.diff} | 166 +++++++++++--------- .../{gcc-4.7.3-kos.diff => gcc-4.8.2-kos.diff} | 166 +++++++++++--------- utils/dc-chain/unpack.sh | 27 +++- 5 files changed, 261 insertions(+), 165 deletions(-) copy utils/dc-chain/patches/{gcc-4.7.3-kos.diff => gcc-4.8.1-kos.diff} (96%) copy utils/dc-chain/patches/{gcc-4.7.3-kos.diff => gcc-4.8.2-kos.diff} (96%) diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index 3f7a9ae..d3e0c79 100644 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -29,10 +29,11 @@ kos_root=$(CURDIR)/../../.. # kos_base: equivalent of KOS_BASE (contains include/ and kernel/) kos_base=$(CURDIR)/../.. binutils_ver=2.23.2 -gcc_ver=4.7.3 +gcc_ver=4.8.2 newlib_ver=2.0.0 gdb_ver=6.7.1 insight_ver=6.7.1 + # With GCC 4.x versions, the patches provide a kos thread model, so you should # use it. With 3.4.6, you probably want posix here. If you really don't want # threading support for C++ (or Objective C/Objective C++), you can set this to @@ -57,6 +58,20 @@ pass2_languages=c,c++,objc,obj-c++ # Change this if you don't have Bash installed in /bin SHELL = /bin/bash +# GCC compiles fine with clang, but only if we use libstdc++ instead of libc++. +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + ifneq ($(shell $(CXX) --version | grep clang),) + CXX := "$(CXX) -stdlib=libstdc++" + endif +endif + +# Catch all... +ifeq ($(CXX),) + CXX := g++ +endif + + # Makefile variables install=$(prefix)/bin pwd := $(shell pwd) @@ -133,9 +148,11 @@ $(build_binutils): src_dir = binutils-$(binutils_ver) $(build_binutils): log = $(logdir)/$(build).log $(build_binutils): logdir @echo "+++ Building $(src_dir) to $(build)..." + sed -e 's/ @colophon/ @@colophon/' -e 's/do...@cy.../doc@@cygnus.com/' $(src_dir)/bfd/doc/bfd.texinfo > $(src_dir)/bfd/doc/bfd.texinfo2 + mv $(src_dir)/bfd/doc/bfd.texinfo2 $(src_dir)/bfd/doc/bfd.texinfo -mkdir -p $(build) > $(log) - cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --disable-werror $(to_log) + cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --disable-werror CXX=$(CXX) $(to_log) make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) $(clean_up) @@ -147,7 +164,7 @@ $(build_gcc_pass1): logdir @echo "+++ Building $(src_dir) to $(build) (pass 1)..." -mkdir -p $(build) > $(log) - cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls $(extra_configure_args) $(to_log) + cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls $(extra_configure_args) CXX=$(CXX) $(to_log) make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) @@ -185,7 +202,7 @@ $(build_gcc_pass2): logdir -mkdir -p $(build) > $(log) cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --with-newlib --disable-libssp --disable-tls \ - --enable-threads=$(thread_model) --enable-languages=$(pass2_languages) $(extra_configure_args) $(to_log) + --enable-threads=$(thread_model) --enable-languages=$(pass2_languages) $(extra_configure_args) CXX=$(CXX) $(to_log) make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) $(clean_up) diff --git a/utils/dc-chain/download.sh b/utils/dc-chain/download.sh index b61cee4..e5dce05 100755 --- a/utils/dc-chain/download.sh +++ b/utils/dc-chain/download.sh @@ -1,5 +1,41 @@ #!/bin/sh -wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2 || exit 1 -wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.3/gcc-4.7.3.tar.bz2 || exit 1 -wget -c ftp://sourceware.org/pub/newlib/newlib-2.0.0.tar.gz || exit 1 +# These version numbers are all that should ever have to be changed. +export GCC_VER=4.8.2 +export BINUTILS_VER=2.23.2 +export NEWLIB_VER=2.0.0 +export GMP_VER=5.1.3 +export MPFR_VER=3.1.2 +export MPC_VER=1.0.1 + +# Download everything. +if command -v wget >/dev/null 2>&1; then + echo "Downloading binutils-$BINUTILS_VER..." + wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.bz2 || exit 1 + echo "Downloading GCC $GCC_VER..." + wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2 || exit 1 + echo "Downloading Newlib $NEWLIB_VER..." + wget -c ftp://sourceware.org/pub/newlib/newlib-$NEWLIB_VER.tar.gz || exit 1 + echo "Downloading GMP $GMP_VER..." + wget -c ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.bz2 || exit 1 + echo "Downloading MPFR $MPFR_VER..." + wget -c http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VER.tar.bz2 || exit 1 + echo "Downloading MPC $MPC_VER..." + wget -c http://www.multiprecision.org/mpc/download/mpc-$MPC_VER.tar.gz || exit 1 +elif command -v curl >/dev/null 2>&1; then + echo "Downloading Binutils $BINUTILS_VER..." + curl -C - -O ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.bz2 || exit 1 + echo "Downloading GCC $GCC_VER..." + curl -C - -O ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2 || exit 1 + echo "Downloading Newlib $NEWLIB_VER..." + curl -C - -O ftp://sourceware.org/pub/newlib/newlib-$NEWLIB_VER.tar.gz || exit 1 + echo "Downloading GMP $GMP_VER..." + curl -C - -O ftp://ftp.gnu.org/gnu/gmp/gmp-$GMP_VER.tar.bz2 || exit 1 + echo "Downloading MPFR $MPFR_VER..." + curl -O http://www.mpfr.org/mpfr-current/mpfr-$MPFR_VER.tar.bz2 || exit 1 + echo "Downloading MPC $MPC_VER..." + curl -O http://www.multiprecision.org/mpc/download/mpc-$MPC_VER.tar.gz || exit 1 +else + echo >&2 "You must have either wget or cURL installed to use this script!" + exit 1 +fi diff --git a/utils/dc-chain/patches/gcc-4.7.3-kos.diff b/utils/dc-chain/patches/gcc-4.8.1-kos.diff similarity index 96% copy from utils/dc-chain/patches/gcc-4.7.3-kos.diff copy to utils/dc-chain/patches/gcc-4.8.1-kos.diff index cd3a5c4..8f581db 100644 --- a/utils/dc-chain/patches/gcc-4.7.3-kos.diff +++ b/utils/dc-chain/patches/gcc-4.8.1-kos.diff @@ -1,7 +1,7 @@ -diff -ruN gcc-4.7.3/gcc/configure gcc-4.7.3-kos/gcc/configure ---- gcc-4.7.3/gcc/configure 2013-02-06 10:23:55.000000000 -0500 -+++ gcc-4.7.3-kos/gcc/configure 2013-05-17 21:30:40.000000000 -0400 -@@ -11338,7 +11338,7 @@ +diff -ruN gcc-4.8.1/gcc/configure gcc-4.8.1-kos/gcc/configure +--- gcc-4.8.1/gcc/configure 2013-05-08 07:36:36.000000000 -0400 ++++ gcc-4.8.1-kos/gcc/configure 2013-10-09 14:49:41.000000000 -0400 +@@ -11107,7 +11107,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -10,12 +10,11 @@ diff -ruN gcc-4.7.3/gcc/configure gcc-4.7.3-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1.S ---- gcc-4.7.3/libgcc/config/sh/crt1.S 2011-11-02 10:33:56.000000000 -0400 -+++ gcc-4.7.3-kos/libgcc/config/sh/crt1.S 2013-05-17 21:34:42.000000000 -0400 -@@ -1,1369 +1,202 @@ --/* Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2009, 2011 -- Free Software Foundation, Inc. +diff -ruN gcc-4.8.1/libgcc/config/sh/crt1.S gcc-4.8.1-kos/libgcc/config/sh/crt1.S +--- gcc-4.8.1/libgcc/config/sh/crt1.S 2013-02-04 14:06:20.000000000 -0500 ++++ gcc-4.8.1-kos/libgcc/config/sh/crt1.S 2013-10-09 15:02:12.000000000 -0400 +@@ -1,1368 +1,202 @@ +-/* Copyright (C) 2000-2013 Free Software Foundation, Inc. - This file was pretty much copied from newlib. +! KallistiOS ##version## +! @@ -179,8 +178,7 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - shori sym & 65535, reg -#endif - .global start -+_start: - start: +-start: - LOAD_ADDR (_stack, r15) - -#ifdef MMU_SUPPORT @@ -730,7 +728,8 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - .global start - .import ___rtos_profiler_start_timer - .weak ___rtos_profiler_start_timer --start: ++_start: + start: - mov.l stack_k,r15 - -#if defined (__SH3__) || (defined (__SH_FPU_ANY__) && ! defined (__SH2A__)) || defined (__SH4_NOFPU__) @@ -885,6 +884,8 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - ! call the mainline - mov.l main_k,r0 +- jsr @r0 +- nop +#if defined (__SH_FPU_ANY__) + ! Save FPSCR + mov.l old_fpscr_addr,r0 @@ -894,16 +895,21 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. + ! Reset FPSCR + mov #4,r4 ! Use 00040000 (DN=1) + mov.l fpscr_addr,r0 - jsr @r0 -- nop ++ jsr @r0 + shll16 r4 +#endif ++ ++ ! Setup a sentinel value for frame pointer in case we're using ++ ! FRAME_POINTERS for stack tracing. ++ mov #-1,r14 - ! call exit - mov r0,r4 - mov.l exit_k,r0 -- jsr @r0 -- nop ++ ! Jump to the kernel main ++ mov.l main_addr,r0 + jsr @r0 + nop - - .balign 4 -#ifdef PROFILE @@ -912,17 +918,11 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - mov.l profiling_enabled_k2, r0 - mov #0, r1 - mov.l r1, @r0 -+ ! Setup a sentinel value for frame pointer in case we're using -+ ! FRAME_POINTERS for stack tracing. -+ mov #-1,r14 - # call mcleanup - mov.l mcleanup_k, r0 - jmp @r0 -+ ! Jump to the kernel main -+ mov.l main_addr,r0 -+ jsr @r0 - nop +- nop - - .balign 4 -mcleanup_k: @@ -936,13 +936,38 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. -etext_k: - .long __etext -#endif /* PROFILE */ -- ++ ! Program can return here (not likely) or jump here directly ++ ! from anywhere in it to go straight back to the monitor ++_arch_real_exit: ++ ! Reset SR ++ mov.l old_sr,r0 ++ ldc r0,sr ++ ++ ! Disable MMU, invalidate TLB ++ mov #4,r0 ++ mov.l mmu_addr,r1 ++ mov.l r0,@r1 ++ ++ ! Wait (just in case) ++ nop ! 1 ++ nop ! 2 ++ nop ! 3 ++ nop ! 4 ++ nop ! 5 ++ nop ! 6 ++ nop ! 7 ++ nop ! 8 ++ ++ ! Restore VBR ++ mov.l old_vbr,r0 ++ ldc r0,vbr + - .align 2 -#if defined (__SH_FPU_ANY__) -set_fpscr_k: - .long ___set_fpscr -#endif /* defined (__SH_FPU_ANY__) */ - +- -stack_k: - .long _stack -edata_k: @@ -971,32 +996,7 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - ! Whether profiling or not, keep interrupts masked, - ! the RTOS will enable these if required. - .long 0x600000f1 -+ ! Program can return here (not likely) or jump here directly -+ ! from anywhere in it to go straight back to the monitor -+_arch_real_exit: -+ ! Reset SR -+ mov.l old_sr,r0 -+ ldc r0,sr -+ -+ ! Disable MMU, invalidate TLB -+ mov #4,r0 -+ mov.l mmu_addr,r1 -+ mov.l r0,@r1 -+ -+ ! Wait (just in case) -+ nop ! 1 -+ nop ! 2 -+ nop ! 3 -+ nop ! 4 -+ nop ! 5 -+ nop ! 6 -+ nop ! 7 -+ nop ! 8 -+ -+ ! Restore VBR -+ mov.l old_vbr,r0 -+ ldc r0,vbr - +- -rtos_start_fn: - .long ___rtos_profiler_start_timer - @@ -1006,27 +1006,28 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - ! For bare machine, we need to enable interrupts to get profiling working - .long 0x60000001 -#else -+ ! If we're working under dcload, call its EXIT syscall -+ mov.l dcload_magic_addr,r0 -+ mov.l @r0,r0 -+ mov.l dcload_magic_value,r1 -+ cmp/eq r0,r1 -+ bf normal_exit - +- -sr_initial_bare: - ! Privileged mode RB 1 BL 0. Keep BL 0 to allow default trap handlers to work. - ! Keep interrupts disabled - the application will enable as required. - .long 0x600000f1 -#endif -+ mov.l dcload_syscall,r0 ++ ! If we're working under dcload, call its EXIT syscall ++ mov.l dcload_magic_addr,r0 + mov.l @r0,r0 -+ jsr @r0 -+ mov #15,r4 ++ mov.l dcload_magic_value,r1 ++ cmp/eq r0,r1 ++ bf normal_exit - ! supplied for backward compatibility only, in case of linking - ! code whose main() was compiled with an older version of GCC. - .global ___main -___main: ++ mov.l dcload_syscall,r0 ++ mov.l @r0,r0 ++ jsr @r0 ++ mov #15,r4 ++ + ! Set back the stack and return (presumably to a serial debug) +normal_exit: + mov.l old_stack,r15 @@ -1564,9 +1565,9 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - .ualong 0x0 -#endif /* VBR_SETUP */ -#endif /* ! __SH5__ */ -diff -ruN gcc-4.7.3/libgcc/config/sh/fake-kos.S gcc-4.7.3-kos/libgcc/config/sh/fake-kos.S ---- gcc-4.7.3/libgcc/config/sh/fake-kos.S 1969-12-31 19:00:00.000000000 -0500 -+++ gcc-4.7.3-kos/libgcc/config/sh/fake-kos.S 2013-05-17 21:34:42.000000000 -0400 +diff -ruN gcc-4.8.1/libgcc/config/sh/fake-kos.S gcc-4.8.1-kos/libgcc/config/sh/fake-kos.S +--- gcc-4.8.1/libgcc/config/sh/fake-kos.S 1969-12-31 19:00:00.000000000 -0500 ++++ gcc-4.8.1-kos/libgcc/config/sh/fake-kos.S 2013-10-09 14:52:25.000000000 -0400 @@ -0,0 +1,75 @@ +! Weakly linked symbols used to get GCC to hopefully compile itself properly. +! These will be replaced by the real symbols in actual compiled programs. @@ -1644,9 +1645,9 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/fake-kos.S gcc-4.7.3-kos/libgcc/config/sh/f + mov #-1, r0 + \ No newline at end of file -diff -ruN gcc-4.7.3/libgcc/config/sh/gthr-kos.h gcc-4.7.3-kos/libgcc/config/sh/gthr-kos.h ---- gcc-4.7.3/libgcc/config/sh/gthr-kos.h 1969-12-31 19:00:00.000000000 -0500 -+++ gcc-4.7.3-kos/libgcc/config/sh/gthr-kos.h 2013-05-17 21:36:10.000000000 -0400 +diff -ruN gcc-4.8.1/libgcc/config/sh/gthr-kos.h gcc-4.8.1-kos/libgcc/config/sh/gthr-kos.h +--- gcc-4.8.1/libgcc/config/sh/gthr-kos.h 1969-12-31 19:00:00.000000000 -0500 ++++ gcc-4.8.1-kos/libgcc/config/sh/gthr-kos.h 2013-10-09 15:34:26.000000000 -0400 @@ -0,0 +1,355 @@ +/* Copyright (C) 2009, 2010, 2011, 2012 Lawrence Sebald */ + @@ -2003,10 +2004,10 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/gthr-kos.h gcc-4.7.3-kos/libgcc/config/sh/g +#endif /* _LIBOBJC */ + +#endif /* ! GCC_GTHR_KOS_H */ -diff -ruN gcc-4.7.3/libgcc/config/sh/t-sh gcc-4.7.3-kos/libgcc/config/sh/t-sh ---- gcc-4.7.3/libgcc/config/sh/t-sh 2011-11-07 12:14:32.000000000 -0500 -+++ gcc-4.7.3-kos/libgcc/config/sh/t-sh 2013-05-17 21:33:11.000000000 -0400 -@@ -24,6 +24,8 @@ +diff -ruN gcc-4.8.1/libgcc/config/sh/t-sh gcc-4.8.1-kos/libgcc/config/sh/t-sh +--- gcc-4.8.1/libgcc/config/sh/t-sh 2013-02-04 14:06:20.000000000 -0500 ++++ gcc-4.8.1-kos/libgcc/config/sh/t-sh 2013-10-09 14:51:38.000000000 -0400 +@@ -23,6 +23,8 @@ $(LIB1ASMFUNCS_CACHE) LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array @@ -2015,14 +2016,25 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/t-sh gcc-4.7.3-kos/libgcc/config/sh/t-sh crt1.o: $(srcdir)/config/sh/crt1.S $(gcc_compile) -c $< -diff -ruN gcc-4.7.3/libgcc/configure gcc-4.7.3-kos/libgcc/configure ---- gcc-4.7.3/libgcc/configure 2012-08-06 10:34:27.000000000 -0400 -+++ gcc-4.7.3-kos/libgcc/configure 2013-05-17 21:32:08.000000000 -0400 -@@ -4480,6 +4480,7 @@ +diff -ruN gcc-4.8.1/libgcc/configure gcc-4.8.1-kos/libgcc/configure +--- gcc-4.8.1/libgcc/configure 2012-11-04 18:08:42.000000000 -0500 ++++ gcc-4.8.1-kos/libgcc/configure 2013-10-09 14:50:54.000000000 -0400 +@@ -4517,6 +4517,7 @@ + tpf) thread_header=config/s390/gthr-tpf.h ;; + vxworks) thread_header=config/gthr-vxworks.h ;; + win32) thread_header=config/i386/gthr-win32.h ;; ++ kos) thread_header=config/sh/gthr-kos.h ;; + esac + + +diff -ruN gcc-4.8.1/libstdc++-v3/configure gcc-4.8.1-kos/libstdc++-v3/configure +--- gcc-4.8.1/libstdc++-v3/configure 2013-05-24 14:10:37.000000000 -0400 ++++ gcc-4.8.1-kos/libstdc++-v3/configure 2013-10-09 15:25:48.000000000 -0400 +@@ -15172,6 +15172,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; win32) thread_header=config/i386/gthr-win32.h ;; + kos) thread_header=config/sh/gthr-kos.h ;; esac - # Substitute configuration variables + diff --git a/utils/dc-chain/patches/gcc-4.7.3-kos.diff b/utils/dc-chain/patches/gcc-4.8.2-kos.diff similarity index 96% copy from utils/dc-chain/patches/gcc-4.7.3-kos.diff copy to utils/dc-chain/patches/gcc-4.8.2-kos.diff index cd3a5c4..8f581db 100644 --- a/utils/dc-chain/patches/gcc-4.7.3-kos.diff +++ b/utils/dc-chain/patches/gcc-4.8.2-kos.diff @@ -1,7 +1,7 @@ -diff -ruN gcc-4.7.3/gcc/configure gcc-4.7.3-kos/gcc/configure ---- gcc-4.7.3/gcc/configure 2013-02-06 10:23:55.000000000 -0500 -+++ gcc-4.7.3-kos/gcc/configure 2013-05-17 21:30:40.000000000 -0400 -@@ -11338,7 +11338,7 @@ +diff -ruN gcc-4.8.1/gcc/configure gcc-4.8.1-kos/gcc/configure +--- gcc-4.8.1/gcc/configure 2013-05-08 07:36:36.000000000 -0400 ++++ gcc-4.8.1-kos/gcc/configure 2013-10-09 14:49:41.000000000 -0400 +@@ -11107,7 +11107,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -10,12 +10,11 @@ diff -ruN gcc-4.7.3/gcc/configure gcc-4.7.3-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1.S ---- gcc-4.7.3/libgcc/config/sh/crt1.S 2011-11-02 10:33:56.000000000 -0400 -+++ gcc-4.7.3-kos/libgcc/config/sh/crt1.S 2013-05-17 21:34:42.000000000 -0400 -@@ -1,1369 +1,202 @@ --/* Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2009, 2011 -- Free Software Foundation, Inc. +diff -ruN gcc-4.8.1/libgcc/config/sh/crt1.S gcc-4.8.1-kos/libgcc/config/sh/crt1.S +--- gcc-4.8.1/libgcc/config/sh/crt1.S 2013-02-04 14:06:20.000000000 -0500 ++++ gcc-4.8.1-kos/libgcc/config/sh/crt1.S 2013-10-09 15:02:12.000000000 -0400 +@@ -1,1368 +1,202 @@ +-/* Copyright (C) 2000-2013 Free Software Foundation, Inc. - This file was pretty much copied from newlib. +! KallistiOS ##version## +! @@ -179,8 +178,7 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - shori sym & 65535, reg -#endif - .global start -+_start: - start: +-start: - LOAD_ADDR (_stack, r15) - -#ifdef MMU_SUPPORT @@ -730,7 +728,8 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - .global start - .import ___rtos_profiler_start_timer - .weak ___rtos_profiler_start_timer --start: ++_start: + start: - mov.l stack_k,r15 - -#if defined (__SH3__) || (defined (__SH_FPU_ANY__) && ! defined (__SH2A__)) || defined (__SH4_NOFPU__) @@ -885,6 +884,8 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. - ! call the mainline - mov.l main_k,r0 +- jsr @r0 +- nop +#if defined (__SH_FPU_ANY__) + ! Save FPSCR + mov.l old_fpscr_addr,r0 @@ -894,16 +895,21 @@ diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1. + ! Reset FPSCR + mov #4,r4 ! Use 00040000 (DN=1) + mov.l fpscr_addr,r0 - jsr @r0 -- nop ++ jsr @r0 + shll16 r4 +#endif ++ ++ ! Setup a sentinel value for frame pointer in case we're using ++ ! FRAME_POINTERS for stack tracing. ++ mov #-1,r14 - ! call exit - mov r0,r4 - mov.l exit_k,r0 -- jsr @r0 -- nop ++ ! Jump to the kernel main ++ mov.l main_addr,r0 + jsr @r0 ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-11-11 03:23:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via d4348100d82ba60f8ad9d3f1809e00cdfd3873b7 (commit) from 0e31085b79f865558b8561fa6f437b0392abb32d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d4348100d82ba60f8ad9d3f1809e00cdfd3873b7 Author: Lawrence Sebald <ljs...@us...> Date: Sun Nov 10 22:22:40 2013 -0500 Clang won't build binutils because of some warnings. Make them not be errors. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index d37f83e..3f7a9ae 100644 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -135,7 +135,7 @@ $(build_binutils): logdir @echo "+++ Building $(src_dir) to $(build)..." -mkdir -p $(build) > $(log) - cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(to_log) + cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --disable-werror $(to_log) make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) $(clean_up) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-10-04 21:24:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 0e31085b79f865558b8561fa6f437b0392abb32d (commit) from 2619c271f8a8cd456733ef2f3332e07d68e0dba6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0e31085b79f865558b8561fa6f437b0392abb32d Author: Lawrence Sebald <ljs...@us...> Date: Fri Oct 4 17:23:42 2013 -0400 Fix a bit of an issue in the documentation of the basic threading example. ----------------------------------------------------------------------- Summary of changes: .../threading/general/general_threading_test.c | 28 +++++--------------- 1 files changed, 7 insertions(+), 21 deletions(-) diff --git a/examples/dreamcast/basic/threading/general/general_threading_test.c b/examples/dreamcast/basic/threading/general/general_threading_test.c index 5808509..0ae1e8c 100644 --- a/examples/dreamcast/basic/threading/general/general_threading_test.c +++ b/examples/dreamcast/basic/threading/general/general_threading_test.c @@ -97,10 +97,6 @@ void *thd_3(void *v) { return NULL; } -/* Hardware / basic OS init: IRQs disabled, threads enabled, - no initial romdisk */ -KOS_INIT_FLAGS(INIT_THD_PREEMPT); - /* The main program */ int main(int argc, char **argv) { int x, y, i; @@ -112,25 +108,21 @@ int main(int argc, char **argv) { /* Print a banner */ printf("KOS 1.1.x thread program:\n"); - /* Create two threads, but don't start them yet. Note that at this - point in your program, IRQs are still disabled. This is so that you - have full control over what happens to the threads. All threads are - created as joinable so we can thd_join them later on to wait for them - to die. */ - t0 = thd_create(0, thd_0, NULL); - t1 = thd_create(0, thd_1, NULL); - t2 = thd_create(0, thd_2, NULL); - /* Create a semaphore for timing purposes */ sem_init(&sem, 1); - /* Enabling IRQs starts the thread scheduler */ - irq_enable(); /* In the foreground, draw a moire pattern on the screen */ for(y = 0; y < 480; y++) for(x = 320; x < 640; x++) vram_s[y * 640 + x] = ((x * x) + (y * y)) & 0x1f; + /* Create two threads, which can/will start immediately. All threads are + created as joinable so we can thd_join them later on to wait for them + to die. */ + t0 = thd_create(0, thd_0, NULL); + t1 = thd_create(0, thd_1, NULL); + t2 = thd_create(0, thd_2, NULL); + timer_spin_sleep(1000); thd_pslist(printf); thd_pslist_queue(printf); @@ -200,12 +192,6 @@ int main(int argc, char **argv) { for(i = 0; i < 10; i++) thd_join(t3[i], NULL); - /* Disable IRQs, thus turning off threading. All threads that were - running are now gone. If your threads were doing anything like - PowerVR or other hardware access, I recommend avoiding this sort - of brute-force shutdown approach =) */ - irq_disable(); - /* Shut it all down */ printf("Done.\n"); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-09-13 15:56:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2619c271f8a8cd456733ef2f3332e07d68e0dba6 (commit) via 752d383de8a48955ab37d229e770a2f0e41c41a0 (commit) from 0910afc3f6100e1cbac0cc19788a9d21b5f022af (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2619c271f8a8cd456733ef2f3332e07d68e0dba6 Author: Lawrence Sebald <ljs...@us...> Date: Fri Sep 13 11:55:52 2013 -0400 Fix two unused parameter warnings when compiling without frame pointers. commit 752d383de8a48955ab37d229e770a2f0e41c41a0 Author: Lawrence Sebald <ljs...@us...> Date: Wed Aug 28 09:05:55 2013 -0400 Fix a stupid mistake in fs_readlink... ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/stack.c | 2 ++ kernel/fs/fs.c | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/stack.c b/kernel/arch/dreamcast/kernel/stack.c index 02134b7..db43481 100644 --- a/kernel/arch/dreamcast/kernel/stack.c +++ b/kernel/arch/dreamcast/kernel/stack.c @@ -44,6 +44,8 @@ void arch_stk_trace_at(uint32 fp, int n) { dbgio_printf("-------------- End Stack Trace -----------------\n"); #else + (void)fp; + (void)n; dbgio_printf("Stack Trace: frame pointers not enabled!\n"); #endif } diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index 67c0257..49c4a15 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -803,7 +803,7 @@ int fs_readlink(const char *path, char *buf, size_t bufsize) { } else { strcpy(fullpath, fs_getwd()); - strcat(fullpath, '/'); + strcat(fullpath, "/"); strcat(fullpath, path); } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-08-25 21:31:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 0910afc3f6100e1cbac0cc19788a9d21b5f022af (commit) from 4a943f57860ae1a6976b53b841e3c2cae727827d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0910afc3f6100e1cbac0cc19788a9d21b5f022af Author: Lawrence Sebald <ljs...@us...> Date: Sun Aug 25 17:31:02 2013 -0400 Add readlink to the VFS. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 41 ++++++++++++++++++++++++++++++- include/kos/fs.h | 29 ++++++++++++++++++++++ kernel/arch/dreamcast/fs/fs_dcload.c | 3 +- kernel/arch/dreamcast/fs/fs_dclsocket.c | 3 +- kernel/arch/dreamcast/fs/fs_iso9660.c | 3 +- kernel/arch/dreamcast/fs/fs_vmu.c | 3 +- kernel/fs/fs.c | 32 ++++++++++++++++++++++++ kernel/fs/fs_pty.c | 1 + kernel/fs/fs_ramdisk.c | 3 +- kernel/fs/fs_romdisk.c | 1 + kernel/fs/fs_socket.c | 3 +- kernel/libc/koslib/Makefile | 2 +- kernel/libc/koslib/readlink.c | 11 ++++++++ 13 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 kernel/libc/koslib/readlink.c diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index a6b0adf..25a64e0 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -1710,6 +1710,44 @@ static int fs_ext2_symlink(vfs_handler_t *vfs, const char *path1, return 0; } +static ssize_t fs_ext2_readlink(vfs_handler_t *vfs, const char *path, char *buf, + size_t bufsize) { + fs_ext2_fs_t *mnt = (fs_ext2_fs_t *)vfs->privdata; + int rv; + size_t len = bufsize; + uint32_t inode_num; + ext2_inode_t *inode; + + /* Find a free file handle */ + mutex_lock(&ext2_mutex); + + /* Find the object in question */ + if((rv = ext2_inode_by_path(mnt->fs, path, &inode, &inode_num, 2, NULL))) { + errno = -rv; + mutex_unlock(&ext2_mutex); + return -1; + } + + /* Read the value of the link. This will return -EINVAL if the object isn't + a symlink, so we don't have to worry about checking that here. */ + if((rv = ext2_resolve_symlink(mnt->fs, inode, buf, &len))) { + errno = -rv; + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + return -1; + } + + /* We're done with the inode, so release it and the lock. */ + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + + /* Figure out what we're going to return. */ + if(len > bufsize) + return bufsize; + + return len; +} + /* This is a template that will be used for each mount */ static vfs_handler_t vh = { /* Name Handler */ @@ -1746,7 +1784,8 @@ static vfs_handler_t vh = { fs_ext2_symlink, /* symlink */ fs_ext2_seek64, /* seek64 */ fs_ext2_tell64, /* tell64 */ - fs_ext2_total64 /* total64 */ + fs_ext2_total64, /* total64 */ + fs_ext2_readlink /* readlink */ }; static int initted = 0; diff --git a/include/kos/fs.h b/include/kos/fs.h index abb6684..6f31bfe 100644 --- a/include/kos/fs.h +++ b/include/kos/fs.h @@ -193,6 +193,14 @@ typedef struct vfs_handler { /** \brief Return the size of an opened file as a 64-bit integer */ uint64 (*total64)(void *hnd); + + /** \brief Read the value of a symbolic link + \note path will not be passed through realpath() before calling the + filesystem function. It is also important to not call realpath() + in your implementation as it is possible that readlink() will be + called in realpath(). */ + ssize_t (*readlink)(struct vfs_handler *vfs, const char *path, char *buf, + size_t bufsize); } vfs_handler_t; /** \brief The number of distinct file descriptors that can be in use at a @@ -514,6 +522,27 @@ int fs_link(const char *path1, const char *path2); */ int fs_symlink(const char *path1, const char *path2); +/** \brief Read the value of a symbolic link. + + This function implements the POSIX function readlink(), which simply reads + the value of the symbolic link at the end of a path. This does not resolve + any internal links and it does not canonicalize the path either. + + \param path The symbolic link to read. + \param buf The buffer to place the link's contents in. + \param bufsize The number of bytes allocated to buf. + \return -1 on failure, the number of bytes placed into buf + on success. If the return value is equal to bufsize, + you may not have the whole link -- provide a larger + buffer and try again. + + \note Most filesystems in KallistiOS do not support + symbolic links. Filesystems that do not support + symlinks will simply set errno to ENOSYS and return + -1. +*/ +ssize_t fs_readlink(const char *path, char *buf, size_t bufsize); + /** \brief Duplicate a file descriptor. This function duplicates the specified file descriptor, returning a new file diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index a62249e..e6d8332 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -418,7 +418,8 @@ static vfs_handler_t vh = { NULL, /* symlink */ NULL, /* seek64 */ NULL, /* tell64 */ - NULL /* total64 */ + NULL, /* total64 */ + NULL /* readlink */ }; // We have to provide a minimal interface in case dcload usage is diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index 6586292..34be302 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -723,7 +723,8 @@ static vfs_handler_t vh = { NULL, /* symlink */ NULL, /* seek64 */ NULL, /* tell64 */ - NULL /* total64 */ + NULL, /* total64 */ + NULL /* readlink */ }; /* dbgio handler */ diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index f68cd5e..94a4acd 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -1009,7 +1009,8 @@ static vfs_handler_t vh = { NULL, /* symlink */ NULL, /* seek64 */ NULL, /* tell64 */ - NULL /* total64 */ + NULL, /* total64 */ + NULL /* readlink */ }; /* Initialize the file system */ diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index 8494b2c..f8f6628 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -663,7 +663,8 @@ static vfs_handler_t vh = { NULL, /* symlink */ NULL, /* seek64 */ NULL, /* tell64 */ - NULL /* total64 */ + NULL, /* total64 */ + NULL /* readlink */ }; int fs_vmu_init() { diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index ca36da1..67c0257 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -793,6 +793,38 @@ int fs_symlink(const char *path1, const char *path2) { } } +int fs_readlink(const char *path, char *buf, size_t bufsize) { + vfs_handler_t *vfs; + char fullpath[PATH_MAX]; + + /* Prepend the current working directory if we have to. */ + if(path[0] == '/') { + strcpy(fullpath, path); + } + else { + strcpy(fullpath, fs_getwd()); + strcat(fullpath, '/'); + strcat(fullpath, path); + } + + /* Look for the handler */ + vfs = fs_verify_handler(fullpath); + + if(!vfs) { + errno = ENOENT; + return -1; + } + + if(vfs->readlink) { + return vfs->readlink(vfs, fullpath + strlen(vfs->nmmgr.pathname), buf, + bufsize); + } + else { + errno = ENOSYS; + return -1; + } +} + /* Initialize FS structures */ int fs_init() { return 0; diff --git a/kernel/fs/fs_pty.c b/kernel/fs/fs_pty.c index 63034b8..965dc0f 100644 --- a/kernel/fs/fs_pty.c +++ b/kernel/fs/fs_pty.c @@ -713,6 +713,7 @@ static vfs_handler_t vh = { NULL, NULL, NULL, + NULL, NULL }; diff --git a/kernel/fs/fs_ramdisk.c b/kernel/fs/fs_ramdisk.c index 3c0b187..85cb80a 100644 --- a/kernel/fs/fs_ramdisk.c +++ b/kernel/fs/fs_ramdisk.c @@ -670,7 +670,8 @@ static vfs_handler_t vh = { NULL, /* symlink XXX */ NULL, /* seek64 XXX */ NULL, /* tell64 XXX */ - NULL /* total64 XXX */ + NULL, /* total64 XXX */ + NULL /* readlink XXX */ }; /* Attach a piece of memory to a file. This works somewhat like open for diff --git a/kernel/fs/fs_romdisk.c b/kernel/fs/fs_romdisk.c index b19e07d..b1d09d9 100644 --- a/kernel/fs/fs_romdisk.c +++ b/kernel/fs/fs_romdisk.c @@ -468,6 +468,7 @@ static vfs_handler_t vh = { NULL, NULL, NULL, + NULL, NULL }; diff --git a/kernel/fs/fs_socket.c b/kernel/fs/fs_socket.c index 01de8fd..ab6929d 100644 --- a/kernel/fs/fs_socket.c +++ b/kernel/fs/fs_socket.c @@ -125,7 +125,8 @@ static vfs_handler_t vh = { NULL, /* symlink */ NULL, /* seek64 */ NULL, /* tell64 */ - NULL /* total64 */ + NULL, /* total64 */ + NULL /* readlink */ }; /* Have we been initialized? */ diff --git a/kernel/libc/koslib/Makefile b/kernel/libc/koslib/Makefile index e13506b..ad9217e 100644 --- a/kernel/libc/koslib/Makefile +++ b/kernel/libc/koslib/Makefile @@ -12,6 +12,6 @@ OBJS = abort.o byteorder.o memset2.o memset4.o memcpy2.o memcpy4.o \ opendir.o readdir.o closedir.o rewinddir.o scandir.o seekdir.o \ telldir.o usleep.o inet_addr.o realpath.o getcwd.o chdir.o mkdir.o \ creat.o sleep.o rmdir.o rename.o inet_pton.o inet_ntop.o \ - inet_ntoa.o inet_aton.o poll.o select.o symlink.o + inet_ntoa.o inet_aton.o poll.o select.o symlink.o readlink.o include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/libc/koslib/readlink.c b/kernel/libc/koslib/readlink.c new file mode 100644 index 0000000..d07f296 --- /dev/null +++ b/kernel/libc/koslib/readlink.c @@ -0,0 +1,11 @@ +/* KallistiOS ##version## + + readlink.c + Copyright (C) 2013 Lawrence Sebald +*/ + +#include <kos/fs.h> + +ssize_t readlink(const char *path, char *buf, size_t bufsize) { + return fs_readlink(path, buf, bufsize); +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-08-25 21:28:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4a943f57860ae1a6976b53b841e3c2cae727827d (commit) from 970a257a4db99de104ac930a9ac4add1006bc0d6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4a943f57860ae1a6976b53b841e3c2cae727827d Author: Lawrence Sebald <ljs...@us...> Date: Sun Aug 25 17:27:38 2013 -0400 Make sure nobody tries to rename a directory so that it would be its own child. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 62 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 58 insertions(+), 4 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index 24eedb5..a6b0adf 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -637,11 +637,11 @@ retry: static int int_rename(fs_ext2_fs_t *fs, const char *fn1, const char *fn2, ext2_inode_t *pinode, ext2_inode_t *finode, uint32_t finode_num, int isfile) { - ext2_inode_t *dpinode, *dinode; - uint32_t dpinode_num, tmp; + ext2_inode_t *dpinode, *dinode = NULL, *sinode; + uint32_t dpinode_num, tmp, sinode_num; char *cp, *ent; int irv, isdir = 0; - ext2_dirent_t *dent; + ext2_dirent_t *dent, *dent2; /* Make a writable copy of the destination filename. */ if(!(cp = strdup(fn2))) { @@ -722,6 +722,61 @@ static int int_rename(fs_ext2_fs_t *fs, const char *fn1, const char *fn2, } } + /* Make sure the user isn't trying to do something really stupid, like + moving a directory such that it would be an ancestor of itself... Note + that this is really inefficient, but without cacheing the entire + directory structure as we work down it, I'm not sure how I could make it + much better... */ + if(!isfile && dpinode != pinode) { + sinode = dpinode; + sinode_num = dpinode_num; + ext2_inode_retain(sinode); + + for(;;) { + /* If the two entries are the same, there's obviously a problem. */ + if(sinode == finode) { + ext2_inode_put(sinode); + ext2_inode_put(dpinode); + + if(dinode) + ext2_inode_put(dinode); + + return -EINVAL; + } + + /* Grab the dentry for the next thing up the tree. */ + dent2 = ext2_dir_entry(fs->fs, sinode, ".."); + ext2_inode_put(sinode); + + if(!dent2) { + /* Uhm... The directory is missing the ".." entry... */ + ext2_inode_put(dpinode); + + if(dinode) + ext2_inode_put(dinode); + + return -EINVAL; + } + + /* Did we reach the end of the line? */ + if(dent2->inode == sinode_num) { + /* We've hit the end of the line without matching, so we should + be safe. */ + break; + } + + /* Grab the parent's inode for the next pass. */ + if(!(sinode = ext2_inode_get(fs->fs, dent2->inode, &irv))) { + ext2_inode_put(dpinode); + + if(dinode) + ext2_inode_put(dinode); + + return irv; + } + } + } + /* Gulp... Here comes the real work... */ if(dent) { /* We are overwriting something. Remove the object that we're @@ -1818,7 +1873,6 @@ int fs_ext2_sync(const char *mp) { mutex_unlock(&ext2_mutex); return rv; } - int fs_ext2_init(void) { if(initted) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-08-25 03:43:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 970a257a4db99de104ac930a9ac4add1006bc0d6 (commit) via 8e8dcdb1f35ca4f7d75eca8ddb6358925695c378 (commit) from 441060707f0d382a49bc568748bb7ba16a7e86b8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 970a257a4db99de104ac930a9ac4add1006bc0d6 Author: Lawrence Sebald <ljs...@us...> Date: Sat Aug 24 23:43:16 2013 -0400 Fix a few small things in a couple of headers. commit 8e8dcdb1f35ca4f7d75eca8ddb6358925695c378 Author: Lawrence Sebald <ljs...@us...> Date: Sat Aug 24 23:40:28 2013 -0400 Add ext2_inode_retain() to increment the reference count on an inode without looking it up again. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/ext2fs.h | 3 ++- addons/libkosext2fs/inode.c | 17 +++++++++++++++++ addons/libkosext2fs/inode.h | 4 ++++ include/netinet/in.h | 7 ++++--- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/addons/libkosext2fs/ext2fs.h b/addons/libkosext2fs/ext2fs.h index 2a21f47..40d4510 100644 --- a/addons/libkosext2fs/ext2fs.h +++ b/addons/libkosext2fs/ext2fs.h @@ -19,7 +19,8 @@ __BEGIN_DECLS /* Tunable filesystem parameters. These must be set at compile time. */ /* Logarithm (base 2) of the maximum number of entries in the inode cache. - Thus, the inode cache will take up (2^n) * 128 bytes of total space in RAM. + Thus, the inode cache will take up (2^n) * (128 + k) bytes of total space in + RAM (where k is the overhead for accounting information -- 32 bytes in KOS). Set this to a larger number to ensure you can have a lot of files open at once. Also, note that this is a global cache, regardless of how many filesystems you actually have mounted. */ diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 4f1b785..9963831 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -190,6 +190,23 @@ void ext2_inode_put(ext2_inode_t *inode) { #endif } +void ext2_inode_retain(ext2_inode_t *inode) { + struct int_inode *iinode = (struct int_inode *)inode; + + /* Make sure we're not trying anything really dumb. */ + assert(iinode->refcnt != 0); + + /* Increment the reference counter. */ + ++iinode->refcnt; + +#ifdef EXT2FS_DEBUG + /* Technically not thread-safe, but then again, there's many bigger issues + with thread-safety in this library than this. */ + dbglog(DBG_KDEBUG, "ext2_inode_retain: %" PRIu32 " (%" PRIu32 " refs)\n", + iinode->inode_num, iinode->refcnt); +#endif +} + void ext2_inode_mark_dirty(ext2_inode_t *inode) { struct int_inode *iinode = (struct int_inode *)inode; diff --git a/addons/libkosext2fs/inode.h b/addons/libkosext2fs/inode.h index ea3768c..24d4341 100644 --- a/addons/libkosext2fs/inode.h +++ b/addons/libkosext2fs/inode.h @@ -126,6 +126,10 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, void ext2_inode_put(ext2_inode_t *inode); +/* Increment the reference count on an inode that you already have a reference + to. */ +void ext2_inode_retain(ext2_inode_t *inode); + void ext2_inode_mark_dirty(ext2_inode_t *inode); /* Write-back all of the inodes marked as dirty from the specified filesystem to diff --git a/include/netinet/in.h b/include/netinet/in.h index 965eede..ade851e 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -135,11 +135,11 @@ struct sockaddr_in6 { /** \brief Initialize an IPv6 local host address. - This macro can be used to initialize a struct in6_addr to any lcoal address. + This macro can be used to initialize a struct in6_addr to any local address. It functions similarly to INADDR_ANY for IPv4. */ #define IN6ADDR_ANY_INIT {{{ 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0 }}} + 0, 0, 0, 0, 0, 0, 0, 0 }}} /** \brief Initialize an IPv6 loopback address. @@ -147,7 +147,7 @@ struct sockaddr_in6 { address. */ #define IN6ADDR_LOOPBACK_INIT {{{ 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 1 }}} + 0, 0, 0, 0, 0, 0, 0, 1 }}} /** \brief IPv6 local host address. @@ -302,6 +302,7 @@ extern const struct in6_addr in6addr_loopback; #define IN6_IS_ADDR_SITELOCAL(a) \ (((a)->__s6_addr.__s6_addr8[0] == 0xFE) && \ (((a)->__s6_addr.__s6_addr8[1] & 0xC0) == 0xC0)) + /** \brief Test if an IPv6 Address is a multicast address. This macro tests whether an IPv6 address (struct in6_addr *) is a multicast hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-08-12 22:32:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 441060707f0d382a49bc568748bb7ba16a7e86b8 (commit) from da33c868b249bedd99fffb425fade3a25579e42d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 441060707f0d382a49bc568748bb7ba16a7e86b8 Author: Lawrence Sebald <ljs...@us...> Date: Mon Aug 12 18:31:03 2013 -0400 Add automatic Makefile dependency generation if you define the KOS_DEPDIR variable in your Makefile. ----------------------------------------------------------------------- Summary of changes: Makefile.rules | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index 000740f..c66b170 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -7,6 +7,8 @@ # Global KallistiOS Makefile include # Build rules +ifndef KOS_DEPDIR + %.o: %.c kos-cc $(CFLAGS) -c $< -o $@ @@ -16,6 +18,21 @@ %.o: %.cpp kos-c++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ +else + +%.o: %.c + kos-cc $(CFLAGS) -c $< -o $@ -MD -MF $(KOS_DEPDIR)/$(patsubst %.c,%.md,$(subst /,__,$(subst ..,,$<))) + +%.o: %.cc + kos-c++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ -MD -MF $(KOS_DEPDIR)/$(patsubst %.c,%.md,$(subst /,__,$(subst ..,,$<))) + +%.o: %.cpp + kos-c++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ -MD -MF $(KOS_DEPDIR)/$(patsubst %.c,%.md,$(subst /,__,$(subst ..,,$<))) + +-include $(wildcard $(KOS_DEPDIR)/*.md) + +endif + %.o: %.s kos-as $< -o $@ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |