Oscar Shiang

@oscarshiang

Joined on Dec 27, 2018

  • Fact 0 :::info :bulb: Calling pthread_exit on main thread may block when the jobs executed by other threads do not complete ::: #include <pthread.h> #include <stdio.h> #include <unistd.h> void *looping(void *args)
     Like  Bookmark
  • 學號: F74076124 姓名: 向景亘 系級: 資訊 111 開發環境 OS: Ubuntu 20.04 CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz CPU cores: 4 Memory: 16 GB Programming Language: C11, gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
     Like  Bookmark
  • lab3 A 部分 題目說明 根據從 file.in 讀入的資料,將最重的 5 隻牛的體重加總起來輸出 使用 fstream 使用前需要在原始碼的上方加上 #include <fstream> 利用 constructor 進行開檔或是利用 member function 的形式開啟檔案 open 函式的參數形式是 open(filename, open_mode)
     Like  Bookmark
  • <img src="https://upload.wikimedia.org/wikipedia/commons/0/0b/Qt_logo_2016.svg" width="8%" alt="Qt" /> Graphics 系列介紹 :::warning 講解影片:https://youtu.be/B4J64NmlWVA ::: :question: QGraphics QGraphics 是 Qt 中的一種框架,可以管理大量的自製的圖形單元,支援以下功能: 座標變換 碰撞檢測
     Like 1 Bookmark
  • To help us disect the problem from a deployed binary, it will be useful to build some information like git-commit hash, build date, etc. Use vergen to generate a list of env during building. You have to add vergen into Cargo.toml. [package] build = "build.rs" [build-dependencies]
     Like  Bookmark
  • :::info :pencil: 這篇筆記是從 The Linux Foundation 的 Webinar "Setting Up an Environment for Writing Linux Kernel Modules in Rust" 整理而來,有興趣的可以觀看錄影存檔 :movie_camera: Setting Up an Environment for Writing Linux Kernel Modules in Rust [color=#33b2ff] ::: :::success :bulb: 在本篇筆記的命令列範例中,若前綴為 $ 者,表示其執行在 host 端;而前綴為 # 者,表示其須執行在 guest 端 :::
     Like 4 Bookmark
  • contributed by < OscarShiang > 安裝 Ubuntu Linux 因為我們目標的環境是 64 位元的 Linux,但目前 Raspbian 還不支援 64 位元,所以我們改以 Ubuntu Linux Server 64-bit 作爲我們安裝的系統。 建議使用樹莓派基金會所提供的 Raspberry Pi Imager 來製作 SD card :::warning :warning: 目前 rpi imager 無法正確輸出供 Ubuntu 開機使用的設定檔,如果使用 rpi imager 的 Advanced setting 可能會導致 Ubuntu 開機失敗,詳見 Bug #1914878 “At boot on Pi4 with 20.04.02 以及 Unable to boot successfully when using advanced options with Ubuntu Server 20.04.3 LTS #286 的討論 :::
     Like  Bookmark
  • contributed by < OscarShiang > :::success :pencil: The implementation is in OscarShiang/FreeRTOS-Briey ::: Briey SoC VexRiscv is a risc-v hardware implementation written by SpinalHDL. This implementation not only provides the basic extension like [I] and [M] but also other plugins like CSR plugin for previledged registers and instructions to do switching between machine mode and user mode. Briey SoC is a basic implementation based on VexRiscv. It has the following peripherals to use:
     Like 1 Bookmark
  • contributed by <OscarShiang > Port count_bits into srv32 Because we now move our code from Ripes to bare metal environment, we need to follow the calling convention carefully. Thus we should ensure that all we use saved registers and temporary registers properly. :::info :pencil: The revised code can be found at 6cc195f :::
     Like  Bookmark
  • To run BK on Raspberry Pi, we need several steps to set up your hardware Pre-requisites Raspberry Pi 4 TTL to USB cable micro SD card USB type A to type C cable (or power cable) Format SD card
     Like  Bookmark
  • contributed by < OscarShiang > Rewrite Sqrt(x) I implement my code based on 李政憲's one. Because I am curious about the way to compute the square root of a number without using brute force. I have rewritten the code to find floor(sqrt(x)) with binary search approach. #include <stdint.h> #include "math.h"
     Like  Bookmark
  • contributed by < OscarShiang > 硬體準備 Raspberry Pi 4B TTL to USB (P2303HXDL) micro SD card USB type A to type C 檢查 UART 是否可以正常運作
     Like  Bookmark
  • contributed by < OscarShiang > Counting Bits (LeetCode 338) The solution is separated into 2 parts: iterate from 0 to n count 1's of each number To compute the 1's of a number, I apply the idea that the result of a & (a - 1) will always be the value of a without the least significant 1.
     Like  Bookmark
  • contributed by < OscarShiang > 解釋 hideproc 程式碼運作原理,包含 ftrace 的使用 hideproc 的原理在於使用 ftrace hook 進行 live patching 進而更改 find_ge_pid() 函式的行為。 當我們利用 ps 或是列出 /proc/ 目錄底下的程序時,實際上會使用到 find_ge_pid() 函式來進行查找 (在 /fs/proc/base.c 中的 proc_pid_readdir() 使用 next_tgid() 遍尋所有程序,而其實作則使用 find_ge_pid()),所以若我們改變 find_ge_pid() 的行為,就可以達到隱藏程序的效果。 但是我們的目的並不是要完全取代原本的實作,而是偏移部份程序查照的結果。我們使用的方式是利用 ftrace 註冊 hook_ftrace_thunk() 函式,當有程序想要呼叫 find_ge_pid() 時, ftrace 會將其跳轉到我們先前指定的 hook_ftrace_thunk() 函式,透過更改 Instruction Pointer 位址從而跳轉到 hook_find_ge_pid() ,利用原先的 find_ge_pid() 函式進行操作後,如果預期的 pid 是我們想要隱藏者時,我們將代入到 find_ge_pid() 的 pid + 1 讓其無法取得預期的結果,將列表中的 pid 隱藏。 而我們操作 hidden_proc 的 hidden list 的方式是使用 VFS 來進行。
     Like  Bookmark
  • 測驗 $\alpha-1$ 舉出 Linux 核心原始程式碼裡頭 bit rotation 的案例並說明 首先在 Linux source code include/linux/bitops.h 可以看到關於 bitops 的實作 這邊以 8 bit 的實作舉例: static inline __u8 rol8(__u8 word, unsigned int shift) {
     Like  Bookmark
  • digraph { node[shape=box] rankdir=LR power[label="Power Up"] video[label="Video Core"] stub[label="ARMstub"] kernel[label="Kernel"] power->video[label="start4.elf"]
     Like  Bookmark
  • contributed by < OscarShiang > TLS 簡介 HTTPS 的 "S",原先是網景公司 (Netscape) 為了開發網路瀏覽器所研發的一款工具集合 SSL (Secure Socket Layer),經由 IETF 列入 RFC 標準後,稱作 TLS(Transport Layer Security)。 主要用於保障應用程式間的通訊不會遭到竊聽與竄改。 是一種 ULP(Upper Layer Protocol) ,可以在通訊協定上建立加密的機制,因此稱為傳輸層安全協定(TLS) 在協定上大致可分為兩個部分:
     Like  Bookmark
  • 學號: F74076124 姓名: 向景亘 系級: 資訊 111 MLOps 的 OS 設計 機器學習的基本步驟 資料搜集與整理 透過各式各樣不同的方法來搜集資料,並萃取出其中對於模型訓練有效的特徵即可。並且透過 normaliztion 或是 dimesion reduction 的方式減少運算成本。
     Like  Bookmark
  • 學號: F74076124 姓名: 向景亘 系級: 資訊 111 開發環境 OS: Ubuntu 20.04 CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz CPU cores: 4 Memory: 16 GB
     Like  Bookmark
  • contributed by < OscarShiang > 測試環境 $ cat /etc/os-release NAME="Ubuntu" VERSION="20.04 LTS (Focal Fossa)" $ cat /proc/version Linux version 5.4.0-47-generic (buildd@lcy01-amd64-014) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2))
     Like 2 Bookmark