OSDN Git Service

(none)
authorryuz <ryuz>
Sun, 11 May 2008 03:38:02 +0000 (03:38 +0000)
committerryuz <ryuz>
Sun, 11 May 2008 03:38:02 +0000 (03:38 +0000)
aplfw/sample/ia32/pcat/boot.c [new file with mode: 0755]
aplfw/sample/ia32/pcat/boot.h [new file with mode: 0755]
aplfw/sample/ia32/pcat/gcc/crt0.S [new file with mode: 0755]
aplfw/sample/ia32/pcat/gcc/gmake.mak [new file with mode: 0755]
aplfw/sample/ia32/pcat/gcc/ipl.S [new file with mode: 0755]
aplfw/sample/ia32/pcat/gcc/link.x [new file with mode: 0755]
aplfw/sample/ia32/pcat/main.c [new file with mode: 0755]
aplfw/sample/ia32/pcat/ostimer.c [new file with mode: 0755]
aplfw/sample/ia32/pcat/ostimer.h [new file with mode: 0755]
aplfw/sample/ia32/pcat/system.cfg [new file with mode: 0755]

diff --git a/aplfw/sample/ia32/pcat/boot.c b/aplfw/sample/ia32/pcat/boot.c
new file mode 100755 (executable)
index 0000000..74f3d4c
--- /dev/null
@@ -0,0 +1,174 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  boot.c
+ * @brief %jp{ブート部}%en{boot}
+ *
+ * Copyright (C) 1998-2008 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "kernel.h"
+#include "kernel_id.h"
+#include "system/system/system.h"
+#include "system/sysapi/sysapi.h"
+#include "system/file/console.h"
+#include "system/process/process.h"
+#include "system/command/command.h"
+#include "driver/console/pcattext/pcattextdrv.h"
+#include "driver/console/vt100/vt100drv.h"
+#include "driver/serial/pc16550/pc16550drv.h"
+#include "application//syscmd/shell/shell.h"
+#include "application//syscmd/commandlist/commandlist.h"
+#include "application//syscmd/processlist/processlist.h"
+#include "application/utility/timecmd/timecmd.h"
+#include "application/utility/memdump/memdump.h"
+#include "application/utility/memwrite/memwrite.h"
+#include "application/utility/memtest/memtest.h"
+#include "application/utility/keytest/keytest.h"
+#include "application/example/hello/hello.h"
+#include "boot.h"
+#include "ostimer.h"
+
+
+/* システムヒープ */
+long   g_SystemHeap[256 * 1024 / sizeof(long)];
+
+
+
+int Boot_Process(VPARAM Param);
+
+
+
+void Boot_Task(VP_INT exinf)
+{
+       T_SYSTEM_INITIALIZE_INF SysInf;
+       
+       
+       /*************************/
+       /*    固有初期設定       */
+       /*************************/
+       
+       
+       
+       /*************************/
+       /*       初期化          */
+       /*************************/
+       
+       /* システム初期化 */
+       SysInf.pHeapMem        = g_SystemHeap;
+       SysInf.HeapSize        = sizeof(g_SystemHeap);
+       SysInf.SystemStackSize = 1024;
+       SysInf.pfncBoot        = Boot_Process;
+       SysInf.BootParam       = (VPARAM)0;
+       SysInf.BootStackSize   = 1024;
+       System_Initialize(&SysInf);
+}
+
+
+/* ブートプロセス */
+int Boot_Process(VPARAM Param)
+{
+       T_PROCESS_CREATE_INF    ProcInf;
+       HANDLE                                  hProcess;
+       HANDLE                                  hDriver;
+       HANDLE                                  hConOut;
+       HANDLE                                  hConIn;
+       
+       
+       /*************************/
+       /*   デバイスドライバ    */
+       /*************************/
+       
+       /* タイマ初期化 */        
+/*     OsTimer_Initialize();   */
+       
+       /* 16550デバドラ生成 (/dev/com0 に登録) */
+/*
+       hDriver = Pc16550Drv_Create((void *)0x03f8, 0, 4, 1843200, 256);
+       File_AddDevice("com1", hDriver);
+       hDriver = Pc16550Drv_Create((void *)0x02f8, 0, 3, 1843200, 256);
+       File_AddDevice("com2", hDriver);
+*/
+       
+       
+       /* コンソールを生成( /dev/con0 に登録) */
+       hDriver = PcatTextDrv_Create((void *)0, (void *)0x000b8000);
+       File_AddDevice("screen0", hDriver);
+       
+       /* コンソールを開く */
+       hConOut = File_Open("/dev/screen0", FILE_OPEN_READ | FILE_OPEN_WRITE);
+       
+       
+       
+       /*************************/
+       /*     標準入出力設定    */
+       /*************************/
+       
+       Process_SetConIn(HANDLE_NULL, hConIn);
+       Process_SetConOut(HANDLE_NULL, hConOut);
+       Process_SetStdIn(HANDLE_NULL, hConIn);
+       Process_SetStdOut(HANDLE_NULL, hConOut);
+       Process_SetStdErr(HANDLE_NULL, hConOut);
+       
+       
+       /*************************/
+       /*     コマンド登録      */
+       /*************************/
+       Command_AddCommand("sh",       Shell_Main);
+       Command_AddCommand("ps",       ProcessList_Main);
+       Command_AddCommand("help",     CommandList_Main);
+       Command_AddCommand("time",     TimeCmd_Main);
+       Command_AddCommand("memdump",  MemDump_Main);
+       Command_AddCommand("memwrite", MemWrite_Main);
+       Command_AddCommand("memtest",  MemTest_Main);
+       Command_AddCommand("keytest",  KeyTest_Main);
+       Command_AddCommand("hello",    Hello_Main);
+       
+       
+       /*************************/
+       /*    起動メッセージ     */
+       /*************************/
+       StdIo_PutString(
+                       "\n\n"
+                       "================================================================\n"
+                       " Hyper Operating System  Application Flamework\n"
+                       "\n"
+                       "                          Copyright (C) 1998-2008 by Project HOS\n"
+                       "                          http://sourceforge.jp/projects/hos/\n"
+                       "================================================================\n"
+                       "\n");
+       
+       
+       /*************************/
+       /*      シェル起動       */
+       /*************************/
+       
+       /* プロセスの生成*/
+       ProcInf.pszCommandLine = "sh -i";                                                               /* 実行コマンド */
+       ProcInf.pszCurrentDir  = "";                                                                    /* 起動ディレクトリ */
+       ProcInf.pfncEntry      = NULL;                                                                  /* 起動アドレス */
+       ProcInf.Param          = 0;                                                                             /* ユーザーパラメータ */
+       ProcInf.StackSize      = 2048;                                                                  /* スタックサイズ */
+       ProcInf.Priority       = PROCESS_PRIORITY_NORMAL;                               /* プロセス優先度 */
+       ProcInf.hTerminal      = Process_GetTerminal(HANDLE_NULL);              /* ターミナル */
+       ProcInf.hConIn         = Process_GetConIn(HANDLE_NULL);                 /* コンソール入力 */
+       ProcInf.hConOut        = Process_GetConOut(HANDLE_NULL);                /* コンソール出力 */
+       ProcInf.hStdIn         = Process_GetStdIn(HANDLE_NULL);                 /* 標準入力 */
+       ProcInf.hStdOut        = Process_GetStdOut(HANDLE_NULL);                /* 標準出力 */
+       ProcInf.hStdErr        = Process_GetStdErr(HANDLE_NULL);                /* 標準エラー出力 */
+       for ( ; ; )
+       {
+               hProcess = Process_Create(&ProcInf);
+               Process_WaitExit(hProcess);
+               Process_Delete(hProcess);
+       }
+}
+
+
+
+/* end of file */
diff --git a/aplfw/sample/ia32/pcat/boot.h b/aplfw/sample/ia32/pcat/boot.h
new file mode 100755 (executable)
index 0000000..41c3352
--- /dev/null
@@ -0,0 +1,31 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  sample.c
+ * @brief %jp{サンプルプログラム}%en{Sample program}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+#ifndef __boot_h__
+#define __boot_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Boot_Task(VP_INT exinf);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __boot_h__ */
+
+
+/* end of file */
diff --git a/aplfw/sample/ia32/pcat/gcc/crt0.S b/aplfw/sample/ia32/pcat/gcc/crt0.S
new file mode 100755 (executable)
index 0000000..308d7cf
--- /dev/null
@@ -0,0 +1,53 @@
+/** 
+ * Hyper Operating System V4 Advance
+ *
+ *  Sample program for PC/AT
+ *
+ * Copyright (C) 1998-2007 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+                               .extern         main
+                               .extern         _kernel_int_isp
+                               .extern         ___bss
+                               .extern         ___bss_end
+
+                               .global         _boot_handler
+                               .global         __main
+
+
+                               .text
+                               .align  4
+
+/************************************************
+  起動ハンドラ
+************************************************/
+_boot_handler: 
+                               movl    (_kernel_int_isp), %esp
+                               
+                       /* BSS clear */
+                               movl    $___bss_end, %ecx
+                               subl    $___bss, %ecx
+                               movl    $___bss, %edi
+                               xorl    %eax, %eax
+                               cld
+                               rep             stosb
+                               
+                               
+                               call    main
+                               
+_end_main:
+                               hlt
+                               jmp             *_end_main
+
+__main:
+                               ret                     /* 何もしない */
+
+
+
+                               .end
+
+
+/* end of file */
diff --git a/aplfw/sample/ia32/pcat/gcc/gmake.mak b/aplfw/sample/ia32/pcat/gcc/gmake.mak
new file mode 100755 (executable)
index 0000000..da3f3ba
--- /dev/null
@@ -0,0 +1,185 @@
+# ----------------------------------------------------------------------------
+# Hyper Operating System V4 Advance
+#  makefile for PC/AT
+#
+# Copyright (C) 1998-2008 by Project HOS
+# http://sourceforge.jp/projects/hos/
+# ----------------------------------------------------------------------------
+
+
+# --------------------------------------
+#  %jp{各種設定}{setting}
+# --------------------------------------
+
+# %jp{ターゲット名}%en{target name}
+TARGET ?= sample
+
+
+# %jp{ツール定義}%en{tools}
+GCC_ARCH   ?= i386-elf-
+CMD_CC     ?= $(GCC_ARCH)gcc
+CMD_ASM    ?= $(GCC_ARCH)gcc
+CMD_LINK   ?= $(GCC_ARCH)gcc
+CMD_OBJCNV ?= $(GCC_ARCH)objcopy
+
+
+# %jp{アーキテクチャ定義}%en{architecture}
+ARCH_NAME ?= pcat
+ARCH_CC   ?= gcc
+
+
+# %jp{ディレクトリ定義}
+TOP_DIR            = ../../../../..
+KERNEL_DIR         = $(TOP_DIR)/kernel
+KERNEL_CFGRTR_DIR  = $(TOP_DIR)/cfgrtr/build/gcc
+KERNEL_MAKINC_DIR  = $(KERNEL_DIR)/build/common/gmake
+KERNEL_BUILD_DIR   = $(KERNEL_DIR)/build/ia32/pcat/gcc
+HOSAPLFW_DIR       = $(TOP_DIR)/aplfw
+HOSAPLFW_INC_DIR   = $(HOSAPLFW_DIR)
+HOSAPLFW_BUILD_DIR = $(HOSAPLFW_DIR)/build/ia32/i386/gcc
+
+# %jp{コンフィギュレータ定義}
+KERNEL_CFGRTR = $(KERNEL_CFGRTR_DIR)/h4acfg-$(ARCH_NAME)
+
+
+# %jp{共通定義読込み}%jp{common setting}
+include $(KERNEL_MAKINC_DIR)/common.inc
+
+
+# %jp{ライブラリ定義}%en{libraries}
+HOSAPLFW_LIB = $(HOSAPLFW_BUILD_DIR)/hosaplfw.$(EXT_LIB)
+
+
+# %jp{リンカスクリプト}%en{linker script}
+LINK_SCRIPT = link.x
+
+
+# %jp{パス設定}%en{add source directories}
+INC_DIRS += . .. $(HOSAPLFW_INC_DIR)
+SRC_DIRS += . ..
+
+
+# %jp{オプションフラグ}%en{option flags}
+AFLAGS  = -march=i386
+CFLAGS  = -march=i386
+LNFLAGS = -nostartfiles -Wl,-Map,$(TARGET).map,-T$(LINK_SCRIPT)
+
+
+# %jp{コンパイラ依存の設定読込み}%en{compiler dependent definitions}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_d.inc
+
+# %jp{実行ファイル生成用設定読込み}%en{definitions for exection file}
+include $(KERNEL_MAKINC_DIR)/makexe_d.inc
+
+
+# %jp{出力ファイル名}%en{output files}
+TARGET_EXE = $(TARGET).$(EXT_EXE)
+TARGET_MOT = $(TARGET).$(EXT_MOT)
+TARGET_HEX = $(TARGET).$(EXT_HEX)
+TARGET_BIN = $(TARGET).$(EXT_BIN)
+TARGET_IMG = $(TARGET).img
+
+
+
+# --------------------------------------
+#  %jp{ソースファイル}%en{source files}
+# --------------------------------------
+
+# %jp{アセンブラファイルの追加}%en{assembry sources}
+ASRCS += ./crt0.S
+
+
+# %jp{C言語ファイルの追加}%en{C sources}
+CSRCS += ../main.c
+CSRCS += ../kernel_cfg.c
+CSRCS += ../boot.c
+CSRCS += ../ostimer.c
+
+
+# %jp{ライブラリの追加}%en{libraries}
+LIBS := $(HOSAPLFW_LIB) $(LIBS)
+
+
+
+
+# --------------------------------------
+#  %jp{ルール定義}%en{rules}
+# --------------------------------------
+
+# %jp{ALL}%en{all}
+.PHONY : all
+all: make_subprject kernel_make makeexe_all ipl.bin $(TARGET_BIN) $(TARGET_HEX) $(TARGET_MOT) $(TARGET).img
+
+# %jp{サブプロジェクトメイク}%en{make subproject}
+.PHONY : make_subprject
+make_subprject:
+       $(MAKE) -C $(HOSAPLFW_BUILD_DIR) -f gmake.mak
+
+# %jp{クリーン}%en{clean}
+.PHONY : clean
+clean: makeexe_clean
+       rm -f $(TARGET_BIN) $(TARGET_HEX) $(TARGET_MOT) $(TARGET).img $(OBJS) ../kernel_cfg.c ../kernel_id.h
+
+# %jp{サブプロジェクトを含めたクリーン}%en{mostlyclean}
+.PHONY : mostlyclean
+mostlyclean: clean kernel_clean
+       $(MAKE) -C $(HOSAPLFW_BUILD_DIR) -f gmake.mak clean
+
+# %jp{依存関係更新}%en{depend}
+.PHONY : depend
+depend: makeexe_depend
+
+# %jp{サブプロジェクトを含めた依存関係更新}%en{mostlydepend}
+.PHONY : mostlydepend
+mostlydepend: depend kernel_depend
+       $(MAKE) -C $(HOSAPLFW_BUILD_DIR) -f gmake.mak depend
+
+# %jp{ソース一括コピー}%en{source files copy }
+.PHONY : srccpy
+srccpy: makeexe_srccpy
+
+# %jp{サブプロジェクトを含めたソース一括コピー}%en{mostly source files copy}
+.PHONY : mostlysrccpy
+mostlysrccpy: srccpy srccpy
+       $(MAKE) -C $(KERNEL_BUILD_DIR) -f gmake.mak srccpy
+       $(MAKE) -C $(HOSAPLFW_BUILD_DIR) -f gmake.mak srccpy
+
+# %jp{コンフィギュレータ実行}%en{configurator}
+../kernel_cfg.c ../kernel_id.h: ../system.cfg $(KERNEL_CFGRTR)
+       cpp -E ../system.cfg ../system.i
+       $(KERNEL_CFGRTR) ../system.i -c ../kernel_cfg.c -i ../kernel_id.h
+
+
+# %jp{IPL部の生成}
+ipl.bin: $(OBJS_DIR)/ipl.o
+       $(GCC_ARCH)ld -Ttext=0x0000 $(OBJS_DIR)/ipl.o -o ipl.out
+       $(CMD_OBJCNV) -O binary ipl.out ipl.bin
+
+# %jP{フロッピーディスクイメージ生成}%en{FD image}
+$(TARGET).img: ipl.bin $(TARGET_BIN)
+       ./fd_img.pl $(TARGET).img ipl.bin $(TARGET_BIN)
+
+.PHONY : bochs
+bochs: $(TARGET).img
+       bochs "floppya: 1_44=$(TARGET).img, status=inserted" "boot: a"
+
+
+# %jp{実行ファイル生成用設定読込み}%en{rules for exection file}
+include $(KERNEL_MAKINC_DIR)/makexe_r.inc
+
+# %jp{コンパイラ依存のルール定義読込み}%en{rules for compiler}
+include $(KERNEL_MAKINC_DIR)/$(ARCH_CC)_r.inc
+
+
+
+
+# --------------------------------------
+#  %jp{依存関係}%en{dependency}
+# --------------------------------------
+
+$(TARGET_EXE): $(LINK_SCRIPT)
+$(OBJS_DIR)/sample.$(EXT_OBJ): ../sample.c ../kernel_id.h
+
+
+# end of file
+
diff --git a/aplfw/sample/ia32/pcat/gcc/ipl.S b/aplfw/sample/ia32/pcat/gcc/ipl.S
new file mode 100755 (executable)
index 0000000..de83171
--- /dev/null
@@ -0,0 +1,217 @@
+/** 
+ * Hyper Operating System V4 Advance
+ *
+ *  Sample program for PC/AT
+ *
+ * Copyright (C) 1998-2008 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+
+IPL_SEG   = 0x07c0                     /* ロードされるセグメントアドレス */
+LOAD_SEG  = 0x0800                     /* 本体をロードするセグメントアドレス */
+IPL_ADDR  = (IPL_SEG << 4)
+LOAD_ADDR = (LOAD_SEG << 4)
+
+LOAD_SEC_NUM = 128
+
+
+                               .code16
+                               .text
+                               .org    0
+
+                               .global ipl_top
+
+               /***** IPL部 *****/
+ipl_top:
+                               cli
+                               jmpl    $IPL_SEG, $ipl_start    /* CSの初期化 */
+ipl_start:
+                               movw    $IPL_SEG, %ax
+                               movw    %ax, %ds                                /* DSの初期化 */
+                               movw    %ax, %ss                                /* SSの初期化 */
+                               movw    $0x200, %ax
+                               movw    %ax, %sp                                /* SPの初期化 */
+
+               /***** 初期化部 *****/
+init_start:
+                               /* 画面のクリア */
+                               call    bios_clr_disp
+                               
+                               /* メッセージ出力 */
+                               movw    $boot_message, %si
+                               call    bios_puts
+                               
+                               /* 本体のロード */
+                               movw    $LOAD_SEG, %ax
+                               movw    %ax, %es
+                               xorw    %bx, %bx                        /* 読込先アドレス */
+                               movw    $1, %ax                         /* 読み込み論理セクタ番号 */
+read_loop:             
+                               pushw   %ax
+                               pushw   %bx
+                               pushw   %es
+                               call    read_sector
+                               popw    %es
+                               popw    %bx
+                               popw    %ax
+                               
+                               addw    $1, %ax
+                               addw    $512, %bx
+                               cmp             $LOAD_SEC_NUM, %ax
+                               jnz             read_loop
+                               
+                               /* ネイティブモードへ移行 */
+                               jmp             switch_32bit
+                               
+                               
+                               /* エラー */
+disk_error:            
+                               movw    $error_message, %si
+                               call    bios_puts
+error_end:             
+                               nop
+                               jmp             error_end
+
+
+read_sector:
+                               /* FDDから1セクタ読み込み */
+                               pushw   %bx
+                               mov             $18, %bl
+                               div             %bl
+                               popw    %bx
+                               
+                               xorw    %cx, %cx
+                               movb    %ah, %cl
+                               incb    %cl                                     /* セクタ設定 */
+                               
+                               movb    %al, %dh                        /* ヘッド番号 */
+                               andb    $0x01, %dh
+                               
+                               shrb    $1, %al
+                               mov             %al, %ch                        /* シリンダ番号 */
+                               
+                               movb    $0x00, %dl                      /* ドライブ番号 */
+                               
+                               movb    $0x02, %ah                      /* 機能コード */
+                               movb    $1, %al                         /* セクタ数 */
+                               int             $0x13
+                               jc              disk_error
+                               cmp             $1, %al
+                               jnz             disk_error
+                               ret
+                               
+                               
+                               /* 画面のクリア */
+bios_clr_disp:
+                               movb    $0x3, %al
+                               movb    $0, %ah
+                               int     $0x10
+                               ret
+
+
+                               /* 1文字出力 */
+bios_putc:
+                               movb    $0x0e, %ah
+                               movb    $0, %bh
+                               int     $0x10
+                               ret
+                               
+                               /* 文字列出力 */
+bios_puts:
+                               lodsb
+                               cmpb    $0, %al
+                               jz              bios_puts_end
+                               call    bios_putc
+                               jmp             bios_puts
+bios_puts_end:
+                               ret
+
+
+switch_32bit:
+                               cli
+                               
+                               /* GDT設定 */
+                               lgdt    gdtr
+                               
+                               /* プロテクトモードへ移行 */
+                               movl    %cr0, %eax
+                               orl             $0x00000001, %eax
+                               movl    %eax, %cr0
+                               
+                               /* パイプラインフラッシュ */
+                               .byte   0xe9, 0x00, 0x00
+                               
+                               /* CS設定 */
+                               .byte   0xea
+                               .word   _start_32bit + IPL_ADDR
+                               .word   0x0008
+                               
+                               .code32
+_start_32bit:  
+                               movw    $0x0010, %ax
+                               movw    %ax, %ss
+                               movw    %ax, %ds
+                               movw    %ax, %es
+                               movw    %ax, %fs
+                               movw    %ax, %gs
+                               
+                               movl    $LOAD_ADDR, %eax
+                               jmp             %eax
+
+
+
+                               /* 起動メッセージ */
+boot_message:
+                       .ascii  "HOS-Loader\r\nNow loading...\r\n\0"
+
+                               /* エラーメッセージ */
+error_message:
+                       .ascii  "disk error\r\n\0"
+
+
+
+/************************************************
+  グローバルディスクリプタテーブル
+************************************************/
+
+gdt_base:
+gdt_000:               /* ヌルセグメント */
+                               .word   0x0000
+                               .word   0x0000
+                               .byte   0x00
+                               .byte   0x00
+                               .byte   0x00
+                               .byte   0x00
+
+gdt_001:               /* コードセグメント用 */
+                               .word   0xffff          /* リミット[15:0]:0xffff */
+                               .word   0x0000          /* ベース[15:0]:0x0000 */
+                               .byte   0x00            /* ベース[23:16] */
+                               .byte   0x9a            /* P:1, DPL:0, S:1, TYPE:5, A:0 */
+                               .byte   0xcf            /* G:1, D=1, リミット[19:15]:0xf */
+                               .byte   0x00            /* ベース[32:24]:0x00 */
+
+gdt_002:               /* データセグメント用 */               
+                               .word   0xffff          /* リミット[15:0]:0xffff */
+                               .word   0x0000          /* ベース[15:0]:0x0000 */
+                               .byte   0x00            /* ベース[23:16] */
+                               .byte   0x92            /* P:1, DPL:0, S:1, TYPE:1, A:0 */
+                               .byte   0xcf            /* G:1, D=1, リミット[19:15]:0xf */
+                               .byte   0x00            /* ベース[32:24]:0x00 */
+gdt_end:
+
+
+                               /* lgdt命令用領域 */
+gdtr:                  .word   gdt_end - gdt_base - 1
+                               .long   gdt_base + IPL_ADDR
+
+
+                               /* マジックナンバー */
+                               .org    510
+                               .word   0xaa55
+
+
+
+/* end of file  */
diff --git a/aplfw/sample/ia32/pcat/gcc/link.x b/aplfw/sample/ia32/pcat/gcc/link.x
new file mode 100755 (executable)
index 0000000..c3a6f5d
--- /dev/null
@@ -0,0 +1,56 @@
+ENTRY(_boot_handler)
+
+
+MEMORY
+{
+       ram    : o = 0x00008000, l = 0x98000
+}
+
+
+SECTIONS
+{
+       .text :
+       {
+                ___text = . ; 
+               objs_*/crt0.o(.text)
+               *(.text)
+               *(.strings)
+               *(.rodata*)
+                ___text_end = . ; 
+       } > ram
+       .tors :
+       {
+               . = ALIGN(4);
+               ___ctors = . ;
+               *(.ctors)
+               ___ctors_end = . ;
+               ___dtors = . ;
+               *(.dtors)
+               ___dtors_end = . ;
+       } > ram
+       .rdata :
+       {
+               ___rdata = . ;
+               *(.rdata)
+               ___rdata_end = . ;
+       } > ram
+       .eh_frame :
+       {
+               *(.eh_frame)
+       } > ram
+       data : 
+       {
+               ___data = . ;
+               *(.data)
+               ___data_end = . ;
+       } > ram
+       .bss :
+       {
+               ___bss = . ;
+               *(.bss)
+               *(COMMON)
+               ___bss_end = . ;  
+       } > ram
+}
+
+
diff --git a/aplfw/sample/ia32/pcat/main.c b/aplfw/sample/ia32/pcat/main.c
new file mode 100755 (executable)
index 0000000..75e7919
--- /dev/null
@@ -0,0 +1,27 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  main.c
+ * @brief %jp{メイン関数}%en{main}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "kernel.h"
+
+
+
+/** %jp{メイン関数} */
+int main()
+{
+       /* %jp{カーネルの動作開始} */
+       vsta_knl();
+       
+       return 0;
+}
+
+
+
+/* end of file */
diff --git a/aplfw/sample/ia32/pcat/ostimer.c b/aplfw/sample/ia32/pcat/ostimer.c
new file mode 100755 (executable)
index 0000000..f3b7da7
--- /dev/null
@@ -0,0 +1,51 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  ostimer.c
+ * @brief %jp{OSタイマ}%en{OS timer}
+ *
+ * Copyright (C) 1998-2008 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#include "kernel.h"
+#include "ostimer.h"
+
+
+
+void OsTimer_Isr(VP_INT exinf);        /**< %jp{タイマ割込みサービスルーチン} */
+
+extern VP _kernel_inh_tbl[224];
+
+/** %jp{OS用タイマ初期化ルーチン} */
+void OsTimer_Initialize(VP_INT exinf)
+{
+       T_CISR cisr;
+       
+       /* %jp{割り込みサービスルーチン生成} */
+       cisr.isratr = TA_HLNG;
+       cisr.exinf  = 0;
+       cisr.intno  = 0;
+       cisr.isr    = (FP)OsTimer_Isr;
+       acre_isr(&cisr);
+       
+       /* %jp{タイマ動作開始} */
+       _kernel_outpb(0x43, 0x34);
+       _kernel_outpb(0x40, 0x9c);      /* 11932 = 0x2e9c */
+       _kernel_outpb(0x40, 0x2e);
+       
+       /* %jp{割込み許可} */
+       ena_int(0);
+}
+
+
+/** %jp{タイマ割り込みハンドラ} */
+void OsTimer_Isr(VP_INT exinf)
+{
+       /* %jp{タイムティック供給} */
+       isig_tim();
+}
+
+
+/* end of file */
diff --git a/aplfw/sample/ia32/pcat/ostimer.h b/aplfw/sample/ia32/pcat/ostimer.h
new file mode 100755 (executable)
index 0000000..e741bb1
--- /dev/null
@@ -0,0 +1,31 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  ostimer.c
+ * @brief %jp{OSタイマ}%en{OS timer}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+#ifndef __ostimer_h__
+#define __ostimer_h__
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** %jp{OS用タイマ初期化ルーチン} */
+void OsTimer_Initialize(VP_INT exinf);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __ostimer_h__ */
+
+
+/* end of file */
diff --git a/aplfw/sample/ia32/pcat/system.cfg b/aplfw/sample/ia32/pcat/system.cfg
new file mode 100755 (executable)
index 0000000..3e16f48
--- /dev/null
@@ -0,0 +1,28 @@
+/** 
+ *  Sample program for Hyper Operating System V4 Advance
+ *
+ * @file  system.cfg
+ * @brief %jp{サンプルのコンフィギュレーション}
+ *
+ * Copyright (C) 1998-2006 by Project HOS
+ * http://sourceforge.jp/projects/hos/
+ */
+
+
+/* %jp{カーネル独自の設定}%en{kernel} */
+KERNEL_HEP_MEM(65536, NULL);
+KERNEL_INT_STK(2048, NULL);
+KERNEL_MAX_TSKID(32);
+KERNEL_MAX_SEMID(32);
+KERNEL_MAX_FLGID(32);
+KERNEL_MAX_MBXID(32);
+KERNEL_MAX_MPFID(32);
+KERNEL_MAX_ISRID(32);
+
+
+/* %jp{ブートタスク}%en{Boot task} */
+INCLUDE("\"boot.h\"");
+CRE_TSK(TSKID_BOOT, {TA_HLNG | TA_ACT, 0, Boot_Task, 2, 1024, NULL});
+
+
+/* end of file */