Skip to content

Instantly share code, notes, and snippets.

View knknkn1162's full-sized avatar

Kenta Nakajima knknkn1162

View GitHub Profile
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity flopr_tb is
end entity;
architecture behavior of flopr_tb is
component flopr
generic(N: integer);
port (
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity counter_tb is
end entity;
architecture testbench of counter_tb is
component counter is
@knknkn1162
knknkn1162 / Vagrantfile
Last active August 27, 2019 13:12
何がOS実装の理解を難しくしているのかとGNU assemblyの準備 ref: https://qiita.com/knknkn1162/items/9bd54e165c6c9edca49b
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.synced_folder ".", "/home/vagrant/shared"
end
initcode.o: file format elf32-i386
Disassembly of section .text:
00000000 <start>:
# exec(init, argv)
$ gcc -nostdlib -Wl,-emain hello0.S -Wl,--verbose
GNU ld (GNU Binutils for Ubuntu) 2.24
Supported emulations:
elf_i386
i386linux
elf32_x86_64
elf_x86_64
elf_l1om
elf_k1om
i386pep
Memory Configuration
Name Origin Length Attributes
*default* 0x0000000000000000 0xffffffffffffffff
Linker script and memory map
LOAD /tmp/cc9UJbgz.o
0x0000000008048000 PROVIDE (__executable_start, 0x8048000)
@knknkn1162
knknkn1162 / linker_map
Created September 15, 2018 14:21
xv6 kernel
$ i386-jos-elf-ld -m elf_i386 -T kernel.ld -o kernel entry.o bio.o console.o exec.o file.o fs.o ide.o ioapic.o kalloc.o kbd.o lapic.o log.o main.o mp.o picirq.o pipe.o proc.o sleeplock.o spinlock.o string.o swtch.o syscall.o sysfile.o sysproc.o trapasm.o trap.o uart.o vectors.o vm.o -b binary initcode entryother -M
Allocating common symbols
Common symbol size file
log 0xc4 log.o
kmem 0x3c kalloc.o
ioapicid 0x1 mp.o
ioapic 0x4 ioapic.o
bcache 0x4958 bio.o
$ gcc -nostdlib -Wl,-emain call.s
$ ./a.out
Hello world!
$ objdump -S a.out > a.asm && cat a.asm
a.out: file format elf32-i386
Disassembly of section .text:
@knknkn1162
knknkn1162 / entryother.asm
Last active September 13, 2018 08:18
entryother
bootblockother.o: file format elf32-i386
Disassembly of section .text:
00007000 <start>:
# This code combines elements of bootasm.S and entry.S.
.code16
@knknkn1162
knknkn1162 / entry_disasm.asm
Last active September 21, 2018 11:55
entry ~ enable paging with modifying %cr0 ~ jump main
$ objdump -S kernel
kernel: file format elf32-i386
Disassembly of section .text:
80100000 <multiboot_header>:
80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh
80100006: 00 00 add %al,(%eax)