All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jody Bruchon <jody@jodybruchon.com>
To: linux-8086@vger.kernel.org
Subject: Anything good here? Diff of elks -> nanox
Date: Sun, 12 Feb 2012 17:36:30 -0500	[thread overview]
Message-ID: <4F383EEE.301@jodybruchon.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]

I've run a diff between the nanox project on Google Code and the ELKS 
project as seen in Git, removed all documentation-style files from the 
diff, and am attaching it here. Does anyone see anything of interest 
that should be included in the ELKS code base?

Jody Bruchon


[-- Attachment #2: diff-elks-nanox --]
[-- Type: text/plain, Size: 26074 bytes --]

diff -Naurw elks/Makefile ../nanox-read-only/Makefile
--- elks/Makefile	2012-02-11 13:44:34.767714127 -0500
+++ ../nanox-read-only/Makefile	2012-02-11 13:50:49.915715767 -0500
@@ -142,7 +142,7 @@
 include/linuxmt/compiler-generated.h:
 	printf > include/linuxmt/compiler-generated.h		\
 		'#define %s %s\n'				\
-		UTS_VERSION "\"#$(DIST)���$(shell date)\""
+		UTS_VERSION "\"#$(DIST)���$(shell date +%Y-%m-%d)\""
 
 #########################################################################
 # lint rule
@@ -197,7 +197,7 @@
 	@printf '\n  %076u\n\n' 0 | tr 0 =
 
 distclean: clean nodep
-	rm -f .config* .menuconfig* arch/i86/Image
+	rm -f .config* .menuconfig*
 
 #########################################################################
 # Create distribution archives.
diff -Naurw elks/Makefile-rules ../nanox-read-only/Makefile-rules
--- elks/Makefile-rules	2012-02-08 16:12:46.882498544 -0500
+++ ../nanox-read-only/Makefile-rules	2012-02-11 13:50:49.231715765 -0500
@@ -91,7 +91,7 @@
 DIST		= $(shell printf '%u.%u.%u-pre%u' \
 			$(VERSION) $(PATCHLEVEL) $(SUBLEVEL) $(PRE))
 
-VSNCODE		= $(shell printf '0x%06X%02X' $$(($(VSNCODE1)-1)) $(PRE))
+VSNCODE		= $(shell printf '0x%06X%02X' $$[$(VSNCODE1)-1] $(PRE))
 
 endif
 
diff -Naurw elks/arch/i86/Makefile ../nanox-read-only/arch/i86/Makefile
--- elks/arch/i86/Makefile	2012-02-08 16:12:46.898498544 -0500
+++ ../nanox-read-only/arch/i86/Makefile	2012-02-11 13:50:50.607715772 -0500
@@ -61,7 +61,7 @@
 .PHONY: 		boot/system toolkit
 
 boot/bootsect:		boot/bootsect.o
-	$(LD) -0 $(ARCH_LD) -s -o boot/bootsect -M boot/bootsect.o > Boot.map
+	$(LD) -0 -M $(ARCH_LD) -s -o boot/bootsect boot/bootsect.o > Boot.map
 
 boot/bootsect.o:	boot/bootsect.s
 
@@ -70,12 +70,12 @@
 boot/crt1.o:		boot/crt1.c
 
 boot/netbootsect:	boot/netbootsect.o
-	$(LD) $(LDFLAGS) $(ARCH_LD) -s -o boot/netbootsect -M boot/netbootsect.o > Netboot.map
+	$(LD) $(LDFLAGS) -M $(ARCH_LD) -s -o boot/netbootsect boot/netbootsect.o > Netboot.map
 
 boot/netbootsect.o:	boot/netbootsect.s
 
 boot/setup:		boot/setup.o
-	$(LD) -0 $(ARCH_LD) -s -o boot/setup -M boot/setup.o > Setup.map
+	$(LD) -0 -M $(ARCH_LD) -s -o boot/setup boot/setup.o > Setup.map
 
 
 boot/setup.o:		boot/setup.s
@@ -89,10 +89,10 @@
 ifeq ($(CONFIG_ARCH_SIBO), y)
 
 boot/system: $(AARCHIVES) $(ADRIVERS) sibo/crt1.o sibo/crt0.o
-	(cd $(BASEDIR) ; $(LD) $(LDFLAGS) $(ARCH_LD) \
+	(cd $(BASEDIR) ; $(LD) $(LDFLAGS) -t -M $(ARCH_LD) \
 		$(ARCH_DIR)/sibo/crt0.o $(ARCH_DIR)/sibo/crt1.o \
 		init/main.o $(ARCHIVES) $(DRIVERS) \
-		-t -M -o $(ARCH_DIR)/boot/system > System.tmp ; \
+		-o $(ARCH_DIR)/boot/system > System.tmp ; \
 		sort -k4 System.tmp > System.map ; rm -f System.tmp ) 
 
 #SIBO image build
@@ -104,11 +104,10 @@
 else
 
 boot/system:	$(AARCHIVES) $(ADRIVERS) boot/crt1.o boot/crt0.o
-	(cd $(BASEDIR) ; $(LD) $(LDFLAGS) $(ARCH_LD) \
-		-t -M -o $(ARCH_DIR)/boot/system \
+	(cd $(BASEDIR) ; $(LD) $(LDFLAGS) -t -M $(ARCH_LD) \
 		$(ARCH_DIR)/boot/crt0.o $(ARCH_DIR)/boot/crt1.o \
 		init/main.o $(ARCHIVES) $(DRIVERS) \
-		> System.tmp ; \
+		-o $(ARCH_DIR)/boot/system > System.tmp ; \
 		sort -k4 System.tmp > System.map ; rm -f System.tmp ) 
 
 #PC image build
diff -Naurw elks/arch/i86/boot/setup.S ../nanox-read-only/arch/i86/boot/setup.S
--- elks/arch/i86/boot/setup.S	2012-02-08 16:12:46.898498544 -0500
+++ ../nanox-read-only/arch/i86/boot/setup.S	2012-02-11 13:50:50.131715769 -0500
@@ -101,7 +101,8 @@
 
 
 ! Check signature at end of setup
-	mov	ax,#SETUPSEG      ;setup codesegment
+	;mov	ax,#SETUPSEG      ;setup codesegment
+	mov	ax,cs
 	mov	ds,ax
 	cmp	setup_sig1,#SIG1
 	jne	bad_sig
@@ -130,7 +131,9 @@
 start_sys_seg:	.word	SYSSEG
 
 bad_sig:
-	mov	ax,#INITSEG     ;code setup
+	;mov	ax,#INITSEG     ;code setup
+	mov	ax,cs		;setup seg
+	sub	ax,#0x20	;init seg
 	mov	ds,ax
 	xor	bh,bh
 	mov	bl,[497]	! get setup sects from boot sector
@@ -149,14 +152,15 @@
 ! Move rest of setup code/data to here
 	mov	di,#2048	! four sectors loaded by LILO
 	sub	si,si
-	mov	ax,#SETUPSEG
+	mov	ax,cs		;SETUPSEG
 	mov	es,ax
 	mov	ax,#SYSSEG
 	mov	ds,ax
+	cld
 	rep
 	movsw
 
-	mov	ax,#SETUPSEG
+	mov	ax,cs		;SETUPSEG
 	mov	ds,ax
 	cmp	setup_sig1,#SIG1
 	jne	no_sig
@@ -185,6 +189,28 @@
 
 	pop ds 
 	retf                           ;back to BIOS
+#else
+	mov	ax,cs
+	cmp	ax,#SETUPSEG
+	je	start_os
+	sub	ax,#0x20	; init seg
+	mov	ds,ax
+	xor	bh,bh
+	mov	bl,[497]	! get setup sects from boot sector
+	add	bx,#0x5
+	mov	cl,#8
+	shl	bx,cl		! convert to words
+	mov	cx,bx
+	mov	ax,#INITSEG
+	mov	es,ax
+	xor	si,si
+	xor	di,di
+	cld
+	rep
+	movsw
+	mov	ss,ax		! INITSEG
+	mov	sp,#0x4000-12	
+	jmp far	SETUPSEG:start_os
 #endif
 
 
@@ -194,7 +220,9 @@
 ;-- from here the real loder starts
 ;-------------------------------------------------------
 start_os:
-	mov	ax,#INITSEG       ;datasegment setup.S
+	;mov	ax,#INITSEG       ;datasegment setup.S
+	mov	ax,cs		;setup seg
+	sub	ax,#0x20	;init seg
 	mov	ds,ax
 
 
@@ -283,7 +311,9 @@
 
 	call	getcpu
 	push	es
-	mov	ax,#INITSEG
+	;mov	ax,#INITSEG
+	mov	ax,cs		;setup seg
+	sub	ax,#0x20	;init seg
 	mov	es,ax
 	mov	cx,#12
 	mov	di,#0x80
@@ -298,7 +328,9 @@
 #ifdef CONFIG_HW_FLOPPY_DRIVE
 	call	getfloppy
 #endif
-	mov	ax,#INITSEG
+	;mov	ax,#INITSEG
+	mov	ax,cs		;setup seg
+	sub	ax,#0x20	;init seg
 	mov	ds,ax
 	int	0x12		! determine the size of the basememory
 	mov	[0x2a],ax
diff -Naurw elks/arch/i86/drivers/block/doshd.c ../nanox-read-only/arch/i86/drivers/block/doshd.c
--- elks/arch/i86/drivers/block/doshd.c	2012-02-08 16:12:46.914498544 -0500
+++ ../nanox-read-only/arch/i86/drivers/block/doshd.c	2012-02-11 13:50:50.723715771 -0500
@@ -168,7 +168,7 @@
 	if ((BD_AX != 0x100) && (!CARRY_SET)) {
 	    drivep->cylinders = ((BD_CX >> 8) & 255);
 	    drivep->cylinders += (((BD_CX >> 6) & 3) * 256);
-	    drivep->heads = ((BD_DX >> 8) & 63) + 1;
+	    drivep->heads = ((BD_DX >> 8)) + 1;
 	    drivep->sectors = (BD_CX & 63);
 	    drivep->fdtype = -1;
 	}
@@ -461,8 +461,9 @@
 	BD_DX = hd_drive_map[target];	/* Head 0, drive number */
 	call_bios();
 	if (!CARRY_SET) {
-	    drivep->sectors = (BD_CX & 0xff) + 1;
-	    drivep->cylinders = (BD_CX >> 8) + 1;
+	    drivep->sectors = (BD_CX & 0x3f)/* + 1*/;
+	    drivep->cylinders = ((BD_CX >> 8) | ((BD_CX & 0xC0) << 2)) + 1;
+	    drivep->heads = (BD_DX >> 8)  + 1;
 	} else
 	    printk("bioshd_open: no diskinfo %d\n", hd_drive_map[target]);
 
@@ -700,7 +701,7 @@
 
 	start = req->rq_sector;
 	buff = req->rq_buffer;
-	if ((int) hd[minor].start_sect == -1 || start >= hd[minor].nr_sects) {
+	if ((int) hd[minor].start_sect == -1 /*|| start >= hd[minor].nr_sects*/) {
 	    printk("hd: bad partition start=%d sect=%d nr_sects=%d.\n",
 		   start, (int) hd[minor].start_sect,
 		   (int) hd[minor].nr_sects);
diff -Naurw elks/arch/i86/drivers/char/Config.in ../nanox-read-only/arch/i86/drivers/char/Config.in
--- elks/arch/i86/drivers/char/Config.in	2012-02-08 16:12:46.942498544 -0500
+++ ../nanox-read-only/arch/i86/drivers/char/Config.in	2012-02-11 13:50:50.995715774 -0500
@@ -3,7 +3,7 @@
 #
 
 mainmenu_option next_comment
-    comment 'Character device drivers'
+    comment 'Character device drivers (SUBMENU IS CURRENTLY BROKEN!)'
 
     if [ "$CONFIG_ARCH_SIBO" != "y" ]; then
 	choice 'Select console driver'			\
diff -Naurw elks/arch/i86/drivers/char/KeyMaps/Config.in ../nanox-read-only/arch/i86/drivers/char/KeyMaps/Config.in
--- elks/arch/i86/drivers/char/KeyMaps/Config.in	2012-02-11 15:20:36.463741924 -0500
+++ ../nanox-read-only/arch/i86/drivers/char/KeyMaps/Config.in	1969-12-31 19:00:00.000000000 -0500
@@ -1,14 +0,0 @@
-# Automatically created - do not edit.
-
-choice 'XT Keyboard support'			\
-	"Belgique   	CONFIG_KEYMAP_BE	\
-	 Deutsch    	CONFIG_KEYMAP_DE	\
-	 Dvorak     	CONFIG_KEYMAP_DV	\
-	 Espanol    	CONFIG_KEYMAP_ES	\
-	 Fran���ais   	CONFIG_KEYMAP_FR	\
-	 Italiano   	CONFIG_KEYMAP_IT	\
-	 Suede      	CONFIG_KEYMAP_SE	\
-	 British    	CONFIG_KEYMAP_UK	\
-	 American   	CONFIG_KEYMAP_US"		American
-
-# EOF.
diff -Naurw elks/arch/i86/drivers/char/KeyMaps/keymaps.h ../nanox-read-only/arch/i86/drivers/char/KeyMaps/keymaps.h
--- elks/arch/i86/drivers/char/KeyMaps/keymaps.h	2012-02-11 15:20:36.463741924 -0500
+++ ../nanox-read-only/arch/i86/drivers/char/KeyMaps/keymaps.h	1969-12-31 19:00:00.000000000 -0500
@@ -1,11 +0,0 @@
-/* Automatically created - do not edit */
-
-#include "keys-be.h"		/* BE	Belgique 	*/
-#include "keys-de.h"		/* DE	Deutsch  	*/
-#include "keys-dv.h"		/* DV	Dvorak   	*/
-#include "keys-es.h"		/* ES	Espanol  	*/
-#include "keys-be.h"		/* FR	Fran���ais 	*/
-#include "keys-it.h"		/* IT	Italiano 	*/
-#include "keys-se.h"		/* SE	Suede    	*/
-#include "keys-uk.h"		/* UK	British  	*/
-#include "keys-us.h"		/* US	American 	*/
diff -Naurw elks/arch/i86/drivers/char/KeyMaps/mkcfg ../nanox-read-only/arch/i86/drivers/char/KeyMaps/mkcfg
--- elks/arch/i86/drivers/char/KeyMaps/mkcfg	2012-02-08 16:12:46.970498544 -0500
+++ ../nanox-read-only/arch/i86/drivers/char/KeyMaps/mkcfg	2012-02-11 13:50:50.987715774 -0500
@@ -23,4 +23,4 @@
     printf '"\t\tAmerican\n\n# EOF.\n' >&3
 }
 
-codes | sort -k 2 | process 3> Config.in 4> keymaps.h
+codes | sort -k 2f | process 3> Config.in 4> keymaps.h
diff -Naurw elks/arch/i86/drivers/char/bioscon.c ../nanox-read-only/arch/i86/drivers/char/bioscon.c
--- elks/arch/i86/drivers/char/bioscon.c	2012-02-08 16:12:46.994498544 -0500
+++ ../nanox-read-only/arch/i86/drivers/char/bioscon.c	2012-02-11 13:50:50.995715774 -0500
@@ -15,6 +15,7 @@
 #include <linuxmt/major.h>
 #include <linuxmt/sched.h>
 #include <linuxmt/ntty.h>
+#include <linuxmt/debug.h>
 
 #ifdef CONFIG_CONSOLE_BIOS 
 
diff -Naurw elks/arch/i86/drivers/char/meta.c ../nanox-read-only/arch/i86/drivers/char/meta.c
--- elks/arch/i86/drivers/char/meta.c	2012-02-11 01:30:21.683500018 -0500
+++ ../nanox-read-only/arch/i86/drivers/char/meta.c	2012-02-11 13:50:50.987715774 -0500
@@ -67,11 +67,11 @@
 
 static void do_meta_request(kdev_t device)
 {
-    int major = MAJOR(device);
     struct ud_driver *driver = get_driver(major);
     struct ud_request *udr;
     struct request *req;
     char *buff;
+    int major = MAJOR(device);
 
     printk("do_meta_request %d %x\n", major, blk_dev[major].current_request);
     if (NULL == driver) {
diff -Naurw elks/arch/i86/kernel/irqtab.c ../nanox-read-only/arch/i86/kernel/irqtab.c
--- elks/arch/i86/kernel/irqtab.c	2012-02-08 16:12:47.006498544 -0500
+++ ../nanox-read-only/arch/i86/kernel/irqtab.c	2012-02-11 13:50:49.923715766 -0500
@@ -36,11 +36,6 @@
    #define bios_call_cnt    cseg_bios_call_cnt
 #endif
 
-#ifdef CONFIG_ROMCODE
- #define SEG_IRQ_DATA es
-#else
- #define SEG_IRQ_DATA cs
-#endif
 
 #ifndef S_SPLINT_S
 #asm
@@ -110,27 +105,27 @@
         mov dx,ds      ;the original value
         cli            ;just here
         
+        xor ax,ax
+        mov es,ax      ;intr table
+
 #ifdef CONFIG_ROMCODE
         mov ax,#CONFIG_ROM_IRQ_DATA
-        mov es,ax
+#else
+        mov ax,cs
 #endif        
+        mov ds,ax
         
-        seg SEG_IRQ_DATA
-	mov stashed_ds,ds
-	mov bios_call_cnt_l,#5
-
-        xor ax,ax
-        mov es,ax      ;intr table
+	mov stashed_ds,dx	
 
 	seg es                     ;insert new timer intr 
 	mov bx,[32]
-	mov off_stashed_irq0_l, bx   ; the old one
+	mov off_stashed_irq0, bx   ; the old one
 	lea ax,_irq0
 	seg es
 	mov [32],ax
 	seg es
 	mov bx,[34]
-	mov seg_stashed_irq0_l, bx
+	mov seg_stashed_irq0, bx
 	mov ax,cs
 	seg es
 	mov [34],ax
@@ -435,7 +430,7 @@
 !	Save all registers
 !
 
-!	cli		! Might not be disabled on an exception
+	cli		! Might not be disabled on an exception
 	push	ds
 	push	es
 	push	bx
@@ -450,19 +445,23 @@
 !
 #ifdef CONFIG_ROMCODE
         mov bx,#CONFIG_ROM_IRQ_DATA
-        mov es,bx
+#else
+        mov bx,cs
 #endif        
+        mov ds,bx
+        
+	mov	stashed_irq,ax	! Save IRQ number
+	mov	ax,ss		! Get current SS
+	mov	bx,ax		! Save for later
+	mov	stashed_ss, ax	! Save SS:SP
+	mov	ax,sp
+	mov	stashed_sp, ax
 !
 !	Switch segments
 !
-        seg SEG_IRQ_DATA
-	mov	bx,stashed_ds		! Recover the data segment
-	mov	ds,bx
-	mov	es,bx
-
-	mov	dx,ss			! Get current SS
-	mov	bp,sp			! Get current SP
-	movb	cl,bios_call_cnt_l
+	mov	ax,stashed_ds   ! Recover the data segment
+	mov	ds,ax
+	mov	es,ax
 !
 !	Set up task switch controller
 !
@@ -470,13 +469,14 @@
 !
 !	See where we were (BX holds the SS on entry)
 !
-	cmp	dx,bx		! SS = kernel SS ?
+	cmp	ax,bx		! SS = kernel SS ?
 	je	ktask		! Kernel - no work
 !
 !	User or BIOS etc
 !
+	mov	ax,bx
 	mov	bx,_current
-	cmp	dx,4[bx]	! entry ss = current->t_regs.ss?
+	cmp	ax,4[bx]	! entry ss = current->t_regs.ss?
 	je	utask		! Switch to kernel
 !
 !	Bios etc - switch to interrupt stack
@@ -488,23 +488,37 @@
 !	User task. Extract kernel SP. (BX already holds current)
 !
 utask:
-	mov	sp,[bx]		! switch to kernel stack ptr
+	mov	ax,[bx]		! kernel stack ptr
+	mov	sp,ax		! switch to kernel stack
 	inc	ch		! Switch allowable
+	j	switched
+ktask:
 !
 !	In ktask state we have a suitable stack. It might be 
 !	better to use the intstack..
 !
 switched:
-	mov	bx,ds
-	mov	ss,bx		! /* Set SS: right */
-ktask:
+	mov	ax,ds
+	mov	ss,ax		! /* Set SS: right */
 ! /*
 !	Put the old SS;SP on the top of the stack. We can't
 !	leave them in stashed_ss/sp as we could re-enter the
 !	routine on a reschedule.
 ! */
-	push	bp		! push entry SP
-	push	dx		! push entry SS
+#ifdef CONFIG_ROMCODE
+        mov ax,#CONFIG_ROM_IRQ_DATA
+        mov es,ax
+        seg es
+	push	stashed_sp
+	seg es
+	push	stashed_ss
+        
+#else
+	seg 	cs
+	push	stashed_sp
+	seg	cs
+	push	stashed_ss
+#endif
 !
 !	We are on a suitable stack and cx says whether we can	
 !	switch afterwards. The C code will want to eat CX so
@@ -516,9 +530,19 @@
 	mov	bp,sp
 	mov	_can_tswitch, ch
 	push	cx		! Save ch
+#ifdef CONFIG_ROMCODE
+        seg	es
+#else        
+	seg	cs		! Recover the IRQ we saved
+#endif	
+	mov	ax,stashed_irq
 	push	ax		! IRQ for later
 	push	bp		! Register base
 	push	ax		! IRQ number
+#ifdef CONFIG_ROMCODE
+        mov ax,ds
+        mov es,ax        ;es back to dataseg
+#endif        
 !
 !	Call the C code
 !
@@ -533,22 +557,48 @@
 !
 !	Restore any chips
 !
-	cmp	ax,#16
+	cmp	ax,#15
 	jge	was_trap	! Traps need no reset
-	or	ax,ax		! Is int #0?
-	jnz	a4
-	dec	cl		! Will call bios int?
-	je	was_trap
-a4:
+	cmp	ax,#8
+	jge	sec_8259	! IRQ on low chip
+!
+!	Reset primary 8259
+!
 	mov	cl,al		! Save the IRQ number
-	movb	al,#0x20	! EOI
-	cmp	cl,#8
-	jb	a6		! IRQ on low chip
+	inb	al,0x21		! The chip line state
+	jmp	a7
+a7:	jmp	a8
+a8:
+!	movb	al,#1
+!	shl	al,cl		! Shift the irq (saved in cl) to a mask
+!	orb	al,_cache_21
+!	movb	_cache_21, al	
+	movb	al,_cache_21	! Extract the IRQ mask register
+	outb	0x21,al		! Now ack the IRQ
+	jmp	a9
+a9:	jmp	a10
+a10:	movb	al,#0x20	! EOI
+	outb	0x20,al
+	jmp	was_trap
+	
 !
 !	Reset secondary 8259 if we have taken an AT rather
 !	than XT irq. We also have to prod the primay
 !	controller EOI..
 !
+sec_8259:
+	mov	cl,al		! Save the IRQ for making masks
+	inb	al,0xA1
+	jmp	a1
+a1:	jmp	a2
+a2:	movb	al,#1
+	shl	al,cl
+	orb	al,_cache_A1
+	movb	_cache_A1, al
+	outb	0xA1,al		! Now ack the IRQ
+	jmp	a3
+a3:	jmp	a4
+a4:	movb	al,#0x20
 	outb	0xA0,al
 	jmp	a5
 a5:	jmp	a6
@@ -559,17 +609,6 @@
 !
 
 was_trap:
-	orb	cl,cl
-	jnz	no_bios_call
-!
-!	IRQ 0 (timer) has to go on to the bios for some systems
-!
-	dec	bios_call_cnt_l
-	jne	no_bios_call
-	mov	bios_call_cnt_l,#5
-	pushf
-	callf	[off_stashed_irq0_l]
-no_bios_call:
 !
 !	Now look at rescheduling
 !
@@ -616,25 +655,83 @@
 	pop	cx
 	pop	bx
 	pop	es
+#ifdef CONFIG_ROMCODE
+	mov	ax,#CONFIG_ROM_IRQ_DATA
+	mov	ds,ax
+#else
+	seg	cs
+#endif
+	mov	ax, stashed_irq
+	or 	ax,ax
+	jz	irq0_bios
 	pop	ds
 	pop	ax
 !
 !	Iret restores CS:IP and F (thus including the interrupt bit)
 !
 	iret
+!
+!	IRQ 0 (timer) has to go on to the bios for some systems
+!	
+!	FIXME: should call the bios only every fifth event.
+!
+irq0_bios:
+    pop     ds  
+	pop	ax           ;now the stack empty
+
+;------------------------------------------------
+;Build new Stack
+;
+;  SP    ->  RET seg
+;            RET offs
+;  SP-4  ->  BP
+;  SP-4  ->  BX   
+;            DS
+;  SP-8  ->  free                     ;sp
+
+label1:
+
+	sub sp,#4                     ;space for retf
+	push bp
+	mov bp,sp 
+
+	push	bx
+	push    ds                 
+#ifdef CONFIG_ROMCODE
+	mov bx,#CONFIG_ROM_IRQ_DATA
+#else
+	mov bx,cs 
+#endif
+	mov ds,bx
+	mov	bx,bios_call_cnt
+	inc	bx
+	cmp	bx,#5
+	jne	no_bios_call
+
+	xor	bx,bx
+	mov	bios_call_cnt,bx
+	mov bx, seg_stashed_irq0
+	mov	[bp+4], bx
+	mov bx, off_stashed_irq0
+	mov [bp+2], bx
+
+	pop ds
+	pop	bx       
+	pop bp
+	retf                          
+
+no_bios_call:                          ;sp-8 
+	mov	bios_call_cnt,bx
+	pop	ds
+	pop	bx                     ;sp-4              
+	pop bp
+	add sp,#4
+	iret
 
 	.data
 .globl	_can_tswitch
 _can_tswitch:
 	.byte 0
-
-off_stashed_irq0_l:
-	.word	0
-seg_stashed_irq0_l:
-	.word	0
-bios_call_cnt_l:
-	.word	0
-
 	.zerow	256		! (was) 128 byte interrupt stack
 _intstack:
 
diff -Naurw elks/arch/i86/mm/user.c ../nanox-read-only/arch/i86/mm/user.c
--- elks/arch/i86/mm/user.c	2012-02-08 16:12:47.070498544 -0500
+++ ../nanox-read-only/arch/i86/mm/user.c	2012-02-11 13:50:50.563715771 -0500
@@ -34,23 +34,27 @@
 
 #ifndef S_SPLINT_S
 #asm
-	push	si
-	push	di
+!	push	si
+!	push	di
 	mov	dx,es
 	mov	bx,ds
 	mov	es,bx
-	mov	ax,[bp+.memcpy_fromfs.ds]	! source segment (local variable)
+!	mov	ax,[bp+.memcpy_fromfs.ds]	! source segment (local variable)
+	mov	ax,[bp-6]	! source segment (local variable)
 	mov	ds,ax
-	mov	di,[bp+.memcpy_fromfs.daddr]	! destination address
-	mov	si,[bp+.memcpy_fromfs.saddr]	! source address
-	mov	cx,[bp+.memcpy_fromfs.len]	! number of bytes to copy
+!	mov	di,[bp+.memcpy_fromfs.daddr]	! destination address
+!	mov	si,[bp+.memcpy_fromfs.saddr]	! source address
+!	mov	cx,[bp+.memcpy_fromfs.len]	! number of bytes to copy
+	mov	di,[bp+4]	! destination address
+	mov	si,[bp+6]	! source address
+	mov	cx,[bp+8]	! number of bytes to copy
 	cld
 	rep
 	movsb
 	mov	ds,bx
 	mov	es,dx
-	pop	di
-	pop	si
+!	pop	di
+!	pop	si
 #endasm
 #endif
 
@@ -74,20 +78,24 @@
 
 #ifndef S_SPLINT_S
 #asm
-	push	si
-	push	di
+!	push	si
+!	push	di
 	mov	dx,es
-	mov	ax,[bp+.memcpy_tofs.es]	! source segment (local variable)
+!	mov	ax,[bp+.memcpy_tofs.es]	! source segment (local variable)
+	mov	ax,[bp-6]	! source segment (local variable)
 	mov	es,ax
-	mov	di,[bp+.memcpy_tofs.daddr]	! destination address
-	mov	si,[bp+.memcpy_tofs.saddr]	! source address
-	mov	cx,[bp+.memcpy_tofs.len]	! number of bytes to copy
+!	mov	di,[bp+.memcpy_tofs.daddr]	! destination address
+!	mov	si,[bp+.memcpy_tofs.saddr]	! source address
+!	mov	cx,[bp+.memcpy_tofs.len]	! number of bytes to copy
+	mov	di,[bp+4]	! destination address
+	mov	si,[bp+6]	! source address
+	mov	cx,[bp+8]	! number of bytes to copy
 	cld
 	rep
 	movsb
 	mov	es,dx
-	pop	di
-	pop	si
+!	pop	di
+!	pop	si
 #endasm
 #endif
 }
@@ -167,21 +175,25 @@
 #ifndef S_SPLINT_S
 #asm
 
-	push	di
-	push	si
-	mov	ax,[bp+.strlen_fromfs.ds]	! source segment (local variable)
+!	push	di
+!	push	si
+!	mov	ax,[bp+.strlen_fromfs.ds]	! source segment (local variable)
+	mov	ax,[bp-6]	! source segment (local variable)
 	mov	es,ax
-	mov	di,[bp+.strlen_fromfs.saddr]	! source address
+!	mov	di,[bp+.strlen_fromfs.saddr]	! source address
+	mov	di,[bp+4]	! source address
 	cld
 	xor	al,al		! search for NULL byte
 	mov	cx,#-1
 	rep
 	scasb
-	sub	di,[bp+.strlen_fromfs.saddr]	! calc len +1
+!	sub	di,[bp+.strlen_fromfs.saddr]	! calc len +1
+	sub	di,[bp+4]	! calc len +1
 	dec	di
-	mov	[bp+.strlen_fromfs.ds],di	! save in local var ds
-	pop	si
-	pop	di
+!	mov	[bp+.strlen_fromfs.ds],di	! save in local var ds
+	mov	[bp-6],di	! save in local var ds
+!	pop	si
+!	pop	di
 #endasm
 #endif
 
diff -Naurw elks/arch/i86/tools/wrt_disk.c ../nanox-read-only/arch/i86/tools/wrt_disk.c
--- elks/arch/i86/tools/wrt_disk.c	2012-02-08 16:12:47.106498545 -0500
+++ ../nanox-read-only/arch/i86/tools/wrt_disk.c	2012-02-11 13:50:50.067715769 -0500
@@ -7,7 +7,7 @@
  * pick up any improvements as that developes.
  */
 
-#define DEBUG
+#define DEBUG_WRT_DISK
 
 #include "tools.h"
 
@@ -51,7 +51,7 @@
     LCD_WriteChar(' ');
 }
 
-#ifndef DEBUG
+#ifndef DEBUG_WRT_DISK
 
 void debug(char *a) {
     while (*a)
@@ -314,3 +314,5 @@
 
     return 0;
 }
+
+#undef DEBUG_WRT_DISK
diff -Naurw elks/fs/romfs/inode.c ../nanox-read-only/fs/romfs/inode.c
--- elks/fs/romfs/inode.c	2012-02-11 01:12:46.731494883 -0500
+++ ../nanox-read-only/fs/romfs/inode.c	2012-02-11 13:50:49.371715766 -0500
@@ -243,7 +243,7 @@
     return res;
 }
 
-static int romfs_copyfrom(struct inode *i, char *dest, loff_t offset,
+static int romfs_copyfrom(struct inode *i, void *dest, loff_t offset,
 			  size_t count)
 {
     struct buffer_head *bh;
@@ -279,7 +279,7 @@
 
     while (res < count) {
 	offset += maxsize;
-	*dest += maxsize;
+	((char *) dest) += maxsize;
 
 	bh = bread(i->i_dev, (block_t) (offset >> ROMBSBITS));
 
diff -Naurw elks/include/arch/debug_disp.h ../nanox-read-only/include/arch/debug_disp.h
--- elks/include/arch/debug_disp.h	2012-02-08 16:12:47.146498545 -0500
+++ ../nanox-read-only/include/arch/debug_disp.h	2012-02-11 13:50:48.783715763 -0500
@@ -7,7 +7,10 @@
  *      Debugging facility over i/o port 
  * Modifications:
  * 
- * $Log$
+ * $Log: debug_disp.h,v $
+ * Revision 1.3  2002/04/26 19:45:17  rhw2
+ * Next stage of `make lint` verification of the ELKS source code.
+ *
  * Revision 1.2  2002/02/24 17:29:00  rhw2
  * Fixed #else and #endif to not fox the bcc -ansi option. Reformatted scripts/Configure and scripts/Menuconfig to a consistent style. Removed ELKS dependency on the Linux kernel source being available.
  *
diff -Naurw elks/include/arch/dma.h ../nanox-read-only/include/arch/dma.h
--- elks/include/arch/dma.h	2012-02-08 16:12:47.146498545 -0500
+++ ../nanox-read-only/include/arch/dma.h	2012-02-11 13:50:48.783715763 -0500
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: dma.h,v 1.5 2002/04/26 19:45:18 rhw2 Exp $
  * linux/include/asm/dma.h: Defines for using and allocating dma channels.
  * Written by Hennus Bergman, 1992.
  * High DMA channel support & info by Hannu Savolainen
diff -Naurw elks/init/main.c ../nanox-read-only/init/main.c
--- elks/init/main.c	2012-02-08 16:12:47.278498546 -0500
+++ ../nanox-read-only/init/main.c	2012-02-11 13:50:49.191715765 -0500
@@ -1,4 +1,4 @@
-/* $Header$ 
+/* $Header: /cvsroot/elks/elks/init/main.c,v 1.28 2006/11/08 22:57:21 segin Exp $ 
  */
 
 #include <linuxmt/config.h>
diff -Naurw elks/kernel/printk.c ../nanox-read-only/kernel/printk.c
--- elks/kernel/printk.c	2012-02-08 16:12:47.282498547 -0500
+++ ../nanox-read-only/kernel/printk.c	2012-02-11 13:50:48.307715761 -0500
@@ -25,14 +25,18 @@
  *	MTK:	Sep 97 - Misc hacks to shrink generated code
  */
 
-#include <arch/segment.h>
+#include <linuxmt/fcntl.h>
 #include <linuxmt/mm.h>
+#include <linuxmt/sched.h>
+#include <linuxmt/types.h>
+
+#include <arch/segment.h>
 
 /*
  *	Just to make it work for now
  */
 
-extern void con_charout(char);
+extern void con_charout();
 
 static void con_write(register char *buf, int len)
 {
@@ -44,10 +48,11 @@
 
     static char colour[8] = { 27, '[', '3', '0', ';', '4', '0', 'm' };
 
-    if (++(colour[3]) == '8')
-	colour[3] = '1';
-
     p = colour;
+
+    if (++(p[3]) == '8')
+	p[3] = '1';
+
     do
 	con_charout(*p);
     while (*p++ != 'm');
@@ -76,51 +81,42 @@
 static void numout(char *ptr, int len, int width, int base, int useSign,
 		   int Upper, int Zero)
 {
+    long int vs;
     unsigned long int v;
-    register char *bp;
-    char buf[12];
+    register char *bp, *bp2;
+    char buf[32];
 
-    if (width > sizeof(buf))		/* Error-check width specified */
-	width = sizeof(buf);
+    if (width > 31)			/* Error-check width specified */
+	width = 31;
 
-	v = (len == 2) ? *((unsigned short *) ptr) : *((unsigned long *) ptr);
-    if (useSign) {
-	if (len == 2)
-	    v = ((long)(*((short *) ptr)));
-	if ((long)v < 0)
-	    v = (-(long)v);
-	else
-	    useSign = 0;
-    }
+    bp = bp2 = buf + 31;
 
-    bp = buf + sizeof(buf);
-
-    {
-	register char *bp2;
+    if (useSign) {
+	vs = (len == 2) ? *((short *) ptr) : *((long *) ptr);
+	if (vs < 0) {
+	    v = - vs;
+	    *bp = '-';
+	    con_write(bp, 1);
+	} else
+	    v = vs;
+    } else
+	v = (len == 2) ? *((unsigned short *) ptr) : *((unsigned long *) ptr);
 
-	bp2 = Upper ? hex_string : hex_lower;
+    *bp = 0;
     do {
-	    *--bp = *(bp2 + (v % base));	/* Store digit */
-	} while ((v /= base));
-    }
-
-    if (useSign && !Zero)
-	*--bp = '-';
+	if (Upper)
+	    *--bp = hex_string[v % base]; 	/* Store digit */
+	else
+	    *--bp = hex_lower[v % base]; 	/* Store digit */
+    } while ((v /= base) && (bp > buf));
 
-    width -= buf - bp + sizeof(buf);
-    while (--width >= 0)			/* Process width */
+    while (bp2 - bp < width)			/* Process width */
 	if (Zero)
 	    *--bp = '0';
 	else
 	    *--bp = ' ';
 
-    if (useSign && Zero) {
-	if (*bp != '0')
-	    bp--;
-	*bp = '-';
-    }
-
-    con_write(bp, buf + sizeof(buf) - bp);
+    con_write(bp, buf - bp + sizeof(buf) - 1);
 }
 
 void printk(register char *fmt,int a1)
@@ -184,7 +180,7 @@
 		    con_write(cp++, 1);
 		    width--;
 		}
-		while (--width >= 0)
+		while (width-- > 0)
 		    con_write(" ", 1);
 		break;
 	    case 't':
@@ -195,11 +191,11 @@
 		    cp++;
 		    width--;
 		}
-		while (--width >= 0)
+		while (width-- > 0)
 		    con_write(" ", 1);
 		break;
 	    case 'c':
-		while (--width >= 1)
+		while (width-- > 1)
 		    con_write(" ", 1);
 		con_write(p, 1);
 		p += 2;
@@ -228,7 +224,7 @@
 	for (j = 2; j <= 8; j++)
 	    printk(" %04X", bp[j]);
 	printk("\n");
-    } while (++i < 9);
+    } while (++i > 9);
 
     /* Lock up with infinite loop */
 
@@ -243,8 +239,10 @@
     panic("kernel restarted\n");
 }
 
-void redirect_main(void)
-{
-    pokeb(get_cs(), 0, 0xe9);
-    pokew(get_cs(), 1, ((__u16) kernel_restarted) - 3);
-}
+/*
+//void redirect_main(void)
+//{
+//    pokeb(get_cs(), 0, 0xe9);
+//    pokew(get_cs(), 1, ((__u16) kernel_restarted) - 3);
+//}
+*/

                 reply	other threads:[~2012-02-12 22:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F383EEE.301@jodybruchon.com \
    --to=jody@jodybruchon.com \
    --cc=linux-8086@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.