Hitachi SuperH (SH3/SH4) port

NIIBE Yutaka (gniibe@chroot.org)
Mon, 30 Aug 1999 08:53:25 +0900


Hi there, I've send two messages, but they have not been delivered.
This is third try. Current version is against 2.3.15, supporting both
endianness.

I've already send the patch to Linus. If we're lucky enough, we could
see it in standard kernel.

Thanks,

-- 
Niibe Yutaka

------- start of digest (2 messages) (RFC 934 encapsulation) ------- From: NIIBE Yutaka <gniibe@chroot.org> To: linux-kernel@vger.rutgers.edu Subject: Hitachi SuperH (SH3) port Date: Wed, 18 Aug 1999 21:13:57 +0900 Message-Id: <199908181213.VAA07384@pwd.chroot.org>

Hello folks,

Last summer, I mentioned about the port to Hitachi's SuperH (SH-3). Finally, it works somewhat.

As I haven't got hardware information of Hitachi's Windows CE machine, I've changed my goal to "just" the kernel port. Currently, I'm using small evaluation board of SH-3 made by Kyoto Micro Computer, which is available from CQ publishing campany (in Japan). The board only has a serial interface. It has SH7708 CPU running 60MHz with 4MB memory.

My port (please not that it's not finnished work) is available at:

ftp://ftp.m17n.org/pub/linux-sh-1999-08-18.tar.gz ftp://ftp.m17n.org/pub/linux-sh-1999-08-18.diff.gz

It is against linux-2.2.10, and it successfully boot, read image to RAM disk and mount it and runs simple user program ("hello world").

It does successfully:

timer interrupt handling system call paging (MMU) context switch

I've not yet implemented the signal handling.

I enclose the output from the kernel, for the record. :-)

Enjoy, - -- Niibe Yutaka

- ----------------------------------- $ sh-gniibe-elf-gdb vmlinux GNU gdb 4.18 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i586-pc-linux-gnu --target=sh-gniibe-elf"... [waiting for cqsh3(/dev/ttyS0,115200)...] Loading section .text, size 0x4f824 lma 0x8c001000 Loading section .rodata, size 0x5d7b lma 0x8c050824 Loading section ___ex_table, size 0x1200 lma 0x8c0565a0 Loading section .data, size 0x8480 lma 0x8c0577a0 Loading section .data.init_task, size 0x2000 lma 0x8c060000 Loading section .text.init, size 0x317c lma 0x8c062000 Loading section .data.init, size 0x78 lma 0x8c06517c Loading section .data.cacheline_aligned, size 0x10 lma 0x8c066000 Loading section .data.disk_image, size 0x8000 lma 0x8c067000 Start address 0x8c001000 , load size 441891 Transfer rate: 50501 bits/sec. (gdb) run Starting program: /home/niibe/w/linux-sh/vmlinux Linux version 2.2.10 (gniibe@akebono) (gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)) #1 Wed Aug 18 21:11:43 JST 1999 Calibrating delay loop... 29.90 BogoMIPS Memory: 3496k/4096k available (348k kernel code, 48k reserved, 188k data, 16k init) POSIX conformance testing by UNIFIX Linux NET4.0 for Linux 2.2 Based upon Swansea University Comp8uter Society NE3.039 Starting kswapd v 1.5 RAM disk driver initialized: 16 RAM disks of 4096K size RAMDISK: ext2 filesystem found at block 0 RAMDISK: Loading 64 blocks [1 disk] into ram disk... |/-\done. VFS: Mounted root (ext2 filesystem). Hello World! This is SuperH! Hello World! Hello World! This is SuperH! Hello World! ... - ----------------------------------- ------------------------------ From: NIIBE Yutaka <gniibe@m17n.org> To: linux-kernel@vger.rutgers.edu Cc: steve@xemacs.org, jimb@red-bean.com, tomo@etl.go.jp Subject: Hitachi SuperH (SH-3) Port Date: Thu, 19 Aug 1999 17:32:54 +0900 (JST) Message-Id: <199908190832.RAA16960@tsukuba.m17n.org>

Hi there,

As I remember correctly, I sent a message to the linux-kernel list yesterday. But I didn't see my message got delivered. In that message, I said that the port of Hitachi SuperH (SH-3). May be it's just my dream...

Today, I've implemented signal handling and it works. As it works well on context switch, paging, system calls, and signal handling, I think that I've finished most important part.

Current snapshot is available at: ftp://ftp.m17n.org/pub/super-h/linux-sh-1999-08-19.diff.gz

It's against Linux version 2.2.11.

I enclose today's output of the kernel, and the user program to test signal hadling.

