Skip to content

Instantly share code, notes, and snippets.

#include <kos.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "memfuncs.h"
#include "fastmem.h"
#define SIZE 1024 * 1 //16+1
/* Copyright (C) Paul Cercueil <paul@crapouillou.net> */
static void * memcpy_64bit_32Bytes_zcrc(void *dest, const void *src, size_t len) {
if(!len)
return dest;
void * ret_dest = dest;
_Complex float double_scratch;
_Complex float double_scratch2;
@pcercuei
pcercuei / sh4_gcc_test_unroll.c
Last active September 29, 2023 23:00
Small code to test GCC's loop unrolling on SH4
#include <sys/time.h>
#include <stdio.h>
#include <stdint.h>
#include <kos.h>
static const unsigned int test = 8;
KOS_INIT_FLAGS(INIT_DEFAULT);
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (C) 2024 Paul Cercueil <paul@crapouillou.net>
*/
#ifndef __LIBUDIV_H__
#define __LIBUDIV_H__
#ifdef _MSC_BUILD
# define clz32(x) _lzcnt_u32(x)
#include <math.h>
#include <kos.h>
#include <dc/vmu_fb.h>
KOS_INIT_FLAGS(INIT_DEFAULT | INIT_MALLOCSTATS);
/* 4x6 font from the Linux kernel:
* https://github.com/torvalds/linux/blob/master/lib/fonts/font_mini_4x6.c
*
* Modified locally to pack the data better. */
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <kos.h>
static volatile uint32_t * const pteh = (uint32 *)(0xff000000);
static volatile uint32_t * const ptel = (uint32 *)(0xff000004);
static volatile uint32_t * const mmucr = (uint32 *)(0xff000010);
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <kos.h>
static volatile uint32_t * const pteh = (uint32 *)(0xff000000);
static volatile uint32_t * const ptel = (uint32 *)(0xff000004);
static volatile uint32_t * const mmucr = (uint32 *)(0xff000010);
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR sh4)
if (NOT DEFINED CMAKE_SYSROOT)
set(CMAKE_SYSROOT $ENV{KOS_PORTS})
endif()
if (NOT DEFINED CMAKE_FIND_ROOT_PATH)
#set(CMAKE_FIND_ROOT_PATH $ENV{KOS_BASE})
options:
parameters:
author: paul
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
[ 5.251588] Btrfs loaded, crc32c=crc32c-intel
[ 5.454897] sd 5:0:0:0: [sdc] 2012160 512-byte logical blocks: (1.03 GB/983 MiB)
[ 5.456103] sd 5:0:0:0: [sdc] Write Protect is off
[ 5.456110] sd 5:0:0:0: [sdc] Mode Sense: 03 00 00 00
[ 5.457205] sd 5:0:0:0: [sdc] No Caching mode page found
[ 5.457217] sd 5:0:0:0: [sdc] Assuming drive cache: write through
[ 5.475817] sdc: sdc1
[ 5.480320] sd 5:0:0:0: [sdc] Attached SCSI removable disk
[ 5.908899] sr 0:0:1:0: [sr0] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE cmd_age=0s
[ 5.908909] sr 0:0:1:0: [sr0] tag#0 Sense Key : Not Ready [current]