Skip to content

Instantly share code, notes, and snippets.

View uchan-nos's full-sized avatar

Kota UCHIDA uchan-nos

View GitHub Profile
@uchan-nos
uchan-nos / rust_wasm_memo.md
Last active October 22, 2020 13:32
Rust + Wasm

Ubuntu 18.04

$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
$ rustup target add wasm32-unknown-unknown
$ sudo apt install libssl-dev
$ cargo install wasm-bindgen-cli
@uchan-nos
uchan-nos / _gvimrc
Created October 12, 2020 01:37
C++講習会で使っているGVim for Windowsの設定ファイル
set enc=utf-8
source $VIMRUNTIME/delmenu.vim
set langmenu=ja_jp.utf-8
source $VIMRUNTIME/menu.vim
colorscheme evening
set guifont=Myrica_M:h15
set guioptions-=T
set guioptions-=r
set guioptions-=R
@uchan-nos
uchan-nos / grep.cpp
Last active April 29, 2020 09:39
GPD MicroPC上のMikanOSでいくつかのコマンドが正常に実行できないバグを調査するメモ
#include <cstdio>
#include <cstdlib>
#include <regex>
#include "../syscall.h"
void DumpMem(uint64_t addr, int n) {
char s[128];
auto p = reinterpret_cast<volatile uint64_t*>(addr);
for (int i = 0; i < n - 1; i += 2) {
sprintf(s, "%016lx: %016lx %016lx\n",
@uchan-nos
uchan-nos / mikanos_debug_reboot-after-rpn.md
Last active April 24, 2020 07:04
MikanOSでrpnコマンド実行後にPCが再起動するバグを調査するメモ
  • MikanOS のリポジトリ https://github.com/uchan-nos/mikanos
  • 現象を確認したコミット b08a21e5d6b65f870da55e2bd1430762c0025ac2
    • このコミットは uchan のローカルマシンにしか存在しない可能性がある

現象の再現

QEMU にて MikanOS を起動させ,初期ターミナルにて「rpn 2 3 +」と入力しエンター。 画面に「app exited. ret = 5」と表示された後,いずれかのキーを入力すると MikanOS が再起動される(ブートローダーの処理からまた開始される)。

無関係に思えることをすると現象が治まる

@uchan-nos
uchan-nos / x86-64-instruction-list.txt
Created January 14, 2020 06:53
All mnemonics of x86-64, extracted from Intel SDM Vol.2 version May 2019 "Instruction Set Reference A-Z"
aaa
aad
aam
aas
adc
adcx
add
addpd
addps
addsd
sudo apt install zlib1g-dev libiberty-dev liblzma-dev
cd ipxe/src
make bin-x86_64-efi/ipxe.efi EMBED=../../ipxe_load.cfg
@uchan-nos
uchan-nos / memo_io.weight.md
Created July 7, 2019 03:02
Reading article about io.waight
@uchan-nos
uchan-nos / simple_add_server_template.py
Created May 20, 2019 02:24
HTTP server responses 'GET /add/x/y'
#!/usr/bin/python3
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
parsed_path = urlparse(self.path)
path_elements = parsed_path.path.split('/')[1:]
@uchan-nos
uchan-nos / http_calculator.py
Created May 20, 2019 02:27
HTTP server calculates add, sub, mul, div.
#!/usr/bin/python3
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse, parse_qs
calculate_funcs = {
'add': lambda x, y: x + y,
'sub': lambda x, y: x - y,
'mul': lambda x, y: x * y,
@uchan-nos
uchan-nos / kernel_map.txt
Created May 13, 2019 01:10
OS Kernel Link Map
Address Size Align Out In Symbol
0000000000100190 0000000000001d81 16 .rodata
0000000000100190 0000000000000022 4 main.o:(.rodata)
0000000000100198 0000000000000003 0 kDesktopBGColor
00000000001001af 0000000000000003 0 kDesktopFGColor
00000000001001b2 0000000000000e2d 1 <internal>:(.rodata)
0000000000100fe0 00000000000000a0 8 main.o:(.rodata._ZN5Error11code_names_E)
0000000000100fe0 00000000000000a0 0 Error::code_names_
0000000000101080 0000000000000048 8 main.o:(.rodata._ZTVNSt3__110__function6__funcIPFvaaENS_9allocatorIS3_EES2_EE)
0000000000101080 0000000000000048 0 vtable for std::__1::__function::__func<void (*)(signed char, signed char), std::__1::allocator<void (*)(signed char, signed char)>, void (signed char, signed char)>