Skip to content

Instantly share code, notes, and snippets.

View archshift's full-sized avatar

Gui Andrade archshift

View GitHub Profile
@archshift
archshift / keystone-pfsoc-notes.md
Last active September 18, 2022 02:30
Keystone and the Polarfire SOC Icicle Kit

Keystone and the Polarfire SOC Icicle Kit

Running Keystone on the Icicle Kit

Boot process: FSBL (hart-software-services) -> OpenSBI + Keystone security manager -> U-boot -> Linux

To start off, clone the repositories from all of the above links (and switch to the linked branch).

Building FSBL that loads from SPI flash

FAILED: SingleSource/UnitTests/Vector/AVX512F/CMakeFiles/Vector-AVX512F-convert.dir/convert.c.o
/usr/local/google/home/guiand/llvm-test-suite/build.noopt/tools/timeit --summary SingleSource/UnitTests/Vector/AVX512F/CMakeFiles/Vector-AVX512F-convert.dir/convert.c.o.time /usr/local/google/home/guiand/opt/msan.noopt.clang -DNDEBUG -O3 -w -Werror=date-time -march=skylake-avx512 -fms-extensions -I /usr/local/google/home/guiand/llvm-test-suite/SingleSource/UnitTests/Vector -MD -MT SingleSource/UnitTests/Vector/AVX512F/CMakeFiles/Vector-AVX512F-convert.dir/convert.c.o -MF SingleSource/UnitTests/Vector/AVX512F/CMakeFiles/Vector-AVX512F-convert.dir/convert.c.o.d -o SingleSource/UnitTests/Vector/AVX512F/CMakeFiles/Vector-AVX512F-convert.dir/convert.c.o -c ../SingleSource/UnitTests/Vector/AVX512F/convert.c
clang: /usr/local/google/home/guiand/llvm-project/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:2785: void (anonymous namespace)::MemorySanitizerVisitor::handleVectorConvertIntrinsic(llvm::IntrinsicIns
; ModuleID = '<stdin>'
source_filename = "sqrt.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @msan.module_ctor, i8* null }]
@__msan_track_origins = weak_odr local_unnamed_addr constant i32 2
; Function Attrs: norecurse nounwind readnone uwtable
define dso_local noundef i32 @_Z4sqrti(i32 noundef %x) local_unnamed_addr #0 {
; ModuleID = 'sqrt.c'
source_filename = "sqrt.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @msan.module_ctor, i8* null }]
@__msan_track_origins = weak_odr local_unnamed_addr constant i32 2
@__msan_retval_tls = external thread_local(initialexec) global [100 x i64]
@__msan_retval_origin_tls = external thread_local(initialexec) global i32
@__msan_param_tls = external thread_local(initialexec) global [100 x i64]
This file has been truncated, but you can view the full file.
========= Found colliding stack frames with PC=0x0000002cc2da, BP=0x7ffd2a9e73e0! ==========
====== Found:
#0 0x2cc2d9 in __sanitizer_dtor_callback /usr/local/google/home/guiand/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:922:3
#1 0x7fe561fc57d8 in ~LockGuard /usr/local/google/home/guiand/llvm-project/libcxxabi/src/cxa_guard_impl.h:386:5
#2 0x7fe561fc57d8 in acquire_init_byte /usr/local/google/home/guiand/llvm-project/libcxxabi/src/cxa_guard_impl.h:333:3
#3 0x7fe561fc57d8 in cxa_guard_acquire /usr/local/google/home/guiand/llvm-project/libcxxabi/src/cxa_guard_impl.h:205:23
#4 0x7fe561fc57d8 in __cxa_guard_acquire /usr/local/google/home/guiand/llvm-project/libcxxabi/src/cxa_guard.cpp:39:31
#5 0x7fe5621241df in std::__1::locale::__global() /usr/local/google/home/guiand/llvm-project/libcxx/src/locale.cpp:507:5
#6 0x7fe562124425 in std::__1::locale::locale() /usr/local/google/home/guiand/llvm-project/libcxx/src/locale.cpp:512:17
#7 0x7fe5620733f3 in std::__1::basic_str
fn make_crc(buf: &[u8]) -> u8 {
let crc_for_byte = |mut byte: u8| {
const polynomial: u8 = 0x89;
if byte & 0x80 != 0 {
byte ^= polynomial
}
for _ in 1..8 {
byte <<= 1;
if byte & 0x80 != 0 {
byte ^= polynomial;
macro_rules! extract_bits {
($val:expr, $low:expr => $hi:expr) => {{
let max_bit = std::mem::size_of_val(&$val) * 8 - 1;
assert!((($hi as usize) <= max_bit) && ($low >= 0));
$val << (max_bit - $hi) >> (max_bit - $hi + $low)
}};
}
macro_rules! create_bitfield {
($name:ident: $ty:ty, { $($var_name:ident: $var_low:expr => $var_hi:expr),* }) => {
try!(file.seek(SeekFrom::Start(file_pos)));;
try!(pad.seek(SeekFrom::Start(pad_pos)));
let mut file_reader = BufStream::with_capacities(BUF_SIZE, BUF_SIZE, file).take(size);
let mut pad_reader = BufStream::with_capacities(BUF_SIZE, BUF_SIZE, pad).take(size);
loop {
let mut read_buf_size;
let mut read_pad_size;
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <3ds.h>
#define wait() svcSleepThread(2000000000ull)
static const u32 KPROC_OFFSET_PID = 0xB4;
From 33ac99c83160760eb42bc3481d0f47ef3f2adcc8 Mon Sep 17 00:00:00 2001
From: archshift <gh@archshift.com>
Date: Tue, 24 Mar 2015 19:01:48 -0700
Subject: [PATCH] Small optimization in add_ctr
---
source/decryptor/crypto.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/source/decryptor/crypto.c b/source/decryptor/crypto.c