Zbr's days.
May
Sun Mon Tue Wed Thu Fri Sat
   
29    
2007
Months
May

About :: TODO :: Blog :: RSS :: Old blog :: Projects :: GIT :: Gallery :: Notes

Tue, 29 May 2007

My small SuperH bootloader.


SH IPL+g version 0.9, Copyright (C) 2000 Free Software Foundation, Inc.

This software comes with ABSOLUTELY NO WARRANTY; for details type `w'.
This is free software, and you are welcome to redistribute it under
certain conditions; type `l' for details.

2002/09/09 Making.  2004/09/08 I-O DATA NSU Update.
266:133:33 on base clock 22.22MHz and SDRAM 4 burst. CF boot.

PCIC initialization done.
MASTER:48bit LBA mode non support
Disk drive detected: LEXAR ATA FLASH V1.00 11014102039199095066 
LBA: 001EBF10
DiskSize: 1031675904Byte
PIO MODE1
Set Transfer Mode result: 50 
> b
Set Transfer Mode result: 50 
Initialize Device Parameters result: 50 
IDLE result: 50 
Starting from MBR
SECOND LOADER
Bootloader code is pretty simple - it reads predefined number of sectors (currently only one) from predefined sector number into memory and jumps there for execution.
In the example above, first bootloader resides in MBR and is limited to be 512 bytes only, so it reads into memory data from flash using IPL calls via traps from second sector and jumps to that memory. Second application just prints a string into serial console using IPL calls.

here is exerpt of the reading code for example:
read_sector:
	mov	#2, r0			! READ SECTORS
	mov	r13, r6			! destination address
	mov	#1, r5			! looks like source address (source sector number)
	mov	#0, r4			! device number (?)
	mov	#1, r7			! number of sectors
	trapa	#0x3f

	tst	r0, r0
	bt	second_loader

	! Error
	mova	message_err, r0
	mov	r0, r4
	mov	#6, r5
	mov	#0, r0			! Serial Output
	trapa	#0x3f

second_loader:
	mov	#6, r0			! Cache "on"
	mov	#0, r4
	trapa	#0x3f

	mov	r13, r0
	jmp	@r0
	nop
So, code it pretty simple, but it does work.
Next task is to read the whole kernel into mem and jump there. Stay tuned.

/devel/sh :: Link / Comments (0)


OpenBSD mbufs and tags.


They have been committed a major change for mbuf PF processing - *BSD stacks used to use tags behind mbuf to store various additional information related to packet processing, that memory is allocated in addition to quite big header, which is very slow. With above change PF related processing information is stored in mbuf structure.
That doubled PF performance.

I'm trying to recall how many years Linux does not use tags in skbs and stores everything in skb structure itself.

/devel/other :: Link / Comments (0)


Beer drinking on streets is officially forbidden in Russia.


Law was accepted in Duma with only one voice against and one refrain. Likely the latter overslept and the former confused the buttons.

You probably know, I live in country, where any government which tried to regulate and limit strong drinks finished its life in pain and sorrow.

/other :: Link / Comments (0)


I have been invited to 2007 Linux Kernel Summit.


It will be hosted in in Cambridge, UK, 5-6 September.

Thinking...

/devel/other :: Link / Comments (0)