Skip to content

Instantly share code, notes, and snippets.

View naoki9911's full-sized avatar
🌴
On vacation

Naoki MATSUMOTO naoki9911

🌴
On vacation
View GitHub Profile
@naoki9911
naoki9911 / relocate.c
Last active September 14, 2018 15:02
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/BlockIo.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/SimpleFileSystem.h>
#include <Library/DevicePathLib.h>
#include <Guid/FileInfo.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
@naoki9911
naoki9911 / loader.c
Last active September 14, 2018 15:32
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/BlockIo.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/SimpleFileSystem.h>
#include <Library/DevicePathLib.h>
#include <Guid/FileInfo.h>
#include <Guid/Acpi.h>
#include <Library/MemoryAllocationLib.h>
@naoki9911
naoki9911 / entry.S
Last active September 15, 2018 15:46
//一部省略
.globl _start
_start = V2P_WO(entry)
.globl wait_main
wait_main:
.long 0
# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
int
main(void)
{
kinit1(end, P2V(4*1024*1024)); // phys page allocator
kvmalloc(); // kernel page table
mpinit(); // detect other processors
lapicinit(); // interrupt controller
seginit(); // segment descriptors
picinit(); // disable pic
ioapicinit(); // another interrupt controller
@naoki9911
naoki9911 / mp.c
Created September 16, 2018 15:32
void
mpinit(void)
{
uchar *p, *e;
int ismp;
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
VOID *vendor_table;
Status = EfiGetSystemConfigurationTable(&gEfiAcpiTableGuid,&vendor_table);
struct rsdp *acpi_rsdp = (struct rsdp *)vendor_table;
Print(L"Signature:");
UINTN i;
for(i=0;i<6;i++){
Print(L"%c",acpi_rsdp->sig[i]);
}
Print(L"\n");
Print(L"XSDT Address: %08x\n",acpi_rsdp->XsdtAddress);
@naoki9911
naoki9911 / structs.h
Last active September 17, 2018 04:02
struct rsdp {
CHAR8 sig[8];
UINT8 Checksum;
CHAR8 OEMID[6];
UINT8 Revision;
UINT32 RsdtAddress;
UINT32 Len;
UINT64 XsdtAddress;
UINT8 ExtChecksum;
UINT8 reserved[3];
@naoki9911
naoki9911 / mp_uefi.c
Last active September 17, 2018 04:31
#include "types.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "x86.h"
#include "mmu.h"
#include "proc.h"
#include "mp_uefi.h"
#include "debug.h"
@naoki9911
naoki9911 / mp_uefi.h
Last active September 17, 2018 04:22
struct uefi_madt {
uchar sig[4];
uint len;
uchar rev;
uchar chksum;
uchar oem_id[6];
uchar oem_table[8];
uint oem_rev;
uint creator_id;
uint creator_rev;
@naoki9911
naoki9911 / main.go
Created November 1, 2019 12:02
SoftEther Wrapper
package main
import (
"flag"
"fmt"
"log"
"os"
"os/exec"
"strings"
"net"