	.section	.text
	.global	stat
	.type	stat, %function
stat:
	push	{r7, lr}
	mov	r7, #106	@ stat system call
	mov	r2, #1
	add	r0, r0, r2	@ Skip count byte
	svc	#0
	cmp	r0, #0
	bne	end		@ return value <> 0
	ldr	r2, [r1, #8]	@ Load st_mode as word
	mov	r2, r2, lsl #16	@ Move to top
	mov	r2, r2, lsr #28	@ and back to bottom, plus another 12 bits for the smallest useful value
	str	r2, [r1, #8]	@ Store the new word
end:
	pop	{r7, pc}