It really works. For those who doubt much, I send this message with Cc: to Steve L. Baur (XEmacs maintainer) Jim Blandy (Guile maintainer) and Morioka Tomohiko (The author of SEMI, FLIM, and APEL), who really see it's working! I'm pleased that we can share this opportunity.

Enjoy, - -- Niibe Yutaka

- -------------------------- Script started on Thu Aug 19 17:13:35 1999 $ sh-gniibe-elf-gdb vmlinux GNU gdb 4.18 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i586-pc-linux-gnu --target=sh-gniibe-elf"... [waiting for cqsh3(/dev/ttyS0,115200)...] Loading section .text, size 0x50b04 lma 0x8c001000 Loading section .rodata, size 0x5d43 lma 0x8c051b04 Loading section ___ex_table, size 0x12a0 lma 0x8c057850 Loading section .data, size 0x8874 lma 0x8c058af0 Loading section .data.init_task, size 0x2000 lma 0x8c062000 Loading section .text.init, size 0x31bc lma 0x8c064000 Loading section .data.init, size 0x78 lma 0x8c0671bc Loading section .data.cacheline_aligned, size 0x10 lma 0x8c068000 Loading section .data.disk_image, size 0x400 lma 0x8c069000 Start address 0x8c001000 , load size 416159 Transfer rate: 51219 bits/sec. (gdb) run Starting program: /home/niibe/w/linux-sh/vmlinux Linux version 2.2.11 (gniibe@akebono) (gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)) #1 Thu Aug 19 17:01:45 JST 1999 Calibrating delay loop... 29.90 BogoMIPS Memory: 3512k/4096k available (352k kernel code, 20k reserved, 196k data, 16k init) POSIX conformance testing by UNIFIX Linux NET4.0 for Linux 2.2 Based upon Swansea6 University ComSociety NET3.039 Starting kswapd v 1.5 RAM disk driver initialized: 16 RAM disks of 4096K size RAMDISK: Compressed image found at block 0 VFS: Mounted root (ext2 filesystem). Hello World! This is SuperH! This is SuperH! Hello World! This is SuperH! Hello World! This is SuperH! This is SuperH! This is SuperH! Hello World! This is SuperH! This is SuperH! Hello World! This is SuperH! Hello World! This is SuperH! This is SuperH! This is SuperH! Hello World! This is SuperH!

Program received signal SIGINT, Interrupt. 0x8f2010e6 in ?? () (gdb) $ exit

Script done on Thu Aug 19 17:15:31 1999 - -------------------------- #define SIGHUP 1 #define SIGKILL 9

struct sigaction { void (*sa_handler)(int); unsigned long sa_flags; void (*sa_restorer)(void); unsigned long sa_mask; };

extern inline int kill(int pid, int sig) { register int ret; register unsigned long r4 asm("r4") = (long)pid; register unsigned long r5 asm("r5") = (long)sig;

asm volatile("trapa #35" : "=&z" (ret) : "r" (r4), "r" (r5), "0" (37));

return ret; }

extern inline int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) { register int ret; register unsigned long r4 asm("r4") = (long)signum; register unsigned long r5 asm("r5") = (long)act; register unsigned long r6 asm("r6") = (long)oldact;

asm volatile("trapa #35" : "=&z" (ret) : "r" (r4), "r" (r5), "r" (r6), "0" (67));

return ret; }

extern inline int write(int fd, const void *buf, int count) { register int ret; register unsigned long r4 asm("r4") = (long)fd; register unsigned long r5 asm("r5") = (long)buf; register unsigned long r6 asm("r6") = (long)count;

asm volatile("trapa #35" : "=&z" (ret) : "r" (r4), "r" (r5), "r" (r6), "0" (4));

return ret; }

extern inline int fork(void) { register int ret;

asm volatile("trapa #35" : "=&z" (ret) : "0" (2));

return ret; }

static void handle_sighup(int sig) { write(1,"This is SuperH!\n", 16); if (sig != 1) write(1,"??\n", 3); }

void start (void) { int i; int pid;

pid = fork(); if (pid < 0) { write(1,"something unusual...\n", 21); for (;;); } if (pid) { /* parent */ for (;;) { for (i=0; i<6000000; i++); kill(pid, SIGHUP); } } else { /* Child */ struct sigaction act;

act.sa_handler = handle_sighup; act.sa_flags = 0; act.sa_restorer = 0; act.sa_mask = 0; sigaction(SIGHUP, &act, 0);

for (;;) { write(1,"Hello World!\n", 13); for (i=0; i<12000000; i++); } } } - -------------------------- ------- end -------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/