⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flextt.h.s

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 S
📖 第 1 页 / 共 2 页
字号:
;		All pages will have the same access, domain, cb etc.
;		Addresses are flat-mapped.
;		CLARGE, CSMALL -> Coarse 2nd Level Page Tables
;		FLARGE, FSMALL, FTINY -> Fine 2nd Level Page Tables
;----------------------------------------------------------------------------		
	
	MACRO
	CreateL2PageTable $type, $baseaddr, $access, $cb_bits
	LCLA	count
	LCLA	count_inc

count	SETA	0x0		 
L2Val	SETA	0xbad2bad0	; Default to faulting value, just in case
	
	;; Set up counter increment
	[ "$type" = "CLARGE" :LOR: "$type" = "CSMALL"
count_inc	SETA	0x1000
	|
count_inc	SETA	0x400
	]

	WHILE	count < 0x00100000
	
	;; Select appropriate descriptor entry
	[ "$type" = "CLARGE" :LOR: "$type" = "FLARGE"
	L2LargePage	(($baseaddr:AND:0xfff00000):OR:0x$count), $access, $access, $access, $access, $cb_bits
	]
	[ "$type" = "CSMALL" :LOR: "$type" = "FSMALL"
	L2SmallPage	(($baseaddr:AND:0xfff00000):OR:0x$count), $access, $access, $access, $access, $cb_bits
	]
	[ "$type" = "FTINY"
	L2TinyPage	(($baseaddr:AND:0xfff00000):OR:0x$count), $access, $cb_bits
	]
	DCD	L2Val

count	SETA	count + count_inc
	WEND
	
	MEND


;----------------------------------------------------------------------------
; Macro:        FlexTT_END
; Function:	Create the necessary Level 2 pagetables
; Parameters:   
; Operation:    
; Assumptions:	Uses the data accumulated earlier
;----------------------------------------------------------------------------		

	MACRO
	FlexTT_END

	ALIGN 16384		; Place after the full Level 1 Table

	;; Loop through the number of L2 page tables, creating them as required.
	;; Arguments have to be explicitly dereferenced before passing to the
	;; CreateL2PageTable macro...
	     
	LCLA deref_base
	LCLS deref_type
	LCLS deref_access
	LCLS deref_cb_bits

	LCLA counter

counter	SETA	0
	WHILE	counter < L2TABLE_COUNT
counter	SETA	counter+1

deref_type SETS L2TABLE_TYPE_$counter
deref_access SETS L2TABLE_ACCESS_$counter
deref_cb_bits SETS L2TABLE_CB_BITS_$counter
deref_base SETA L2TABLE_L1BASE_$counter

	;; Force correct alignment per level 2 table...

	[ (deref_type:LEFT:4) /= "CUST"

	[ deref_type = "CLARGE" :LOR: deref_type = "CSMALL"
	ALIGN	1024
	|
	ALIGN	4096
	]

	|

	[ SIZE_$deref_type = "COARSE"
	ALIGN	1024
	|
	ALIGN	4096
	]
	]


	[ (deref_type:LEFT:4) /= "CUST"
	CreateL2PageTable	$deref_type, 0x$deref_base, $deref_access, $deref_cb_bits
	|
	;; Set up all necessary parameters for the custom level 2 table routines
CLT_ADDR	SETA	deref_base
CLT_SIZE	SETS	SIZE_$deref_type
	;; call the macro for this custom table
	$deref_type
	]	

	WEND
	MEND


;----------------------------------------------------------------------------
; Macro:	CLT_LARGE
; Function:	Custom Level 2 Table LARGE PAGE
; Parameters:   $numpages - number of pages to insert
; Operation:    
; Assumptions:	All other parameters are GBLS variables, preceded CLT_
;----------------------------------------------------------------------------		

	MACRO
	CLT_LARGE	$numpages, $ap0, $ap1, $ap2, $ap3, $cb, $aliased
	
	;; check for a recognised pagetable size
	[ ("$CLT_SIZE" /= "COARSE") :LAND: ("$CLT_SIZE" /= "FINE")
	INFO 1, "Unable to determine L2 size ($CLT_SIZE)\n"
	]
	
	;; check for correct start alignment
	[ (CLT_ADDR:AND:0x0000ffff) <> 0
	INFO 1, "Alignment failure trying to place 64k page\n"
	]
	
	;; Set up local variables
	LCLA	n_pages		; Number of pages we need to create
	LCLA	n_entries	; Table entries per page
	LCLA	addr_inc	; Address increment per entry
	LCLA	count
	
