View Single Post
Old 24 January 2006, 18:12   #13
NOB
Zone Friend
 
Join Date: Aug 2005
Location: Germany
Age: 49
Posts: 424
Supervisor

Here is an bootblock that moves itself to the upper
memory, entering the supervisormode via privilege violation
and moving a mini(crap) prog to $300 and jumps in..

Code:
 
go: dc.b "DOS",0
dc.l 0
dc.l "HOL."
move: lea start(pc),a0
lea $7fc00.l,a1 ;move to $7fc00
move.l a1,a4
move.w #end-start,d0
trans: move.b (a0)+,(a1)+
dbf d0,trans
jmp (a4) 
start:
lea $dff000,a6 ;stop interrupts
move.w #$7fff,d0
move.w d0,$9a(a6)
move.w d0,$96(a6)
move.w d0,$9e(a6)
move.w d0,$9c(a6)
lea $bfd100,a5
move.b #%10000001,(a5);Drive select turn off drive motors
nop ;wait a bit
nop
nop
move.b #%11111001,(a5);select all 
 
move.l $20.w,a5 ;privilege violation memory vektor adress-> rescue it
lea super(pc),a4 ;
move.l a4,$20.w ;move own address to $20 (privilege violation vektor)
super: move.w #$2700,sr 
 
;call an violation(usermode)	
;(writing to the sr in usermode is a privilege violation)
;and enters the supervisor mode
;$20 points here ..continue here in supervisor mode
;and set the status register 
 
 
move.l a5,$20.w ;write back old $20 Vector;(Vector number is 8)
 
lea $0000c0.l,a7 ;now SSP Supervisorstackpointer
lea $000200.l,a0 ;set userstackpointer 
move.l a0,usp ;donĀ“t know if this is nescessary....
 
;dosomestuff....
move2: lea trap(pc),a0 ;move to $300
lea $00300.l,a1
move.l a1,a4
move.w #end-trap,d0
trans2: move.b (a0)+,(a1)+
dbf d0,trans2
jmp (a4) ;jmp to $300 
 
trap:
move d0,$dff180 ;blinken
addq #1,d0
btst #6,$bfe001
beq.s ende
bra.s trap
ende: rts ;crash......
 
 
end:
Attached Files
File Type: pdf supervisor.pdf (75.0 KB, 266 views)

Last edited by NOB; 23 January 2007 at 21:02.
NOB is offline  
 
Page generated in 0.05305 seconds with 12 queries