OSを作ってみよう (534レス)
1-

37: 03/02/28 15:39 AAS
/*** NoName\include\sys\elf.h ***/

#ifndef_elf_h_
#define_elf_h_

#defineEI_MAG00
#defineEI_MAG11
#defineEI_MAG22
#defineEI_MAG33
#defineEI_CLASS4
#defineEI_DATA5
#defineEI_VERSION6
省7
38: 03/02/28 15:39 AAS
/*** NoName\include\sys\elf.h ***/

#defineIS_ELF(ehdr)((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
(ehdr).e_ident[EI_MAG3] == ELFMAG3)

typedefunsigned intElf32_Addr;
typedefunsigned shortElf32_Half;
typedefunsigned intElf32_Off;
typedefunsigned intElf32_Sword;
typedefunsigned intElf32_Word;
省1
39: 03/02/28 15:40 AAS
/*** NoName\include\sys\elf.h ***/

typedef struct {
unsigned chare_ident[EI_NIDENT];
Elf32_Halfe_type;
Elf32_Halfe_machine;
Elf32_Worde_version;
Elf32_Addre_entry;
Elf32_Offe_phoff;
Elf32_Offe_shoff;
Elf32_Worde_flags;
省7
40: 03/02/28 15:40 AAS
/*** NoName\include\sys\elf.h ***/

typedef struct {
Elf32_Wordsh_name;
Elf32_Wordsh_type;
Elf32_Wordsh_flags;
Elf32_Addrsh_addr;
Elf32_Offsh_offset;
Elf32_Sizesh_size;
Elf32_Wordsh_link;
Elf32_Wordsh_info;
省3
41: 03/02/28 15:41 AAS
/*** NoName\include\sys\elf.h ***/

typedef struct {
Elf32_Wordp_type;
Elf32_Offp_offset;
Elf32_Addrp_vaddr;
Elf32_Addrp_paddr;
Elf32_Sizep_filesz;
Elf32_Sizep_memsz;
Elf32_Wordp_flags;
Elf32_Sizep_align;
省2
42: 03/02/28 15:42 AAS
/*** NoName\include\sys\kernel.h ***/

#ifndef_ese_sys_kernel_h_
#define_ese_sys_kernel_h_

#include <sys/typedef.h>
#include <sys/task.h>
#include <sys/memory.h>
#include <sys/aspace.h>
#include <sys/core.h>
#include <sys/cpu.h>
#include <sys/util.h>
省1
43: 03/02/28 15:42 AAS
/*** NoName\include\sys\memory.h ***/

#ifndef_ese_sys_memory_h_
#define_ese_sys_memory_h_

extern unsigned int memory_upper;
extern unsigned int num_free_page;
extern void memory_initialize(unsigned int upper);
extern void reserve_memory(unsigned int start, unsigned int size);
extern void *alloc_page(void);
extern void free_page(void *page);
extern sys_grow_heap(Task *self, int size);
省1
44: 03/02/28 15:44 AAS
/*** NoName\include\sys\multiboot.h ***/

/* multiboot.h - the header for Multiboot */
/* Copyright (C) 1999 Free Software Foundation, Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
省4
45: 03/02/28 15:44 AAS
/*** NoName\include\sys\multiboot.h ***/

/* Macros. */

/* The magic number for the Multiboot header. */
#define MULTIBOOT_HEADER_MAGIC0x1BADB002

/* The flags for the Multiboot header. */
#define MULTIBOOT_HEADER_FLAGS0x00010003

/* The magic number passed by a Multiboot-compliant boot loader. */
#define MULTIBOOT_BOOTLOADER_MAGIC0x2BADB002
省8
46: 03/02/28 15:45 AAS
/*** NoName\include\sys\multiboot.h ***/

#ifndef ASM
/* Do not include here in boot.S. */

/* Types. */

/* The Multiboot header. */
typedef struct multiboot_header
{
unsigned long magic;
unsigned long flags;
unsigned long checksum;
省6
47: 03/02/28 15:45 AAS
/*** NoName\include\sys\multiboot.h ***/

/* The symbol table for a.out. */
typedef struct aout_symbol_table
{
unsigned long tabsize;
unsigned long strsize;
unsigned long addr;
unsigned long reserved;
} aout_symbol_table_t;

/* The section header table for ELF. */
省7
48: 03/02/28 15:46 AAS
/*** NoName\include\sys\multiboot.h ***/

/* The Multiboot information. */
typedef struct multiboot_info
{
unsigned long flags;
unsigned long mem_lower;
unsigned long mem_upper;
unsigned long boot_device;
unsigned long cmdline;
unsigned long mods_count;
省17
49: 03/02/28 15:46 AAS
/*** NoName\include\sys\multiboot.h ***/

/* The memory map. Be careful that the offset 0 is base_addr_low
but no size. */
typedef struct memory_map
{
unsigned long size;
unsigned long base_addr_low;
unsigned long base_addr_high;
unsigned long length_low;
unsigned long length_high;
省3
50: 03/02/28 15:48 AAS
/*** NoName\include\sys\queue.h ***/

/*
* TOPPERS/JSP Kernel
* Toyohashi Open Platform for Embedded Real-Time Systems/
* Just Standard Profile Kernel
*
* Copyright (C) 2000 by Embedded and Real-Time Systems Laboratory
* Toyohashi Univ. of Technology, JAPAN
*
* 上記著作権者は,以下の条件を満たす場合に限り,本ソフトウェア(本ソ
省21
51: 03/02/28 15:49 AAS
/*** NoName\include\sys\queue.h ***/

/*
*キュー操作ライブラリ
*
* このキュー操作ライブラリでは,キューヘッダを含むリング構造のダブル
* リンクキューを扱う.具体的には,キューヘッダの次エントリはキューの
* 先頭のエントリ,前エントリはキューの末尾のエントリとする.また,キ
* ューの先頭のエントリの前エントリと,キューの末尾のエントリの次エン
* トリは,キューヘッダとする.空のキューは,次エントリ,前エントリと
* も自分自身を指すキューヘッダであらわす.
省10
52: 03/02/28 15:49 AAS
/*** NoName\include\sys\queue.h ***/

/*
* キューの初期化
*
* queue にはキューヘッダを指定する.
*/
Inline void
queue_initialize(QUEUE *queue)
{
queue->prev = queue->next = queue;
省15
53: 03/02/28 15:50 AAS
/*** NoName\include\sys\queue.h ***/

/*
* エントリの削除
*
* entry をキューから削除する.
*/
Inline void
queue_delete(QUEUE *entry)
{
entry->prev->next = entry->next;
省9
54: 03/02/28 15:50 AAS
/*** NoName\include\sys\queue.h ***/

Inline QUEUE *
queue_delete_next(QUEUE *queue)
{
QUEUE*entry;

//assert(queue->next != queue);
entry = queue->next;
queue->next = entry->next;
entry->next->prev = queue;
return(entry);
省16
55: 03/02/28 15:51 AAS
/*** NoName\include\sys\task.h ***/

#ifndef_ese_sys_task_h_
#define_ese_sys_task_h_

#include <sys/queue.h>

#defineNumTask16

#defineTaskKernelStackSize(8*1024)
#defineTaskUserStackSize(256*1024)
省8
56: 03/02/28 15:52 AAS
/*** NoName\include\sys\task.h ***/

struct _Task {
QUEUEqueue;
Context*context;
charkernel_stack[TaskKernelStackSize];
unsigned intuser_stack;
intid;
intstate;
PageEntry*page_table;
intheap;
省15
1-
あと 478 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.008s