n_pages	SETA	$numpages	
L2Val	SETA	0xbad2bad0	; Default to faulting value, just in case	

		       
	[ "$CLT_SIZE" = "COARSE"
n_entries	SETA	16
addr_inc	SETA	0x1000
	|
n_entries	SETA	64
addr_inc	SETA	0x400
	]


	WHILE	n_pages > 0
;;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	[ "$aliased" = "ALIASPAIRS"
CLT_ADDR	SETA	CLT_ADDR + 0x10000 ; put us a page ahead of the staring PA

	;do an extra page
	;; vvvvvvvvvvvvvvvvvvvv One Page vvvvvvvvvvvvvvvvvvvv
count		SETA	n_entries
		WHILE	count > 0

		L2LargePage	0x$CLT_ADDR, $ap0, $ap1, $ap2, $ap3, $cb
		DCD	L2Val
	       
CLT_ADDR	SETA	CLT_ADDR + addr_inc	; update address pointer
count		SETA	count - 1		; update loop counter
		WEND
	;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	; the page will have updated CLT_ADDR - now 
CLT_ADDR	SETA	CLT_ADDR - 0x20000 ; Back to the original PA
	]

	;; do original page code
	;; vvvvvvvvvvvvvvvvvvvv One Page vvvvvvvvvvvvvvvvvvvv
count		SETA	n_entries
		WHILE	count > 0

		L2LargePage	0x$CLT_ADDR, $ap0, $ap1, $ap2, $ap3, $cb
		DCD	L2Val
	       
CLT_ADDR	SETA	CLT_ADDR + addr_inc	; update address pointer
count		SETA	count - 1		; update loop counter
		WEND
	;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	[ "$aliased" = "ALIASPAIRS"
CLT_ADDR	SETA	CLT_ADDR + 0x10000 ; Now 2 pages above original PA
n_pages	SETA	n_pages - 1 ; we've done an extra page
	]

;;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
n_pages	SETA	n_pages - 1
	WEND




	MEND


;----------------------------------------------------------------------------
; Macro:	CLT_SMALL
; Function:	Custom Level 2 Table SMALL PAGE
; Parameters:   $numpages - number of pages to insert
; Operation:    
; Assumptions:	All other parameters are GBLS variables, preceded CLT_
;----------------------------------------------------------------------------		

	MACRO
	CLT_SMALL	$numpages, $ap0, $ap1, $ap2, $ap3, $cb, $aliased
	
	;; check for a recognised pagetable size
	[ ("$CLT_SIZE" /= "COARSE") :LAND: ("$CLT_SIZE" /= "FINE")
	INFO 1, "Unable to determine L2 size ($CLT_SIZE)\n"
	]
	
	;; check for correct start alignment
	[ (CLT_ADDR:AND:0x00000fff) <> 0
	INFO 1, "Alignment failure trying to place 4k page\n"
	]
	
	;; Set up local variables
	LCLA	n_pages		; Number of pages we need to create
	LCLA	n_entries	; Table entries per page
	LCLA	addr_inc	; Address increment per entry
	LCLA	count
	
n_pages	SETA	$numpages	
L2Val	SETA	0xbad2bad0	; Default to faulting value, just in case	

		       
	[ "$CLT_SIZE" = "COARSE"
n_entries	SETA	1
addr_inc	SETA	0x1000
	|
n_entries	SETA	4
addr_inc	SETA	0x400
	]


	WHILE	n_pages > 0
;;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	[ "$aliased" = "ALIASPAIRS"
CLT_ADDR	SETA	CLT_ADDR + 0x1000 ; put us a page ahead of the staring PA

	;do an extra page
	;; vvvvvvvvvvvvvvvvvvvv One Page vvvvvvvvvvvvvvvvvvvv
count		SETA	n_entries
		WHILE	count > 0

		L2SmallPage	0x$CLT_ADDR, $ap0, $ap1, $ap2, $ap3, $cb
		DCD	L2Val	
	       
CLT_ADDR	SETA	CLT_ADDR + addr_inc	; update address pointer
count		SETA	count - 1		; update loop counter
		WEND
	;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	; the page will have updated CLT_ADDR - now 
CLT_ADDR	SETA	CLT_ADDR - 0x2000 ; Back to the original PA
	]

	;; do original page code
	;; vvvvvvvvvvvvvvvvvvvv One Page vvvvvvvvvvvvvvvvvvvv
count		SETA	n_entries
		WHILE	count > 0

		L2SmallPage	0x$CLT_ADDR, $ap0, $ap1, $ap2, $ap3, $cb
		DCD	L2Val	
	       
CLT_ADDR	SETA	CLT_ADDR + addr_inc	; update address pointer
count		SETA	count - 1		; update loop counter
		WEND
	;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


	[ "$aliased" = "ALIASPAIRS"
CLT_ADDR	SETA	CLT_ADDR + 0x1000 ; Now 2 pages above original PA
n_pages	SETA	n_pages - 1 ; we've done an extra page
	]

;;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
n_pages	SETA	n_pages - 1
	WEND





	MEND	

	
;----------------------------------------------------------------------------
; Macro:	CLT_TINY
; Function:	Custom Level 2 Table TINY PAGE
; Parameters:   $numpages - number of pages to insert
; Operation:    
; Assumptions:	All other parameters are GBLS variables, preceded CLT_
;----------------------------------------------------------------------------		

	MACRO
	CLT_TINY	$numpages, $ap, $cb, $aliased
	
	;; check for a recognised pagetable size
	[ ("$CLT_SIZE" /= "FINE")
	INFO 1, "Cannot Place 1k pages into a $CLT_SIZE L2 table\n"
	]
	
	;; check for correct start alignment
	[ (CLT_ADDR:AND:0x000003ff) <> 0
	INFO 1, "Alignment failure trying to place 1k page\n"
	]
	
	;; Set up local variables
	LCLA	n_pages		; Number of pages we need to create
	LCLA	n_entries	; Table entries per page
	LCLA	addr_inc	; Address increment per entry
	LCLA	count
	
n_pages	SETA	$numpages	
L2Val	SETA	0xbad2bad0	; Default to faulting value, just in case	

n_entries	SETA	1
addr_inc	SETA	0x400



	WHILE	n_pages > 0
;;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	[ "$aliased" = "ALIASPAIRS"
CLT_ADDR	SETA	CLT_ADDR + 0x400 ; put us a page ahead of the staring PA

	;do an extra page
	;; vvvvvvvvvvvvvvvvvvvv One Page vvvvvvvvvvvvvvvvvvvv
count		SETA	n_entries
		WHILE	count > 0

		L2TinyPage	0x$CLT_ADDR, $ap, $cb
		DCD	L2Val
	       
CLT_ADDR	SETA	CLT_ADDR + addr_inc	; update address pointer
count		SETA	count - 1		; update loop counter
		WEND
	;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

	; the page will have updated CLT_ADDR - now 
CLT_ADDR	SETA	CLT_ADDR - 0x800 ; Back to the original PA
	]

	;; do original page code
	;; vvvvvvvvvvvvvvvvvvvv One Page vvvvvvvvvvvvvvvvvvvv
count		SETA	n_entries
		WHILE	count > 0

		L2TinyPage	0x$CLT_ADDR, $ap, $cb
		DCD	L2Val
	       
CLT_ADDR	SETA	CLT_ADDR + addr_inc	; update address pointer
count		SETA	count - 1		; update loop counter
		WEND
	;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


	[ "$aliased" = "ALIASPAIRS"
CLT_ADDR	SETA	CLT_ADDR + 0x400 ; Now 2 pages above original PA
n_pages	SETA	n_pages - 1 ; we've done an extra page
	]

;;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
n_pages	SETA	n_pages - 1
	WEND


	MEND	
		
;------------------------------------------------------------------------------

	END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -